mirror of
https://github.com/pixelfed/pixelfed.git
synced 2025-01-25 00:09:29 +00:00
Update AccountController, add pagination to notifications
This commit is contained in:
parent
63343ae503
commit
545efbeee3
1 changed files with 10 additions and 2 deletions
|
@ -3,6 +3,7 @@
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
use Carbon\Carbon;
|
||||||
use Auth, Cache, Redis;
|
use Auth, Cache, Redis;
|
||||||
use App\{Notification, Profile, User};
|
use App\{Notification, Profile, User};
|
||||||
|
|
||||||
|
@ -15,10 +16,17 @@ class AccountController extends Controller
|
||||||
|
|
||||||
public function notifications(Request $request)
|
public function notifications(Request $request)
|
||||||
{
|
{
|
||||||
|
$this->validate($request, [
|
||||||
|
'page' => 'nullable|min:1|max:3'
|
||||||
|
]);
|
||||||
$profile = Auth::user()->profile;
|
$profile = Auth::user()->profile;
|
||||||
//$notifications = $this->fetchNotifications($profile->id);
|
$timeago = Carbon::now()->subMonths(6);
|
||||||
$notifications = Notification::whereProfileId($profile->id)
|
$notifications = Notification::whereProfileId($profile->id)
|
||||||
->orderBy('id','desc')->take(30)->simplePaginate();
|
->whereDate('created_at', '>', $timeago)
|
||||||
|
->orderBy('id','desc')
|
||||||
|
->take(30)
|
||||||
|
->simplePaginate();
|
||||||
|
|
||||||
return view('account.activity', compact('profile', 'notifications'));
|
return view('account.activity', compact('profile', 'notifications'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue