Route::post('/update-client',
array(
'uses' => 'Client\API\ClientAPIController@Update',
'as' => 'apiUpdateClient',
)
);
Route::post('/delete-client',
array(
'uses' => 'Client\API\ClientAPIController@Delete',
'as' => 'apiDeleteClient',
)
);
But, these routes are not now working in Laravel 8. Below are error details
Target class [Client\API\ClientAPIController] does not exist.
It works if I write like below and got it fixed
Route::post('/update-client',
array(
'uses' => 'App\Http\Controller\Client\API\ClientAPIController@Update',
'as' => 'apiUpdateClient',
)
);
Question -
My route file contains many client routes. So, instead of appending App\Http\Controller with each route, I thought to do it like below,
use App\Http\Controllers\Client\API\ClientAPIController;
Route::post('/update-client',
array(
'uses' => [ClientAPIController::class, 'Update'],
'as' => 'apiUpdateClient',
)
);
Above code gave me error,,,
ReflectionFunction::__construct() expects parameter 1 to be string, array given
Am I using wrong syntax for uses parameter?