All Projects → reliese → Laravel

reliese / Laravel

Licence: mit
Laravel Model Generator

Projects that are alternatives of or similar to Laravel

Laravel Eloquent Query Cache
Adding cache on your Laravel Eloquent queries' results is now a breeze.
Stars: ✭ 529 (-26.01%)
Mutual labels:  eloquent, database, laravel
Gorose
GoRose(go orm), a mini database ORM for golang, which inspired by the famous php framwork laravle's eloquent. It will be friendly for php developer and python or ruby developer. Currently provides six major database drivers: mysql,sqlite3,postgres,oracle,mssql, Clickhouse.
Stars: ✭ 947 (+32.45%)
Mutual labels:  eloquent, database, laravel
Larawiz
Larawiz is a easy project scaffolder for Laravel
Stars: ✭ 28 (-96.08%)
Mutual labels:  database, laravel, scaffold
Laravel Tags
Add tags and taggable behaviour to your Laravel app
Stars: ✭ 1,026 (+43.5%)
Mutual labels:  eloquent, database, laravel
Laravel Translatable
A Laravel package for multilingual models
Stars: ✭ 624 (-12.73%)
Mutual labels:  eloquent, database, laravel
Laravel Database Encryption
A package for automatically encrypting and decrypting Eloquent attributes in Laravel 5.5+, based on configuration settings.
Stars: ✭ 238 (-66.71%)
Mutual labels:  eloquent, database, laravel
Eloquent Driver
A package that allows you to store Statamic entries in a database.
Stars: ✭ 28 (-96.08%)
Mutual labels:  eloquent, database, laravel
Laravel Optimistic Locking
Adds optimistic locking feature to eloquent models.
Stars: ✭ 71 (-90.07%)
Mutual labels:  eloquent, database, laravel
Laravel Settings
Store key value pair in database as settings
Stars: ✭ 107 (-85.03%)
Mutual labels:  eloquent, database, laravel
Laravel Migrate Fresh
An artisan command to build up a database from scratch
Stars: ✭ 179 (-74.97%)
Mutual labels:  eloquent, database, laravel
Lada Cache
A Redis based, fully automated and scalable database cache layer for Laravel
Stars: ✭ 424 (-40.7%)
Mutual labels:  eloquent, database, laravel
Laravel Cascade Soft Deletes
Cascading deletes for Eloquent models that implement soft deletes
Stars: ✭ 498 (-30.35%)
Mutual labels:  eloquent, laravel
Laravel Model Status
Easily add statuses to your models
Stars: ✭ 510 (-28.67%)
Mutual labels:  eloquent, laravel
Squire
A library of static Eloquent models for common fixture data.
Stars: ✭ 496 (-30.63%)
Mutual labels:  eloquent, laravel
Laravel Mediable
Laravel-Mediable is a package for easily uploading and attaching media files to models with Laravel 5.
Stars: ✭ 541 (-24.34%)
Mutual labels:  eloquent, laravel
Compoships
Multi-columns relationships for Laravel's Eloquent ORM
Stars: ✭ 537 (-24.9%)
Mutual labels:  eloquent, laravel
Laravel Model States
State support for models
Stars: ✭ 559 (-21.82%)
Mutual labels:  eloquent, laravel
Laracsv
A Laravel package to easily generate CSV files from Eloquent model
Stars: ✭ 583 (-18.46%)
Mutual labels:  eloquent, laravel
Laravel Schemaless Attributes
Add schemaless attributes to Eloquent models
Stars: ✭ 595 (-16.78%)
Mutual labels:  eloquent, laravel
Laravel Moderation
A simple Content Moderation System for Laravel 5.* that allows you to Approve or Reject resources like posts, comments, users, etc.
Stars: ✭ 487 (-31.89%)
Mutual labels:  eloquent, laravel

Laravel Model Generator

Build Status Latest Stable Version Total Downloads Latest Unstable Version License

Laravel Model Generator aims to speed up the development process of Laravel applications by providing some convenient code-generation capabilities. The tool inspects your database structure, including column names and foreign keys, in order to automatically generate Models that have correctly typed properties, along with any relationships to other Models.

How does it work?

This package expects that you are using Laravel 5.1 or above. You will need to import the reliese/laravel package via composer:

Configuration

It is recommended that this package should only be used on a local environment for security reasons. You should install it via composer using the --dev option like this:

composer require reliese/laravel --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

Generating models with artisan

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 supports MySQL, PostgreSQL and SQLite databases. Support for other databases are encouraged to be added through pull requests.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].