public function postLeido($id)
 {
     $not = Notificacion::find($id);
     $not->read = true;
     $not->save();
     return response()->json('yes', 200);
 }
Esempio n. 2
0
 public function toAll()
 {
     $roles = Role::all();
     foreach ($roles as $role) {
         $users = $role->users()->whereNotIn('id', [$this->from])->get();
         foreach ($users as $user) {
             Notificacion::create(['send_by' => $this->from, 'user_id' => $users->id, 'message' => $this->message, 'sent' => time(), 'tipo' => $this->tipe, 'url' => $this->url, 'level' => $role->id]);
         }
     }
 }