I am try to add route to my web In my routes.php
Route::get('/blog', 'WebController@blogIndex');
In my controller
namespace App\Http\Controllers;
class WebController extends Controller {
public function __construct()
{
}
/**
* Show the application welcome screen to the user.
*
* @return Response
*/
public function index()
{
$products = Product::where("status","=","active")->where("in_home", "=",1)->orderBy("created_at", "ASC")->take(3)->get();
return view("home")
->with("active","home")
->with("products",$products);
}
public function blogIndex()
{
return view("blog")
}
}
The, when i visit the url : miwebstite.com/blog, show the error
BadMethodCallException in Controller.php line 273: Method [blogIndex] does not exist.
But, if the route "/blog" call function index(), it work. If i put this code in my routes.php:
Route::get('/blog', function(){
return view("blog")
})
Also Work
I tryed, run the command
composer dumpautoload
rm -rf vendor/laravel
composer update
But it does not work, I do not know what else to work
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire