Answer the question
In order to leave comments, you need to log in
How to implement code in laravel to display information in one block?
The point is, I'll try to get it right.
There is a main admin file:
<!DOCTYPE html>
<html lang="{{ config('app.locale') }}">
<head>
@include('admin.inc.head')
</head>
<body>
@include('admin.inc.authpanel')
@include('admin.inc.subnavbar')
<!-- /subnavbar -->
@yield('content')
@include('admin.inc.footer')
<!-- /footer -->
@yield
for a specific action. create.blade.php
into @yield
. $data = [
'posts'=>Post::where('id', '<>', $id)->get(),
'article'=>Article::find($id),//выбираем статью для редактирования
'categories'=>Category::all(),
];
Answer the question
In order to leave comments, you need to log in
I use https://laravel.com/docs/5.4/views#view-composers for this . In a separate class, which is loaded through the service provider, we fumble any data directly into the necessary views. The only negative is that the composer starts after the controller, before the view, which can sometimes cause discomfort
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question