本文整理汇总了PHP中Roles::where方法的典型用法代码示例。如果您正苦于以下问题:PHP Roles::where方法的具体用法?PHP Roles::where怎么用?PHP Roles::where使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Roles
的用法示例。
在下文中一共展示了Roles::where方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getRoleByKeywork
/**
* [getRoleByKeywork search role]
* @param [type] $keywork [description]
* @param [type] $perPage [description]
* @return [type] [description]
*/
public function getRoleByKeywork($keywork, $perPage)
{
if ($keywork != 'all') {
$role = Roles::whereRaw('role_name like ?', array('%' . $keywork . '%'))->orderBy('id', 'asc')->paginate($perPage);
} else {
$role = Roles::where('role_name', '!=', '')->orderBy('id', 'asc')->paginate($perPage);
}
return $role;
}
示例2: delRoleAction
public function delRoleAction($id)
{
try {
Roles::where('id', '=', $id)->delete();
RolePolicy::where('role_id', '=', $id)->delete();
RoleUser::where('role_id', '=', $id)->delete();
return Redirect::to('role')->with('success', 'ลบทิ้งบทบาทรหัส = ' . $id . ' สำเร็จ.');
} catch (Exception $e) {
return Redirect::to('role')->with('warning', 'Error occur info:' . $e->getMessage());
//throw new Exception( 'Something really gone wrong', 0, $e);
}
}
示例3: Role
public function Role($role_id)
{
return Roles::where('id', '=', $role_id)->get()->first();
}
示例4: function
| session does not match the one given in this request, we'll bail.
|
*/
/*Route::filter('csrf', function()
{
if (Session::token() !== Input::get('_token'))
{
throw new Illuminate\Session\TokenMismatchException;
}
});*/
Route::filter('auth.admin', function () {
if (Auth::employee()->guest()) {
return Redirect::route('admin.login');
}
$role = Auth::employee()->get()->role_id;
$roles = Roles::where('id', '=', $role)->get()->first();
//var_dump($roles);die;
//var_dump(Rolepermission::where('name','=',Route::getCurrentRoute()->getPath())->where('role_id','=',$roles->id)->get());die;
if ($roles) {
if (Rolepermission::where('name', '=', Route::getCurrentRoute()->getPath())->where('role_id', '=', $roles->id)->get() != '[]') {
return View::make('emails.route_forbidden');
}
}
});
Route::filter('auth.user', function () {
if (Auth::user()->guest()) {
return Redirect::route('user.login');
}
});
Route::filter('auth.support', function () {
if (Auth::employee()->guest()) {