Files
exchange/app/Http/Controllers/UserController.php
T
Jack Goh d56f185c69 added vue time ago component
added custom field for booking updated notification
updated fetch notification on frontend
2018-08-30 16:04:14 +08:00

31 lines
623 B
PHP

<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Auth;
class UserController extends Controller
{
/**
* Display the specified resource.
*
* @param \App\ChinaBankSlip $chinaBankSlip
* @return \Illuminate\Http\Response
*/
public function show(Request $request)
{
$user = Auth::user();
return $user->loadMissing('notifications');
}
public function notifications()
{
$notifications = auth()->user()->unreadNotifications()->limit(5)->get();
return response()->json(['notifications'=>$notifications], 200);
}
}