コード例 #1
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     // This gets all rows and all columns from the players table.
     // If you want to change this. You can select specific columns by passing an array of the column names in all()
     $players = Player::orderBy('first_name', 'asc')->get();
     return view('players.index', compact('players'));
 }
コード例 #2
0
ファイル: TeamController.php プロジェクト: rcabr497/beerPong
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     // This method finds the player by id. so the url would be players/1
     // If an id of 1 doesn't exist laravel will throw an exception
     $team = Team::findOrFail($id);
     $players = Player::orderBy('first_name', 'asc')->get();
     // This passes the data to the view. The compact function is shorthand for an array.
     // In the view you would use $player to access all the columns
     return view('teams.edit', compact('team', 'players'));
 }
コード例 #3
0
 /**
  * Show the create an event form
  *
  * @return view
  **/
 public function create()
 {
     $players = Player::orderBy('first_name')->get();
     return view('dashboard.events.create', compact('players'));
 }
コード例 #4
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index($player, $entry)
 {
     $opplogs = (object) array();
     $opponents = Player::orderBy('full_name');
     return view('pages/players/journal/opponent/index', compact('player', 'entry', 'opponents', 'opplogs'));
 }