Problem with foreach, Aravel is not recognizing the model Indexes

Asked

Viewed 48 times

2

Index Controller:

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

use App\Http\Requests;
use App\Http\Controllers\Controller;
use View;
use App\Indexes;
use Illuminate\Support\Facades\DB;

class IndexController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public $restful = true;

    public function index()
    {
        return view::make('index')
        ->with('name', 'teste')
        ->with('index', Indexes::all());
    }

Model:

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Indexes extends Model
{
    protected $table = 'index';

    protected $filliable = [
      'name'
    ];
}

Meu Index.blade:

@foreach($indexes as $index)

  <td> {{$index->name}} </td>

  @endforeach
  • Undefined Variable Indexes appears in Blade.php

  • Welcome to Sopt. Click [Edit] and explain the problem better.

  • Lucky I got the problem rsrs how to close the topic

  • 1

    Post the solution as the answer and click on the "V" right next to the answer.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.