DeveloperBreeze

Using Laravel Config and Localization Based on Site Settings

Premium Component

This is a premium Content. Upgrade to access the content and more premium features.

Upgrade to Premium

Related Posts

More content you might like

Tutorial
php

Securing Laravel Applications Against Common Vulnerabilities

Use the {{ }} syntax in Blade templates to automatically escape user input:

   <p>{{ $user->name }}</p>

Nov 16, 2024
Read More
Tutorial
php

Building a Custom Pagination System for API Responses

  • Pagination metadata.
  • Links for next/previous pages.
  • Cursor behavior.

Test paginated responses:

Nov 16, 2024
Read More
Tutorial
php

Creating Dynamic Content in Laravel Based on Site Settings

   use Illuminate\Support\Facades\Cache;

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

Add it to composer.json:

Nov 16, 2024
Read More
Tutorial
php

Laravel Best Practices for Sharing Data Between Views and Controllers

  • Don’t duplicate logic in multiple controllers or views.
  • Share common data globally using View::share.
  • Cache data that doesn’t change frequently, like menus or site settings.

Nov 16, 2024
Read More

Discussion 0

Please sign in to join the discussion.

No comments yet. Be the first to share your thoughts!