laravelsnip

كتابات: 
// Laravel create new project
lando composer create-project laravel/laravel project
// Laravel installation
composer install -n
mkdir -p storage/framework/{sessions,views,cache}
chmod -R 0777 storage/framework
php artisan key:generate
php artisan migrate:refresh --seed
// deploy
cd /var/www/html/$1
git pull
#composer install --no-interaction --no-dev
#composer update -n
composer install --no-interaction
chown www-data:www-data -R /var/www/html/$1
php artisan migrate --force
php artisan optimize:clear
php artisan cache:clear
#php artisan config:clear
#php artisan config:cache
// Useful Laravel commands
php artisan route:list // to list all defined routes
php artisan migrate:fresh --seed // To run the database seeders
* * * * * cd /var/www/html && php artisan schedule:run >> /dev/null 2>&1
// When you want to loop all db table records, use ::cursor()
SOURCE: https://webomnizz.com/working-with-lazy-collection-in-laravel-6/
// https://www.amitmerchant.com/using-lazy-collections-on-memory-hungry-operations-in-laravel6/
// Deploy commands
git pull
composer install --no-interaction --no-dev
php artisan migrate --force
php artisan optimize:clear
php artisan cache:clear
// 20190225
php artisan make:migration create_replies_table
php artisan migrate
// re migrate a specific migration file
php artisan migrate:refresh --path=./database/migrations/FILE_NAME.php
// filament
php artisan make:filament-resource MODEL_NAME_HERE

// Create user
php artisan tinker
DB::table('users')->insert(['name'=>'admin','email'=>'[email protected]','password'=>Hash::make('admin')])

php artisan tinker --execute='User::create(["name"=>"admin", "email"=>"[email protected]", "email_verified_at"=> now(), "password"=> bcrypt("admin")]);'
// Steps to create a new DB table.
1. Create the migrate `php artisan make:model MODE_NAME_HERE -m ` (the -m is to create a migration file for this model)
1. Create a resource with controller. `php artisan make:controller CONTROLLER_NAME_HERE --resource`
1. Add the route to this controller. `Route:resource('posts', 'PostsController');`
php artisan make:command CommandNameHereCommand
// Command signature naming: model:action:column
// https://www.youtube.com/watch?v=o1NVVntEvd0
// Add config variable
1. Go to config/app.php
1. Add your config variable name at the end of this config file. `'your_variable_name' => env('YOUR_VARIABLE_NAME', NULL),`
1. Add the `YOUR_VARIABLE_NAME=hello` into your .env file.
1. You can now get the value by `config('app.your_variable_name')`

فضلاً إذا أعجبتك هذه الصفحة لاتنسى أن تقوم بمشاركتها