Skip to content

Instantly share code, notes, and snippets.

View kusowl's full-sized avatar
🎯
Focusing

Kushal Saha kusowl

🎯
Focusing
View GitHub Profile
@kusowl
kusowl / pass-data-globaly-blade-compoent-laravel.md
Created October 21, 2025 05:06
Passing Data to a Global Dynamic Component in Blade

Passing Data to a Global Dynamic Component in Blade (Laravel)

Dynamic components in Laravel often needs to share data throughout the site. A common example is a navbar that dynamically loads the most recently added categories.

View composers are one way to tackle this problem.

Let’s take the navbar component, which takes a prop:

@props(['categories'])