本文整理汇总了PHP中app\Role::lists方法的典型用法代码示例。如果您正苦于以下问题:PHP Role::lists方法的具体用法?PHP Role::lists怎么用?PHP Role::lists使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Role
的用法示例。
在下文中一共展示了Role::lists方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: edit
public function edit($id)
{
$info = User::findOrFail($id);
$userLists = User::lists('name', 'id');
$userRoles = Role::lists('label', 'id');
return view('user_role.edit', compact('info', 'userLists', 'userRoles'));
}
示例2: edit
/**
* Show a user edit page
*
* @param $id
*
* @return \Illuminate\View\View
*/
public function edit($id)
{
$user = User::findOrFail($id);
$roles = Role::lists('title', 'id');
$sites = Sites::site_access()->lists('title', 'id');
return view('admin.users.edit', compact('user', 'roles', 'sites'));
}
示例3: edit
/**
* Form for editing an existing permission with the given id is shown with this method.
*
* @param $id
* @return \Illuminate\View\View
*/
public function edit($id)
{
$permission = Permission::find($id);
$roles = Role::lists('name', 'id');
$routes = array_unique($this->getAuthorizedRoutes());
return view('rbac-gui.permissions.edit', compact('permission', 'roles', 'routes'));
}
示例4: edit
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return Response
*/
public function edit(Employee $employee)
{
$title = "Edit: " . $employee->last_name . ', ' . $employee->first_name;
$roles = \App\Role::lists('role', 'id');
$projects = \App\Project::lists('name', 'id');
return view('employees.edit', compact('employee', 'title', 'roles', 'projects'));
}
示例5: edit
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function edit($id)
{
$user = User::findOrFail($id);
$roles = Role::lists('display_name', 'id');
$columnSizes = ['sm' => [4, 8], 'lg' => [2, 10]];
$tab = 'users';
return view('admin.users.edit', compact('user', 'roles', 'tab', 'columnSizes'));
}
示例6: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
$user = Auth::user();
$user->load('roles.permissions')->get();
$roles = Role::lists('name', 'id');
// dd($roles);
return view('pages.dashboard', compact('user', 'roles'));
}
示例7: run
public function run()
{
$faker = Faker::create();
DB::table('role_user')->insert(['role_id' => 1, 'user_id' => 1]);
$usersIds = User::lists('id')->all();
$rolesIds = Role::lists('id')->all();
foreach (range(2, 6) as $index) {
DB::table('role_user')->insert(['role_id' => $faker->randomElement($rolesIds), 'user_id' => $index]);
}
}
示例8: edit
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function edit(User $user)
{
if ($user->cannot('edit', $user)) {
return redirect('users');
}
//if(Gate::denies('edit', $user)) return redirect('users');//??
$roles = \App\Role::lists('role', 'id');
$countries = \App\Country::lists('name', 'id');
return view('users.edit', compact('user', 'roles', 'countries'));
}
示例9: edit
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function edit($id)
{
if (\Auth::user()->roles[0]->can('menu-update')) {
$menu = $this->menus->findOrFail($id);
$items = $this->menus->lists('name', 'id')->toarray();
$roles = Role::lists('name', 'id')->toarray();
$selected = $menu->roles->lists('id')->toarray();
return view('admin.menus.edit', compact('menu', 'selected', 'roles', 'items'));
}
return \Redirect::route('admin.menus.index')->withErrors(trans('acl::dashboard.unauthorized_access'));
}
示例10: getRegister
/**
* Show the application registration form.
*
* @return Response
*/
public function getRegister()
{
// if ($this->agent->roles() == "Administrator")
// {
$roles = Role::lists('name', 'id');
$programs = Program::lists('name', 'id');
return view('auth.register', compact('roles', 'programs'));
// }
// else{
// return view('errors.unauth');
// }
}
示例11: edit
public function edit(Annoucement $annoucement)
{
if (!Entrust::can('edit_annoucement')) {
return redirect('/dashboard')->withErrors(config('constants.NA'));
}
$selected_roles = array();
foreach ($annoucement->Role as $role) {
$selected_roles[] = $role->id;
}
$roles = Role::lists('display_name', 'id')->all();
$custom_field_values = Helper::getCustomFieldValues($this->form, $annoucement->id);
return view('annoucement.edit', compact('roles', 'annoucement', 'selected_roles', 'custom_field_values'));
}
示例12: getRegister
public function getRegister()
{
if (!Entrust::can('create_user')) {
return redirect('/dashboard')->withErrors(config('constants.NA'));
}
$departments = Department::lists('department_name', 'id')->all();
if (Entrust::hasRole('admin')) {
$roles = Role::lists('name', 'id')->all();
} else {
$roles = Role::where('name', '!=', 'admin')->lists('name', 'id')->all();
}
return view('user.create', compact('departments', 'roles'));
}
示例13: ComposeWebPanelForms
public function ComposeWebPanelForms()
{
view()->composer('templates.' . \Config::get('webpanel.template') . 'webpanel.store.items._form', function ($view) {
$view->with('categories', StoreCategory::lists('display_name', 'id'));
$view->with('servers', StoreServer::lists('display_name', 'id'));
});
view()->composer('templates.' . \Config::get('webpanel.template') . 'webpanel.store.categories._form', function ($view) {
$view->with('servers', StoreServer::lists('display_name', 'id'));
});
view()->composer('templates.' . \Config::get('webpanel.template') . 'webpanel.panel.users._form', function ($view) {
$view->with('roles', Role::lists('display_name', 'id'));
});
view()->composer('templates.' . \Config::get('webpanel.template') . 'webpanel.panel.roles._form', function ($view) {
$view->with('permissions', Permission::lists('display_name', 'id'));
});
view()->composer('templates.' . \Config::get('webpanel.template') . 'webpanel.panel.permissions._form', function ($view) {
$view->with('roles', Role::lists('display_name', 'id'));
});
}
示例14: create
/**
* Show the form for creating a new resource.
*
* @return Response
*/
public function create()
{
if (Auth::user()->identifier == 3) {
$title = 'dataUpdate';
$roles = Role::lists('name', 'id');
$rolesShow = Role::all();
$functionalAreas = FunctionalAreas::lists('name', 'id');
$faShow = FunctionalAreas::all();
$industry = Industry::lists('name', 'id');
$industryShow = Industry::all();
$skills = Skills::lists('name', 'id');
$indfunctionalMapping = Industry_functional_area_mappings::leftJoin('industries', 'industry_functional_area_mappings.industry', '=', 'industries.id')->leftJoin('functional_areas', 'industry_functional_area_mappings.functional_area', '=', 'functional_areas.id')->get([DB::raw('concat(industries.name, " - ", functional_areas.name) as name'), 'industry_functional_area_mappings.id as id'])->lists('name', 'id');
$industryfareaShow = Industry_functional_area_mappings::leftJoin('industries', 'industry_functional_area_mappings.industry', '=', 'industries.id')->leftJoin('functional_areas', 'industry_functional_area_mappings.functional_area', '=', 'functional_areas.id')->get(['industries.name as name', 'functional_areas.name as fareaname', 'industry_functional_area_mappings.id']);
// $indfunctional = Industry_functional_area_mappings::leftJoin('industries', 'industry_functional_area_mappings.industry', '=', 'industries.id')
// ->leftJoin('functional_areas', 'industry_functional_area_mappings.functional_area', '=', 'functional_areas.id')
// ->get([DB::raw('concat(industries.name, " - ", functional_areas.name) as name'), 'industry_functional_area_mappings.id as id']);
// $industryfarearoleShow = Industry_functional_area_role_mapping::leftJoin('roles', 'industry_functional_area_role_mapping.role', '=', 'roles.id')
// ->get(['roles.name as name', $indfunctional]);
return view('pages.adminUpdate', compact('title', 'skills', 'roles', 'functionalAreas', 'industry', 'indfunctionalMapping', 'rolesShow', 'faShow', 'industryShow', 'industryfareaShow', 'industryfarearoleShow'));
// return $indfunctionalMapping;
} else {
return redirect('/home');
}
}
示例15: edit
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\View\View
*/
public function edit($id)
{
$user = $this->users->findOrFail($id);
$roles = Role::lists('name', 'id');
return \View::make('admin.users.edit', ['user' => $user, 'roles' => $roles, 'title' => 'edit']);
}