pkeidel/dbtolaravel

Reads a database and creates the migrations, models, controllers and blades for the tables

Installs: 196

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 1

Forks: 1

Open Issues: 0

Language:HTML

v1.2.1 2020-03-23 09:58 UTC

README

687474703a2f2f666f7274686562616467652e636f6d2f696d616765732f6261646765732f6d616b65732d70656f706c652d736d696c652e737667

Build Status

With this package it is possible to auto-generate a lot of needed files if you already have an existing database schema. Files that can be generated:

  • migration
  • model
  • views to view a single model, edit a single model and list all models
  • controller
  • route
  • seeder with existing data

Install

composer require pkeidel/dbtolaravel

DB2Laravel is only active if APP_DEBUG=true or DBTOLARAVEL_ENABLED=true

< Laravel 5.5

As always, add it to your app/config.php:

'providers' => [
    // ....
    PKeidel\DBtoLaravel\Providers\DBtoLaravelServiceProvider::class,
]

>= Laravel 5.5

// get you a coffee, you're done

usage

  • visit yoururl/dbtolaravel, for example http://127.0.0.1/dbtolaravel
  • you can select a configured database connection
  • in the table you can create all files of view a diff to compare the file to an existing one

Filter Tables

Register a filter in your AppServiceProvider.php:

DBtoLaravelHelper::$FILTER = function($table) {
    return strpos($table, 'eyewitness_io_') !== 0 && strpos($table, 'oauth_') !== 0;
};

Override type mapping

DBtoLaravelHelper::$MAPPINGS = ['enum' => 'string', 'bytea' => 'binary', 'macaddr' => 'string'];