mirror of
https://github.com/flarum/framework.git
synced 2025-02-21 04:31:57 +08:00
Add ExtensionsServiceProvider to load enabled extensions
This commit is contained in:
parent
67f64b631a
commit
9af9dce740
33
src/Support/Extensions/ExtensionsServiceProvider.php
Normal file
33
src/Support/Extensions/ExtensionsServiceProvider.php
Normal file
@ -0,0 +1,33 @@
|
||||
<?php namespace Flarum\Support\Extensions;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use DB;
|
||||
|
||||
class ExtensionsServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Bootstrap the application events.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the service provider.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
$extensions = json_decode(DB::table('config')->where('key', 'extensions_enabled')->pluck('value'), true);
|
||||
|
||||
foreach ($extensions as $extension) {
|
||||
if (file_exists($file = base_path().'/extensions/'.$extension.'/bootstrap.php')) {
|
||||
require $file;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user