DeveloperBreeze

Laravel Tutorials. Development Tutorials, Guides & Insights

Unlock 5+ expert-curated laravel tutorials. tutorials, real-world code snippets, and modern dev strategies. From fundamentals to advanced topics, boost your laravel tutorials. skills on DeveloperBreeze.

Securing Laravel Applications Against Common Vulnerabilities

Tutorial November 16, 2024
php

   use Illuminate\Support\Str;

   $cleanInput = Str::clean($request->input('content'));

For inputs that allow HTML (e.g., WYSIWYG editors), use an HTML sanitizer like HTMLPurifier:

Building a Custom Pagination System for API Responses

Tutorial November 16, 2024
php

We’ll implement a custom solution to meet these needs.

Add a route for the API endpoint in routes/api.php:

Laravel Best Practices for Sharing Data Between Views and Controllers

Tutorial November 16, 2024
php

   use Illuminate\Support\Facades\Cache;

   public function boot()
   {
       $navigationMenu = Cache::rememberForever('navigation_menu', function () {
           return [
               ['title' => 'Home', 'url' => '/'],
               ['title' => 'About', 'url' => '/about'],
           ];
       });

       View::share('navigationMenu', $navigationMenu);
   }
   <ul>
       @foreach ($navigationMenu as $item)
           <li><a href="{{ $item['url'] }}">{{ $item['title'] }}</a></li>
       @endforeach
   </ul>

Using Laravel Config and Localization Based on Site Settings

Tutorial November 16, 2024
php

   return [
       'welcome' => 'Welcome to our application!',
   ];

Spanish (es/messages.php):

Building a Base Controller for Reusable Data Access in Laravel

Tutorial November 16, 2024
php

   namespace App\Http\Controllers;

   class DashboardController extends BaseController
   {
       public function index()
       {
           return view('dashboard.index', [
               'userRole' => $this->userRole,
               'featureToggles' => $this->featureToggles,
               'appConfig' => $this->appConfig,
           ]);
       }
   }

Any other controllers that require access to these shared properties can also extend BaseController: