本文整理汇总了PHP中app\User::All方法的典型用法代码示例。如果您正苦于以下问题:PHP User::All方法的具体用法?PHP User::All怎么用?PHP User::All使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\User
的用法示例。
在下文中一共展示了User::All方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
/**
* Show a list of all the users.
*
* @return View
*/
public function index()
{
// Grab all the users
$users = User::All();
// Show the page
return View('admin.users.index', compact('users'));
}
示例2: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
$faker = \Faker\Factory::create();
foreach (range(1, 10) as $index) {
$user = User::All()->random(1);
Profile::create(['user_id' => $user->id, 'telephone' => $faker->phoneNumber, 'telegram' => $faker->username]);
}
}
示例3: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
$faker = \Faker\Factory::create();
//Posts::truncate();
foreach (range(1, 10) as $index) {
$user = User::All()->random(1);
Posts::create(['author_id' => $user->id, 'title' => $faker->sentence(3), 'body' => $faker->text, 'slug' => $faker->slug(), 'active' => 1]);
}
}
示例4: index
public function index(User $user)
{
if (Auth::user()->role == 'admin') {
$data['users'] = User::All();
return view('admin.index', $data);
} else {
$data['message'] = 'Вам сюда нельзя!';
return view('errors.forbidden', $data);
}
}
示例5: getIndex
/**
* Show a list of all the users.
*
* @return View
*/
public function getIndex()
{
// Grab all the users
$users = User::All();
// Do we want to include the deleted users?
if (Input::get('withTrashed')) {
$users = User::withTrashed()->get();
} elseif (Input::get('onlyTrashed')) {
$users = User::onlyTrashed()->get();
}
// Show the page
return View::make('admin.users.index', compact('users'));
}
示例6: getWinners
/**
* Responds to requests to POST
*/
public function getWinners()
{
$winners = User::All()->random(2);
return view("winner")->with(array('users' => $winners));
//
}
示例7: getAll
public function getAll()
{
$users = User::All();
return $users;
}
示例8: seguidores
public function seguidores($id)
{
$follows = Follow::where('user_id', $id)->get();
$users = User::All();
return view('users.seguidores', compact('follows', 'users'));
}
示例9: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
$users = User::All();
$test = 'test';
return view('welcome', ['users' => $users, 'test' => $test]);
}
示例10: create
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
$users = User::All();
return view('sick/register', ['users' => $users]);
}
示例11: index
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
$usuarios = User::All();
return view('user.index', compact('usuarios'));
}
示例12: function
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
Route::get('/', function () {
return view('index');
});
Route::get('demo', function () {
return view('test');
});
Route::get('users', function () {
$users = \App\User::All();
//select * from users
return view('userhome')->with('blogger', $users);
});
Route::get('profile/{id}', function ($uid) {
$user = \App\User::find($uid);
return view('profile')->with('user', $user);
});
Route::get('blogdetail/{id}', function ($blogid) {
$blog = \App\Blog::find($blogid);
return view('blogdetails')->with('blogs', $blog);
});
Route::post('/signup', array('as' => 'signup', 'before' => 'csrf', 'uses' => 'AuthController@userSignup'));
Route::post('/signin', array('as' => 'signin', 'before' => 'csrf', 'uses' => 'AuthController@userSignin'));
Route::get('home', array('as' => 'home', 'before' => 'auth', 'uses' => 'HomeController@getHome'));
Route::get('vehicle', 'Front@vehicle');
示例13: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
$users = User::All();
return view('users', compact('users'));
}