/** * Display a listing of the resource. * * @return Response */ public function index() { if (Auth::user()->type === 'user') { return redirect('admin/patterns'); } $users = User::all(); // $date = $users->timestamp; $patterns = Pattern::all(); $category = Category::all(); $subcategory = SubCategory::all(); $nielsen = RulesNielsen::all(); $comments = Comment::all(); return view('admin.dashboard', ['patternsCount' => $patterns->count(), 'patterns' => Pattern::where('active', 1)->orderBy('title', 'desc')->take(8)->get(), 'users' => $users, 'nielsen' => $nielsen, 'category' => $category, 'subcategory' => $subcategory, 'comments' => $comments, 'commentsCount' => $comments->count(), 'usersTime' => Carbon::now()->subDays(1)->diffForHumans(), 'usersCount' => $users->count(), 'usersNormals' => User::where('type', 'user')->orderBy('active', 'desc')->take(8)->get(), 'usersExperts' => User::where('type', 'expert')->orderBy('active', 'desc')->take(8)->get()]); }
/** * Show the form for creating a new resource. * * @return Response */ public function create() { $categories = Category::all(); return view('admin.patterns.category.create', compact('categories')); }
/** * Show the form for editing the specified resource. * * @param int $id * @return Response */ public function edit($id) { $categories = Category::all(); $subcategory = SubCategory::findOrFail($id); return view('admin.patterns.subcategory.edit', compact('subcategory', 'categories')); }
/** * Show the form for editing the specified resource. * * @param int $id * @return Response */ public function edit($id) { $patterns = patterns\Pattern::findOrFail($id); $categories = patterns\Category::all(); $rules = patterns\RulesNielsen::all(); return view('admin.patterns.patterns.edit', compact('patterns', 'rules', 'categories')); }