Composable Generator
The Composable Generator Command, will create a new Vue Composable for the provided Module with a very basic boilerplate code. If you want to create a new ReportComposable
file, for the Customer
Module, you can run the following command:
bash
php artisan modular:make-composable Customer ReportComposable
And a new ReportComposable.vue
file will be created at resources/js/Modules/Customer/Composables
folder.
bash
./resources/js/Pages/Customer
├── Components
│ └── CustomerReport.vue
├── Composables
│ └── useReportComposable.js
├── CustomerForm.vue
└── CustomerIndex.vue
This way, you can easily import local composables required by your Components, keeping your Components cleaner and organized.
vue
<!-- ./resources/js/Pages/Customer/CustomerReport.vue -->
<template>...</template>
<script setup>
import useReportComposable from './Composables/useReportComposable'
...
</script>