Giter Site home page Giter Site logo

laravelscaffoldinginfyomsample's Introduction

LaravelScaffoldingInfyOmSample

  1. Laravelプロジェクトの作成
$ laravel new LaravelScaffoldingInfyOmSample
$ cd LaravelScaffoldingInfyOmSample

Laravel5.4以上、MySQL5.7.7未満の場合はapp\Providers\AppServiceProvider.phpを以下のように変更する

use Illuminate\Support\Facades\Schema;
    public function boot()
    {
        Schema::defaultStringLength(191);
    }

認証を有効化する

$ php artisan make:auth
$ php artisan migrate
  1. InfyOm Laravel Generatorのインストール

composer.json に以下を追加する

"require": {
    "infyomlabs/laravel-generator": "5.8.x-dev",
    "laravelcollective/html": "^5.8.0",
    "infyomlabs/adminlte-templates": "5.8.x-dev",
    "infyomlabs/swagger-generator": "dev-master",
    "appointer/swaggervel": "dev-master",
    "doctrine/dbal": "~2.3"
}

以下のコマンドを実行する

$ composer update

config/app.phpに以下のサービスプロバイダ(Service Providers)を追加する

Collective\Html\HtmlServiceProvider::class,
Laracasts\Flash\FlashServiceProvider::class,
Prettus\Repository\Providers\RepositoryServiceProvider::class,
\InfyOm\Generator\InfyOmGeneratorServiceProvider::class,
\InfyOm\AdminLTETemplates\AdminLTETemplatesServiceProvider::class,

config/app.phpに以下のエイリアス(Aliases)を追加する

'Form'      => Collective\Html\FormFacade::class,
'Html'      => Collective\Html\HtmlFacade::class,
'Flash'     => Laracasts\Flash\Flash::class,

以下のコマンドを実行する

$ php artisan vendor:publish

app\Providers\RouteServiceProvider.phpのmapApiRoutes関数の中身を以下に変更する

Route::prefix('api')
    ->middleware('api')
    ->as('api.')
    ->namespace($this->namespace."\\API")
    ->group(base_path('routes/api.php'));

以下のコマンドを実行する

$ php artisan infyom:publish
$ php artisan infyom.publish:layout
  1. InfyOm Laravel Generatorコマンドの実行

※Soft Delete(論理削除)について

デフォルトで論理削除が有効化されているので、必要に応じてconfig/infyom/laravel_generator.phpの以下の項目を編集して無効化する。論理削除を使用する場合はテーブルにdeletd_atカラムが存在することを確認しておく

'options' => 'softDelete' => true

スキャフォールディングを実行する

# $ php artisan infyom:scaffold $MODEL_NAME --fromTable --tableName=$TABLE_NAME

$ php artisan infyom:scaffold ItemType --fromTable --tableName=itemtype
$ php artisan infyom:scaffold Item --fromTable --tableName=item

Item、ItemTypeモデルのそれぞれについて、idカラムのバリデーションを解除する (AUTO INCREMENTを設定しているため)

    public static $rules = [
        'id' => 'required', // ←この行を削除
        ...
    ];

Copyright (c) 2019 YA-androidapp(https://github.com/YA-androidapp) All rights reserved.

laravelscaffoldinginfyomsample's People

Contributors

dependabot[bot] avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.