added view components support for modules
This commit is contained in:
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.
|
||||
*
|
||||
|
Reference in New Issue
Block a user