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

Create or edit app/Helpers/helpers.php and add the following:

   use Illuminate\Support\Facades\Cache;

   if (!function_exists('getSetting')) {
       function getSetting($key, $default = null)
       {
           return Cache::rememberForever("setting_{$key}", function () use ($key, $default) {
               $setting = \App\Models\Setting::where('key', $key)->first();
               return $setting ? $setting->value : $default;
           });
       }
   }

Nov 16, 2024
Read More