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 :: json from php 
Php :: how to add php 7.4 in homebrew 
Php :: php code to increase maximum execution time 
Php :: SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes (SQL: alter table `users` add unique `users_email_unique`(`email`)) 
Php :: eloquent where between 
Php :: hide wordpress error 
Php :: migration not found laravel 
Php :: PHP Warning: require(/vendor/autoload.php): failed to open stream: No such file or directory in /var/www/api-fase/bootstrap/autoload.php on line 17 
Php :: image acf 
Php :: php has been blocked by CORS policy 
Php :: php generate random string of characters 
Php :: laravel has table 
Php :: php post self 
Php :: laravel/framework[v5.8.0, ..., 5.8.x-dev] require php ^7.1.3 - your php version (8.1.6) does not satisfy that req 
Php :: how to count string characters in php 
Php :: enie letter validation laravel regex 
Php :: php encode url parameters 
Php :: laravel hash::check 
Php :: wordpress if admin 
Php :: try catch php 
Php :: add leading zeros in php 
Php :: php artisan serve not working 
Php :: laravel create project in current directory 
Php :: laravel validation time hours minutes format 
Php :: php switch 
Php :: get index of element in array php 
Php :: using a php array in jquery 
Php :: php artisan migrate --env=testing 
Php :: woocommerce terms and condition fields checked by default 
Php :: get yesterday date in php 
ADD CONTENT
Topic
Content
Source link
Name
7+3 =