mardi 14 janvier 2020

How to use multiple route for notification in Laravel

How can I use multiple href tag for notification? I mean whenever I put the route in the tag it redirects me to that only one specific path but I want to redirect them to the related notification.

Here's my controller:

    public function rejectRequest($id)
    {

        $userRequest = UserRequest::all()->pluck('user_id')->toArray();
        $userModels  = User::where('id', $userRequest)->get();
        $techId      = Auth::user()['name'];

        $data = collect([
            'user' => $techId,
            'body'  => 'Reject Your Tuition Request',
        ]);

        UserRequest::where('id', $id)->update(array('status' => 'rejected'));
        Notification::send($userModels, new      RejectStudentRequest($data));
        return redirect()->back()->with('success','Request Rejected!');
    }

Here's my Blade Notification code:

@foreach(Auth::user()->unreadnotifications as $notification)
 <li class="notifications-not-read">
  <a href="#">
  <span class="notification-icon"><i class="icon-material-outline-group"></i></span>
  <span class="notification-text">
    <strong><span class="color">
    
  </span>
    </strong>
   
  </span>
 </a>
</li>
@endforeach


from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2FRLDsR
via IFTTT

Aucun commentaire:

Enregistrer un commentaire