Solution 1 :

You cannot have two routes with the same path unless they have different methods.
And you are getting this error “Route [home.callqueue] not defined” because the second route is overriding the first one.

 Route::put('admin',['as'=>'home.callqueue','uses'=>'HomeController@callqueue']);
 Route::put('admin',['as'=>'home.updatenotif','uses'=>'HomeController@updatenotif']);

What you can do is change the paths of your routes to:

 Route::put('admin/callqueue',['as'=>'home.callqueue','uses'=>'HomeController@callqueue']);
 Route::put('admin/updatenotif',['as'=>'home.updatenotif','uses'=>'HomeController@updatenotif']);

Solution 2 :

Because return redirect(‘admin’) is method get.

Problem :

I want to make two Route::put for my controller, but Im having errors when I do this.
I’m having an error like this:

FacadeIgnitionExceptionsViewException
Route [home.callqueue] not defined. (View:
C:xampphtdocsdqrsresourcesviewsdashboard.blade.php)

This is my Controller

    public function updatenotif(Request $request)
    {
        $request->validate([
            'text'=>['max:255']

        ]);

        DB::table('notifications')->where('id', '1')->update(['text'=>$request->text]);

        return redirect('admin')->withStatus(__('Notification message updated successfully.'));

    }


    public function callqueue(Request $request)
    {
        $request->validate([
            'called'=>['max:255']

        ]);

        $dept=Auth::user()->department;
        Queue::where('department',$dept)
                       ->whereDate('created_at', Carbon::today())
                       ->orderBy('id', 'desc')
                       ->first()
                       ->update(['called'=>$request->called]);

                       return redirect('admin')->withStatus(__('Queue has been called.'));
    }

This is my web routes

  Route::put('admin',['as'=>'home.callqueue','uses'=>'HomeController@callqueue']);
  Route::put('admin',['as'=>'home.updatenotif','uses'=>'HomeController@updatenotif']);

IMAGE #2

Comments

Comment posted by aynber

You cannot have two routes with the same path. Either use different paths or use one route calling a third function, that will call one of the other functions based on parameters.

Comment posted by Felippe Duarte

What’s “admin” in

Comment posted by Bruno

formatting improvment

By