1
0
Fork 0

Update InternalApiController

This commit is contained in:
Daniel Supernault 2018-12-10 20:36:27 -07:00
parent 0870b72a97
commit a774ad7373
No known key found for this signature in database
GPG Key ID: 0DEF1C662C9033F7
1 changed files with 0 additions and 31 deletions

View File

@ -94,37 +94,6 @@ class InternalApiController extends Controller
return $status->url();
}
public function notifications(Request $request)
{
$this->validate($request, [
'page' => 'nullable|min:1|max:3',
]);
$profile = Auth::user()->profile;
$timeago = Carbon::now()->subMonths(6);
$notifications = Notification::with('actor')
->whereProfileId($profile->id)
->whereDate('created_at', '>', $timeago)
->orderBy('id', 'desc')
->simplePaginate(30);
$notifications = $notifications->map(function($k, $v) {
return [
'id' => $k->id,
'action' => $k->action,
'message' => $k->message,
'rendered' => $k->rendered,
'actor' => [
'avatar' => $k->actor->avatarUrl(),
'username' => $k->actor->username,
'url' => $k->actor->url(),
],
'url' => $k->item->url(),
'read_at' => $k->read_at,
];
});
return response()->json($notifications, 200, [], JSON_PRETTY_PRINT);
}
// deprecated
public function discover(Request $request)
{