Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@bayareawebpro
Created October 4, 2019 18:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bayareawebpro/c4205766aebba12d5d9c09abe2ed0bc4 to your computer and use it in GitHub Desktop.
Save bayareawebpro/c4205766aebba12d5d9c09abe2ed0bc4 to your computer and use it in GitHub Desktop.
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Foundation\Composer;
class DumpAutoload extends Command
{
/**
* The name and signature of the console command.
* @example https://stackoverflow.com/questions/37238547/run-composer-dump-autoload-from-controller-in-laravel-5
* @var string
*/
protected $signature = 'dump-autoload';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Regenerate framework autoload files';
/**
* The Composer instance.
*
* @var \Illuminate\Foundation\Composer
*/
protected $composer;
/**
* Create a new command instance.
*
* @param Composer $composer
* @return void
*/
public function __construct(Composer $composer)
{
parent::__construct();
$this->composer = $composer;
}
/**
* Execute the console command.
*
* @return void
*/
public function handle()
{
$this->composer->dumpAutoloads();
$this->composer->dumpOptimized();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment