/** * 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()]); }
public function getSubcategories(Request $request) { //if($request->ajax()) { $subcategories = Category::find($request['category_id'])->subcategories; return $subcategories; //} //return false; }
/** * 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')); }