I have Post and Category models. When I create a new message, I want to use the existing spectacle to display a flag in the category, but the all () method returns an array to the size of the number of existing categories in the table without any data.
$categorias = Categoria::all(); dd($categorias); return View::make('posts.nuevo')->with('categorias' => $categorias);
This is the contents of dd ($ categorization):
object(Illuminate\Database\Eloquent\Collection)[218] protected 'items' => array (size=7) 0 => object(Categoria)[209] public 'table' => string 'categorias' (length=10) public 'timestamps' => boolean false protected 'fillable' => array (size=1) ... protected 'connection' => null protected 'primaryKey' => string 'id' (length=2) protected 'perPage' => int 15 public 'incrementing' => boolean true protected 'attributes' => array (size=2) ... protected 'original' => array (size=2) ...
I have 7 rows inserted in a table.
I have a view that displays a list of all categories of its own model category with the same all () method and works correctly.
How can I do to take me to camps?
source share