added view components support for modules
This commit is contained in:
parent
1cff173824
commit
1deeece33a
28
app/Console/Stubs/Modules/component.stub
Normal file
28
app/Console/Stubs/Modules/component.stub
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace $NAMESPACE$;
|
||||
|
||||
use Illuminate\View\Component;
|
||||
|
||||
class $CLASS$ extends Component
|
||||
{
|
||||
/**
|
||||
* Create a new component instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View|string
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
return view('$ALIAS$::$VIEW_NAME$');
|
||||
}
|
||||
}
|
@ -2,6 +2,7 @@
|
||||
|
||||
namespace $NAMESPACE$;
|
||||
|
||||
use Illuminate\Support\Facades\Blade;
|
||||
use Illuminate\Support\ServiceProvider as Provider;
|
||||
|
||||
class $NAME$ extends Provider
|
||||
@ -14,6 +15,7 @@ class $NAME$ extends Provider
|
||||
public function boot()
|
||||
{
|
||||
$this->loadViews();
|
||||
$this->loadViewComponents();
|
||||
$this->loadTranslations();
|
||||
$this->loadMigrations();
|
||||
//$this->loadConfig();
|
||||
@ -39,6 +41,16 @@ class $NAME$ extends Provider
|
||||
$this->loadViewsFrom(__DIR__ . '/../Resources/views', '$ALIAS$');
|
||||
}
|
||||
|
||||
/**
|
||||
* Load view components.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function loadViewComponents()
|
||||
{
|
||||
Blade::componentNamespace('$COMPONENT_NAMESPACE$', '$ALIAS$');
|
||||
}
|
||||
|
||||
/**
|
||||
* Load translations.
|
||||
*
|
||||
|
@ -111,7 +111,7 @@ return [
|
||||
'resource' => ['path' => 'Http/Resources', 'generate' => false],
|
||||
'asset' => ['path' => 'Resources/assets', 'generate' => false],
|
||||
'lang' => ['path' => 'Resources/lang/en-GB', 'generate' => true],
|
||||
'views' => ['path' => 'Resources/views', 'generate' => true],
|
||||
'view' => ['path' => 'Resources/views', 'generate' => true],
|
||||
'test' => ['path' => 'Tests', 'generate' => false],
|
||||
'repository' => ['path' => 'Repositories', 'generate' => false],
|
||||
'event' => ['path' => 'Events', 'generate' => false],
|
||||
@ -122,6 +122,7 @@ return [
|
||||
'email' => ['path' => 'Emails', 'generate' => false],
|
||||
'notification' => ['path' => 'Notifications', 'generate' => false],
|
||||
'route' => ['path' => 'Routes', 'generate' => true],
|
||||
'component' => ['path' => 'View/Components', 'generate' => false],
|
||||
],
|
||||
],
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user