laravel eloquent create vs insert

Updated: 17th July 2024
Tags: laravel

There are few important differences:

#InsertCreate
Respect fillable / guardedNoYes
Creates timestampsNoYes
Returns created objectNoYes
Allow multi insertYesNo

How to restart supervisor laravel

Updated: 5th July 2024
Tags: laravel ubuntu supervisor

If you changed superviser config, or add new program to it, you need to restart it.

sudo supervisorctl stop all
sudo supervisorctl reread
sudo supervisorctl update
sudo supervisorctl start "laravel-worker:*"

[Solved] SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry for key 'failed_jobs_uuid_unique'

Updated: 13th June 2024
Tags: php laravel

How to check my laravel version

Updated: 14th April 2024
Tags: laravel
php artisan about

It will show laravel version with bunch of other usefull information.

artisan about

[Solved] CSRF Token Mismatch Error from API Laravel Sanctum

Updated: 14th April 2024
Tags: php laravel sanctum

[Solved] Composer require / Generating optimized autoload files is very slow

Updated: 14th April 2024
Tags: php composer laravel windows10

Add whole directory of your app to windows defender Exclusions. You can also move your projects in project directory and add projects to exclusion.

Social metatags for vue app

Updated: 7th April 2024
Tags: vue nginx laravel

Laravel FormRequest handling checkbox

Updated: 7th March 2024
Tags: laravel

[Solved] file_put_contents(/bootstrap/cache/packages.php): failed to open stream: Permission denied

Updated: 17th February 2023
Tags: laravel php ubuntu

Laravel check produced SQL

Updated: 15th April 2021
Tags: laravel
DB::enableQueryLog(); // Enable query log
// use orm
dd(DB::getQueryLog()); // Show results of log

Laravel clear queue job code cache

Updated: 12th April 2021
Tags: php laravel

Laravel queue job is caching your job php code, so after updating job code you need to:

php artisan queue:restart

Laravel select random row from table

Updated: 22th December 2019
Tags: php laravel sql

Get randow row from table in laravel 5.3+

$randomRow = DB::table('table')
            ->inRandomOrder()
            ->first();

Get randow id from table in laravel 5.3+

$randomId = DB::table('table')
            ->inRandomOrder()
            ->value('id');

Increase laravel performance

Updated: 20th December 2019
Tags: php laravel

Update laravel/installer global

Updated: 20th December 2019
Tags: php composer laravel

Laravel fresh install ubuntu HTTP 500 Fix

Updated: 18th December 2019
Tags: php laravel ubuntu

After installing laravel you MUST change some folder permissions.

sudo chmod 755 -R laravel_app
sudo chmod -R o+w laravel_app/storage
sudo chmod -R o+w laravel_app/bootstrap/cache