/** * Display the specified resource. * * @param $slug * * @return Response * @internal param int $id */ public function show($slug) { try { $quote = Quote::where(['slug' => $slug])->firstOrFail(); $statusCode = 200; $response = ['data' => $quote]; } catch (Exception $e) { $statusCode = 400; } finally { return Response::json($response, $statusCode); } }
public function edit() { $user = User::findOrFail(Auth::user()->id); $entity = Entity::where('user_id', Auth::user()->id)->firstOrFail(); $about = About::where('user_id', Auth::user()->id)->firstOrFail(); $contact = Contact::where('user_id', Auth::user()->id)->firstOrFail(); $home = Home::where('user_id', Auth::user()->id)->firstOrFail(); $quote = Quote::where('user_id', Auth::user()->id)->get(); $quote_count = $quote->count(); $skill = Skill::where('user_id', Auth::user()->id)->get(); $skill_count = $skill->count(); $skill_slider = SkillSlider::where('user_id', Auth::user()->id)->get(); $skill_slider_count = $skill_slider->count(); $portfolio_piece = PortfolioPiece::where('user_id', Auth::user()->id)->get(); $portfolio_piece_count = $portfolio_piece->count(); return view('edit')->with('user', $user)->with('home', $home)->with('entity', $entity)->with('contact', $contact)->with('about', $about)->with('skill', $skill)->with('skill_count', $skill_count)->with('quote', $quote)->with('quote_count', $quote_count)->with('skill_slider', $skill_slider)->with('skill_slider_count', $skill_slider_count)->with('portfolio_piece', $portfolio_piece)->with('portfolio_piece_count', $portfolio_piece_count); }
public function search(Request $request) { $token = $request->get('token'); $quotes = Quote::where('quote', 'LIKE', '%' . $token . '%')->whereOr('author', 'LIKE', '%' . $token . '%')->orderBy('author')->paginate(env('RECIPE_PAGINATION_MAX')); return view('quotes.index')->with('quotes', $quotes); }