To place job on the queue using tinker: use Illuminate\Contracts\Bus\Dispatcher; //for command app(Dispatcher::class)->dispatch($command); //for job app(Dispatcher::class)->dispatch(new App\Jobs\TestJob); //or $pending =
Category: PHP
Laravel Model
To create a new model php artisan make:model model_name This will make a model file in App directory. As a
PHP access object properties
When encounter access problem to an object’s property, you can Transfer object to array $obj_arr=$obj->toArray(); Access the member $Status =
Ways to Dispatch Laravel Work Process
With minimum configuration according to this stackoverflow post: nohup php artisan queue:work –daemon & This will run the queue:work process
Larave Nested Where Clause
A good link to look at: https://stackoverflow.com/questions/60559442/nested-orwhere-in-one-where-laravel To implement the following SQL: select * from logs where created_at between “2021-02-23”
Laravel Config and Env
Good discussion env() calls work as long as you don’t use php artisan config:cache. So it’s very dangerous because it
Adding DS Data Structure Extension to PHP
This is for Windows running PHP through XAMPP Go to https://pecl.php.net/package/ds download dll, choose 32 or 64 bit version. Note,
Laravel Multiple Database Connection
For Laravel > 5.3 Add in .env file properties of the second connection (DB_HOST, DB_PORT, DB_DATABASE, DBUSERNAME, DB_PASSWORD) Add second
Laravel Console Command
Generate the command php artisan make:command command_name Call command php artisan command:command_name –options arguments Optionally, register An Command, add yourCommand
Laravel Job and Queue
This post shows the steps on how to run queue in database using background worker process. Useful tutorials: https://scotch.io/tutorials/why-laravel-queues-are-awesome https://laravel-news.com/laravel-jobs-and-queues-101