Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

nazar1987's avatar

[L5] laravel 5.1 fresh command

hi every one laravel 5 it come with scaffold authentication and i see in laravel 5.1 found folder auth in controller but not found any view how can make fresh copy for laravel 5.1

0 likes
9 replies
bestmomo's avatar

What do you mean with fresh copy ? If you want to remove all auth you can use php artisan fresh.

absiddiqueLive's avatar

@nazar1987 You just this code in your Route

Route::controllers([
    'auth' => 'Auth\AuthController',
    'password' => 'Auth\PasswordController',
]);

To see Route use blow code

 php artisan route:list

And after that you needs to overwrite some function as you need, you also need to put view file or create the view file !

bestmomo's avatar

@nazar1987 it's odd because FreshCommand class is still in core but not in ArtisanServiceProvider.

bestmomo's avatar

@nazar1987

It's easy to create this command in app/Console/Commands :

<?php

namespace App\Console\Commands;

use Illuminate\Console\Command;
use Illuminate\Filesystem\Filesystem;
use Illuminate\Console\ConfirmableTrait;
use Symfony\Component\Console\Input\InputOption;

class FreshCommand extends Command
{
    use ConfirmableTrait;

    /**
     * The console command name.
     *
     * @var string
     */
    protected $name = 'fresh';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Remove auth included with the framework';

    /**
     * Execute the console command.
     *
     * @return void
     */
    public function fire()
    {
        if (!$this->confirmToProceed()) {
            return;
        }

        $files = new Filesystem;

        $files->deleteDirectory(app_path('Http/Controllers/Auth'));

        $files->delete(base_path('database/migrations/2014_10_12_000000_create_users_table.php'));
        $files->delete(base_path('database/migrations/2014_10_12_100000_create_password_resets_table.php'));

        $this->info('Auth removed! Enjoy your fresh start.');
    }

    /**
     * Get the console command options.
     *
     * @return array
     */
    protected function getOptions()
    {
        return [
            ['force', null, InputOption::VALUE_NONE, 'Force the operation to run when in production.'],
        ];
    }
}

Set it in Console/Kernel :

protected $commands = [
    \App\Console\Commands\FreshCommand::class,
];
1 like

Please or to participate in this conversation.