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) { $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]); }