Support the ongoing development of Laravel.io →
Views Blade Architecture
Last updated 2 years ago.
0

loose the

Route::resource('courses','CourseController');

and start writing every route ;)

Route::get('courses/{id}/events/create', [
    'as'    => 'admin.events.create',
    'uses' => 'CourseController@createEvent'
]);
Last updated 2 years ago.
0

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?

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.