Laravel check produced SQL
Updated: 15th April 2021Tags: laravel
DB::enableQueryLog(); // Enable query log
// use orm
dd(DB::getQueryLog()); // Show results of log
DB::enableQueryLog(); // Enable query log
// use orm
dd(DB::getQueryLog()); // Show results of log
ps aux --sort=-%mem | awk 'NR<=800{print $0}'
ps -eo pid,lstart,cmd
git reset --soft HEAD~1
git push origin master --force
git reset --hard HEAD~1
git push origin master --force
Laravel queue job is caching your job php code, so after updating job code you need to:
php artisan queue:restart
Fast command to test nginx config and reload nginx if test is successful
sudo nginx -t && sudo nginx -s reload
To run some command in background, so you can close terminal, type the following:
nohup command-with-options &
TL DR; To build app on windows to linux 64 type this in powershell
$Env:GOOS = "linux"; $Env:GOARCH = "amd64"; go build main.go
PHP server in current directory
php -S localhost:8000
PHP server in public directory
php -S localhost:8000 -t public
If you try to import dumped file, and there is such an error, try using mysql console with options and then import sql file
mysql -u root -p --max_allowed_packet=6400M
If you haven't acess to console or the previous doesn't work
set global max_allowed_packet=10000000000;
SELECT * FROM my_table ORDER BY id DESC LIMIT 1;
SELECT MAX(id) FROM my_table;
$randomRow = DB::table('table')
->inRandomOrder()
->first();
$randomId = DB::table('table')
->inRandomOrder()
->value('id');
SELECT * FROM my_table ORDER BY RAND() LIMIT 1;