public function create(Request $request) { $this->validate($request, ['ftep' => 'required']); $ftep = Ftep::find($request->input('ftep'), ['id', 'ft_id', 'title']); $ft = Ft::find($ftep->ft_id, ['title']); return view('ftepfav.create', ['ftep' => $ftep, 'ft' => $ft]); }
public function create(Request $request) { if ($request->has('ftep')) { return view('ftrev.create', ['ft' => Ft::find($request->input('ft'), ['id', 'title']), 'ftep' => Ftep::find($request->input('ftep'), ['id', 'title'])]); } else { return view('ftrev.create', ['ft' => Ft::find($request->input('ft'), ['id', 'title'])]); } }
public function favorites($id) { $ft = Ft::find($id, ['id', 'title']); $favorites = Ftfav::with(['user' => function ($query) { $query->select('id', 'name'); }])->select('user_id', 'created_at')->where('ft_id', $id)->orderBy('created_at')->paginate(20); return view('ft.favorites', ['ft' => $ft, 'favorites' => $favorites]); }