I keep getting this error
syntax error, unexpected '['
it is in the line 1 of the following code snippet:
Route.php
Route::get('api/test/{input}', [ 'before' => 'checkauth', "as" => "test", "uses" => "TestController@show" ]);
what is wrong?
I keep getting this error
syntax error, unexpected '['
it is in the line 1 of the following code snippet:
Route.php
Route::get('api/test/{input}', [ 'before' => 'checkauth', "as" => "test", "uses" => "TestController@show" ]);
what is wrong?
Change your array notation.
Route::get('api/test/{input}', array(
'before' => 'checkauth',
"as" => "test",
"uses" => "TestController@show"
));
As Michael Berkowski says, the use of the array notation with [
requires PHP 5.4+
From the Php array documentation
As of PHP 5.4 you can also use the short array syntax, which replaces array() with [].
You should use the array();
notation:
Route::get('api/test/{input}', array(
'before' => 'checkauth',
"as" => "test",
"uses" => "TestController@show"
));