haakco / reliese-laravel-models
Fork of Reliese Components for Laravel Framework code generation. With patches for postgresql, and a couple other things.
Installs: 3 295
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 2
Forks: 316
Open Issues: 0
Requires
- php: ^7.3|^8.0
- doctrine/dbal: >=2.5
- illuminate/console: >=5.1
- illuminate/contracts: >=5.1
- illuminate/database: >=5.1
- illuminate/filesystem: >=5.1
- illuminate/support: >=5.1
Requires (Dev)
- fzaninotto/faker: ~1.4
- mockery/mockery: >=1.4
- phpunit/phpunit: ^9
- dev-master
- v3.0.2
- v3.0.1
- v2.0.2
- v2.0.1
- v1.x-dev
- v1.9.13
- v1.3.4
- v1.3.3
- v1.3.2
- v1.3.1
- v1.3.0
- v1.2.4
- v1.2.3
- v1.2.2
- v1.2.0
- v1.1.13
- v1.1.12
- v1.1.11
- v1.1.10
- v1.1.9
- v1.1.8
- v1.1.7
- v1.1.6
- v1.1.5
- v1.1.4
- v1.1.3
- v1.1.2
- v1.1.1
- v1.1.0
- v1.0.3
- v1.0.2
- v1.0.1
- v1.0.0
- v0.0.19
- v0.0.18
- v0.0.17
- v0.0.16
- v0.0.15
- v0.0.14
- v0.0.13
- v0.0.12
- v0.0.11
- v0.0.10
- v0.0.9
- v0.0.8
- v0.0.7
- v0.0.6
- v0.0.5
- v0.0.4
- v0.0.3
- v0.0.2
- v0.0.1
- dev-timhaak/master
This package is auto-updated.
Last update: 2024-10-26 10:12:26 UTC
README
This is a clone of Reliese Laravel with some submitted patches applied.
Most importantly the ones that add support for postgres.
As they don't seem to be actively maintaining this I've forked and applied the patches.
If they start actively maintaining the project and merging patches I'll remove this one as would prefer the get the acknowledgment for their hard work.
Reliese Laravel is a collection of Laravel Components which aim is to help the development process of Laravel applications by providing some convenient code-generation capabilities.
How does it work?
This package expects that you are using Laravel 5.1 or above.
You will need to import the haakco/reliese-laravel-models
package via composer:
composer require haakco/reliese-laravel-models
Configuration
Add the service provider to your config/app.php
file within the providers
key:
// ... 'providers' => [ /* * Package Service Providers... */ Reliese\Coders\CodersServiceProvider::class, ], // ...
Configuration for local environment only
If you wish to enable generators only for your local environment, you should install it via composer using the --dev option like this:
composer require haakco/reliese-laravel-models --dev
Then you'll need to register the provider in app/Providers/AppServiceProvider.php
file.
public function register() { if ($this->app->environment() == 'local') { $this->app->register(\Reliese\Coders\CodersServiceProvider::class); } }
Models
Add the models.php
configuration file to your config
directory and clear the config cache:
php artisan vendor:publish --tag=reliese-models php artisan config:clear
Usage
Assuming you have already configured your database, you are now all set to go.
- Let's scaffold some of your models from your default connection.
php artisan code:models
- You can scaffold a specific table like this:
php artisan code:models --table=users
- You can also specify the connection:
php artisan code:models --connection=mysql
- If you are using a MySQL database, you can specify which schema you want to scaffold:
php artisan code:models --schema=shop
Customizing Model Scaffolding
To change the scaffolding behaviour you can make config/models.php
configuration file
fit your database needs. Check it out ;-)
Tips
1. Keeping model changes
You may want to generate your models as often as you change your database. In order
not to lose you own model changes, you should set base_files
to true
in your config/models.php
.
When you enable this feature your models will inherit their base configurations from base models. You should avoid adding code to your base models, since you will lose all changes when they are generated again.
Note: You will end up with two models for the same table and you may think it is a horrible idea to have two classes for the same thing. However, it is up to you to decide whether this approach gives value to your project :-)
Support
For the time being, this package only supports MySQL databases. Support for other databases will be added soon.