2017 © Pedro Peláez
 

library laragen

A Generator for Laravel 5

image

laragen/laragen

A Generator for Laravel 5

  • Wednesday, March 15, 2017
  • by xuesong
  • Repository
  • 2 Watchers
  • 16 Stars
  • 96 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 1 Open issues
  • 9 Versions
  • 13 % Grown

The README.md

Laragen

A powerful yet lightweight generator for Laravel 5.4 and php7

Installation

  1. Install via composer., (*1)

    composer require laragen/laragen --dev
    
  2. Add LaragenServiceProvider to app/Providers/AppServiceProvider.php., (*2)

    if ($this->app->environment('local')) {    
        $this->app->register(\Laragen\Laragen\LaragenServiceProvider::class);
    }
    
  3. Publish config files., (*3)

    bash php artisan vendor:publish --tag=laragen.config, (*4)

Quick Look

```bash
php artisan laragen:model User
php artisan laragen:model --all

php artisan laragen:api User
php artisan laragen:api User --model --actions=index,view

php artisan laragen:channel Sms
php artisan laragen:channel Sms --message=mobile,content
php artisan laragen:message Sms
php artisan laragen:message Sms --attributes=mobie,content
```

Config

```php return [ 'model' => [ 'path' => 'Models', // path after app/ 'soft_delete' => true, //add deleted_at for $dates 'traits' => [], // traits for model 'parent_class' => 'Illuminate\Database\Eloquent\Model', 'ignore_admin_tables' => true, //ignore admin tables generated by laravel-admin plugin 'ignore_tables' => ['jobs', 'migrations', 'notifications'], //ignore system tables 'morph_many' => [ //see https://laravel.com/docs/5.4/eloquent-relationships# polymorphic-relations 'Comment' => ['News', 'Post'], 'Like' => ['News', 'Post'], ],, (*5)

  ],
  'api' => [
      'path' => 'Api', // path after `app/Controllers/`
      'version' => 1, // real path is `app/Controllers/{path}/V{version}`
      'parent_class' => 'App\Http\Controllers\Controller',
  ],

]; ```, (*6)

Sample Output

  1. Generate Eloquent Model Class., (*7)

    <?php
    namespace App\Models;
    
    use Illuminate\Database\Eloquent\Model;
    use Illuminate\Database\Eloquent\Relations\BelongsTo;
    use Illuminate\Database\Eloquent\Relations\BelongsToMany;
    use Illuminate\Database\Eloquent\Relations\HasMany;
    use Illuminate\Database\Eloquent\Relations\MorphMany;
    use Illuminate\Database\Eloquent\Relations\MorphTo;
    use Illuminate\Database\Eloquent\SoftDeletes;
    use Illuminate\Notifications\Notifiable;
    
    class Comment extends Model
    {
        use SoftDeletes;
    
        public $fillable = ['user_id', 'content', 'commentable_id', 'commentable_type'];
    
        public $casts = [];
    
        public $appends = [];
    
        public $dates = ['deleted_at'];
    
    
        /**
         * Get user
         * @return BelongsTo
         */
        public function user(): BelongsTo
        {
            return $this->belongsTo(User::class);
        }
    
    
        /**
         * Get commentable model
         * @return MorphTo
         */
        public function commentable(): MorphTo
        {
            return $this->morphTo();
        }
    
    }
    

Any issue or pull request is appreciated :)

The Versions

15/03 2017

dev-master

9999999-dev

A Generator for Laravel 5

  Sources   Download

MIT

The Requires

 

by Johnny Wu

15/03 2017

v0.2.4

0.2.4.0

A Generator for Laravel 5

  Sources   Download

MIT

The Requires

 

by Johnny Wu

15/03 2017

v0.2.3

0.2.3.0

A Generator for Laravel 5

  Sources   Download

MIT

The Requires

 

by Johnny Wu

13/03 2017

v0.2.2

0.2.2.0

A Generator for Laravel 5

  Sources   Download

MIT

The Requires

 

by Johnny Wu

10/03 2017

v0.2.1

0.2.1.0

A Generator for Laravel 5

  Sources   Download

MIT

The Requires

 

by Johnny Wu

10/03 2017

v0.2.0

0.2.0.0

A Generator for Laravel 5

  Sources   Download

MIT

The Requires

 

by Johnny Wu

10/03 2017

v0.1.4

0.1.4.0

A Generator for Laravel 5

  Sources   Download

MIT

The Requires

 

by Johnny Wu

09/03 2017

v0.1.3

0.1.3.0

A Generator for Laravel 5

  Sources   Download

MIT

The Requires

 

by Johnny Wu

08/03 2017

v0.1.2

0.1.2.0

A Generator for Laravel 5

  Sources   Download

MIT

The Requires

 

by Johnny Wu