bram1028/laravel-support

Adds common functionality to Laravel.

1.3.1 2021-03-30 19:19 UTC

This package is auto-updated.

Last update: 2024-04-29 04:00:30 UTC


README

This library contains common funtionality that I use across many Laravel applications. I think some of this stuff belongs in the framework, but what do I know?

Installation is simple:

composer require bram1028/laravel-support

The service provider will be loaded automatically.

@optional

Checks if a section has content, so you can wrap a yield in other code.

@optional('hero')
    <div class="hero">
        <div class="hero-body">
            {!! $yield !!}
        </div>
    </div>
@endoptional

Route::if()

Makes styling active nav links much cleaner.

<ul>
    <li class="{!! Route::if('about', 'is-active') !!}">
        <a href="{{ route('about') }}">About Us</a>
    </li>
</ul>

And yes, you can pass multiple route names. The last parameter is used as the output value.

artisan job:list

Lists all jobs under App\Jobs.

artisan job:run

Runs a job under App\Jobs.

Currently only supports jobs without constructor parameters.