Route
Route::get('all-news', 'BlogController@allNews')->name('firstfunction');
BlogController
public function allNews()
{
$posts = Post::all();
return view('tarek')->with([
'mydata' => $posts,
]);
}
Error
Class App\\Http\\Controllers\\BlogController does not exist
first check your address there is BlogController.php in : app/http/controllers/
folder then check your namespace in your BlogController.php :
namespace App\Http\Controllers;
check your BlogController name and finally composerdump autoload
您是否将文件保存在正确的位置
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.