Beispiel #1
0
 public function favorites($id)
 {
     $ftep = Ftep::find($id, ['id', 'ft_id', 'title']);
     $ft = Ft::find($ftep->ft_id, ['id', 'title']);
     $favorites = Ftepfav::with(['user' => function ($query) {
         $query->select('id', 'name');
     }])->select('user_id', 'created_at')->where('ftep_id', $id)->orderBy('created_at')->paginate(20);
     return view('ftep.favorites', ['ftep' => $ftep, 'ft' => $ft, 'favorites' => $favorites]);
 }
Beispiel #2
0
 public function ftepfavs(Request $request, $id)
 {
     if ($request->has('order')) {
         $order = $request->input('order');
     } else {
         $order = 'desc';
     }
     $ftepfavs = Ftepfav::with(['ftep' => function ($query) {
         $query->join('fts', 'fts.id', '=', 'fteps.ft_id')->select('fteps.id as id', 'ft_id', 'fts.title as ft_title', 'fteps.title as title', 'release_date', 'staff', 'fteps.poster_url as poster_url');
     }])->select('ftep_id', 'created_at')->where('user_id', $request->user()->id)->orderBy('created_at', $order)->paginate(50);
     return view('user.ftepfavs', ['user' => User::find($id, ['id', 'name']), 'ftepfavs' => $ftepfavs, 'order' => $order]);
 }