PHP code example of charsen / moo-scaffold

1. Go to this page and download the library: Download charsen/moo-scaffold library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

charsen / moo-scaffold example snippets


    //...
    'paths' => ['admin/*', 'api/*'],
    //...

    //...
    public function boot()
    {
        //
        $this->registerMacros();

        parent::boot();
    }
    //...
    protected function registerMacros()
    {
        Route::macro('iResource', function($name, $controller) {
            Route::get($name . '/trashed', $controller . '@trashed')->name($name . '.trashed');
            Route::delete($name . '/forever/{id}', $controller . '@forceDestroy')->name($name . '.forceDestroy');
            Route::delete($name . '/batch', $controller . '@destroyBatch')->name($name . '.destroyBatch');
            Route::patch($name . '/restore', $controller . '@restore')->name($name . '.restore');
            Route::resource($name, $controller);
        });
    }
    //...

    //...
    protected $middlewareGroups = [
        //...
        'admin' => [
            \Illuminate\Routing\Middleware\SubstituteBindings::class,
        ],
        //...
    ];
    //...

    //...
    public function map()
    {
        $this->mapApiRoutes();

        $this->mapWebRoutes();

        //
        $this->mapAdminRoutes();
    }

    //...
    protected function mapAdminRoutes()
    {
        Route::prefix('admin')
             ->middleware('admin')
             ->group(base_path('routes/admin.php'));
    }
    //...

Route::iResource('departments', \App\Admin\Controllers\System\DepartmentController::class);
sh
php artisan list
sh
php artisan moo:init "Charsen <https://github.com/charsen>"
sh
php artisan vendor:publish --provider=Mooeen\\Scaffold\\ScaffoldProvider --tag=config
sh
php artisan moo:schema `module_name`
sh
php artisan moo:migration `schema_file_name`
sh
php artisan moo:model `schema_file_name`
sh
php artisan moo:controller `app_name` `schema_file_name`
sh
php artisan moo:api `namesapce`
sh
php artisan moo:i18n