示例#1
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($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);
     $matches = Match::table('matches')->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.show', compact('team'));
 }