DeveloperBreeze

Laravel Programming Tutorials, Guides & Best Practices

Explore 51+ expertly crafted laravel tutorials, components, and code examples. Stay productive and build faster with proven implementation strategies and design patterns from DeveloperBreeze.

Creating Dynamic Content in Laravel Based on Site Settings

Tutorial November 16, 2024
php

   @if (getSetting('featured_products_widget', 'false') === 'true')
       <div class="widget">
           <h3>Featured Products</h3>
           <!-- Widget content -->
       </div>
   @endif

   @if (getSetting('recent_posts_widget', 'false') === 'true')
       <div class="widget">
           <h3>Recent Posts</h3>
           <!-- Widget content -->
       </div>
   @endif

For more complex dynamic behavior, retrieve settings in controllers.

Creating a Configurable Pagination System in Laravel

Tutorial November 16, 2024
php

   php artisan migrate

Generate the model:

Using Laravel Config and Localization Based on Site Settings

Tutorial November 16, 2024
php

   namespace App\Models;

   use Illuminate\Database\Eloquent\Model;

   class SiteSetting extends Model
   {
       protected $fillable = ['key', 'value'];
   }

Add initial settings for testing purposes.