本文整理汇总了PHP中app\models\User::all方法的典型用法代码示例。如果您正苦于以下问题:PHP User::all方法的具体用法?PHP User::all怎么用?PHP User::all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\models\User
的用法示例。
在下文中一共展示了User::all方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getUser
public function getUser()
{
$all = User::all();
$env = \App::environment();
var_dump($all, $env);
foreach ($all as $v) {
var_dump($env);
var_dump($v->name);
var_dump($v->nickname);
var_dump($v->createTime);
var_dump($v->updateTime);
var_dump($v->deleteTime);
}
//$id = 30;
//$user = UserService::getUserById($id);
//$list = UserService::getList(1,10);
//\Debugbar::info();
//\Debugbar::error('Error!');
//\Debugbar::warning('Watch out…');
//\Debugbar::addMessage('Another message', 'mylabel');
//\Debugbar::startMeasure('render','Time for rendering');
//\Debugbar::stopMeasure('render');
//\Debugbar::addMeasure('now', LARAVEL_START, microtime(true));
//echo 'ssss';
//\Debugbar::disable();
/*
foreach($list as $k=>$v){
//var_dump($v['name']);
}
var_dump($list);
*/
}
示例2: getFakerWithUniqueUserData
/**
* @return Faker
*/
protected function getFakerWithUniqueUserData()
{
// Prepare an array with user data already used
$users = User::all();
if (!$this->uniques) {
$uniques = ['username' => [], 'email' => []];
foreach ($users as $user) {
array_push($uniques['username'], [$user->username => null]);
array_push($uniques['email'], [$user->email => null]);
}
$this->uniques = $uniques;
}
// As the array of already used faker data is protected in Faker and
// has no accessor method, we'll rely on ReflectionObject to modify
// the property before letting faker generate data.
//though reflected object should be added to the faker itself somehow
// which is hacky
//so we decided to overcome it with bindTo hack
$faker = Faker::create();
$unique = $faker->unique();
$binder = function ($value) {
$this->unqiue = $value;
};
$unqiueBinder = $binder->bindTo($unique, $unique);
$unqiueBinder($this->uniques);
return $faker;
}
示例3: delete
public function delete($userType, $id, Request $req)
{
$temp = null;
$profile = null;
if ($userType == 'admin') {
//$profile= Founder::findOrFail($id)->toArray();
//dd($profile);
Admin::findOrFail($id)->delete();
} elseif ($userType == 'founder') {
//$profile= Founder::findOrFail($id)->toArray();
//dd($profile);
Founder::findOrFail($id)->delete();
} elseif ($userType = 'investor') {
//$profile= Investor::findOrFail($id)->toArray();
//dd($profile);
Investor::findOrFail($id)->delete();
} elseif ($userType = 'campaign') {
//$profile= Investor::findOrFail($id)->toArray();
//dd($profile);
Campaign::findOrFail($id)->delete();
}
flash()->success($userType . ' Deleted');
$users = User::all();
return view('admin.home', compact('users'));
}
示例4: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
$brand = Brand::all();
$category = Category::all();
$user = User::all();
return view('product.create_new_product', compact('brand', 'category', 'subcat_level1', 'user'));
}
示例5: _init
protected function _init()
{
parent::_init();
$this->aclAdd('login', array('restricted', 'accounts'));
$this->Facebook = new FacebookConnect(FACEBOOK_APP_ID, FACEBOOK_APP_SECRET, array('redirect_uri' => FACEBOOK_REDIRECT_URI));
$this->tpl->assign('Facebook', $this->Facebook);
$this->tpl->assign('users', User::all());
}
示例6: all
public function all()
{
$users = User::all();
if ($users->isEmpty()) {
return $this->responseNotFound(['Users is empty']);
}
return $this->responseOk($users);
}
示例7: getIndex
public function getIndex()
{
$roles = [0 => 'Все'];
foreach (Role::all() as $role) {
$roles[$role->id] = $role->title;
}
return view('admin.users.index', ['users' => User::all(), 'roles' => $roles]);
}
示例8: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
DB::table('profiles')->delete();
$users = User::all();
foreach ($users as $user) {
Profile::create(['display_name' => 'The Real Doodle Maestro', 'user_id' => $user->id]);
}
}
示例9: getIndex
public function getIndex()
{
if (!$this->hasPermission('manage.user')) {
return response()->view('errors.401', [], 401);
}
$users = User::all();
return view('user.index', compact('users'));
}
示例10: index
/**
* Get a set of application data.
*
* @return \Illuminate\Http\JsonResponse
*/
public function index()
{
$playlists = Playlist::byCurrentUser()->orderBy('name')->with('songs')->get()->toArray();
// We don't need full song data, just ID's
foreach ($playlists as &$playlist) {
$playlist['songs'] = array_pluck($playlist['songs'], 'id');
}
return response()->json(['artists' => Artist::orderBy('name')->with('albums', with('albums.songs'))->get(), 'settings' => Setting::all()->lists('value', 'key'), 'playlists' => $playlists, 'interactions' => Interaction::byCurrentUser()->get(), 'users' => auth()->user()->is_admin ? User::all() : [], 'user' => auth()->user()]);
}
示例11: create
/**
* Show the form for creating a new Role.
*
* @return Response
*/
public function create()
{
$users = User::all();
$userlist = array();
foreach ($users as $key => $value) {
$userlist[$value->objectId] = $value->username;
}
return view('roles.create')->with(array('users' => $userlist));
}
示例12: index
/**
* Get a set of application data.
*
* @return \Illuminate\Http\JsonResponse
*/
public function index()
{
$playlists = Playlist::byCurrentUser()->orderBy('name')->with('songs')->get()->toArray();
// We don't need full song data, just ID's
foreach ($playlists as &$playlist) {
$playlist['songs'] = array_pluck($playlist['songs'], 'id');
}
return response()->json(['artists' => Artist::orderBy('name')->with('albums', with('albums.songs'))->get(), 'settings' => Setting::lists('value', 'key')->all(), 'playlists' => $playlists, 'interactions' => Interaction::byCurrentUser()->get(), 'users' => auth()->user()->is_admin ? User::all() : [], 'currentUser' => auth()->user(), 'useLastfm' => env('LASTFM_API_KEY') && env('LASTFM_API_SECRET'), 'currentVersion' => Application::VERSION, 'latestVersion' => auth()->user()->is_admin ? app()->getLatestVersion() : Application::VERSION]);
}
示例13: index
/**
* Get a set of application data.
*
* @return \Illuminate\Http\JsonResponse
*/
public function index()
{
$playlists = Playlist::byCurrentUser()->orderBy('name')->with('songs')->get()->toArray();
// We don't need full song data, just ID's
foreach ($playlists as &$playlist) {
$playlist['songs'] = array_pluck($playlist['songs'], 'id');
}
return response()->json(['artists' => Artist::orderBy('name')->with('albums', with('albums.songs'))->get(), 'settings' => auth()->user()->is_admin ? Setting::pluck('value', 'key')->all() : [], 'playlists' => $playlists, 'interactions' => Interaction::byCurrentUser()->get(), 'users' => auth()->user()->is_admin ? User::all() : [], 'currentUser' => auth()->user(), 'useLastfm' => Lastfm::used(), 'useYouTube' => YouTube::enabled(), 'allowDownload' => config('koel.download.allow'), 'cdnUrl' => app()->staticUrl(), 'currentVersion' => Application::VERSION, 'latestVersion' => auth()->user()->is_admin ? app()->getLatestVersion() : Application::VERSION]);
}
示例14: getIndex
/**
* get Index.
*
* @return Response Show Root dashboard
*/
public function getIndex()
{
logger()->info(__METHOD__);
logger()->warning('[ROOT ACCESS]');
//////////////////
// FOR REFACTOR //
//////////////////
$users = User::all();
return view('Backend::dashboard', compact('users'));
}
示例15: getIndex
/**
* get Index.
*
* @return Response Show Root dashboard
*/
public function getIndex()
{
$this->log->info(__METHOD__);
$this->log->warning('[ROOT ACCESS]');
//////////////////
// FOR REFACTOR //
//////////////////
$users = User::all();
return view('root.dashboard', compact('users'));
}