title: What is the best way to manage home page banners in Laravel?
body: <p>This is my banners structure in home page :</p>
  <p><a href="https://i.stack.imgur.com/T5tlU.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/T5tlU.jpg" alt="Banners Structure" /></a></p>
  <p>As you can see I have 4 section for banners - <em>small banners | medium banners | news banners | large banners</em></p>
  <p>And I have one model called <code>Banner</code> , 4 controllers to manage this banners and 4 tables to save data.</p>
  <p>This is <code>Banner</code> model :</p>
  <pre><code>&lt;?php
  
  namespace App;
  
  use Illuminate\Database\Eloquent\Model;
  
  class Banner extends Model
  {
      protected $fillable = [
          'title', 'image', 'url', 'image_title', 'image_alt'
      ];
  }
  </code></pre>
  <p>And Controllers :</p>
  <p><strong>SmallController :</strong></p>
  <pre><code>class SmallController extends Controller
  {
      public function small_list()
      {
          $smallBanners = DB::table('small_banner')-&gt;get();
          return view('admin.banners.small.list', compact('smallBanners'));
      }
  
      public function small_create()
      {
          return view('admin.banners.small.add');
      }
  
      public function small_store(Request $request)
      {
          $data = $request-&gt;validate([
              'title' =&gt; 'required',
              'url' =&gt; 'required',
              'image' =&gt; 'required',
              'image_title' =&gt; 'max:255',
              'image_alt' =&gt; 'max:255'
          ]);
          DB::table('small_banner')-&gt;insert($data);
          return redirect(route('admin.banners.small.index'));
      }
  
      public function small_edit($id)
      {
          $small = DB::table('small_banner')-&gt;where('id', $id)-&gt;first();
          return view('admin.banners.small.edit', compact('small'));
      }
  
      public function small_update(Request $request, $id)
      {
          $small = DB::table('small_banner')-&gt;where('id', $id)-&gt;first();
          if ($request-&gt;has('image')) {
              if (file_exists($small-&gt;image)) {
                  unlink($small-&gt;image);
              }
              DB::table('small_banner')-&gt;where('id', $id)-&gt;update([
                  'image' =&gt; $request['image']
              ]);
          }
          DB::table('small_banner')-&gt;where('id', $id)-&gt;update([
              'title' =&gt; $request['title'],
              'url' =&gt; $request['url'],
              'image_title' =&gt; $request['image_title'],
              'image_alt' =&gt; $request['image_alt']
          ]);
          return redirect(route('admin.banners.small.index'));
      }
  
      public function small_delete($id)
      {
          $small = DB::table('small_banner')-&gt;where('id', $id)-&gt;first();
          DB::table('small_banner')-&gt;where('id', $id)-&gt;delete();
          if (file_exists($small-&gt;image)) {
          unlink($small-&gt;image);
          }
          return redirect(route('admin.banners.small.index'));
      }
  }
  </code></pre>
  <p>Other Controllers are like <strong>SmallController</strong></p>
  <p>And this is how I show this banners :</p>
  <pre><code>@foreach($smallBanners as $small)
          &lt;div class=&quot;col-6 col-lg-3&quot;&gt;
               &lt;div class=&quot;widget-banner card&quot;&gt;
                    &lt;a href=&quot;{{ $small-&gt;url }}&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;
                       &lt;img class=&quot;img-fluid w-100&quot; loading=&quot;lazy&quot;
                            src=&quot;{{ $small-&gt;image }}&quot; title=&quot;{{ $small-&gt;title }}&quot;
                            alt=&quot;{{ $small-&gt;image_alt }}&quot; width=&quot;350&quot; height=&quot;200&quot;&gt;
                    &lt;/a&gt;
                &lt;/div&gt;
           &lt;/div&gt;
  @endforeach
  </code></pre>
  <p>Other views like small banner.</p>
  <p>But in this case, for example in small banners, if we upload 5 images instead 4 images, the structure will be messed up.</p>
  <p>What is the best way to manage this banners and optimize codes ?</p>