How can I pull database values into a template? (footer.blade.php
). I can pull data into home.blade.php
just fine but since I'm just doing @include('templates.footer')
, I'm not sure how to pull table values into footer.blade.php
This is my current setup:
HomeController.php
public function index() {
$general = DB::table('general')->get();
return view('home', ['general' => $general]);
}
home.blade.php
@extends('templates.master')
@section('content')
@foreach($general as $key => $data)
{{ $data -> content}}
@endforeach
@endsection
master.blade.php
<!doctype html>
<html lang="en">
<head>
</head>
<body>
@include('templates.header')
@yield('content')
@include('templates.footer')
</body>
footer.blade.php
<footer class="footer padding-medium">
This is the footer
</footer>
I am looking to do something like this:
footer.blade.php
<footer class="footer padding-medium">
@foreach($general as $key => $data)
{{ $data -> content}}
@endforeach
</footer>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…