ctf0/helper-cmnds

Some Helper Console Cmnds For Laravel To Speedup The Usual Workflow

v2.0.1 2021-02-13 02:26 UTC

README

Laravel Helper Cmnds
Latest Stable Version Total Downloads

A helper console cmnds to speedup the usual workflow.


Installation

  • composer require ctf0/helper-cmnds

Usage

ex:clear       # Clear (Bootstrap-Files/Cache/Config/Route-Cache/View/Session/Compiled/Laravel-LogFile/Pass-Resets)
ex:finetune    # Cache (Bootstrap-Files/View/Config/Routes/Events)
ex:make        # Make (Controller/Model/Migration/Seeder/Route/View/Validation)

1- ex:clear

  • php artisan optimize:clear
  • Cache::store('file')->flush();
  • Session::flush()
  • File::cleanDirectory(config('session.files'));
  • File::put(storage_path('logs/laravel.log'), '');
  • php artisan auth:clear-resets if the table was migrated
  • composer dump-autoload
  • an event gets fired when this command has finished in case you want to run something else after it, and you can hook into it through:

    // app/Providers/EventServiceProvider.php
    public function boot()
    {
        parent::boot();
    
        Event::listen('clearAll.done', function () {
            // any other cmnds you want to run
        });
    }

2- ex:finetune

  • composer dump-autoload
  • php artisan optimize
  • php artisan view:cache
  • php artisan event:cache

3- ex:make (for a two word className ex. SubPage, write it as sub_page)

  • Validation [y/N] Read More.

    • create 2 classes for Update & Store php artisan make:request {name}
    • register the FormRequest classes to the controller automatically
  • Controller

    • if "Route Model Binding" we will add the Model class to the controller automatically
    • php artisan make:controller --resource
  • Model & Migration

    • create App/Models/BaseModel.php if not found
    • create App/Models/ClassName.php
    • php artisan make:migration {name} --create
  • Seeder [y/N]

    • php artisan make:seeder
    • create a seeder file & register it under DatabaseSeeder::run().
  • Routes [y/N] Also Check

    • creates a new folder in routes/WebRoutes/ClassName.php.
    • append a loop to web.php to include all the files from the routes/WebRoutes folder.
  • Views [y/N]

    • create a new folder in resources/views/pages/ClassName/ + files for 'index/create/show/edit'.

Security

If you discover any security-related issues, please email ctf0-dev@protonmail.com.