loose the
Route::resource('courses','CourseController');
and start writing every route ;)
Route::get('courses/{id}/events/create', [
'as' => 'admin.events.create',
'uses' => 'CourseController@createEvent'
]);
Thanks but this seems to create a whole myriad of errors.
I tried to cut it down to basics to check to avoid issues with uses to begin with
Route::get('courses', 'CourseController@index');
Route::get('courses/create', 'CourseController@create');
Route::post('courses/create', 'CourseController@store');
Route::get('courses/{id}/edit', 'CourseController@edit');
Route::post('courses/{id}/edit', 'CourseController@update');
Route::get('courses/{id}', 'CourseController@show');
firstly for the 'courses' page, which has a link to create a course.
Route [admin.courses.create] not defined
In CourseController
class CourseController extends AdminController {
/**
* Display a listing of the resource.
*
* @return Response
*/
protected $layout = 'layouts.admin';
public function index()
{
$courses = User::find(1)->courses;
$this->layout->content=View::make('admin.courses.index')->with('course', $courses);
}
public function create()
{
$teachers = array('' => 'Select Course Teacher') + Teacher::lists('t_lname', 'id');
$this->layout->content=View::make('admin.courses.create')->with('teachers', $teachers);
}
This was okay when I use
Route::resource('courses','CourseController');
I'm a newbie so maybe I'm missing something here?
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community