Laravel Blank white page Laravel Blank white page laravel laravel

Laravel Blank white page


The problem is the order of your routes.

Move the add route above your catch all {id} route.

Route::group(['prefix' => 'commodities'], function(){    Route::get('commodities', [        'as' => 'showCommodities', 'uses' => 'CommodityController@showAll'    ]);    Route::get('add', [        'as' => 'addCommodity', 'uses' => 'CommodityController@create'    ]);    Route::get('{id}', [        'as' => 'showCommodity', 'uses' => 'CommodityController@show'    ]);    Route::post('update', [        'as' => 'updateCommodity', 'uses' => 'CommodityController@update'    ]);    Route::post('destroy', [        'as' => 'destroyCommodity', 'uses' => 'CommodityController@destroy'    ]);    Route::post('add', [        'as' => 'storeCommodity', 'uses' => 'CommodityController@store'    ]);});

Laravel will go through your routes.php file top to bottom. The below route is essentially a catch all.

Route::get('{id}', [        'as' => 'showCommodity', 'uses' => 'CommodityController@show']);

This means it will catch all GET requests to urls that match the pattern:

/commodities/some-kind-of-string.

As the /commodities/add uri matches the above pattern it will use that route because it appears first in the routes file.