Hello,
Don't know if writing in proper channel, but i've a trouble with passing data into view.
I've tried in few way:
-
$articles = Article::all();
View::share('articles', $articles);
return View::make('dashboard');
-
$articles = Article::all();
return View::make('dashboard')->with('articles', $articles);
-
$articles = Article::all();
return View::make('dashboard', array('articles' => $articles));
All these codes are of course in the index method of DashboardController.
Always i get:
Undefined variable: articles (View: /Users/Ultearie/Sites/Czysta/Czysta/resources/views/dashboard.blade.php)
All layouts looks like:
app.blade.php
@yield('content')
dashboard.blade.php
@extends('app')
@section('content')
@foreach ($articles as $article)
<tr>
<td><input type="checkbox" name="delete" value="{{ $article->id }}"/></td>
<td>{{ $article->title }}</td>
</tr>
@endforeach
Sorry if wrote in wrong section but i really searched through several sites, tutorials etc and nothing helped