It would be even better to move this to a middleware class. This way you can set it per route or for your whole application ;)
Sep 1, 2019
9
Level 1
over written php.ini in laravel
It's has been a challenge for a lot of laravel newbie to overwrite php.ini setting in laravel but here is a simple one: The below code has the ability to overwrite .ini in PHP. these will be very useful for those hosting their laravel app on a shared hosting.
Route::group(['middleware'=>'custom_middleware'], function () {
ini_set('upload_max_filesize', '500M');
ini_set('max_execution_time', 600);
ini_set('post_max_size', '500M');
});
Level 88
@automaton Just run php artisan make:middleware PHPIniMiddleware and add all those calls to the handle method. Then register the middleware in app/Http/Kernel.php and you're done ;)
1 like
Please or to participate in this conversation.