2013-06-01 34 views
0

我有在laravel link_to_action问题4唔明在laravel链接4

在laravel 3,我会像显示

{{ HTML::link_to_action('user/create', 'Create User') }} 

一个链接,但因为我已经切换到laravel 4 I”米创造我的控制器,这样UserController的,但是当我尝试使用HTML

{{ HTML::linkAction('user/create', 'Create User') }} 

它给我和错误动作,即使有一个名为创建方法不存在。 任何帮助将不胜感激。

这是我的控制器

<?php 

class UserController extends \BaseController { 

    /** 
    * Display a listing of the resource. 
    * 
    * @return Response 
    */ 
    public function index() 
    { 
     // 
    } 

    /** 
    * Show the form for creating a new resource. 
    * 
    * @return Response 
    */ 
    public function create() 
    { 
     // 
    } 

    /** 
    * Store a newly created resource in storage. 
    * 
    * @return Response 
    */ 
    public function store() 
    { 
     // 
    } 

    /** 
    * Display the specified resource. 
    * 
    * @param int $id 
    * @return Response 
    */ 
    public function show($id) 
    { 
     // 
    } 

    /** 
    * Show the form for editing the specified resource. 
    * 
    * @param int $id 
    * @return Response 
    */ 
    public function edit($id) 
    { 
     // 
    } 

    /** 
    * Update the specified resource in storage. 
    * 
    * @param int $id 
    * @return Response 
    */ 
    public function update($id) 
    { 
     // 
    } 

    /** 
    * Remove the specified resource from storage. 
    * 
    * @param int $id 
    * @return Response 
    */ 
    public function destroy($id) 
    { 
     // 
    } 
} 

回答

3
// L3 
{{ HTML::link_to_action('[email protected]', 'Create User') }} 

// L4 
{{ HTML::linkAction('[email protected]', 'Create User') }} 

编辑:

// I think you missed that entry in your routes.php 
Route::resource('user', 'UserController'); 
+0

嗯,我试过了,它似乎工作,但仍然给错误 –

+0

和那些是什么错误? – Ochi

+0

你在你的routes.php中有这个条目吗? **路由::资源('用户','UserController'); ** – Ochi