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.

Tutorial
php

Creating a Configurable Pagination System in Laravel

  • If no database setting is found, the default value of 10 is used.

Use the same approach for product listings or user lists:

Nov 16, 2024
Read More
Tutorial
php

Using Laravel Config and Localization Based on Site Settings

   namespace Database\Seeders;

   use Illuminate\Database\Seeder;
   use Illuminate\Support\Facades\DB;

   class SiteSettingsSeeder extends Seeder
   {
       public function run()
       {
           DB::table('site_settings')->insert([
               ['key' => 'app_name', 'value' => 'My Laravel App'],
               ['key' => 'app_timezone', 'value' => 'UTC'],
               ['key' => 'app_language', 'value' => 'en'],
           ]);
       }
   }
   php artisan db:seed --class=SiteSettingsSeeder

Nov 16, 2024
Read More
Tutorial
php

How to Dynamically Manage Application Settings in Laravel

Create resources/views/admin/settings/edit.blade.php:

   <form action="{{ route('admin.settings.update') }}" method="POST">
       @csrf
       @method('PUT')

       @foreach ($settings as $setting)
           <div>
               <label>{{ ucfirst(str_replace('_', ' ', $setting->key)) }}</label>
               <input type="text" name="settings[{{ $setting->key }}]" value="{{ $setting->value }}">
           </div>
       @endforeach

       <button type="submit">Save Settings</button>
   </form>

Nov 16, 2024
Read More