我试图从我的userController类返回一个视图,但是却收到未定义的view()错误。我可以返回字符串,但不能返回“视图”。
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index($id)
{
//
return 'yay, you\'re there, and number is '.$id;
}
/**
* Show the form for creating a new resource.
*
* @return Response
*/
public function create()
{
//
return 'create method is working';
}
/**
* 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)
{
//
}
public function contact(){
return View('contact');
}
}
我从Windows命令行创建了控制器。我找不到与此相关的问题,因此将不胜感激。哦,我正在使用laravel 4.2。谢谢。