Blade Components with default values in properties

Super easy way to get default property values from a Laravel Blade Component. Took me a couple of minutes to figure this out: rvery prop is available as a variable so this is very easy using the coalescing operator.


// normal width content
<x-app>
    ....
</x-app>

// wider-than-normal-content
<x-app class="col-12">
    ....
</x-app>

// view/component/app.blade.php
<div class="container">
    <div class="row">
        <div class="{{ $class ?? 'col-6' }}">
            <div class="content">
                
            </div>
        </div>
    </div>
</div>