first commit
This commit is contained in:
		
							
								
								
									
										80
									
								
								app/Console/Commands/BillReminder.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										80
									
								
								app/Console/Commands/BillReminder.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,80 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace App\Console\Commands;
 | 
			
		||||
 | 
			
		||||
use App\Models\Company\Company;
 | 
			
		||||
use App\Models\Expense\Bill;
 | 
			
		||||
use App\Notifications\Expense\Bill as Notification;
 | 
			
		||||
 | 
			
		||||
use Jenssegers\Date\Date;
 | 
			
		||||
use Illuminate\Console\Command;
 | 
			
		||||
 | 
			
		||||
class BillReminder extends Command
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * The name and signature of the console command.
 | 
			
		||||
     *
 | 
			
		||||
     * @var string
 | 
			
		||||
     */
 | 
			
		||||
    protected $signature = 'reminder:bill';
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * The console command description.
 | 
			
		||||
     *
 | 
			
		||||
     * @var string
 | 
			
		||||
     */
 | 
			
		||||
    protected $description = 'Send reminders for bills';
 | 
			
		||||
    
 | 
			
		||||
    /**
 | 
			
		||||
     * Create a new command instance.
 | 
			
		||||
     *
 | 
			
		||||
     * @return void
 | 
			
		||||
     */
 | 
			
		||||
    public function __construct()
 | 
			
		||||
    {
 | 
			
		||||
        parent::__construct();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Execute the console command.
 | 
			
		||||
     *
 | 
			
		||||
     * @return mixed
 | 
			
		||||
     */
 | 
			
		||||
    public function handle()
 | 
			
		||||
    {
 | 
			
		||||
        // Get all companies
 | 
			
		||||
        $companies = Company::all();
 | 
			
		||||
 | 
			
		||||
        foreach ($companies as $company) {
 | 
			
		||||
            $company->setSettings();
 | 
			
		||||
 | 
			
		||||
            //$days = explode(',', setting('general.schedule_bill_days', '1,3'));
 | 
			
		||||
            $days = explode(',', $company->schedule_bill_days);
 | 
			
		||||
 | 
			
		||||
            foreach ($days as $day) {
 | 
			
		||||
                $this->remind(trim($day), $company);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    protected function remind($day, $company)
 | 
			
		||||
    {
 | 
			
		||||
        // Get due date
 | 
			
		||||
        $date = Date::today()->addDays($day)->toDateString();
 | 
			
		||||
 | 
			
		||||
        // Get upcoming bills
 | 
			
		||||
        $bills = Bill::companyId($company->id)->due($date)->with('vendor')->get();
 | 
			
		||||
 | 
			
		||||
        foreach ($bills as $bill) {
 | 
			
		||||
            // Notify all users assigned to this company
 | 
			
		||||
            foreach ($company->users as $user) {
 | 
			
		||||
                if (!$user->can('read-notifications')) {
 | 
			
		||||
                    continue;
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                $user->notify(new Notification($bill));
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										47
									
								
								app/Console/Commands/CompanySeed.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										47
									
								
								app/Console/Commands/CompanySeed.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,47 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace App\Console\Commands;
 | 
			
		||||
 | 
			
		||||
use Illuminate\Console\Command;
 | 
			
		||||
 | 
			
		||||
class CompanySeed extends Command
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * The name and signature of the console command.
 | 
			
		||||
     *
 | 
			
		||||
     * @var string
 | 
			
		||||
     */
 | 
			
		||||
    protected $signature = 'company:seed {company}';
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * The console command description.
 | 
			
		||||
     *
 | 
			
		||||
     * @var string
 | 
			
		||||
     */
 | 
			
		||||
    protected $description = 'Seed for specific company';
 | 
			
		||||
    
 | 
			
		||||
    /**
 | 
			
		||||
     * Create a new command instance.
 | 
			
		||||
     *
 | 
			
		||||
     * @return void
 | 
			
		||||
     */
 | 
			
		||||
    public function __construct()
 | 
			
		||||
    {
 | 
			
		||||
        parent::__construct();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Execute the console command.
 | 
			
		||||
     *
 | 
			
		||||
     * @return mixed
 | 
			
		||||
     */
 | 
			
		||||
    public function handle()
 | 
			
		||||
    {
 | 
			
		||||
        $class = $this->laravel->make('CompanySeeder');
 | 
			
		||||
        
 | 
			
		||||
        $seeder = $class->setContainer($this->laravel)->setCommand($this);
 | 
			
		||||
        
 | 
			
		||||
        $seeder->__invoke();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										83
									
								
								app/Console/Commands/InvoiceReminder.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										83
									
								
								app/Console/Commands/InvoiceReminder.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,83 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace App\Console\Commands;
 | 
			
		||||
 | 
			
		||||
use App\Models\Company\Company;
 | 
			
		||||
use App\Models\Income\Invoice;
 | 
			
		||||
use App\Notifications\Income\Invoice as Notification;
 | 
			
		||||
 | 
			
		||||
use Jenssegers\Date\Date;
 | 
			
		||||
use Illuminate\Console\Command;
 | 
			
		||||
 | 
			
		||||
class InvoiceReminder extends Command
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * The name and signature of the console command.
 | 
			
		||||
     *
 | 
			
		||||
     * @var string
 | 
			
		||||
     */
 | 
			
		||||
    protected $signature = 'reminder:invoice';
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * The console command description.
 | 
			
		||||
     *
 | 
			
		||||
     * @var string
 | 
			
		||||
     */
 | 
			
		||||
    protected $description = 'Send reminders for invoices';
 | 
			
		||||
    
 | 
			
		||||
    /**
 | 
			
		||||
     * Create a new command instance.
 | 
			
		||||
     *
 | 
			
		||||
     * @return void
 | 
			
		||||
     */
 | 
			
		||||
    public function __construct()
 | 
			
		||||
    {
 | 
			
		||||
        parent::__construct();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Execute the console command.
 | 
			
		||||
     *
 | 
			
		||||
     * @return mixed
 | 
			
		||||
     */
 | 
			
		||||
    public function handle()
 | 
			
		||||
    {
 | 
			
		||||
        // Get all companies
 | 
			
		||||
        $companies = Company::all();
 | 
			
		||||
 | 
			
		||||
        foreach ($companies as $company) {
 | 
			
		||||
            $company->setSettings();
 | 
			
		||||
 | 
			
		||||
            //$days = explode(',', config('general.schedule_invoice_days', '1,3'));
 | 
			
		||||
            $days = explode(',', $company->schedule_invoice_days);
 | 
			
		||||
 | 
			
		||||
            foreach ($days as $day) {
 | 
			
		||||
                $this->remind(trim($day), $company);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    protected function remind($day, $company)
 | 
			
		||||
    {
 | 
			
		||||
        // Get due date
 | 
			
		||||
        $date = Date::today()->subDays($day)->toDateString();
 | 
			
		||||
 | 
			
		||||
        // Get upcoming bills
 | 
			
		||||
        $invoices = Invoice::companyId($company->id)->due($date)->with('customer')->get();
 | 
			
		||||
 | 
			
		||||
        foreach ($invoices as $invoice) {
 | 
			
		||||
            // Notify the customer
 | 
			
		||||
            $invoice->customer->notify(new Notification($invoice));
 | 
			
		||||
 | 
			
		||||
            // Notify all users assigned to this company
 | 
			
		||||
            foreach ($company->users as $user) {
 | 
			
		||||
                if (!$user->can('read-notifications')) {
 | 
			
		||||
                    continue;
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                $user->notify(new Notification($invoice));
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										47
									
								
								app/Console/Kernel.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										47
									
								
								app/Console/Kernel.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,47 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace App\Console;
 | 
			
		||||
 | 
			
		||||
use Illuminate\Console\Scheduling\Schedule;
 | 
			
		||||
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
 | 
			
		||||
 | 
			
		||||
class Kernel extends ConsoleKernel
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * The Artisan commands provided by your application.
 | 
			
		||||
     *
 | 
			
		||||
     * @var array
 | 
			
		||||
     */
 | 
			
		||||
    protected $commands = [
 | 
			
		||||
        Commands\CompanySeed::class,
 | 
			
		||||
        Commands\BillReminder::class,
 | 
			
		||||
        Commands\InvoiceReminder::class,
 | 
			
		||||
    ];
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Define the application's command schedule.
 | 
			
		||||
     *
 | 
			
		||||
     * @param  \Illuminate\Console\Scheduling\Schedule  $schedule
 | 
			
		||||
     * @return void
 | 
			
		||||
     */
 | 
			
		||||
    protected function schedule(Schedule $schedule)
 | 
			
		||||
    {
 | 
			
		||||
        // Not installed yet
 | 
			
		||||
        if (env('DB_DATABASE', '') == '') {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $schedule->command('reminder:invoice')->dailyAt(setting('general.schedule_time', '09:00'));
 | 
			
		||||
        $schedule->command('reminder:bill')->dailyAt(setting('general.schedule_time', '09:00'));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Register the Closure based commands for the application.
 | 
			
		||||
     *
 | 
			
		||||
     * @return void
 | 
			
		||||
     */
 | 
			
		||||
    protected function commands()
 | 
			
		||||
    {
 | 
			
		||||
        require base_path('routes/console.php');
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										68
									
								
								app/Console/Stubs/Modules/command.stub
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										68
									
								
								app/Console/Stubs/Modules/command.stub
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,68 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace $NAMESPACE$;
 | 
			
		||||
 | 
			
		||||
use Illuminate\Console\Command;
 | 
			
		||||
use Symfony\Component\Console\Input\InputOption;
 | 
			
		||||
use Symfony\Component\Console\Input\InputArgument;
 | 
			
		||||
 | 
			
		||||
class $CLASS$ extends Command
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * The console command name.
 | 
			
		||||
     *
 | 
			
		||||
     * @var string
 | 
			
		||||
     */
 | 
			
		||||
    protected $name = '$COMMAND_NAME$';
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * The console command description.
 | 
			
		||||
     *
 | 
			
		||||
     * @var string
 | 
			
		||||
     */
 | 
			
		||||
    protected $description = 'Command description.';
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Create a new command instance.
 | 
			
		||||
     *
 | 
			
		||||
     * @return void
 | 
			
		||||
     */
 | 
			
		||||
    public function __construct()
 | 
			
		||||
    {
 | 
			
		||||
        parent::__construct();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Execute the console command.
 | 
			
		||||
     *
 | 
			
		||||
     * @return mixed
 | 
			
		||||
     */
 | 
			
		||||
    public function fire()
 | 
			
		||||
    {
 | 
			
		||||
        //
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Get the console command arguments.
 | 
			
		||||
     *
 | 
			
		||||
     * @return array
 | 
			
		||||
     */
 | 
			
		||||
    protected function getArguments()
 | 
			
		||||
    {
 | 
			
		||||
        return [
 | 
			
		||||
            ['example', InputArgument::REQUIRED, 'An example argument.'],
 | 
			
		||||
        ];
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Get the console command options.
 | 
			
		||||
     *
 | 
			
		||||
     * @return array
 | 
			
		||||
     */
 | 
			
		||||
    protected function getOptions()
 | 
			
		||||
    {
 | 
			
		||||
        return [
 | 
			
		||||
            ['example', null, InputOption::VALUE_OPTIONAL, 'An example option.', null],
 | 
			
		||||
        ];
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										15
									
								
								app/Console/Stubs/Modules/composer.stub
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								app/Console/Stubs/Modules/composer.stub
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,15 @@
 | 
			
		||||
{
 | 
			
		||||
    "name": "$VENDOR$/$LOWER_NAME$",
 | 
			
		||||
    "description": "",
 | 
			
		||||
    "authors": [
 | 
			
		||||
        {
 | 
			
		||||
            "name": "$AUTHOR_NAME$",
 | 
			
		||||
            "email": "$AUTHOR_EMAIL$"
 | 
			
		||||
        }
 | 
			
		||||
    ],
 | 
			
		||||
    "autoload": {
 | 
			
		||||
        "psr-4": {
 | 
			
		||||
            "$MODULE_NAMESPACE$\\$STUDLY_NAME$\\": ""
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										9
									
								
								app/Console/Stubs/Modules/controller-plain.stub
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								app/Console/Stubs/Modules/controller-plain.stub
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,9 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace $CLASS_NAMESPACE$;
 | 
			
		||||
 | 
			
		||||
use Illuminate\Routing\Controller;
 | 
			
		||||
 | 
			
		||||
class $CLASS$ extends Controller
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										72
									
								
								app/Console/Stubs/Modules/controller.stub
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										72
									
								
								app/Console/Stubs/Modules/controller.stub
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,72 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace $CLASS_NAMESPACE$;
 | 
			
		||||
 | 
			
		||||
use Illuminate\Http\Request;
 | 
			
		||||
use Illuminate\Http\Response;
 | 
			
		||||
use Illuminate\Routing\Controller;
 | 
			
		||||
 | 
			
		||||
class $CLASS$ extends Controller
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * Display a listing of the resource.
 | 
			
		||||
     * @return Response
 | 
			
		||||
     */
 | 
			
		||||
    public function index()
 | 
			
		||||
    {
 | 
			
		||||
        return view('$LOWER_NAME$::index');
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Show the form for creating a new resource.
 | 
			
		||||
     * @return Response
 | 
			
		||||
     */
 | 
			
		||||
    public function create()
 | 
			
		||||
    {
 | 
			
		||||
        return view('$LOWER_NAME$::create');
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Store a newly created resource in storage.
 | 
			
		||||
     * @param  Request $request
 | 
			
		||||
     * @return Response
 | 
			
		||||
     */
 | 
			
		||||
    public function store(Request $request)
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Show the specified resource.
 | 
			
		||||
     * @return Response
 | 
			
		||||
     */
 | 
			
		||||
    public function show()
 | 
			
		||||
    {
 | 
			
		||||
        return view('$LOWER_NAME$::show');
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Show the form for editing the specified resource.
 | 
			
		||||
     * @return Response
 | 
			
		||||
     */
 | 
			
		||||
    public function edit()
 | 
			
		||||
    {
 | 
			
		||||
        return view('$LOWER_NAME$::edit');
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Update the specified resource in storage.
 | 
			
		||||
     * @param  Request $request
 | 
			
		||||
     * @return Response
 | 
			
		||||
     */
 | 
			
		||||
    public function update(Request $request)
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Remove the specified resource from storage.
 | 
			
		||||
     * @return Response
 | 
			
		||||
     */
 | 
			
		||||
    public function destroy()
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										30
									
								
								app/Console/Stubs/Modules/event.stub
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								app/Console/Stubs/Modules/event.stub
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,30 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace $NAMESPACE$;
 | 
			
		||||
 | 
			
		||||
use Illuminate\Queue\SerializesModels;
 | 
			
		||||
 | 
			
		||||
class $CLASS$
 | 
			
		||||
{
 | 
			
		||||
    use SerializesModels;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Create a new event instance.
 | 
			
		||||
     *
 | 
			
		||||
     * @return void
 | 
			
		||||
     */
 | 
			
		||||
    public function __construct()
 | 
			
		||||
    {
 | 
			
		||||
        //
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Get the channels the event should be broadcast on.
 | 
			
		||||
     *
 | 
			
		||||
     * @return array
 | 
			
		||||
     */
 | 
			
		||||
    public function broadcastOn()
 | 
			
		||||
    {
 | 
			
		||||
        return [];
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										33
									
								
								app/Console/Stubs/Modules/job.stub
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								app/Console/Stubs/Modules/job.stub
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,33 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace $NAMESPACE$;
 | 
			
		||||
 | 
			
		||||
use Illuminate\Queue\SerializesModels;
 | 
			
		||||
use Illuminate\Queue\InteractsWithQueue;
 | 
			
		||||
use Illuminate\Contracts\Queue\ShouldQueue;
 | 
			
		||||
use Illuminate\Bus\Queueable;
 | 
			
		||||
 | 
			
		||||
class $CLASS$ implements ShouldQueue
 | 
			
		||||
{
 | 
			
		||||
    use InteractsWithQueue, SerializesModels, Queueable;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Create a new job instance.
 | 
			
		||||
     *
 | 
			
		||||
     * @return void
 | 
			
		||||
     */
 | 
			
		||||
    public function __construct()
 | 
			
		||||
    {
 | 
			
		||||
        //
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Execute the job.
 | 
			
		||||
     *
 | 
			
		||||
     * @return void
 | 
			
		||||
     */
 | 
			
		||||
    public function handle()
 | 
			
		||||
    {
 | 
			
		||||
        //
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										19
									
								
								app/Console/Stubs/Modules/json.stub
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								app/Console/Stubs/Modules/json.stub
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,19 @@
 | 
			
		||||
{
 | 
			
		||||
    "name": "$STUDLY_NAME$",
 | 
			
		||||
    "alias": "$LOWER_NAME$",
 | 
			
		||||
    "description": "",
 | 
			
		||||
    "version": "1.0.0",
 | 
			
		||||
    "category": "payment-gateways",
 | 
			
		||||
    "keywords": [],
 | 
			
		||||
    "active": 1,
 | 
			
		||||
    "order": 0,
 | 
			
		||||
    "providers": [
 | 
			
		||||
        "$MODULE_NAMESPACE$\\$STUDLY_NAME$\\Providers\\$STUDLY_NAME$ServiceProvider"
 | 
			
		||||
    ],
 | 
			
		||||
    "aliases": {},
 | 
			
		||||
    "files": [
 | 
			
		||||
        "start.php"
 | 
			
		||||
    ],
 | 
			
		||||
    "requires": [],
 | 
			
		||||
    "settings": []
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										31
									
								
								app/Console/Stubs/Modules/listener.stub
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								app/Console/Stubs/Modules/listener.stub
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,31 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace $NAMESPACE$;
 | 
			
		||||
 | 
			
		||||
use $EVENTNAME$;
 | 
			
		||||
use Illuminate\Queue\InteractsWithQueue;
 | 
			
		||||
use Illuminate\Contracts\Queue\ShouldQueue;
 | 
			
		||||
 | 
			
		||||
class $CLASS$
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * Create the event listener.
 | 
			
		||||
     *
 | 
			
		||||
     * @return void
 | 
			
		||||
     */
 | 
			
		||||
    public function __construct()
 | 
			
		||||
    {
 | 
			
		||||
        //
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Handle the event.
 | 
			
		||||
     *
 | 
			
		||||
     * @param \$EVENTNAME$ $event
 | 
			
		||||
     * @return void
 | 
			
		||||
     */
 | 
			
		||||
    public function handle(\$EVENTNAME$ $event)
 | 
			
		||||
    {
 | 
			
		||||
        //
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										33
									
								
								app/Console/Stubs/Modules/mail.stub
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								app/Console/Stubs/Modules/mail.stub
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,33 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace $NAMESPACE$;
 | 
			
		||||
 | 
			
		||||
use Illuminate\Bus\Queueable;
 | 
			
		||||
use Illuminate\Mail\Mailable;
 | 
			
		||||
use Illuminate\Queue\SerializesModels;
 | 
			
		||||
use Illuminate\Contracts\Queue\ShouldQueue;
 | 
			
		||||
 | 
			
		||||
class $CLASS$ extends Mailable
 | 
			
		||||
{
 | 
			
		||||
    use Queueable, SerializesModels;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Create a new message instance.
 | 
			
		||||
     *
 | 
			
		||||
     * @return void
 | 
			
		||||
     */
 | 
			
		||||
    public function __construct()
 | 
			
		||||
    {
 | 
			
		||||
        //
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Build the message.
 | 
			
		||||
     *
 | 
			
		||||
     * @return $this
 | 
			
		||||
     */
 | 
			
		||||
    public function build()
 | 
			
		||||
    {
 | 
			
		||||
        return $this->view('view.name');
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										21
									
								
								app/Console/Stubs/Modules/middleware.stub
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								app/Console/Stubs/Modules/middleware.stub
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,21 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace $NAMESPACE$;
 | 
			
		||||
 | 
			
		||||
use Closure;
 | 
			
		||||
use Illuminate\Http\Request;
 | 
			
		||||
 | 
			
		||||
class $CLASS$
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * Handle an incoming request.
 | 
			
		||||
     *
 | 
			
		||||
     * @param  \Illuminate\Http\Request  $request
 | 
			
		||||
     * @param  \Closure  $next
 | 
			
		||||
     * @return mixed
 | 
			
		||||
     */
 | 
			
		||||
    public function handle(Request $request, Closure $next)
 | 
			
		||||
    {
 | 
			
		||||
        return $next($request);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										32
									
								
								app/Console/Stubs/Modules/migration/add.stub
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								app/Console/Stubs/Modules/migration/add.stub
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,32 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
use Illuminate\Support\Facades\Schema;
 | 
			
		||||
use Illuminate\Database\Schema\Blueprint;
 | 
			
		||||
use Illuminate\Database\Migrations\Migration;
 | 
			
		||||
 | 
			
		||||
class $CLASS$ extends Migration
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * Run the migrations.
 | 
			
		||||
     *
 | 
			
		||||
     * @return void
 | 
			
		||||
     */
 | 
			
		||||
    public function up()
 | 
			
		||||
    {
 | 
			
		||||
        Schema::table('$TABLE$', function (Blueprint $table) {
 | 
			
		||||
$FIELDS_UP$
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Reverse the migrations.
 | 
			
		||||
     *
 | 
			
		||||
     * @return void
 | 
			
		||||
     */
 | 
			
		||||
    public function down()
 | 
			
		||||
    {
 | 
			
		||||
        Schema::table('$TABLE$', function (Blueprint $table) {
 | 
			
		||||
$FIELDS_DOWN$
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										32
									
								
								app/Console/Stubs/Modules/migration/create.stub
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								app/Console/Stubs/Modules/migration/create.stub
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,32 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
use Illuminate\Support\Facades\Schema;
 | 
			
		||||
use Illuminate\Database\Schema\Blueprint;
 | 
			
		||||
use Illuminate\Database\Migrations\Migration;
 | 
			
		||||
 | 
			
		||||
class $CLASS$ extends Migration
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * Run the migrations.
 | 
			
		||||
     *
 | 
			
		||||
     * @return void
 | 
			
		||||
     */
 | 
			
		||||
    public function up()
 | 
			
		||||
    {
 | 
			
		||||
        Schema::create('$TABLE$', function (Blueprint $table) {
 | 
			
		||||
            $table->increments('id');
 | 
			
		||||
$FIELDS$
 | 
			
		||||
            $table->timestamps();
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Reverse the migrations.
 | 
			
		||||
     *
 | 
			
		||||
     * @return void
 | 
			
		||||
     */
 | 
			
		||||
    public function down()
 | 
			
		||||
    {
 | 
			
		||||
        Schema::dropIfExists('$TABLE$');
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										32
									
								
								app/Console/Stubs/Modules/migration/delete.stub
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								app/Console/Stubs/Modules/migration/delete.stub
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,32 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
use Illuminate\Support\Facades\Schema;
 | 
			
		||||
use Illuminate\Database\Schema\Blueprint;
 | 
			
		||||
use Illuminate\Database\Migrations\Migration;
 | 
			
		||||
 | 
			
		||||
class $CLASS$ extends Migration
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * Run the migrations.
 | 
			
		||||
     *
 | 
			
		||||
     * @return void
 | 
			
		||||
     */
 | 
			
		||||
    public function up()
 | 
			
		||||
    {
 | 
			
		||||
        Schema::table('$TABLE$', function (Blueprint $table) {
 | 
			
		||||
$FIELDS_UP$
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Reverse the migrations.
 | 
			
		||||
     *
 | 
			
		||||
     * @return void
 | 
			
		||||
     */
 | 
			
		||||
    public function down()
 | 
			
		||||
    {
 | 
			
		||||
        Schema::table('$TABLE$', function (Blueprint $table) {
 | 
			
		||||
$FIELDS_DOWN$
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										32
									
								
								app/Console/Stubs/Modules/migration/drop.stub
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								app/Console/Stubs/Modules/migration/drop.stub
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,32 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
use Illuminate\Support\Facades\Schema;
 | 
			
		||||
use Illuminate\Database\Schema\Blueprint;
 | 
			
		||||
use Illuminate\Database\Migrations\Migration;
 | 
			
		||||
 | 
			
		||||
class $CLASS$ extends Migration
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * Run the migrations.
 | 
			
		||||
     *
 | 
			
		||||
     * @return void
 | 
			
		||||
     */
 | 
			
		||||
    public function up()
 | 
			
		||||
    {
 | 
			
		||||
        Schema::dropIfExists('$TABLE$');
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Reverse the migrations.
 | 
			
		||||
     *
 | 
			
		||||
     * @return void
 | 
			
		||||
     */
 | 
			
		||||
    public function down()
 | 
			
		||||
    {
 | 
			
		||||
        Schema::create('$TABLE$', function (Blueprint $table) {
 | 
			
		||||
            $table->increments('id');
 | 
			
		||||
$FIELDS$
 | 
			
		||||
            $table->timestamps();
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										28
									
								
								app/Console/Stubs/Modules/migration/plain.stub
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								app/Console/Stubs/Modules/migration/plain.stub
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,28 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
use Illuminate\Support\Facades\Schema;
 | 
			
		||||
use Illuminate\Database\Schema\Blueprint;
 | 
			
		||||
use Illuminate\Database\Migrations\Migration;
 | 
			
		||||
 | 
			
		||||
class $CLASS$ extends Migration
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * Run the migrations.
 | 
			
		||||
     *
 | 
			
		||||
     * @return void
 | 
			
		||||
     */
 | 
			
		||||
    public function up()
 | 
			
		||||
    {
 | 
			
		||||
        //
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Reverse the migrations.
 | 
			
		||||
     *
 | 
			
		||||
     * @return void
 | 
			
		||||
     */
 | 
			
		||||
    public function down()
 | 
			
		||||
    {
 | 
			
		||||
        //
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										10
									
								
								app/Console/Stubs/Modules/model.stub
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								app/Console/Stubs/Modules/model.stub
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,10 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace $NAMESPACE$;
 | 
			
		||||
 | 
			
		||||
use Illuminate\Database\Eloquent\Model;
 | 
			
		||||
 | 
			
		||||
class $CLASS$ extends Model
 | 
			
		||||
{
 | 
			
		||||
    protected $fillable = $FILLABLE$;
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										61
									
								
								app/Console/Stubs/Modules/notification.stub
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										61
									
								
								app/Console/Stubs/Modules/notification.stub
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,61 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace $NAMESPACE$;
 | 
			
		||||
 | 
			
		||||
use Illuminate\Bus\Queueable;
 | 
			
		||||
use Illuminate\Notifications\Notification;
 | 
			
		||||
use Illuminate\Contracts\Queue\ShouldQueue;
 | 
			
		||||
use Illuminate\Notifications\Messages\MailMessage;
 | 
			
		||||
 | 
			
		||||
class $CLASS$ extends Notification
 | 
			
		||||
{
 | 
			
		||||
    use Queueable;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Create a new notification instance.
 | 
			
		||||
     *
 | 
			
		||||
     * @return void
 | 
			
		||||
     */
 | 
			
		||||
    public function __construct()
 | 
			
		||||
    {
 | 
			
		||||
        //
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Get the notification's delivery channels.
 | 
			
		||||
     *
 | 
			
		||||
     * @param mixed $notifiable
 | 
			
		||||
     * @return array
 | 
			
		||||
     */
 | 
			
		||||
    public function via($notifiable)
 | 
			
		||||
    {
 | 
			
		||||
        return ['mail'];
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Get the mail representation of the notification.
 | 
			
		||||
     *
 | 
			
		||||
     * @param mixed $notifiable
 | 
			
		||||
     * @return \Illuminate\Notifications\Messages\MailMessage
 | 
			
		||||
     */
 | 
			
		||||
    public function toMail($notifiable)
 | 
			
		||||
    {
 | 
			
		||||
        return (new MailMessage)
 | 
			
		||||
                    ->line('The introduction to the notification.')
 | 
			
		||||
                    ->action('Notification Action', 'https://laravel.com')
 | 
			
		||||
                    ->line('Thank you for using our application!');
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Get the array representation of the notification.
 | 
			
		||||
     *
 | 
			
		||||
     * @param mixed $notifiable
 | 
			
		||||
     * @return array
 | 
			
		||||
     */
 | 
			
		||||
    public function toArray($notifiable)
 | 
			
		||||
    {
 | 
			
		||||
        return [
 | 
			
		||||
            //
 | 
			
		||||
        ];
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										35
									
								
								app/Console/Stubs/Modules/provider.stub
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								app/Console/Stubs/Modules/provider.stub
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,35 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace $NAMESPACE$;
 | 
			
		||||
 | 
			
		||||
use Illuminate\Support\ServiceProvider;
 | 
			
		||||
 | 
			
		||||
class $CLASS$ extends ServiceProvider
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * Indicates if loading of the provider is deferred.
 | 
			
		||||
     *
 | 
			
		||||
     * @var bool
 | 
			
		||||
     */
 | 
			
		||||
    protected $defer = false;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Register the service provider.
 | 
			
		||||
     *
 | 
			
		||||
     * @return void
 | 
			
		||||
     */
 | 
			
		||||
    public function register()
 | 
			
		||||
    {
 | 
			
		||||
        //
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Get the services provided by the provider.
 | 
			
		||||
     *
 | 
			
		||||
     * @return array
 | 
			
		||||
     */
 | 
			
		||||
    public function provides()
 | 
			
		||||
    {
 | 
			
		||||
        return [];
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										30
									
								
								app/Console/Stubs/Modules/request.stub
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								app/Console/Stubs/Modules/request.stub
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,30 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace $NAMESPACE$;
 | 
			
		||||
 | 
			
		||||
use Illuminate\Foundation\Http\FormRequest;
 | 
			
		||||
 | 
			
		||||
class $CLASS$ extends FormRequest
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * Get the validation rules that apply to the request.
 | 
			
		||||
     *
 | 
			
		||||
     * @return array
 | 
			
		||||
     */
 | 
			
		||||
    public function rules()
 | 
			
		||||
    {
 | 
			
		||||
        return [
 | 
			
		||||
            //
 | 
			
		||||
        ];
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Determine if the user is authorized to make this request.
 | 
			
		||||
     *
 | 
			
		||||
     * @return bool
 | 
			
		||||
     */
 | 
			
		||||
    public function authorize()
 | 
			
		||||
    {
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										41
									
								
								app/Console/Stubs/Modules/route-provider.stub
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										41
									
								
								app/Console/Stubs/Modules/route-provider.stub
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,41 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace $MODULE_NAMESPACE$\$MODULE$\Providers;
 | 
			
		||||
 | 
			
		||||
use Illuminate\Routing\Router;
 | 
			
		||||
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
 | 
			
		||||
 | 
			
		||||
class $NAME$ extends ServiceProvider
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * The root namespace to assume when generating URLs to actions.
 | 
			
		||||
     *
 | 
			
		||||
     * @var string
 | 
			
		||||
     */
 | 
			
		||||
    protected $rootUrlNamespace = '$MODULE_NAMESPACE$\$MODULE$\Http\Controllers';
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Called before routes are registered.
 | 
			
		||||
     *
 | 
			
		||||
     * Register any model bindings or pattern based filters.
 | 
			
		||||
     *
 | 
			
		||||
     * @param  Router $router
 | 
			
		||||
     * @return void
 | 
			
		||||
     */
 | 
			
		||||
    public function before(Router $router)
 | 
			
		||||
    {
 | 
			
		||||
        //
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Define the routes for the application.
 | 
			
		||||
     *
 | 
			
		||||
     * @return void
 | 
			
		||||
     */
 | 
			
		||||
    public function map(Router $router)
 | 
			
		||||
    {
 | 
			
		||||
        // if (!app()->routesAreCached()) {
 | 
			
		||||
        //    require __DIR__ . '/Http/routes.php';
 | 
			
		||||
        // }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										6
									
								
								app/Console/Stubs/Modules/routes.stub
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								app/Console/Stubs/Modules/routes.stub
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,6 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
Route::group(['middleware' => 'web', 'prefix' => '$LOWER_NAME$', 'namespace' => '$MODULE_NAMESPACE$\$STUDLY_NAME$\Http\Controllers'], function()
 | 
			
		||||
{
 | 
			
		||||
    Route::get('/', '$STUDLY_NAME$Controller@index');
 | 
			
		||||
});
 | 
			
		||||
							
								
								
									
										7
									
								
								app/Console/Stubs/Modules/scaffold/config.stub
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								app/Console/Stubs/Modules/scaffold/config.stub
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,7 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
return [
 | 
			
		||||
 | 
			
		||||
    'name' => '$STUDLY_NAME$',
 | 
			
		||||
 | 
			
		||||
];
 | 
			
		||||
							
								
								
									
										111
									
								
								app/Console/Stubs/Modules/scaffold/provider.stub
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										111
									
								
								app/Console/Stubs/Modules/scaffold/provider.stub
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,111 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace $NAMESPACE$;
 | 
			
		||||
 | 
			
		||||
use Illuminate\Support\ServiceProvider;
 | 
			
		||||
use Illuminate\Database\Eloquent\Factory;
 | 
			
		||||
 | 
			
		||||
class $CLASS$ extends ServiceProvider
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * Indicates if loading of the provider is deferred.
 | 
			
		||||
     *
 | 
			
		||||
     * @var bool
 | 
			
		||||
     */
 | 
			
		||||
    protected $defer = false;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Boot the application events.
 | 
			
		||||
     *
 | 
			
		||||
     * @return void
 | 
			
		||||
     */
 | 
			
		||||
    public function boot()
 | 
			
		||||
    {
 | 
			
		||||
        $this->registerTranslations();
 | 
			
		||||
        $this->registerConfig();
 | 
			
		||||
        $this->registerViews();
 | 
			
		||||
        $this->registerFactories();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Register the service provider.
 | 
			
		||||
     *
 | 
			
		||||
     * @return void
 | 
			
		||||
     */
 | 
			
		||||
    public function register()
 | 
			
		||||
    {
 | 
			
		||||
        //
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Register config.
 | 
			
		||||
     *
 | 
			
		||||
     * @return void
 | 
			
		||||
     */
 | 
			
		||||
    protected function registerConfig()
 | 
			
		||||
    {
 | 
			
		||||
        $this->publishes([
 | 
			
		||||
            __DIR__.'/../$PATH_CONFIG$/config.php' => config_path('$LOWER_NAME$.php'),
 | 
			
		||||
        ], 'config');
 | 
			
		||||
        $this->mergeConfigFrom(
 | 
			
		||||
            __DIR__.'/../$PATH_CONFIG$/config.php', '$LOWER_NAME$'
 | 
			
		||||
        );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Register views.
 | 
			
		||||
     *
 | 
			
		||||
     * @return void
 | 
			
		||||
     */
 | 
			
		||||
    public function registerViews()
 | 
			
		||||
    {
 | 
			
		||||
        $viewPath = resource_path('views/modules/$LOWER_NAME$');
 | 
			
		||||
 | 
			
		||||
        $sourcePath = __DIR__.'/../$PATH_VIEWS$';
 | 
			
		||||
 | 
			
		||||
        $this->publishes([
 | 
			
		||||
            $sourcePath => $viewPath
 | 
			
		||||
        ]);
 | 
			
		||||
 | 
			
		||||
        $this->loadViewsFrom(array_merge(array_map(function ($path) {
 | 
			
		||||
            return $path . '/modules/$LOWER_NAME$';
 | 
			
		||||
        }, \Config::get('view.paths')), [$sourcePath]), '$LOWER_NAME$');
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Register translations.
 | 
			
		||||
     *
 | 
			
		||||
     * @return void
 | 
			
		||||
     */
 | 
			
		||||
    public function registerTranslations()
 | 
			
		||||
    {
 | 
			
		||||
        $langPath = resource_path('lang/modules/$LOWER_NAME$');
 | 
			
		||||
 | 
			
		||||
        if (is_dir($langPath)) {
 | 
			
		||||
            $this->loadTranslationsFrom($langPath, '$LOWER_NAME$');
 | 
			
		||||
        } else {
 | 
			
		||||
            $this->loadTranslationsFrom(__DIR__ .'/../$PATH_LANG$', '$LOWER_NAME$');
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Register an additional directory of factories.
 | 
			
		||||
     * @source https://github.com/sebastiaanluca/laravel-resource-flow/blob/develop/src/Modules/ModuleServiceProvider.php#L66
 | 
			
		||||
     */
 | 
			
		||||
    public function registerFactories()
 | 
			
		||||
    {
 | 
			
		||||
        if (! app()->environment('production')) {
 | 
			
		||||
            app(Factory::class)->load(__DIR__ . '/Database/factories');
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Get the services provided by the provider.
 | 
			
		||||
     *
 | 
			
		||||
     * @return array
 | 
			
		||||
     */
 | 
			
		||||
    public function provides()
 | 
			
		||||
    {
 | 
			
		||||
        return [];
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										21
									
								
								app/Console/Stubs/Modules/seeder.stub
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								app/Console/Stubs/Modules/seeder.stub
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,21 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace $NAMESPACE$\Database\Seeders;
 | 
			
		||||
 | 
			
		||||
use Illuminate\Database\Seeder;
 | 
			
		||||
use Illuminate\Database\Eloquent\Model;
 | 
			
		||||
 | 
			
		||||
class $NAME$ extends Seeder
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * Run the database seeds.
 | 
			
		||||
     *
 | 
			
		||||
     * @return void
 | 
			
		||||
     */
 | 
			
		||||
    public function run()
 | 
			
		||||
    {
 | 
			
		||||
        Model::unguard();
 | 
			
		||||
 | 
			
		||||
        // $this->call("OthersTableSeeder");
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										17
									
								
								app/Console/Stubs/Modules/start.stub
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								app/Console/Stubs/Modules/start.stub
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,17 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
|--------------------------------------------------------------------------
 | 
			
		||||
| Register Namespaces And Routes
 | 
			
		||||
|--------------------------------------------------------------------------
 | 
			
		||||
|
 | 
			
		||||
| When a module starting, this file will executed automatically. This helps
 | 
			
		||||
| to register some namespaces like translator or view. Also this file
 | 
			
		||||
| will load the routes file for each module. You may also modify
 | 
			
		||||
| this file as you want.
 | 
			
		||||
|
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
if (!app()->routesAreCached()) {
 | 
			
		||||
    require __DIR__ . '/Http/routes.php';
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										9
									
								
								app/Console/Stubs/Modules/views/index.stub
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								app/Console/Stubs/Modules/views/index.stub
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,9 @@
 | 
			
		||||
@extends('$LOWER_NAME$::layouts.master')
 | 
			
		||||
 | 
			
		||||
@section('content')
 | 
			
		||||
    <h1>Hello World</h1>
 | 
			
		||||
 | 
			
		||||
    <p>
 | 
			
		||||
        This view is loaded from module: {!! config('$LOWER_NAME$.name') !!}
 | 
			
		||||
    </p>
 | 
			
		||||
@stop
 | 
			
		||||
							
								
								
									
										12
									
								
								app/Console/Stubs/Modules/views/master.stub
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								app/Console/Stubs/Modules/views/master.stub
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,12 @@
 | 
			
		||||
<!DOCTYPE html>
 | 
			
		||||
<html lang="en">
 | 
			
		||||
    <head>
 | 
			
		||||
        <meta charset="utf-8">
 | 
			
		||||
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
 | 
			
		||||
        <meta name="viewport" content="width=device-width, initial-scale=1">
 | 
			
		||||
        <title>Module $STUDLY_NAME$</title>
 | 
			
		||||
    </head>
 | 
			
		||||
    <body>
 | 
			
		||||
        @yield('content')
 | 
			
		||||
    </body>
 | 
			
		||||
</html>
 | 
			
		||||
		Reference in New Issue
	
	Block a user