本文整理汇总了PHP中app\Permission::select方法的典型用法代码示例。如果您正苦于以下问题:PHP Permission::select方法的具体用法?PHP Permission::select怎么用?PHP Permission::select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Permission
的用法示例。
在下文中一共展示了Permission::select方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: query
/**
* Get the query object to be processed by dataTables.
*
* @return \Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Query\Builder|\Illuminate\Support\Collection
*/
public function query()
{
$query = Permission::select('*');
return $this->applyScopes($query);
}
示例2: getGiveRolePermissions
/**
* Display given permissions to role.
*
* @return void
*/
public function getGiveRolePermissions()
{
$roles = Role::select('id', 'name', 'label')->get();
$permissions = Permission::select('id', 'name', 'label')->get();
return view('admin.permissions.role-give-permissions', compact('roles', 'permissions'));
}
示例3: edit
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function edit($id)
{
if (Gate::denies('userrole.update')) {
return view(config('app.template') . '.error.403');
}
$role = Role::with('permissions')->find($id);
if (!$role) {
return view(config('app.template') . '.error.404');
}
$data = ['role' => $role, 'permissions' => Permission::select(['permissions.*', DB::raw('SUBSTRING(`name`, 1, LOCATE(".", `name`)-1)AS `key`')])->get()];
return view(config('app.template') . '.role.update', $data);
}
示例4: anyPermisionSettings
public function anyPermisionSettings(){
$roles = Role::orderBy('main','name')->get()->toArray();
$permissions = Permission::select('permissions.*')
->addSelect(\DB::raw('right(`name`,length(`name`)-instr(`name`,"-")) as controller'))
->orderBy('controller','id')
->get()
->toArray();
return view('setting.list-permission',[
"roles" => $roles,
"permissions" => $permissions
]);
}
示例5: getUserRolePermissions
/**
* Display given permissions to role.
*
* @return void
*/
public function getUserRolePermissions()
{
$roles = Role::select('id', 'name', 'label')->get();
$permissions = Permission::select('id', 'name', 'label')->get();
return \View::make('admin.permissions.role-assign-permissions', ['roles' => $roles, 'permissions' => $permissions, 'title' => 'assign']);
}
示例6: data
/**
* Show a list of all the languages posts formatted for Datatables.
*
* @return Datatables JSON
*/
public function data()
{
$users = Permission::select(array('id', 'name', 'display_name', 'description'));
return Datatables::of($users)->add_column('actions', '<a href="{{{ URL::to(\'admin/permission/\' . $id . \'/edit\' ) }}}" class="btn btn-success btn-sm iframe" >{{ trans("admin/modal.edit") }}</a>
<a href="{{{ URL::to(\'admin/permission/\' . $id . \'/delete\' ) }}}" class="btn btn-sm btn-danger iframe">{{ trans("admin/modal.delete") }}</a>')->make();
}
示例7: updateUserInfo
/**
* 寫入登入時間及IP 位址
*
* @param \Illuminate\Contracts\Auth\Authenticatable $user
* @return void
*/
public function updateUserInfo(UserContract $user)
{
// 寫入登入IP & 時間
$user->ip_address = Request::ip();
$user->last_login = Carbon::now();
$user->save();
// 寫入可用權限以供nav 選單使用
$role = json_decode($user->role->permissions);
if (in_array('all', $role)) {
$permissions = Permission::select('slug')->where('status', true)->get()->toArray();
// dd($permissions);
} else {
$permissions = Permission::select('slug')->whereIn('slug', $role)->where('status', true)->get()->toArray();
}
// dd($role);
foreach ($permissions as $value) {
$permission[] = $value['slug'];
}
// dd($permission);
session(['permissions' => $permission]);
// dd(session('permissions'));
}