public function getIndex() { if (Auth::user()->grade == 1) { $branch = Branch::take(10)->get(); } else { $branch = Branch::where('user_id', Auth::user()->id)->take(10)->get(); } // 提醒 // $notice = Notice::where('user_id', Auth::user()->id)->where('read', '0')->orderBy('timeline', 'desc')->take(10)->get(); return View::make('index')->with('goods', Good::orderBy('store')->take(10)->get())->with('branch', $branch)->with('notice', $notice); }
public function loadNotice($id) { $squeeb = Notice::where('id', '=', $id)->first(); View::share('squeeb', $squeeb); view::share('model', 'Notice'); //detect device $detect = new Mobile_Detect(); $deviceType = $detect->isMobile() ? $detect->isTablet() ? 'tablet' : 'phone' : 'computer'; View::share('deviceType', $deviceType); //update the squeeb table $this->sqFactor($squeeb); if (Auth::user()) { return View::make('member.squeeb'); } return View::make('guest.squeeb'); }
public function view_notices() { if (Auth::check()) { $data["inside_url"] = Config::get('app.inside_url'); $data["user"] = Session::get('user'); $data["actions"] = Session::get('actions'); if (in_array('side_ver_comunicados', $data["actions"])) { $current_ay = AcademicYear::getCurrentAcademicYear(); if (!$current_ay) { return View::make('notices/academic_year_error', $data); } // si es alumno mostrar comunicados de su nivel o los dirigidos a todos los niveles if ($data["user"]->profiles()->where('name', '=', 'Alumno')->first()) { $data["is_student"] = true; $enrollment = $data["user"]->student->getCurrentEnrollment(); if ($enrollment && $enrollment->state == 'A') { $data["enrolled"] = true; $data["notices_data"] = Notice::where('academic_year_id', '=', $current_ay->id)->where(function ($query) use($enrollment) { $query->where('level_id', '=', $enrollment->level_id)->orWhereNull('level_id'); })->orderBy('created_at', 'DESC')->paginate(20); } else { $data["enrolled"] = false; } } else { $data["is_student"] = false; $data["notices_data"] = Notice::where('academic_year_id', '=', $current_ay->id)->orderBy('created_at', 'DESC')->paginate(20); } return View::make('notices/view_notices', $data); } else { // Llamo a la función para registrar el log de auditoria $log_description = "Se intentó acceder a la ruta '" . Request::path() . "' por el método '" . Request::method() . "'"; Helpers::registerLog(10, $log_description); Session::flash('error', 'Usted no tiene permisos para realizar dicha acción.'); return Redirect::to('/dashboard'); } } else { return View::make('error/error'); } }
public function getIndex() { $notice = Notice::where('user_id', Auth::user()->id)->orderBy('timeline', 'desc')->paginate(); $count = Notice::where('user_id', Auth::user()->id)->count(); return View::make('notice')->with('notice', $notice)->with(compact('count')); }
public function getEdit($id) { $query = Notice::where("id", "=", $id)->get(); return View::make("Dashboard.Notices.Edit")->with("notices", $query)->with("users", User::all()); }
public function personalNoticeView($id) { $query = Notice::where('notice_id', $id); if ($query->count() > 0) { return View::make("Main.Notices.Personal.View")->with("notices", $query->get()); } return App::abort(404); }