public function show($intelligenceSlug, $tutorialId) { $intelligence = Intelligence::where('slug', $intelligenceSlug)->firstOrFail(); $tutorial = Tutorial::where('intelligence_id', $intelligence->id)->findOrFail($tutorialId); $comments = Comment::where('tutorial_id', $tutorial->id)->paginate(15); return view('intelligence.tutorial.show', compact('intelligence', 'tutorial', 'comments')); }
public function store(Request $request, $intelligenceSlug, $tutorialId) { $this->validate($request, ['message' => 'required']); $intelligence = Intelligence::where('slug', $intelligenceSlug)->firstOrFail(); $tutorial = Tutorial::where('intelligence_id', $intelligence->id)->findOrFail($tutorialId); $comment = new Comment(); $comment->user_id = Auth::user()->id; $comment->tutorial_id = $tutorial->id; $comment->message = $request->message; $comment->save(); Flash::success('Comentario creado exitosamente.'); return redirect()->back(); }
public function indexTutorial() { $tutorials = Tutorial::where('accepted', 1)->latest('updated_at')->paginate(20); return view('main.indexTutorial', compact('tutorials')); }
/** * @param $username * @param $slug * @return \Illuminate\Http\RedirectResponse */ public function dislike($username, $slug) { if (Auth::check()) { $user = User::where('username', $username)->with('tutorials')->first(); $article = Tutorial::where('user_id', $user->id)->where('slug', $slug)->first(); $article->dislike(Auth::user()); return redirect()->intended('@' . $article->user->username . '/tutorial/' . $article->slug); } else { alert()->warning('You need to sign in to dislike a tutorial', 'Whoops!'); return redirect()->intended('auth/login'); } }
/** * Display the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function show($id) { $tutorial = Tutorials::where('id', $id)->get(); return view('Tutorial.show')->with('tutorial', $tutorial); }
public function dwTutorial($fileName) { $public_path = public_path(); $entry = Tutorial::where('original_filename', '=', $fileName)->firstOrFail(); $file = $public_path . '/tutoriales/' . $fileName; return response()->download($file); }
public function show($intelligenceSlug) { $intelligence = Intelligence::where('slug', $intelligenceSlug)->firstOrFail(); $tutorials = Tutorial::where('intelligence_id', $intelligence->id)->orderBy('id', 'DESC')->paginate(10); return view('intelligence.show', compact('intelligence', 'tutorials')); }