/** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @return mixed */ public function handle($request, Closure $next) { $user = Auth::user()->role; $profile = template::where('user_id', Auth::id())->count(); if ($profile == 1) { return $next($request); } else { return redirect('/admin/Template/create'); } }
/** * Show the form for creating a new resource. * * @return \Illuminate\Http\Response */ public function create() { $profile = template::where('user_id', Auth::id())->count(); $tag_template = []; if ($profile == 1) { return back(); } else { return view('Template.create', compact('tag_template')); } }
public function template($slug) { $restaurant = template::where('slug', $slug)->first(); $profile = template::where('slug', $slug)->first(); if ($restaurant->user->role == 1) { return view('restaurant.profile', compact('restaurant')); } if ($profile->user->role == 3) { $tatoo = post::where('user_id', $profile->user->id)->OrderBy('id', 'ASC')->paginate(6); return view('tatoo.profile', compact('profile', 'tatoo')); } }
/** * Show the application dashboard. * * @return Response */ public function index() { $template = \App\template::where('user_id', \Auth::id())->first(); return view('home', compact('template')); }