コード例 #1
0
ファイル: AdminController.php プロジェクト: alfons83/tfg
 /**
  * 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()]);
 }
コード例 #2
0
ファイル: NielsenController.php プロジェクト: alfons83/tfg
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id, Request $request)
 {
     $nielsen = RulesNielsen::findOrFail($id);
     $nielsen->delete();
     $message = $nielsen->name . ' fue eliminada de nuestros registros';
     if ($request->ajax()) {
         return response()->json(['id' => $nielsen->id, 'message' => $message]);
     }
     Session::flash('message', $message);
     return redirect()->route('admin.patterns-nielsen.index');
 }
コード例 #3
0
ファイル: PatternController.php プロジェクト: alfons83/tfg
 /**
  * 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'));
 }