简体   繁体   English

Laravel视图没有显示任何内容

[英]Laravel view doesn't show anything

so i am new in Laravel, i follow this Tutorial but when i check my application i got IP-TEST-NGINX , for more details this is my code, 因此,我是Laravel的新手,我遵循此教程,但是当我检查我的应用程序时,获得了IP-TEST-NGINX ,有关更多详细信息,这是我的代码,

First my index action : 首先我的索引操作:

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);
}

Second my route : 第二我的路线:

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

Then my model : 然后我的模型:

<?php

class Service extends Eloquent
{

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

}

Finally my view : 最后我的看法:

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

When i go to the url : http://localhost:8080/laravel/services i got the error IP-TEST-NGINX , any help please :) 当我转到url时: http://localhost:8080/laravel/services我收到错误IP-TEST-NGINX ,请帮忙:)

you are returning the view with service instead of services 您使用service而不是services返回视图

should be: 应该:

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

also, depending on if you are running a virtual host, you may need to hit http://localhost:8080/laravel/public/services 另外,根据您是否正在运行虚拟主机,您可能需要点击http://localhost:8080/laravel/public/services

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM