title: Setting Up Laravel in Ubuntu / DigitalOcean keywords: servers, laravel, coderstape, coder's tape description: Let's take a look at settting up a server from scratch for Laravel. date: April 1, 2019 tags: servers, laravel permalink: setting-up-laravel-in-ubuntu-digitalocean img: https://coderstape.com/storage/uploads/GZTXUbyGum2xeUZM9qBD5aPv8EKLwG3C8RGcRon4.jpeg author: Victor Gonzalez authorlink: https://github.com/vicgonvt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"preset": "per", | |
"rules": { | |
"align_multiline_comment": true, | |
"array_indentation": true, | |
"array_syntax": true, | |
"blank_line_after_namespace": true, | |
"blank_line_after_opening_tag": true, | |
"combine_consecutive_issets": true, | |
"combine_consecutive_unsets": true, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
Builder::macro('deferredPaginate', function ($perPage = null, $columns = ['*'], $pageName = 'page', $page = null) { | |
$model = $this->newModelInstance(); | |
$key = $model->getKeyName(); | |
$table = $model->getTable(); | |
$paginator = $this->clone() | |
// We don't need them for this query, they'll remain | |
// on the query that actually gets the records. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use PhpCsFixer\Config; | |
use PhpCsFixer\Finder; | |
$rules = [ | |
'array_syntax' => ['syntax' => 'short'], | |
'binary_operator_spaces' => [ | |
'default' => 'single_space', | |
'operators' => ['=>' => null], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// phpcs:ignoreFile | |
define( 'EXPOSED_DOMAIN', 'example.sharedwithexpose.com' ); | |
// Load only if we are running under Expose. | |
if ( empty( $_SERVER['HTTP_X_ORIGINAL_HOST'] ) || $_SERVER['HTTP_X_ORIGINAL_HOST'] !== EXPOSED_DOMAIN ) { | |
return; | |
} |
Laravel 8+, Horizon 5.x, Redis 6+
Prepare application
- Install and configure Laravel Horizon as instructed in docs
- Make sure you can access the Horizon dashboard like -
http://yourapp.com/horizon
- For now; it should show status as
inactive
on horizon dashboard
Install redis-server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Process datatables ajax request. | |
* | |
* @return \Illuminate\Http\JsonResponse | |
*/ | |
public function allData(Request $request) | |
{ | |
$registrations = Registration::with('product')->with('reg_type')->select('registrations.*'); | |
$datatable = Datatables::of($registrations); |
Since Chrome apps are now being deprecated. Download postman from https://dl.pstmn.io/download/latest/linux
Although I highly recommend using a snap
sudo snap install postman
tar -xzf Postman-linux-x64-5.3.2.tar.gz
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
## create user group | |
sudo groupadd laravel | |
## add current user to group | |
sudo usermod -a -G www-data $USER | |
## add web server to group | |
sudo usermod -a -G www-data laravel |
NewerOlder