Download the PHP package dev-lnk/moonshine-builder without Composer
On this page you can find all versions of the php package dev-lnk/moonshine-builder. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package moonshine-builder
Creating projects using schemas for the MoonShine.
Hello, Laravel and MoonShine User!
This package allows you to describe the entire project structure using a JSON or SQL
table schema and generate the necessary files, such as:
Installation:
Configuration:
Publish the package configuration file:
In the configuration file, specify the path to your JSON schemas:
Now you can run the command:
You will be given options as to which scheme to use when generating the code, form example:
Creating a Schema
In the builds_dir
directory, create a schema file, for example, category.json
:
To generate project files, run the command:
A more detailed example with multiple resources and relationships can be found here.
Creation from sql table
You can create a resource using a table schema.You must specify the table name and select table
type. Example:
Result:
After generating the files, make sure to register all new Resources in your MoonShineServiceProvider
Timestamps
You can specify the timestamp: true flag
The created_at and updated_at fields will be added to your code. If you manually specified the created_at and updated_at fields, the timestamps
flag will be automatically set to true
Soft deletes
Works similarly to the timestamps
flag and the deleted_at
field
Flags for generating files
Using flags withResource
, withModel
, withMigration
, you can configure what exactly you want to generate for your resource
JSON Schema
For hints in your IDE or for a more detailed description of the json structure, you can use this file
Bulk table import
If you already have a project with its own database and you don't want to build the resources one by one, you can use the following command:
First, select all your Pivot tables to correctly form the BelongsToMany relationship, then select all the necessary tables for which you want to generate resources.
A JSON schema will be generated, which you can edit and apply if desired.