jeroennoten / Laravel-AdminLTE

Easy AdminLTE integration with Laravel
MIT License
3.84k stars 1.08k forks source link

[FEATURE] Possibility to @push to content section #1045

Closed AMoktar closed 9 months ago

AMoktar commented 2 years ago

https://github.com/jeroennoten/Laravel-AdminLTE/blob/2382d0623d33bb37c946c70e4c940371b8b24c25/resources/views/partials/cwrapper/cwrapper-default.blade.php#L22-L25

please add this stack

    <div class="content">
        <div class="{{ config('adminlte.classes_content') ?: $def_container_class }}">
            @stack('content') // <<<<<----
            @yield('content')
        </div>

as https://github.com/jeroennoten/Laravel-AdminLTE/blob/2382d0623d33bb37c946c70e4c940371b8b24c25/resources/views/page.blade.php#L5-L8

so it is easy to create a parent layout like

@extends('adminlte::page')

@push('content')
<div class="container">
    <div class="row justify-content-center">
        <div class="col-md-10">
            @if (session()->has('message'))
            <div class="alert alert-info" role="alert">
                <p>{{ session()->get('message') }}</p>
            </div>
            @endif
        </div>
    </div>
</div>
@endpush

@push('css')
<link href="{{ assets('css/custom.admin.css') }}" rel="stylesheet">
@endpush

currently on release 3.7 the css above is working , but the content push doesnot

Thanks

dfsmania commented 2 years ago

What you want to do, may actually be done if you yield a new section, for example:

my-app-layout.blade.php

@extends('adminlte::page')

@section('content')
<div class="container">
    <div class="row justify-content-center">
        <div class="col-md-10">
            @if (session()->has('message'))
            <div class="alert alert-info" role="alert">
                <p>{{ session()->get('message') }}</p>
            </div>
            @endif
        </div>
    </div>
</div>
@stack('my_layout_content')
@yield('my_layout_content')
@endsection

@push('css')
  <link href="{{ assets('css/custom.admin.css') }}" rel="stylesheet">
@endpush

Then you will usually @extends('my-app-layout') and use the new my_layout_content section.

AMoktar commented 2 years ago

thanks man, my solution was sweet :)) Thanks

dfsmania commented 2 years ago

Ok, we will take this into consideration for a future release...

AMoktar commented 2 years ago

Thanks @Shidersz , You are awesome .

dfsmania commented 9 months ago

Closed by #1235