Laravel视图没有显示任何内容

时间:2014-03-20 14:41:46

标签: php nginx laravel laravel-4

所以我是Laravel的新手,我遵循这个Tutorial但是当我检查我的应用程序时,我得到了 IP-TEST-NGINX ,有关详细信息,这是我的代码,

首先是我的索引操作:

class ServiceController extends BaseController {

/**
 * Display a listing of the resource.
 *
 * @return Response
 */
public function index()
{
    // get all the services
    $services = Service::all();

    // load the view and pass the services
    return View::make('services.index')->with('service', $services);
}

其次是我的路线:

Route::resource('services', 'ServiceController');

然后是我的模特:

<?php

class Service extends Eloquent
{

    /**
     * The database table used by the model.
     *
     * @var string
     */
    public static $table = 'services';

}

最后我的观点:

 @foreach($services as $key => $value)
    <tr>
        <td>{{ $value->user_id }}</td>
        <td>{{ $value->domain }}</td>
        <td>{{ $value->service_name }}</td>

当我转到网址时:http://localhost:8080/laravel/services我收到错误 IP-TEST-NGINX ,请提供任何帮助:)

1 个答案:

答案 0 :(得分:0)

您将使用service而非services

返回视图

应该是:

return View::make('services.index')->with('services', $services);

另外,根据您是否正在运行虚拟主机,您可能需要点击http://localhost:8080/laravel/public/services