Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make sub directories for jobs in Laravel 5.1?

I am using Laravel 5.1. Generally to generate jobs I do php artisan make:job SomeJobName. This would basically create a SomeJobName job in the app/Jobs directory. But what if my application is huge. I would end up having a lot of files in that folder. I want to organize it a little. I want to make sub directories like:

app/Jobs/Users/
   Store.php
   Update.php
   Delete.php
app/Jobs/Posts
   Store.php
   Update.php
   Delete.php

What is the recommended approach to accomplish this?

like image 643
Homo Sapien Avatar asked Dec 25 '22 17:12

Homo Sapien


1 Answers

artisan make:* commands will accept a relative namespace so you can do something like this:

php artisan make:job Users/Store

You don't even need to create the sub-directories as artisan will create them if they don't exist.

like image 194
nCrazed Avatar answered Dec 27 '22 20:12

nCrazed