/** * 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')); }
/** * 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]); } }
/** * 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]); } }
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); } }
/** * 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')); }
/** * Responds to requests to POST */ public function getWinners() { $winners = User::All()->random(2); return view("winner")->with(array('users' => $winners)); // }
public function getAll() { $users = User::All(); return $users; }
public function seguidores($id) { $follows = Follow::where('user_id', $id)->get(); $users = User::All(); return view('users.seguidores', compact('follows', 'users')); }
/** * Display a listing of the resource. * * @return Response */ public function index() { $users = User::All(); $test = 'test'; return view('welcome', ['users' => $users, 'test' => $test]); }
/** * Show the form for creating a new resource. * * @return \Illuminate\Http\Response */ public function create() { $users = User::All(); return view('sick/register', ['users' => $users]); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { $usuarios = User::All(); return view('user.index', compact('usuarios')); }
| 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');
/** * Display a listing of the resource. * * @return Response */ public function index() { $users = User::All(); return view('users', compact('users')); }