A newbie question ...
To open the first page (index) I have the following in a GamesController:
public function index()
{
//show a listing of games
$games = Game::all();
return view('index',['games'=> $games]);
}
which works fine. I have at the top of the controller
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Game;
The model is simply
namespace App;
use Illuminate\Database\Eloquent\Model;
class Game extends Model
{
//
}
In my index page I have a simple list from the db with an edit button which has the code:
<a href="" class="btn btn-default">Edit</a>
In my controller have the following:
public function edit(Request $request)
{
$games = Game::find($request->id);
return view('edit',['games'=>$games]);
}
but when I press the edit button I get
Aucun commentaire:
Enregistrer un commentaire