mirror of
https://gitlab.com/TheGamecraft/c-cms.git
synced 2026-04-21 02:39:10 -04:00
update notification
This commit is contained in:
16
app/User.php
16
app/User.php
@@ -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');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user