本文整理汇总了PHP中app\Role::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Role::get方法的具体用法?PHP Role::get怎么用?PHP Role::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Role
的用法示例。
在下文中一共展示了Role::get方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dashboard
public function dashboard(Request $request)
{
$this->data['teams'] = \App\Team::with('points')->get();
$this->data['roles'] = \App\Role::get();
$this->data['adminUser'] = \App\User::find(1);
$this->data['users'] = \App\User::where('id', '>', 1)->with('points')->get()->sortByDesc('amount');
return View::make('admin.dashboard', $this->data);
}
示例2: getEdit
public function getEdit($id)
{
if ($user = User::find($id)) {
$roles = Role::get();
return View('app.users.edit', ['roles' => $roles, 'user' => $user]);
} else {
return redirect()->route('users.index')->with('errorMsg', trans('app.record_not_found'));
}
}
示例3: edit
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return Response
*/
public function edit($id)
{
$whereAmI = $this->ruta . $this->listOneBreadcrumb('editar usuario', '', 1);
$this->webpage['routes'] = json_encode(getUriByController());
$user = User::findOrFail($id);
$roles = Role::get()->lists('display_name', 'id');
$this->data = array_merge(['whereAmI' => $whereAmI, 'webpage' => $this->webpage, 'user' => $user, 'roles' => $roles], $this->data);
return view('admin.users.edit', $this->data);
}
示例4: index
public function index()
{
$tab = 'dashboard';
$users = User::get();
$usersCount = $users->count();
$activeUsers = $users->where('active', 1)->count();
$inactiveUsers = $usersCount - $activeUsers;
$roles = Role::get();
$rolesCount = $roles->count();
$usersWithRole = DB::table('role_user')->count();
$permissionsCount = Permission::get()->count();
return view('admin.dashboard', compact('tab', 'usersCount', 'activeUsers', 'inactiveUsers', 'rolesCount', 'usersWithRole', 'permissionsCount'));
}
示例5: down
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
$new_permissions = array('can_edit_station_data', 'can_add_station_data', 'can_delete_station_data', 'can_view_station_data');
$roles = Role::get();
$permissions = Permission::whereIn('name', $new_permissions)->get();
$permission_ids = $permissions->lists('id');
// First detach the permissions from the roles
foreach ($roles as $role) {
$role->detachPermissions($permission_ids);
}
// Now delete the permission altogether
foreach ($permissions as $permission) {
$permission->delete();
}
}
开发者ID:davidvarney,项目名称:tagmovement,代码行数:20,代码来源:2016_03_09_170606_add_station_data_permissions_to_permissions_table.php
示例6: anyUserSettings
public function anyUserSettings(Request $request)
{
$users = User::select('users.*','roles.display_name as type_name','roles.id as type_id')
->leftJoin('role_user',function($join){
$join->on("users.id","=","role_user.user_id");
})
->leftJoin('roles','role_user.role_id','=','roles.id');
$users = $users->paginate(5);
$user_types = Role::get()->toArray();
$view = view('setting.list-user',['user_types' => $user_types,'users'=>$users]);
if( $request->ajax() ) {
return $view;
} else {
$this->layout->content = $view;
}
}
示例7: index
/**
* Show the application dashboard.
*
* @return Response
*/
public function index()
{
$roles = Role::get();
return view('entrust.roles.index', compact('roles'));
}
示例8: getIndex
public function getIndex()
{
$listData = Role::get();
return View('app.roles.list', ['listData' => $listData]);
}
示例9: index
/**
* Display a listing of the resource.
*
* @return \Illuminate\View\View
*/
public function index()
{
$roles = $this->roles->get();
return \View::make('admin.roles.index', ['roles' => $roles, 'title' => 'list']);
}
示例10: index
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
$roles = Role::get();
$tab = 'roles';
return view('admin.roles.index', compact('roles', 'tab'));
}
示例11: update
/**
* Update the specified resource in storage.
*
* @param Request $request
* @param int $id
* @return Response
*/
public function update($id)
{
if (Auth::user()->role_id == 1) {
if (Request::isMethod('get')) {
$this->data = array();
$this->data['user'] = User::find($id);
$this->data['role'] = Role::get();
return View::make('admin.users.update', $this->data);
} else {
if (Request::isMethod('post')) {
$data = Input::all();
date_default_timezone_set('Asia/Jakarta');
// CDT
$current_date = date('Y-m-d');
if (empty($_FILES['imginp']['name'])) {
$target_file_final = $data['img_temp'];
} else {
$name = $_FILES['imginp']['name'];
$test = pathinfo($name, PATHINFO_FILENAME);
$target_dir = "artikel/";
$original_name = $test;
$imageFileType = pathinfo($name, PATHINFO_EXTENSION);
//$target_file = $target_dir . basename($_FILES["imginp"]["name"]);
$uploadOk = 1;
// Check if image file is a actual image or fake image
if (isset($_POST["submit"])) {
$check = getimagesize($_FILES["imginp"]["tmp_name"]);
if ($check !== false) {
echo "File is an image - " . $check["mime"] . ".";
$uploadOk = 1;
} else {
echo "File is not an image.";
$uploadOk = 0;
}
}
if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif") {
echo "Sorry, only JPG, JPEG, PNG & GIF files are allowed.";
$uploadOk = 0;
}
// Check if file already exists
$i = 1;
while (file_exists($target_dir . $test . "." . $imageFileType)) {
$test = (string) $original_name . $i;
$name = $test . "." . $imageFileType;
$i++;
}
$target_file = $target_dir . $name;
// Check file size
if ($_FILES["imginp"]["size"] > 500000) {
echo "Sorry, your file is too large.";
$uploadOk = 0;
}
// Allow certain file formats
// Check if $uploadOk is set to 0 by an error
if ($uploadOk == 0) {
echo "Sorry, your file was not uploaded.";
// if everything is ok, try to upload file
} else {
if (move_uploaded_file($_FILES["imginp"]["tmp_name"], $target_file)) {
echo "The file " . basename($_FILES["imginp"]["name"]) . " has been uploaded.";
} else {
echo "Sorry, there was an error uploading your file.";
}
}
$target_file_final = "../" . $target_file;
}
/*else{
echo "adadsdsa";
break;
}*/
User::where('id', $id)->update(array('nama' => $data['nama'], 'username' => $data['username'], 'gambar' => $target_file_final, 'role_id' => $data['role_id']));
return redirect('admin/users');
}
}
} else {
return redirect('/');
}
}