本文整理汇总了PHP中Notice::where方法的典型用法代码示例。如果您正苦于以下问题:PHP Notice::where方法的具体用法?PHP Notice::where怎么用?PHP Notice::where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Notice
的用法示例。
在下文中一共展示了Notice::where方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getIndex
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);
}
示例2: loadNotice
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');
}
示例3: view_notices
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');
}
}
示例4: getIndex
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'));
}
示例5: getEdit
public function getEdit($id)
{
$query = Notice::where("id", "=", $id)->get();
return View::make("Dashboard.Notices.Edit")->with("notices", $query)->with("users", User::all());
}
示例6: personalNoticeView
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);
}