jeudi 30 janvier 2020

ErrorException controller@comment Not defined

My app in showing this error

Action App\Http\Controllers\ComplainController@comment not defined. (View: /var/www/html/Chirag_Laravel/resources/views/backend/pages/ifa/complaint.blade.php)

But i have already entered the controller and the route funtions properly

Controller part:

 public function comment($id,Request $request)
      {
        $user_name=$request->session()->get('user_name');
        $ticket=Complaint::Where('id','=',$id)
                ->SELECT('ticket_no')
                ->get();
        foreach($ticket as $tickets)
        {
         $tik=$tickets['ticket_no'];
          $comments=\DB::SELECT('SELECT comment,comment_by from comments where complaint_id=? AND comment_by=? or comment_by=? ORDER BY id DESC',[$tik,$user_name,'Admin']);
              return view('backend.pages.ifa.comment',compact('tik','id','comments','user_name'));
        }

      }
      public function getComment(Request $request)
      {
        $request->session()->put(['comment_success'=>'Comment Submitted Successfully']);
        $report_id=$request->session()->get('report_id');
        $complain=$request->get('tiko');
        $user_name=$request->get('user_name');
        $comment=$request->get('comment');
        //echo $complain_id."<br>".$comment;
        Comment::create(["complaint_id"=>"$complain","comment"=>"$comment","comment_by"=>"Bill"]);
        return redirect()->back();

      }

Route part:

Route::get('ifa-dashboard/comment/{id}',['uses'=>'ComplainController@comment']);
Route::POST('ifa-dashboard/getComment',['uses'=>'ComplainController@getComment']);

Blade part:

<td><center><a href="">Comment</a></center></td>

Cant find a way out



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire