I want to add a feature to my site.

Example: you need to add an ad unit to the place of the template I need. We have a product.blade.php template. All products are displayed on it. Go to the admin panel, take our block that we want to insert, take the view that we want to change, insert the necessary block in the right place, update. As a result, all products will now be with an ad unit.

How to do this, maybe there are already ready packages?

    1 answer 1

    Can be done using a table in the database. For example, there is a reklama table where the path to the advertisement file and the block identifier are inserted.

    id path block_id

    1 include.adblock1.blade.php 1

    2 include.adblock2.blade.php 2

    in the right kinds

    <?php $ad=App\Ads::where('block_id',1)->first();//Ads это модель ?> @section('reklama1') @include({{$ad->path}}) @endsection <?php $ad=App\Ads::where('block_id',2)->first();//Ads это модель ?> @section('reklama2') @include({{$ad->path}}) @endsection