简体   繁体   中英

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,

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 :)

you are returning the view with service instead of 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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