/**
  * Determine if the user is authorized to make this request.
  *
  * @return bool
  */
 public function authorize()
 {
     $notification = Notification::find($this->route()->parameter('id'));
     return $this->user()->id == $notification->user_id;
 }
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $days_old = $this->argument('days');
     $count = Notification::where('seen', 0)->where('created_at', '>=', Carbon::today()->subDays($days_old) . 'and')->count();
     $this->info("There are {$count} unseen notifications in db created the last {$days_old} days.");
 }
 public function unsee(NotificationRequest $request, $id)
 {
     $notification = Notification::find($id);
     $notification->unsee();
     return "ok";
 }
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $days_old = $this->argument('days');
     Notification::where('seen', 1)->where('seen_at', '<', Carbon::today()->subDays($days_old) . 'and')->delete();
     $this->info("Deleted notifications seen at least {$days_old} days ago.");
 }