public function show($username) { $user = User::where('username', $username)->first(); if (!$user) { session()->flash('error', 'We cannot find a user with the username of [ <b>' . $username . '</b> ] Sorry.'); return redirect()->route('home'); } $bins = Bin::publicOnly()->where('user_id', $user->id)->orderBy('updated_at', 'DESC')->paginate(8); return view('user.show', compact('user', 'bins')); }
public function index() { $sample = '<?php class Idea extends Eloquent { /** * Dreaming of something more? * * @with Laravel */ public function create() { // Have a fresh start... } }'; $artisans = User::verifiedOnly()->count(); $bins = Bin::publicOnly()->count(); $files = Snippet::publicOnly()->count(); return view('home', compact('sample', 'artisans', 'bins', 'files')); }
public function allRecent($version = null) { $active = 'recent'; if ($version) { $bins = Bin::publicOnly()->version($version)->with(['snippets', 'user', 'comments'])->orderBy('updated_at', 'DESC')->paginate(10); } else { $bins = Bin::publicOnly()->with(['snippets', 'user', 'comments'])->orderBy('updated_at', 'DESC')->paginate(10); } return view('bin.all', compact('bins', 'active')); }