add to composer.json, (*1)
"require-dev": {
"dam1r89/proto-generator": "dev-master",
"ivanmijatovic89/proto-view-generator": "dev-master"
},
add to app/config/app.php
, (*2)
'providers' => [
...
'ivanmijatovic89\ProtoViewGenerator\ProtoViewGeneratorServiceProvider',
'dam1r89\ProtoGenerator\ProtoGeneratorServiceProvider',
'Illuminate\Html\HtmlServiceProvider',
]
'aliases' =>
[
...
'Form' => 'Illuminate\Html\FormFacade',
'HTML' => 'Illuminate\Html\HtmlFacade',
]
Go to domain.com/protomaker
For Modules install
https://github.com/caffeinated/modules, (*3)
"require": {
"caffeinated/modules": "~1.0"
}
Service Provider, (*4)
'providers' => [
'Caffeinated\Modules\ModulesServiceProvider'
]
Facade, (*5)
'aliases' =>
[
'Module' => 'Caffeinated\Modules\Facades\Module'
]
publish config file - look at docs, (*6)
Translations
Instal Laravel-Translatable, (*7)
https://github.com/dimsav/laravel-translatable, (*8)
Step 1: Install translation package
Add the package in your composer.json by executing the command., (*9)
composer require dimsav/laravel-translatable
Next, add the service provider to app/config/app.php
, (*10)
'Dimsav\Translatable\TranslatableServiceProvider',
Step 2: Publish Translation Config
php artisan vendor:publish
//or
php artisan vendor:publish --provider="Dimsav\Translatable\TranslatableServiceProvider"
Examples with command line
Than to make module type:, (*11)
php artisan module:make vendor
than create crud, (*12)
php artisan proto vendor --fields='{"name":{"type":"text"},"user_id":{"type":"integer","relation":{"class":"\\App\\User","field":"email","name":"user","type":"hasOne"}}}' --data='{"namespace":"App\\Modules\\Vendor\\"}' --output="App/Modules/Vendor" --output="App/Modules/Vendor" --template="modul" -r
than migrate vendor module, (*13)
php artisan module:migrate vendor
Example for Posts
php artisan module:make post
//old without namespace - delete latter
//php artisan proto post --fields='{"name":{"type":"text","validation":"required|max:25|min:8"}, "body":{"type":"text"},"user_id":{"type":"integer","relation":{"class":"\\App\\User","field":"email","name":"user","type":"hasOne"}},"vendors":{"type":"integer","relation":{"class":"\\App\\Modules\\Vendor\\Models\\Vendor","field":"name","name":"vendors","type":"belongsToMany"}}}' --output="App/Modules/Post" --template="modul" -r
php artisan proto post --fields='{"name":{"type":"text","validation":"required|max:25|min:8"}, "body":{"type":"text"},"user_id":{"type":"integer","relation":{"class":"\\App\\User","field":"email","name":"user","type":"hasOne"}},"vendors":{"type":"integer","relation":{"class":"\\App\\Modules\\Vendor\\Models\\Vendor","field":"name","name":"vendors","type":"belongsToMany"}}}' --data='{"namespace":"App\\Modules\\Post\\"}' --output="App/Modules/Post" --template="modul" -r
php artisan module:migrate post
Navigate to to domain/vendors, (*14)