I recently heard about Laravel 8 changing the way routing was declared, as this video explainsthis video explains that developers upgrading from Laravel 7 or earlier will need to either switch to using the PHP callable syntax or fully namespace the controller in the string syntax (as your first code snippet does) (see the section Routing under Upgrading To 8.0 From 7.xUpgrading To 8.0 From 7.x).
Yes adding that use
statement at the top then you should be able to reference the class without the namespace before it.
You can use the ::class
keyword for name resolution instead of using a string literal:
'uses' => [CrewAPIController::class, 'Update'],
Many populate IDEs will index the class names and allow you to then easily jump to the class definition -e.g. ctrl/command + click on name).
I also wasn't familiar with the 'as'
syntax, then I found this comment on this accepted SO answer to What does "as" keyword mean in Laravel routing?
As keyword is in older version, if you change the documentation to 5.2 you can see the
as
keyword. In newer version it's->name
So you could use the name()
method to make the Named route instead:
Route::post('/update-crew', [CrewAPIController::class, 'Update'])
->name('apiUpdateCrew');
I recently heard about Laravel 8 changing the way routing was declared, as this video explains that developers upgrading from Laravel 7 or earlier will need to either switch to using the PHP callable syntax or fully namespace the controller in the string syntax (as your first code snippet does) (see the section Routing under Upgrading To 8.0 From 7.x).
Yes adding that use
statement at the top then you should be able to reference the class without the namespace before it.
You can use the ::class
keyword for name resolution instead of using a string literal:
'uses' => [CrewAPIController::class, 'Update'],
Many populate IDEs will index the class names and allow you to then easily jump to the class definition -e.g. ctrl/command + click on name).
I also wasn't familiar with the 'as'
syntax, then I found this comment on this accepted SO answer to What does "as" keyword mean in Laravel routing?
As keyword is in older version, if you change the documentation to 5.2 you can see the
as
keyword. In newer version it's->name
So you could use the name()
method to make the Named route instead:
Route::post('/update-crew', [CrewAPIController::class, 'Update'])
->name('apiUpdateCrew');
I recently heard about Laravel 8 changing the way routing was declared, as this video explains that developers upgrading from Laravel 7 or earlier will need to either switch to using the PHP callable syntax or fully namespace the controller in the string syntax (as your first code snippet does) (see the section Routing under Upgrading To 8.0 From 7.x).
Yes adding that use
statement at the top then you should be able to reference the class without the namespace before it.
You can use the ::class
keyword for name resolution instead of using a string literal:
'uses' => [CrewAPIController::class, 'Update'],
Many populate IDEs will index the class names and allow you to then easily jump to the class definition -e.g. ctrl/command + click on name).
I also wasn't familiar with the 'as'
syntax, then I found this comment on this accepted SO answer to What does "as" keyword mean in Laravel routing?
As keyword is in older version, if you change the documentation to 5.2 you can see the
as
keyword. In newer version it's->name
So you could use the name()
method to make the Named route instead:
Route::post('/update-crew', [CrewAPIController::class, 'Update'])
->name('apiUpdateCrew');
I recently heard about Laravel 8 changing the way routing was declared, as this video explains that developers upgrading from Laravel 7 or earlier will need to either switch to using the PHP callable syntax or fully namespace the controller in the string syntax (as your first code snippet does) (see the section Routing under Upgrading To 8.0 From 7.x).
If you addYes adding that use
statement at the top then you should be able to reference the class usingwithout the namespace before it.
You can use the ::class
keyword for name resolution instead of using a string literal:
'uses' => [CrewAPIController::class, 'Update'],
Many populate IDEs will index the class names and allow you to then easily jump to the class definition -e.g. ctrl/command + click on name).
I also wasn't familiar with the 'as'
syntax, then I found this comment on this accepted SO answer to What does "as" keyword mean in Laravel routing?
As keyword is in older version, if you change the documentation to 5.2 you can see the
as
keyword. In newer version it's->name
So you could use the name()
method to make the Named route instead:
Route::post('/update-crew', [CrewAPIController::class, 'Update'])
->name('apiUpdateCrew');
I recently heard about Laravel 8 changing the way routing was declared, as this video explains that developers upgrading from Laravel 7 or earlier will need to either switch to using the PHP callable syntax or fully namespace the controller in the string syntax (as your first code snippet does) (see the section Routing under Upgrading To 8.0 From 7.x).
If you add that use
statement at the top then you should be able to reference the class using the ::class
keyword for name resolution instead of using a string literal:
'uses' => [CrewAPIController::class, 'Update'],
I also wasn't familiar with the 'as'
syntax, then I found this comment on this accepted SO answer to What does "as" keyword mean in Laravel routing?
As keyword is in older version, if you change the documentation to 5.2 you can see the
as
keyword. In newer version it's->name
So you could use the name()
method to make the Named route instead:
Route::post('/update-crew', [CrewAPIController::class, 'Update'])
->name('apiUpdateCrew');
I recently heard about Laravel 8 changing the way routing was declared, as this video explains that developers upgrading from Laravel 7 or earlier will need to either switch to using the PHP callable syntax or fully namespace the controller in the string syntax (as your first code snippet does) (see the section Routing under Upgrading To 8.0 From 7.x).
Yes adding that use
statement at the top then you should be able to reference the class without the namespace before it.
You can use the ::class
keyword for name resolution instead of using a string literal:
'uses' => [CrewAPIController::class, 'Update'],
Many populate IDEs will index the class names and allow you to then easily jump to the class definition -e.g. ctrl/command + click on name).
I also wasn't familiar with the 'as'
syntax, then I found this comment on this accepted SO answer to What does "as" keyword mean in Laravel routing?
As keyword is in older version, if you change the documentation to 5.2 you can see the
as
keyword. In newer version it's->name
So you could use the name()
method to make the Named route instead:
Route::post('/update-crew', [CrewAPIController::class, 'Update'])
->name('apiUpdateCrew');
I recently heard about Laravel 8 changing the way routing was declared, as this video explains that developers upgrading from Laravel 7 or earlier will need to either switch to using the PHP callable syntax or fully namespace the controller in the string syntax (as your first code snippet does) (see the section Routing under Upgrading To 8.0 From 7.x).
If you add that use
statement at the top then you should be able to reference the class using the ::class
keyword for name resolution instead of using a string literal:
'uses' => [CrewAPIController::class, 'Update'],
I also wasn't familiar with the 'as'
syntax, then I found this comment on this accepted SO answer to What does "as" keyword mean in Laravel routing?
As keyword is in older version, if you change the documentation to 5.2 you can see the
as
keyword. In newer version it's->name
So you could use the name()
name()
method to make the Named route instead:
Route::post('/update-crew', [CrewAPIController::class, 'Update'])
->name('apiUpdateCrew');
I recently heard about Laravel 8 changing the way routing was declared, as this video explains that developers upgrading from Laravel 7 or earlier will need to either switch to using the PHP callable syntax or fully namespace the controller in the string syntax (as your first code snippet does) (see the section Routing under Upgrading To 8.0 From 7.x).
If you add that use
statement at the top then you should be able to reference the class using the ::class
keyword for name resolution instead of using a string literal:
'uses' => [CrewAPIController::class, 'Update'],
I also wasn't familiar with the 'as'
syntax, then I found this comment on this accepted SO answer to What does "as" keyword mean in Laravel routing?
As keyword is in older version, if you change the documentation to 5.2 you can see the
as
keyword. In newer version it's->name
So you could use the name()
method to make the Named route instead:
Route::post('/update-crew', [CrewAPIController::class, 'Update'])
->name('apiUpdateCrew');
I recently heard about Laravel 8 changing the way routing was declared, as this video explains that developers upgrading from Laravel 7 or earlier will need to either switch to using the PHP callable syntax or fully namespace the controller in the string syntax (as your first code snippet does) (see the section Routing under Upgrading To 8.0 From 7.x).
If you add that use
statement at the top then you should be able to reference the class using the ::class
keyword for name resolution instead of using a string literal:
'uses' => [CrewAPIController::class, 'Update'],
I also wasn't familiar with the 'as'
syntax, then I found this comment on this accepted SO answer to What does "as" keyword mean in Laravel routing?
As keyword is in older version, if you change the documentation to 5.2 you can see the
as
keyword. In newer version it's->name
So you could use the name()
method to make the Named route instead:
Route::post('/update-crew', [CrewAPIController::class, 'Update'])
->name('apiUpdateCrew');