Do you ever run any of the caching commands while developing? You should not. Try php artisan optimize:clear and be sure that you never run php artisan optimize in dev again :)
Problem in routing | everytime creating new route shows route undefined?
I have created various routes in my laravel 9 application but whenever I am creating new route it takes some time to update and after few restarts and attempts it works fine. Do I need to clear view and cache every time? Example this is happening right now and I don't know where is the problem tried all possibilities such as route:list command. This is my web.php
Route::get('/', function () { return view('welcome'); });
Route::get('/dashboard', function () { return view('admin.index'); })->middleware(['auth','verified'])->name('dashboard');
Route::get('/clear-cache', function() { Artisan::call('view:clear'); return "view Cache is cleared"; });
// Admin all routes Route::controller(AdminController::class)->group(function() { Route::get('/admin/logout', 'logout')->name('admin.logout'); Route::get('/admin/profile', 'profile_page')->name('admin.profile'); Route::get('/edit/profile', 'profile_edit')->name('edit.profile'); });
require DIR.'/auth.php';
//code ends
Here I created edit.profile route I called the route in admin_profile_view.blade.php //Code
@extends('admin.admin_master') @section('admin')
Name : {{$adminData->name}}
User Email : {{$adminData->email}}
UserName : {{$adminData->username}}
Edit Profile @endsection //code ends Now in admin controller I created named AdminController.php //profile edit start public function profile_edit() { $id = Auth::user()->id; $editData = User::find($id); return view('admin.admin_profile_edit',compact('editData')); } //end profile edit I created this function Note: Other functions are working properly. Here is my admin_profile_edit.blade.php //code @extends('admin.admin_master') @section('admin')Textual inputs
Here are examples of .form-control applied to each
textual HTML5 <input> type.
</div>
@endsection
//code-ends
Now I am getting this error
Symfony \ Component \ Routing \ Exception \ RouteNotFoundException
PHP 8.1.2
9.24.0
Route [edit.profile] not defined.
Thank you in advanced, can anyone please tell me where I am doing this mistake? This error occurs every-time when I am creating new route
Please or to participate in this conversation.