I am a new learner of laravel. I face problem while running my code. Method App\Http\Controllers\CategoryController::manage_category does not exist.
Here is my code:
<?php
namespace App\Http\Controllers;
use App\Models\Category;
use Illuminate\Http\Request;
class CategoryController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
return view('admin/category');
}
public function manage_category()
{
return view('admin/manage_category');
}
}
Here is my web route code:
<?php
use Illuminate\Support\Facades\Route;
use App\Http\Controllers\AdminController;
use App\Http\Controllers\CategoryController;
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
Route::get('/', function () {
return view('welcome');
});
Route::get('admin',[AdminController::class,'index']);
Route::post('admin/auth',[AdminController::class,'auth'])->name('admin.auth');
Route::group(['middleware'=>'admin_auth'],function(){
Route::get('admin/dashboard',[AdminController::class,'dashboard']);
Route::get('admin/category',[CategoryController::class,'index']);
Route::get('admin/manage_category',[CategoryController::class,'manage_category']);
});
public function manage_category()in yourCategoryController.phpfile? There is literally nothing else we can do to help unless you show the code causing this error... - Tim Lewisfunction manage_category(), notpublic function manage_category(). There's your error. Also, next time, please edit your question; don't post code in comments when you can edit your question and format it better. (I did this for you this time, but next time it's up to you :)) - Tim Lewis