Created
July 27, 2021 09:42
-
-
Save BinaryKitten/41441343629e652efaea41cd88596488 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
declare(strict_types=1); | |
namespace App\Providers; | |
use Illuminate\Support\ServiceProvider; | |
class DbMacrosProvider extends ServiceProvider | |
{ | |
public function boot(): void | |
{ | |
collect(glob(database_path('macros/*/*.php'), GLOB_NOSORT)) | |
->each(fn ($path) => require_once $path); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I use this provider to autoload macros from single php files that live in
database/macros/
folder