I have 3 models: User, Lesson and Hotspot. A lesson owns many hotspots, and a user owns many lessons. In the future, I may allow users to have access to other user's lessons but that is a decision I'll make later. So to create a new user, I go to "/user/create". To create a new lesson, I go to "/user/1/create". To create a new hotspot, I go to "/user/1/lesson/1/hotspot/create". When I create a new hotspot, in my hotspot controller I have to ask "does the user own this?" "does this lesson own this?" for every CRUD action, which means my hotspot controller has to know a little about user and lesson, which doesn't really feel right.
Am I doing this correctly, or am I incorrect?
Here are my routes (note: uid == user id, lid == lesson id, hid == hotspot id)
// User CRUD routes
Route::get('/user', 'UserController@index');
Route::get('/user/create', 'UserController@create');
Route::post('/user/create', 'UserController@store');
Route::get('/user/{uid}', 'UserController@show');
Route::get('/user/{uid}/edit', 'UserController@edit');
Route::post('/user/{uid}/edit', 'UserController@update');
Route::post('/user/edit', 'UserController@update');
Route::post('/user/{uid}/delete', 'UserController@destroy');
// Lesson CRUD routes
Route::get('/user/{uid}/lesson/', 'LessonController@index');
Route::get('/user/{uid}/lesson/create', 'LessonController@create');
Route::post('/user/{uid}/lesson/create', 'LessonController@store');
Route::get('/user/{uid}/lesson/{lid}', 'LessonController@show');
Route::get('/user/{uid}/lesson/{lid}/edit', 'LessonController@edit');
Route::post('/user/{uid}/lesson/{lid}/edit', 'LessonController@update');
Route::post('/user/{uid}/lesson/edit', 'LessonController@update');
Route::post('/user/{uid}/lesson/{lid}/delete', 'LessonController@destroy');
// Lesson CRUD routes
Route::get('/user/{uid}/lesson/{lid}/hotspot', 'HotspotController@index');
Route::get('/user/{uid}/lesson/{lid}/hotspot/create', 'HotspotController@create');
Route::post('/user/{uid}/lesson/{lid}/hotspot/create', 'HotspotController@store');
Route::get('/user/{uid}/lesson/{lid}/hotspot/{hid}', 'HotspotController@show');
Route::get('/user/{uid}/lesson/{lid}/hotspot/{hid}/edit', 'HotspotController@edit');
Route::post('/user/{uid}/lesson/{lid}/hotspot/{hid}/edit', 'HotspotController@update');
Route::post('/user/{uid}/lesson/{lid}/hotspot/{hid}/edit', 'HotspotController@update');
Route::post('/user/{uid}/lesson/{lid}/hotspot/{hid}/delete', 'HotspotController@destroy');