I'm new to laravel and I got stuck.
My problem is I want 2 sections (navigation, content) that has dynamic data
Here's some code Main Blade
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Portfolio</title>
</head>
<body>
<div class="navigation">
@yield('menu')
</div>
<div class="content">
@yield('content')
</div>
</body>
</html>
portfolio blade
@extends('main')
@section('content')
@foreach($data as $portfolio)
<a href="portfolio/{!!$portfolio->portfolio_url!!}"><img src='{{ URL::asset("images/$portfolio->picture.jpg") }}'/></a>
@endforeach
@stop
and my navigation blade
@extends('main')
@section('menu')
@foreach($menuknoppen as $menuknop)
<a href='{{ URL::to("$menuknop->menu_url") }}'>{{$menuknop->menutitle}}</a>
@endforeach
@stop
the portfolio blade has a controller, but also the menu blade has a controller
Edit1:
the problem is the navigation isn't showing even if I add static text
Edit2:
My controllers my portfolio controller
/**
* Show the profile for the given user.
*
* @param int $id
* @return Response
*/
public function index(){
//here comes a whole list with what i've done
$results = DB::table('projects')->get();
//return $results;
$data = array();
foreach ($results as $key => $result) {
$data[] = $result;
}
return view('portfolio.portfolio')->with('data', $data);
}
public function getProject($portfolio_url){
//this gets the project thats clicked
$results = DB::select('select * from projects where portfolio_url = ?', array($portfolio_url));
return view('portfolio.single')->with('data', $results['0']);
}
}
my navigation controller
class menuController extends Controller {
/**
* Show the profile for the given user.
*
* @param int $id
* @return Response
*/
// public function __construct($table){
// $results = DB::table($table)->get();
// return view('menu')->with('menuknoppen', $results);
// }
public function index(){
$results = DB::table('navigation')->get();
return view('menu')->with('menuknoppen', $results);
}
}