Reputation: 29
This is my function in MemberController
public function text(){
return "hello";
}
This is my route
Route::get('/text',[MemberController::class,'text']);
So,basically its unable to read new route that i created. Thanks in advance
Upvotes: 0
Views: 62
Reputation: 251
Code you have provided is not enough, though you can check following things.
php artisan route:clear
in order to clear the cached routes.web.php
file then, your actual url should be: http://localhost:8000/text.api.php
file then, your url should be: http://localhost:8000/api/text.Upvotes: 0
Reputation: 108
Hope you're using laravel 8 and above follwoing should be your controller code (MemberController.php)
<?php
namespace App\Http\Controllers;
class MemberController extends Controller{
public function text(){
return "hello";
}
}
and this should be your route code (web.php)
<?php
use App\Http\Controllers\MemberController;
Route::get('/text',[MemberController::class,'text']);
Upvotes: 1