How to create a custom cron job in Laravel?

< 1 min readIn Laravel, you can create a custom cron job using the Artisan command make:command. This will generate a new class in the app/Console/Commands directory that extends the Illuminate\Console\Command class. Here are the steps to create a custom cron job: Run this command to generate a new command This will create a new file called MyCustomCronJob.php…

Read More

How to get public path in Laravel?

< 1 min readTo get a public path in Laravel, you can use the public_path() function. Here’s an example: This will return the full path to the file.txt file in the public directory. You can also use the asset() function to generate a URL to a file in the public directory. Here’s an example: This will return a…

Read More

How to sort a Laravel Collection?

< 1 min readTo sort a Laravel collection, you can use the sort method. This method will sort the items in the collection in ascending order according to their values. Here’s an example: You can also pass a callback to the sort method to specify a custom comparison function: If you want to sort the collection in descending…

Read More