pkboom/laravel-inertia-vue-component
Opinionated Inertia Vue Component Creator
Installation
Install the package via composer:
composer require pkboom/laravel-inertia-vue-component
Usage
Create a new controller, which contains Inertia:render.
// SomeController.php
public function index() {
return Inertia::render('Some/Index', [
'foo' => 'foo',
'bar' => 'bar',
]);
}
Run this command.
php artisan make:inertia-vue-component <Controller Name>
// e.g. php artisan make:inertia-vue-component SomeController
js/Pages/Some/Index.vue is created with props
export default {
props: {
foo: String,
bar: String,
}
...
}
To add a prop to an existing component, first add a new key => value to Inertia::render.
// SomeController.php
public function index() {
return Inertia::render('Some/Index', [
'foo' => 'foo',
'bar' => 'bar',
'new' => 'new',
]);
}
Run this command.
php artisan make:inertia-vue-component SomeController
A new prop is created in js/Pages/Some/Index.vue.
export default {
props: {
new: String,
foo: String,
bar: String,
}
...
}
Publish to edit stub.
php artisan vendor:publish --provider="Pkboom\InertiaVueComponent\InertiaVueComponentServiceProvider"
Related Packages
doctrine/dbal
Powerful PHP database abstraction layer (DBAL) with many features for database s...
637,827,751
9,703
laravel/serializable-closure
Laravel Serializable Closure provides an easy and secure way to serialize closur...
413,412,504
609
Version History
| Version | Released | PHP | License |
|---|---|---|---|
| 0.23 | ^8.0 | MIT | |
| 0.22 | ^8.0 | MIT | |
| 0.21 | ^8.0 | MIT | |
| 0.2 | ^8.0 | MIT | |
| 0.1 | ^8.0 | MIT |