Using Laravel 5.4, indeed in the documentation about Route grouping, and an example as this was given about namespacing:
Route::namespace('Admin')->group(function () {
// Controllers Within The "App\Http\Controllers\Admin" Namespace
});
This according to the doc is okay, but after installing Laravel 5.4.30 I discovered that doing the above throws the following error:
PHP Parse error: syntax error, unexpected 'namespace' (T_NAMESPACE) in /Applications/MAMP/htdocs/my_app/routes/web.php on line
Even though I did a workaround by using other route methods before it such as the following:
Route::prefix('')->namespace('Admin')->group(function () {
// Controllers Within The "App\Http\Controllers\Admin" Namespace
});
Yet, Is this a bug in Laravel or something that I did't suspect is the issue in my code?.
If there is a need to provide more explanations, then I am glad to do that.
Update: As @Adweb suggested, it can be done using group(['namespace' => 'Admin'])...
but I am really still keen on what could be the issue based on the error I got.
Here is my PHP version:
PHP 5.6.30 (cli) (built: Mar 11 2017 09:56:27)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies