update notification

This commit is contained in:
Mathieu Lagace
2020-07-27 16:41:28 -04:00
parent c16d1e7e95
commit 2d64d6d422
28 changed files with 1167 additions and 47 deletions

View File

@@ -2,8 +2,10 @@
namespace App;
use Carbon\Carbon;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
use phpDocumentor\Reflection\Types\Collection;
/**
* App\User
@@ -371,4 +373,18 @@ class User extends Authenticatable
{
return $this->permission($perm);
}
public function getNotificationByDay()
{
return \Auth::user()->notifications->groupBy(function ($val) {
return Carbon::parse($val->created_at)->format('Y-m-d');
});
}
public function getNotificationForUI(int $number = 8)
{
return \Auth::user()->notifications->take($number)->groupBy(function ($val) {
return Carbon::parse($val->created_at)->format('Y-m-d');
});
}
}