I am studying Laravel 8, using this code, but error :( please tell me how to fix
Class "App\Http\Controllers\Admin\Category" not found {"exception":{}}
code in Category Controller.php
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
class CategoryController extends Controller
{
public function index()
{
$categories = Category::paginate(2);
return view('admin.categories.index', compact('categories'));
}
code in web.php
use Illuminate\Support\Facades\Route;
Route::get('/', function() {
return view('welcome');
});
Route::group(['prefix' => 'admin', 'namespace' => 'Admin'], function () {
Route::get('/', 'MainController@index')->name('admin.index');
Route::resource('/categories', 'CategoryController');
});
source https://stackoverflow.com/questions/68145482/laravel-8-class-app-http-controllers-admin-category-not-found-exception
Comments
Post a Comment