1
votes

I have a problem within my routes. here is the error meesage "Route [pages.create] not defined". this my show.blade.php:

 {{ link_to_route('pages.create','page2')}} 

routes.php

 Route::resource('page', 'PagesController'); 

PagesController.php


class PagesController extends BaseController {

    public function index()
    {
        return View::make('pages.show');
    }

    public function create()
    {
        return "hai";
    }

    public function store()
    {
        //
    }

    public function show($id)
    {
        //
    }

    public function edit($id)
    {
        //
    }

    public function update($id)
    {
        //
    }

    public function destroy($id)
    {
        //
    }

}
2
Please show us your routes.php file probably you have not defined the route for pages.createjustrohu

2 Answers

1
votes

Please Try Here Laravel Function {{ HTML::linkRoute('pages.create', 'page2' }}

It Properly Work in laravel4.2

1
votes

It should be {{ route('page.create','page2')}}

When a resource generates routes it does not make them plural. So the routes available would be page.create, page.show, page.store, etc.

Also your PageController.php should be named KerjasamasController.php to be loaded properly and everything referencing PageController should be updated to KerjasamasController. I would read more about how PSR-4 autoloading works.