Search
 
SCRIPT & CODE EXAMPLE
 

PHP

execute artisan command from route

Route::get('clear_cache', function () {

    Artisan::call('cache:clear');

    dd("Cache is cleared");

});
Comment

artisan commands in route

//Clear Cache facade value:
Route::get('/clear-cache', function() {
    $exitCode = Artisan::call('cache:clear');
    return '<h1>Cache facade value cleared</h1>';
});

//Reoptimized class loader:
Route::get('/optimize', function() {
    $exitCode = Artisan::call('optimize');
    return '<h1>Reoptimized class loader</h1>';
});

//Route cache:
Route::get('/route-cache', function() {
    $exitCode = Artisan::call('route:cache');
    return '<h1>Routes cached</h1>';
});

//Clear Route cache:
Route::get('/route-clear', function() {
    $exitCode = Artisan::call('route:clear');
    return '<h1>Route cache cleared</h1>';
});

//Clear View cache:
Route::get('/view-clear', function() {
    $exitCode = Artisan::call('view:clear');
    return '<h1>View cache cleared</h1>';
});

//Clear Config cache:
Route::get('/config-cache', function() {
    $exitCode = Artisan::call('config:cache');
    return '<h1>Clear Config cleared</h1>';
});
Comment

artisan command in route

use IlluminateSupportFacadesArtisan;

Route::post('/user/{user}/mail', function ($user) {
    $exitCode = Artisan::call('mail:send', [
        'user' => $user, '--queue' => 'default'
    ]);

    //
});
Comment

laravel artisan command run in route

public function store(Request $request)
{
   Artisan::call("php artisan infyom:scaffold {$request['name']} --fieldsFile=public/Product.json");
}
Comment

PREVIOUS NEXT
Code Example
Php :: increase memory laravel controller 
Php :: php count amount of times a value appears in array 
Php :: how to pass id through get template part 
Php :: php decode json file 
Php :: laravel link active class 
Php :: laravel sort by numbers 
Php :: php sum array of objects 
Php :: laravel collection chunk 
Php :: wordpress check if class exists 
Php :: PHP Startup: Unable to load dynamic library 
Php :: This page isn’t working php 
Php :: php turney if 
Php :: php reduce 
Php :: php change array into comma delimited string 
Php :: php test if three values are equal 
Php :: time to string in php 
Php :: laravel old value for select option 
Php :: yii app db createcommand join yii1 
Php :: laravel group routes 
Php :: php convert string to url 
Php :: date and time in php 
Php :: get words after string in in php 
Php :: http error 500 - php file 
Php :: php in html attributes 
Php :: php replace blackslash 
Php :: csv to array php 
Php :: PHP (WordPress) - Increase Maximum Upload File Size 
Php :: get the full url in php 
Php :: php unix timestamp to date 
Php :: how to start laravel project 
ADD CONTENT
Topic
Content
Source link
Name
2+9 =