Target class controller does not exist – Laravel 8

Here is my controller: <?php namespace App\Http\Controllers\Api; use App\Http\Controllers\Controller; use Illuminate\Http\Request; class RegisterController extends Controller { public function register(Request $request) { dd(‘aa’); } } As seen in the screenshot, the class exists and is in the correct place: My api.php route: Route::get(‘register’, ‘Api\RegisterController@register’); When I hit my register route using Postman, it gave me the … Read more

Laravel: How to Get Current Route Name? (v5 … v7)

In Laravel v4 I was able to get the current route name using… Route::currentRouteName() How can I do it in Laravel v5 and Laravel v6? 32 Answers 32 Try this Route::getCurrentRoute()->getPath(); or \Request::route()->getName() from v5.1 use Illuminate\Support\Facades\Route; $currentPath= Route::getFacadeRoot()->current()->uri(); Laravel v5.2 Route::currentRouteName(); //use Illuminate\Support\Facades\Route; Or if you need the action name Route::getCurrentRoute()->getActionName(); Laravel 5.2 route … Read more