PHP code example of new-japan-orders / scaffold

1. Go to this page and download the library: Download new-japan-orders/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/ */

    

new-japan-orders / scaffold example snippets


php artisan scaffold:init front user

php artisan scaffold:init front user
        ↑
<これらは同じ意味>
        ↓
php artisan scaffold:app front
php artisan scaffold:auth front user

php artisan scaffold:init front user
php artisan scaffold:init admin admin
php artisan migrate
php artisan db:seed --class UserSeeder
php artisan db:seed --class AdminSeeder
 

    public function handle($request, Closure $next, $guard = null)
    {   
        if (Auth::guard($guard)->check()) {
            return redirect($guard.'/home');
        }   

        return $next($request);
    }   

 

    protected function unauthenticated($request, AuthenticationException $exception)
    {   
        if ($request->expectsJson()) {
            return response()->json(['error' => 'Unauthenticated.'], 401);
        }   

        if (in_array('admin', $exception->guards())) {
            return redirect()->guest(route('admin.login'));
        }   
        return redirect()->guest(route('front.login'));
    } 


    protected function mapWebRoutes()
    {   
        Route::middleware('web')
             ->namespace('Front\Http\Controllers')
             ->group(base_path('routes/front.php'));

        Route::middleware('web')
             ->namespace('Admin\Http\Controllers')
             ->group(base_path('routes/admin.php'));
    }   

php artisan scaffold:mvc front user car
        ↑
<これらは同じ意味>
        ↓
php artisan scaffold:controller front car
php artisan scaffold:model car
php artisan scaffold:view front user car