I'm trying to pass anINT from this url: myapp.build/courses/anINT (implemented through CoursesController) to $id in the Lesson_unitsController function below. I've tried a lot of solutions, but I can't seem to get it right.
public function index()
{
$id = ?????
$course = Course::find($id);
return view('lesson_units.index')->with('lesson_units', $course->lesson_units);
The routes in web.php are:
Route::resource('courses', 'CoursesController');
Route::resource('lesson_units', 'Lesson_unitsController');
Do I need another line in the web.php file and can the index function take parameters? If so, how? Thanks
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire