Share
Embed
20170701 Eloquent 核心解構 讓 Laravel 支援更多資料庫
LaravelConf Taiwan 2017
講師:墨嗓 (陳佑竹)
主要涵蓋範圍,介紹 Eloquent 的結構,以及如何讓 Eloquent 支援更多的資料庫。
#Laravel #Eloquent #DBMaker #PHP
mouson(墨嗓)
July 01, 2017
Transcript
127 slides
-
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 Eloquent 核⼼心解構 讓
Laravel ⽀支援更更多資料庫 墨墨嗓 (陳佑⽵竹) 2017-07-01 LaravelConf Taiwan 2017 -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 墨墨嗓 (陳佑⽵竹) •
@mouson • https://fb.me/mouson • https://github.com/mouson • [email protected] • 世成科技 系統分析師 • Laravel Taiwan、DevOps Taiwan 志⼯工 • Laravel 導入、系統規劃、分析、 重構 墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 三不會⼀一只有 • 只有結構上的概念念介紹
• 不會介紹有什什麼 Design Pattern • 不會做出⼀一個 Eloquent Driver • 不會 Live Coding -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 Motivation DBMaker DB
Exec SQL Result Application Code -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 Motivation DBMaker DB
Exec SQL Result Application Code source: https://zh.wikipedia.org/wiki/File:Spaghetti.jpg -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 Motivation DBMaker DB
Exec SQL Result Application Code -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 Motivation DBMaker DB
Exec SQL Result Application Code source: https://zh.wikipedia.org/wiki/File:Spaghetti.jpg https://zh.wikipedia.org/wiki/波动拳#/media/File:波动拳.gif -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 Motivation DBMaker DB
Exec SQL Result Application Code source: https://zh.wikipedia.org/wiki/File:Spaghetti.jpg https://zh.wikipedia.org/wiki/波动拳#/media/File:波动拳.gif https://commons.wikimedia.org/w/index.php?curid=165211 -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 Motivation DBMaker DB
Exec SQL Result Application Code source: https://zh.wikipedia.org/wiki/File:Spaghetti.jpg https://zh.wikipedia.org/wiki/波动拳#/media/File:波动拳.gif https://commons.wikimedia.org/w/index.php?curid=165211 -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 Refactoring DBMaker Application
Code DB Exec SQL Call Result Result Route Controller View Model -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 Refactoring DBMaker Laravel
Application Code DB Exec SQL Call Result Result Route Controller View Model -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 Refactoring DBMaker Laravel
Application Code DB Exec SQL Call Result Result Route Controller View Model ??? ??? -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 Structure MySQL SQLite
PostgreSQL SQL Server Laravel Model Application Code DB Exec SQL Call Result Result Eloquent Model Query Builder DB Connection (PHP Data Objects) Migrations -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 Structure MySQL SQLite
PostgreSQL SQL Server Laravel Model Application Code DB Exec SQL Call Result Result Eloquent Model Query Builder DB Connection (PHP Data Objects) Migrations DBMaker -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 Laravel Connection MySQL
SQLite PostgreSQL SQL Server Laravel Model Application Code DB Exec SQL Call Result Result Eloquent Model Query Builder DB Connection (PHP Data Objects) Migrations Config/database.php -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 Laravel Connection MySQL
SQLite PostgreSQL SQL Server Laravel Model Application Code DB Exec SQL Call Result Result Eloquent Model Query Builder DB Connection (PHP Data Objects) Migrations Database ServiceProvider \Illuminate\Database Config/database.php -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 Laravel Connection MySQL
SQLite PostgreSQL SQL Server Laravel Model Application Code DB Exec SQL Call Result Result Eloquent Model Query Builder DB Connection (PHP Data Objects) Migrations Database ServiceProvider \Illuminate\Database DatabaseManager \Illuminate\Database Config/database.php -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 Laravel Connection MySQL
SQLite PostgreSQL SQL Server Laravel Model Application Code DB Exec SQL Call Result Result Eloquent Model Query Builder DB Connection (PHP Data Objects) Migrations Database ServiceProvider \Illuminate\Database DatabaseManager \Illuminate\Database ConnectionFactory \Illuminate\Database\Connectors Config/database.php -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 Laravel Connection MySQL
SQLite PostgreSQL SQL Server Laravel Model Application Code DB Exec SQL Call Result Result Eloquent Model Query Builder DB Connection (PHP Data Objects) Migrations Database ServiceProvider \Illuminate\Database DatabaseManager \Illuminate\Database ConnectionFactory \Illuminate\Database\Connectors Connection \Illuminate\Database Config/database.php -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 Laravel Connection MySQL
SQLite PostgreSQL SQL Server Laravel Model Application Code DB Exec SQL Call Result Result Eloquent Model Query Builder DB Connection (PHP Data Objects) Migrations Database ServiceProvider \Illuminate\Database DatabaseManager \Illuminate\Database ConnectionFactory \Illuminate\Database\Connectors Connection \Illuminate\Database Config/database.php -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 Laravel Connection MySQL
SQLite PostgreSQL SQL Server Laravel Model Application Code DB Exec SQL Call Result Result Eloquent Model Query Builder DB Connection (PHP Data Objects) Migrations Database ServiceProvider \Illuminate\Database DatabaseManager \Illuminate\Database ConnectionFactory \Illuminate\Database\Connectors Connection \Illuminate\Database Connector \Illuminate\Database\Connectors Config/database.php -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 Laravel Connection MySQL
SQLite PostgreSQL SQL Server Laravel Model Application Code DB Exec SQL Call Result Result Eloquent Model Query Builder DB Connection (PHP Data Objects) Migrations Database ServiceProvider \Illuminate\Database DatabaseManager \Illuminate\Database ConnectionFactory \Illuminate\Database\Connectors Connection \Illuminate\Database Connector \Illuminate\Database\Connectors Config/database.php -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 Laravel Connection MySQL
SQLite PostgreSQL SQL Server Laravel Model Application Code DB Exec SQL Call Result Result Eloquent Model Query Builder DB Connection (PHP Data Objects) Migrations Database ServiceProvider \Illuminate\Database DatabaseManager \Illuminate\Database ConnectionFactory \Illuminate\Database\Connectors Connection \Illuminate\Database Connector \Illuminate\Database\Connectors PDO \PDO Config/database.php -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 Laravel Connection MySQL
SQLite PostgreSQL SQL Server Laravel Model Application Code DB Exec SQL Call Result Result Eloquent Model Query Builder DB Connection (PHP Data Objects) Migrations Database ServiceProvider \Illuminate\Database DatabaseManager \Illuminate\Database ConnectionFactory \Illuminate\Database\Connectors Connection \Illuminate\Database Connector \Illuminate\Database\Connectors PDO \PDO Config/database.php MySQL SQLServe SQLite -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 Laravel Connection MySQL
SQLite PostgreSQL SQL Server Laravel Model Application Code DB Exec SQL Call Result Result Eloquent Model Query Builder DB Connection (PHP Data Objects) Migrations Database ServiceProvider \Illuminate\Database DatabaseManager \Illuminate\Database ConnectionFactory \Illuminate\Database\Connectors Connection \Illuminate\Database Connector \Illuminate\Database\Connectors PDO \PDO Config/database.php MySQL SQLServe SQLite -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 Laravel Connection MySQL
SQLite PostgreSQL SQL Server Laravel Model Application Code DB Exec SQL Call Result Result Eloquent Model Query Builder DB Connection (PHP Data Objects) Migrations Database ServiceProvider \Illuminate\Database DatabaseManager \Illuminate\Database ConnectionFactory \Illuminate\Database\Connectors Connection \Illuminate\Database Connector \Illuminate\Database\Connectors PDO \PDO Config/database.php MySQL SQLServe SQLite -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 PDO provides a
data- access abstraction MySQL SQLServer SQLite -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 PDO provides a
data- access abstraction MySQL SQLServer SQLite MySQL select `id`, `name` from `users` -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 PDO provides a
data- access abstraction MySQL SQLServer SQLite MySQL select `id`, `name` from `users` PHP Data Objects (PDO) $conn = new PDO(...) $conn->query($sql); ... -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 PDO provides a
data- access abstraction MySQL SQLServer SQLite MySQL select `id`, `name` from `users` MS SQLServer PHP Data Objects (PDO) $conn = new PDO(...) $conn->query($sql); ... -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 PDO provides a
data- access abstraction MySQL SQLServer SQLite MySQL select `id`, `name` from `users` MS SQLServer select [id], [name] from [users] PHP Data Objects (PDO) $conn = new PDO(...) $conn->query($sql); ... -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 PDO provides a
data- access abstraction MySQL SQLServer SQLite MySQL select `id`, `name` from `users` MS SQLServer select [id], [name] from [users] PHP Data Objects (PDO) $conn = new PDO(...) $conn->query($sql); ... -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 PDO provides a
data- access abstraction MySQL SQLServer SQLite MySQL select `id`, `name` from `users` MS SQLServer select [id], [name] from [users] SQLite PHP Data Objects (PDO) $conn = new PDO(...) $conn->query($sql); ... -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 PDO provides a
data- access abstraction MySQL SQLServer SQLite MySQL select `id`, `name` from `users` MS SQLServer select [id], [name] from [users] SQLite select "id", "name" from "users" PHP Data Objects (PDO) $conn = new PDO(...) $conn->query($sql); ... -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 MySQL SQLServer SQLite
MySQL select `id`, `name` from `users` MS SQLServer select [id], [name] from [users] SQLite select "id", "name" from "users" PHP Data Objects (PDO) $conn = new PDO(...) $conn->query($sql); ... "Standard" Query Lang ? -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 Laravel Connection Database
ServiceProvider \Illuminate\Database DatabaseManager \Illuminate\Database ConnectionFactory \Illuminate\Database\Connectors Connection \Illuminate\Database Connector \Illuminate\Database\Connectors PDO \PDO Config/database.php MySQL SQLServe SQLite MySQL SQLite PostgreSQL SQL Server Laravel Model Application Code DB Exec SQL Call Result Result Eloquent Model Query Builder DB Connection (PHP Data Objects) Migrations -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 Laravel Connection Database
ServiceProvider \Illuminate\Database DatabaseManager \Illuminate\Database ConnectionFactory \Illuminate\Database\Connectors Connection \Illuminate\Database Connector \Illuminate\Database\Connectors PDO \PDO Config/database.php MySQL SQLServe SQLite Builder \Illuminate\Database\Query \Illuminate\Database\Schema MySQL SQLite PostgreSQL SQL Server Laravel Model Application Code DB Exec SQL Call Result Result Eloquent Model Query Builder DB Connection (PHP Data Objects) Migrations -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 Laravel Connection Database
ServiceProvider \Illuminate\Database DatabaseManager \Illuminate\Database ConnectionFactory \Illuminate\Database\Connectors Connection \Illuminate\Database Connector \Illuminate\Database\Connectors PDO \PDO Config/database.php MySQL SQLServe SQLite Builder \Illuminate\Database\Query \Illuminate\Database\Schema MySQL SQLite PostgreSQL SQL Server Laravel Model Application Code DB Exec SQL Call Result Result Eloquent Model Query Builder DB Connection (PHP Data Objects) Migrations -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 Builder MySQL SQLServer
SQLite MySQL select `id`, `name` from `users` MS SQLServer select [id], [name] from [users] SQLite select "id", "name" from "users" PDO Builder -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 Builder MySQL SQLServer
SQLite MySQL select `id`, `name` from `users` MS SQLServer select [id], [name] from [users] SQLite select "id", "name" from "users" PDO Builder DB::table('users') ->select('id','name') ->get(); -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 Builder MySQL SQLServer
SQLite MySQL select `id`, `name` from `users` MS SQLServer select [id], [name] from [users] SQLite select "id", "name" from "users" PDO Builder DB::table('users') ->select('id','name') ->get(); DB::table('users') ->select('id','name') ->get(); -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 Builder MySQL SQLServer
SQLite MySQL select `id`, `name` from `users` MS SQLServer select [id], [name] from [users] SQLite select "id", "name" from "users" PDO Builder DB::table('users') ->select('id','name') ->get(); -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 Laravel Connection Database
ServiceProvider \Illuminate\Database DatabaseManager \Illuminate\Database ConnectionFactory \Illuminate\Database\Connectors Connection \Illuminate\Database Connector \Illuminate\Database\Connectors PDO \PDO Config/database.php MySQL SQLServe SQLite Builder \Illuminate\Database\Query \Illuminate\Database\Schema MySQL SQLite PostgreSQL SQL Server Laravel Model Application Code DB Exec SQL Call Result Result Eloquent Model Query Builder DB Connection (PHP Data Objects) Migrations -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 MySQL SQLite PostgreSQL
SQL Server Laravel Model Application Code DB Exec SQL Call Result Result Eloquent Model Query Builder DB Connection (PHP Data Objects) Migrations Laravel Connection Database ServiceProvider \Illuminate\Database DatabaseManager \Illuminate\Database ConnectionFactory \Illuminate\Database\Connectors Connection \Illuminate\Database Connector \Illuminate\Database\Connectors PDO \PDO Config/database.php MySQL SQLServe SQLite Builder \Illuminate\Database\Query \Illuminate\Database\Schema Grammar \Illuminate\Database -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 Migrations MySQL SQLite
PostgreSQL SQL Server Laravel Model Application Code DB Exec SQL Call Result Result Eloquent Model Query Builder DB Connection (PHP Data Objects) Migrations -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 Migrations MySQL SQLite
PostgreSQL SQL Server Laravel Model Application Code DB Exec SQL Call Result Result Eloquent Model Query Builder DB Connection (PHP Data Objects) Migrations -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 Build a Building
MySQL SQLite PostgreSQL SQL Server Laravel Model Application Code DB Exec SQL Call Result Result Eloquent Model Query Builder DB Connection (PHP Data Objects) Migrations -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 Build a Building
MySQL SQLite PostgreSQL SQL Server Laravel Model Application Code DB Exec SQL Call Result Result Eloquent Model Query Builder DB Connection (PHP Data Objects) Migrations Blueprint -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 Build a Building
MySQL SQLite PostgreSQL SQL Server Laravel Model Application Code DB Exec SQL Call Result Result Eloquent Model Query Builder DB Connection (PHP Data Objects) Migrations Blueprint Builder -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 Build a Building
MySQL SQLite PostgreSQL SQL Server Laravel Model Application Code DB Exec SQL Call Result Result Eloquent Model Query Builder DB Connection (PHP Data Objects) Migrations Blueprint Builder Grammar -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 Build a Building
MySQL SQLite PostgreSQL SQL Server Laravel Model Application Code DB Exec SQL Call Result Result Eloquent Model Query Builder DB Connection (PHP Data Objects) Migrations Blueprint Builder Grammar Worker -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 Build a Building
MySQL SQLite PostgreSQL SQL Server Laravel Model Application Code DB Exec SQL Call Result Result Eloquent Model Query Builder DB Connection (PHP Data Objects) Migrations Blueprint Builder Grammar Building Worker -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 class CreateUsersTable extends
Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::create('users', function (Blueprint $table) { $table->increments('id'); $table->string('name'); $table->string('email')->unique(); $table->string('password'); $table->rememberToken(); $table->timestamps(); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::dropIfExists('users'); } } Migrations MySQL SQLite PostgreSQL SQL Server Laravel Model Application Code DB Exec SQL Call Result Result Eloquent Model Query Builder DB Connection (PHP Data Objects) Migrations -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 class CreateUsersTable extends
Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::create('users', function (Blueprint $table) { $table->increments('id'); $table->string('name'); $table->string('email')->unique(); $table->string('password'); $table->rememberToken(); $table->timestamps(); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::dropIfExists('users'); } } Schema Schema Schema Migration MySQL SQLite PostgreSQL SQL Server Laravel Model Application Code DB Exec SQL Call Result Result Eloquent Model Query Builder DB Connection (PHP Data Objects) Migrations -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 Migrations Schema Illuminate\Support\Facades
MigrationServiceProvider DatabaseMigrationRepository Migrator MigrationCreator MySQL SQLite PostgreSQL SQL Server Laravel Model Application Code DB Exec SQL Call Result Result Eloquent Model Query Builder DB Connection (PHP Data Objects) Migrations -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 Migrations Schema Illuminate\Support\Facades
public static function connection($name) { return static::$app['db']->connection($name) ->getSchemaBuilder(); } MySQL SQLite PostgreSQL SQL Server Laravel Model Application Code DB Exec SQL Call Result Result Eloquent Model Query Builder DB Connection (PHP Data Objects) Migrations -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 Migrations Schema Illuminate\Support\Facades
Connection Illuminate\Database Builder Illuminate\Database\Schema DB public static function connection($name) { return static::$app['db']->connection($name) ->getSchemaBuilder(); } MySQL SQLite PostgreSQL SQL Server Laravel Model Application Code DB Exec SQL Call Result Result Eloquent Model Query Builder DB Connection (PHP Data Objects) Migrations -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 Migrations Schema Illuminate\Support\Facades
Connection Illuminate\Database Builder Illuminate\Database\Schema DB MySQL SQLite PostgreSQL SQL Server Laravel Model Application Code DB Exec SQL Call Result Result Eloquent Model Query Builder DB Connection (PHP Data Objects) Migrations -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 class CreateUsersTable extends
Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::create('users', function (Blueprint $table) { $table->increments('id'); $table->string('name'); $table->string('email')->unique(); $table->string('password'); $table->rememberToken(); $table->timestamps(); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::dropIfExists('users'); } } Blueprint Schema::create('users', function (Blueprint $table) { $table->increments('id'); $table->string('name'); $table->string('email')->unique(); $table->string('password'); $table->rememberToken(); $table->timestamps(); }); MySQL SQLite PostgreSQL SQL Server Laravel Model Application Code DB Exec SQL Call Result Result Eloquent Model Query Builder DB Connection (PHP Data Objects) Migrations -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 MySQL SQLite PostgreSQL
SQL Server Laravel Model Application Code DB Exec SQL Call Result Result Eloquent Model Query Builder DB Connection (PHP Data Objects) Migrations Migrations Schema Illuminate\Support\Facades Connection Illuminate\Database Builder Illuminate\Database\Schema DB Schema::create('users', function (Blueprint $table) { $table->increments('id'); $table->string('name'); $table->string('email')->unique(); $table->string('password'); $table->rememberToken(); $table->timestamps(); }); -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 MySQL SQLite PostgreSQL
SQL Server Laravel Model Application Code DB Exec SQL Call Result Result Eloquent Model Query Builder DB Connection (PHP Data Objects) Migrations Migrations Schema Illuminate\Support\Facades Connection Illuminate\Database Builder Illuminate\Database\Schema DB public function create($table, Closure $callback) { $this->build(tap( $this->createBlueprint($table), function ($blueprint) use ($callback) { $blueprint->create(); $callback($blueprint); })); } Schema::create('users', function (Blueprint $table) { $table->increments('id'); $table->string('name'); $table->string('email')->unique(); $table->string('password'); $table->rememberToken(); $table->timestamps(); }); -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 MySQL SQLite PostgreSQL
SQL Server Laravel Model Application Code DB Exec SQL Call Result Result Eloquent Model Query Builder DB Connection (PHP Data Objects) Migrations Migrations Schema Illuminate\Support\Facades Connection Illuminate\Database Builder Illuminate\Database\Schema DB Schema::create('users', function (Blueprint $table) { $table->increments('id'); $table->string('name'); $table->string('email')->unique(); $table->string('password'); $table->rememberToken(); $table->timestamps(); }); public function create($table, Closure $callback) { $this->build(tap( $this->createBlueprint($table), function ($blueprint) use ($callback) { $blueprint->create(); $callback($blueprint); })); } -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 MySQL SQLite PostgreSQL
SQL Server Laravel Model Application Code DB Exec SQL Call Result Result Eloquent Model Query Builder DB Connection (PHP Data Objects) Migrations Migrations Schema Illuminate\Support\Facades Connection Illuminate\Database Builder Illuminate\Database\Schema DB Blueprint Illuminate\Database\Schema Schema::create('users', function (Blueprint $table) { $table->increments('id'); $table->string('name'); $table->string('email')->unique(); $table->string('password'); $table->rememberToken(); $table->timestamps(); }); public function create($table, Closure $callback) { $this->build(tap( $this->createBlueprint($table), function ($blueprint) use ($callback) { $blueprint->create(); $callback($blueprint); })); } -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 MySQL SQLite PostgreSQL
SQL Server Laravel Model Application Code DB Exec SQL Call Result Result Eloquent Model Query Builder DB Connection (PHP Data Objects) Migrations Migrations Schema Illuminate\Support\Facades Connection Illuminate\Database Builder Illuminate\Database\Schema DB Blueprint Illuminate\Database\Schema Schema::create('users', function (Blueprint $table) { $table->increments('id'); $table->string('name'); $table->string('email')->unique(); $table->string('password'); $table->rememberToken(); $table->timestamps(); }); public function create($table, Closure $callback) { $this->build(tap( $this->createBlueprint($table), function ($blueprint) use ($callback) { $blueprint->create(); $callback($blueprint); })); } -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 MySQL SQLite PostgreSQL
SQL Server Laravel Model Application Code DB Exec SQL Call Result Result Eloquent Model Query Builder DB Connection (PHP Data Objects) Migrations Migrations Schema Illuminate\Support\Facades Connection Illuminate\Database Builder Illuminate\Database\Schema DB Blueprint Illuminate\Database\Schema Schema::create('users', function (Blueprint $table) { $table->increments('id'); $table->string('name'); $table->string('email')->unique(); $table->string('password'); $table->rememberToken(); $table->timestamps(); }); protected function build(Blueprint $blueprint) { $blueprint->build($this->connection, $this->grammar); } -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 MySQL SQLite PostgreSQL
SQL Server Laravel Model Application Code DB Exec SQL Call Result Result Eloquent Model Query Builder DB Connection (PHP Data Objects) Migrations Migrations Schema Illuminate\Support\Facades Connection Illuminate\Database Builder Illuminate\Database\Schema DB Blueprint Illuminate\Database\Schema Schema::create('users', function (Blueprint $table) { $table->increments('id'); $table->string('name'); $table->string('email')->unique(); $table->string('password'); $table->rememberToken(); $table->timestamps(); }); protected function build(Blueprint $blueprint) { $blueprint->build($this->connection, $this->grammar); } Grammar Illuminate\Database\Schema\Grammars -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 MySQL SQLite PostgreSQL
SQL Server Laravel Model Application Code DB Exec SQL Call Result Result Eloquent Model Query Builder DB Connection (PHP Data Objects) Migrations Migrations Grammar Illuminate\Database\Schema\Grammars Schema Illuminate\Support\Facades Connection Illuminate\Database Builder Illuminate\Database\Schema Blueprint Illuminate\Database\Schema DB Schema::create('users', function (Blueprint $table) { $table->increments('id'); $table->string('name'); $table->string('email')->unique(); $table->string('password'); $table->rememberToken(); $table->timestamps(); }); public function build(Connection $connection, Grammar $grammar) { foreach ($this->toSql($connection, $grammar) as $statement) { $connection->statement($statement); } } -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 Migrations Grammar Illuminate\Database\Schema\Grammars
Schema Illuminate\Support\Facades Connection Illuminate\Database Builder Illuminate\Database\Schema Blueprint Illuminate\Database\Schema DB MySQL SQLite PostgreSQL SQL Server Laravel Model Application Code DB Exec SQL Call Result Result Eloquent Model Query Builder DB Connection (PHP Data Objects) Migrations -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 Migrations Grammar Illuminate\Database\Schema\Grammars
Schema Illuminate\Support\Facades Connection Illuminate\Database Builder Illuminate\Database\Schema Blueprint Illuminate\Database\Schema DB MySQL SQLite PostgreSQL SQL Server Laravel Model Application Code DB Exec SQL Call Result Result Eloquent Model Query Builder DB Connection (PHP Data Objects) Migrations -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 QueryBuilder MySQL SQLite
PostgreSQL SQL Server Laravel Model Application Code DB Exec SQL Call Result Result Eloquent Model Query Builder DB Connection (PHP Data Objects) Migrations -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 DB::table('users') ->select('id', 'name')
->get(); QueryBuilder MySQL SQLite PostgreSQL SQL Server Laravel Model Application Code DB Exec SQL Call Result Result Eloquent Model Query Builder DB Connection (PHP Data Objects) Migrations -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 QueryBuilder Grammar Illuminate\Database\Schema\Grammars
DB Illuminate\Support\Facades Connection Illuminate\Database Builder Illuminate\Database\Schema Processor Illuminate\Database\Schema\Processors DB DB::table('users') ->select('id', 'name') ->get(); MySQL SQLite PostgreSQL SQL Server Laravel Model Application Code DB Exec SQL Call Result Result Eloquent Model Query Builder DB Connection (PHP Data Objects) Migrations -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 MySQL SQLite PostgreSQL
SQL Server Laravel Model Application Code DB Exec SQL Call Result Result Eloquent Model Query Builder DB Connection (PHP Data Objects) Migrations QueryBuilder Grammar Illuminate\Database\Schema\Grammars DB Illuminate\Support\Facades Connection Illuminate\Database Builder Illuminate\Database\Schema Processor Illuminate\Database\Schema\Processors DB DB::table('users') ->select('id', 'name') ->get(); public function table($table) { return $this->query() ->from($table); } -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 MySQL SQLite PostgreSQL
SQL Server Laravel Model Application Code DB Exec SQL Call Result Result Eloquent Model Query Builder DB Connection (PHP Data Objects) Migrations QueryBuilder Grammar Illuminate\Database\Schema\Grammars DB Illuminate\Support\Facades Connection Illuminate\Database Builder Illuminate\Database\Schema Processor Illuminate\Database\Schema\Processors DB DB::table('users') ->select('id', 'name') ->get(); public function table($table) { return $this->query() ->from($table); } -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 MySQL SQLite PostgreSQL
SQL Server Laravel Model Application Code DB Exec SQL Call Result Result Eloquent Model Query Builder DB Connection (PHP Data Objects) Migrations QueryBuilder Grammar Illuminate\Database\Schema\Grammars DB Illuminate\Support\Facades Connection Illuminate\Database Builder Illuminate\Database\Schema Processor Illuminate\Database\Schema\Processors DB DB::table('users') ->select('id', 'name') ->get(); public function query() { return new QueryBuilder( $this, $this->getQueryGrammar(), $this->getPostProcessor() ); } -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 QueryBuilder Grammar Illuminate\Database\Schema\Grammars
DB Illuminate\Support\Facades Connection Illuminate\Database Builder Illuminate\Database\Schema Processor Illuminate\Database\Schema\Processors DB DB::table('users') ->select('id', 'name') ->get(); MySQL SQLite PostgreSQL SQL Server Laravel Model Application Code DB Exec SQL Call Result Result Eloquent Model Query Builder DB Connection (PHP Data Objects) Migrations public function table($table) { return $this->query() ->from($table); } -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 MySQL SQLite PostgreSQL
SQL Server Laravel Model Application Code DB Exec SQL Call Result Result Eloquent Model Query Builder DB Connection (PHP Data Objects) Migrations QueryBuilder Grammar Illuminate\Database\Schema\Grammars DB Illuminate\Support\Facades Connection Illuminate\Database Builder Illuminate\Database\Schema Processor Illuminate\Database\Schema\Processors DB public function select($columns = ['*']) { $this->columns = is_array($columns) ? $columns : func_get_args(); return $this; } DB::table('users') ->select('id', 'name') ->get(); -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 MySQL SQLite PostgreSQL
SQL Server Laravel Model Application Code DB Exec SQL Call Result Result Eloquent Model Query Builder DB Connection (PHP Data Objects) Migrations QueryBuilder Grammar Illuminate\Database\Schema\Grammars DB Illuminate\Support\Facades Connection Illuminate\Database Builder Illuminate\Database\Schema Processor Illuminate\Database\Schema\Processors DB public function get($columns = ['*']) { $original = $this->columns; ...略略... $results = $this->processor ->processSelect( $this, $this->runSelect() ); ...略略... DB::table('users') ->select('id', 'name') ->get(); -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 QueryBuilder Grammar Illuminate\Database\Schema\Grammars
DB Illuminate\Support\Facades Connection Illuminate\Database Builder Illuminate\Database\Schema Processor Illuminate\Database\Schema\Processors DB DB::table('users') ->select('id', 'name') ->get(); MySQL SQLite PostgreSQL SQL Server Laravel Model Application Code DB Exec SQL Call Result Result Eloquent Model Query Builder DB Connection (PHP Data Objects) Migrations public function get($columns = ['*']) { $original = $this->columns; ...略略... $results = $this->processor ->processSelect( $this, $this->runSelect() ); ...略略... -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 MySQL SQLite PostgreSQL
SQL Server Laravel Model Application Code DB Exec SQL Call Result Result Eloquent Model Query Builder DB Connection (PHP Data Objects) Migrations QueryBuilder Grammar Illuminate\Database\Schema\Grammars DB Illuminate\Support\Facades Connection Illuminate\Database Builder Illuminate\Database\Schema Processor Illuminate\Database\Schema\Processors DB protected function runSelect() { return $this->connection->select( $this->toSql(), $this->getBindings(), !$this->useWritePdo ); } DB::table('users') ->select('id', 'name') ->get(); -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 QueryBuilder Grammar Illuminate\Database\Schema\Grammars
DB Illuminate\Support\Facades Connection Illuminate\Database Builder Illuminate\Database\Schema Processor Illuminate\Database\Schema\Processors DB DB::table('users') ->select('id', 'name') ->get(); MySQL SQLite PostgreSQL SQL Server Laravel Model Application Code DB Exec SQL Call Result Result Eloquent Model Query Builder DB Connection (PHP Data Objects) Migrations protected function runSelect() { return $this->connection->select( $this->toSql(), $this->getBindings(), !$this->useWritePdo ); } -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 MySQL SQLite PostgreSQL
SQL Server Laravel Model Application Code DB Exec SQL Call Result Result Eloquent Model Query Builder DB Connection (PHP Data Objects) Migrations QueryBuilder Grammar Illuminate\Database\Schema\Grammars DB Illuminate\Support\Facades Connection Illuminate\Database Builder Illuminate\Database\Schema Processor Illuminate\Database\Schema\Processors DB public function toSql() { return $this->grammar ->compileSelect($this); } DB::table('users') ->select('id', 'name') ->get(); -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 QueryBuilder Grammar Illuminate\Database\Schema\Grammars
DB Illuminate\Support\Facades Connection Illuminate\Database Builder Illuminate\Database\Schema Processor Illuminate\Database\Schema\Processors DB DB::table('users') ->select('id', 'name') ->get(); MySQL SQLite PostgreSQL SQL Server Laravel Model Application Code DB Exec SQL Call Result Result Eloquent Model Query Builder DB Connection (PHP Data Objects) Migrations protected function runSelect() { return $this->connection->select( $this->toSql(), $this->getBindings(), !$this->useWritePdo ); } -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 QueryBuilder Grammar Illuminate\Database\Schema\Grammars
DB Illuminate\Support\Facades Connection Illuminate\Database Builder Illuminate\Database\Schema Processor Illuminate\Database\Schema\Processors DB DB::table('users') ->select('id', 'name') ->get(); MySQL SQLite PostgreSQL SQL Server Laravel Model Application Code DB Exec SQL Call Result Result Eloquent Model Query Builder DB Connection (PHP Data Objects) Migrations public function get($columns = ['*']) { $original = $this->columns; ...略略... $results = $this->processor ->processSelect( $this, $this->runSelect() ); ...略略... -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 How To Create
Own Driver ? MySQL SQLite PostgreSQL SQL Server Laravel Model Application Code DB Exec SQL Call Result Result Eloquent Model Query Builder DB Connection (PHP Data Objects) Migrations DBMaker ??? ??? -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 PDO Support ?
Source: http://php.net/manual/en/pdo.drivers.php -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 Laravel Connection MySQL
SQLite PostgreSQL SQL Server Laravel Model Application Code DB Exec SQL Call Result Result Eloquent Model Query Builder DB Connection (PHP Data Objects) Migrations Database ServiceProvider \Illuminate\Database DatabaseManager \Illuminate\Database ConnectionFactory \Illuminate\Database\Connectors Connection \Illuminate\Database Connector \Illuminate\Database\Connectors PDO \PDO Config/database.php MySQL SQLServe SQLite Builder \Illuminate\Database\Query \Illuminate\Database\Schema Grammar \Illuminate\Database -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 Laravel Migrations MySQL
SQLite PostgreSQL SQL Server Laravel Model Application Code DB Exec SQL Call Result Result Eloquent Model Query Builder DB Connection (PHP Data Objects) Migrations Grammar Illuminate\Database\Schema\Grammars Schema Illuminate\Support\Facades Connection Illuminate\Database Builder Illuminate\Database\Schema Blueprint Illuminate\Database\Schema DB -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 Laravel QueryBuilder Grammar
Illuminate\Database\Schema\Grammars DB Illuminate\Support\Facades Connection Illuminate\Database Builder Illuminate\Database\Schema Processor Illuminate\Database\Schema\Processors DB MySQL SQLite PostgreSQL SQL Server Laravel Model Application Code DB Exec SQL Call Result Result Eloquent Model Query Builder DB Connection (PHP Data Objects) Migrations -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 Tips • Data
Type - Numeric/Char/Time/JSON • Auto Increment Support ? • Start From Unit Test -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 Tips • Data
Type - Numeric/Char/Time/JSON • Auto Increment Support ? • Start From Unit Test -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 Tips - Data
Type - Integer -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 Tips - Data
Type - Integer MySQL int 4 byte bigint 8 byte mediumint 3 byte smallint 2 byte tinyint 1 byte -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 Tips - Data
Type - Integer MySQL int 4 byte bigint 8 byte mediumint 3 byte smallint 2 byte tinyint 1 byte SQLite integer integer integer integer integer -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 Tips - Data
Type - Integer MySQL int 4 byte bigint 8 byte mediumint 3 byte smallint 2 byte tinyint 1 byte SQLite integer integer integer integer integer SQLServer int 4 byte bigint 8 byte smallint 2 byte tinyint 1 byte -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 Tips - Data
Type - Integer MySQL int 4 byte bigint 8 byte mediumint 3 byte smallint 2 byte tinyint 1 byte SQLite integer integer integer integer integer SQLServer int 4 byte bigint 8 byte smallint 2 byte tinyint 1 byte Postgres integer 4 byte bigint 8 byte smallint 2 byte -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 Tips - Data
Type - Integer MySQL SQLite SQLServer Postgres int 4 byte integer int 4 byte integer 4 byte bigint 8 byte integer bigint 8 byte bigint 8 byte mediumint 3 byte integer smallint 2 byte integer smallint 2 byte smallint 2 byte tinyint 1 byte integer tinyint 1 byte protected function typeMediumInteger(Fluent $column) { return 'mediumint'; } -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 Tips - Data
Type - Integer MySQL SQLite SQLServer Postgres int 4 byte integer int 4 byte integer 4 byte bigint 8 byte integer bigint 8 byte bigint 8 byte mediumint 3 byte integer smallint 2 byte integer smallint 2 byte smallint 2 byte tinyint 1 byte integer tinyint 1 byte protected function typeMediumInteger(Fluent $column) { return 'integer'; } -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 Tips - Data
Type - Integer MySQL SQLite SQLServer Postgres int 4 byte integer int 4 byte integer 4 byte bigint 8 byte integer bigint 8 byte bigint 8 byte mediumint 3 byte integer smallint 2 byte integer smallint 2 byte smallint 2 byte tinyint 1 byte integer tinyint 1 byte -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 Tips - Data
Type - Integer MySQL SQLite SQLServer Postgres int 4 byte integer int 4 byte integer 4 byte bigint 8 byte integer bigint 8 byte bigint 8 byte mediumint 3 byte integer smallint 2 byte integer smallint 2 byte smallint 2 byte tinyint 1 byte integer tinyint 1 byte protected function typeMediumInteger(Fluent $column) { return 'int'; } -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 Tips • Data
Type - Numeric/Char/Time/JSON • Auto Increment Support ? • Start From Unit Test -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 Tips - Auto
Increment Support -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 Tips - Auto
Increment Support MySQL auto_increment int auto_increment bigint auto_increment mediumint auto_increment smallint auto_increment tinyint -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 Tips - Auto
Increment Support MySQL auto_increment int auto_increment bigint auto_increment mediumint auto_increment smallint auto_increment tinyint SQLite autoincrement integer autoincrement integer autoincrement integer autoincrement integer autoincrement integer -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 Tips - Auto
Increment Support MySQL auto_increment int auto_increment bigint auto_increment mediumint auto_increment smallint auto_increment tinyint SQLite autoincrement integer autoincrement integer autoincrement integer autoincrement integer autoincrement integer SQLServer identity int identity bigint identity smallint identity tinyint -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 Tips - Auto
Increment Support MySQL auto_increment int auto_increment bigint auto_increment mediumint auto_increment smallint auto_increment tinyint SQLite autoincrement integer autoincrement integer autoincrement integer autoincrement integer autoincrement integer SQLServer identity int identity bigint identity smallint identity tinyint Postgres serial 4 byte bigserial 8 byte smallserial 2 byte -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 MySQL SQLite SQLServer
Postgres auto_increment int autoincrement integer identity int serial 4 byte auto_increment bigint autoincrement integer identity bigint bigserial 8 byte auto_increment mediumint autoincrement integer auto_increment smallint autoincrement integer identity smallint smallserial 2 byte auto_increment tinyint autoincrement integer identity tinyint Tips - Auto Increment Support protected function modifyIncrement(Blueprint $blueprint, Fluent $column) { if (in_array($column->type, $this->serials) && $column->autoIncrement) { return ' auto_increment primary key'; } } -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 MySQL SQLite SQLServer
Postgres auto_increment int autoincrement integer identity int serial 4 byte auto_increment bigint autoincrement integer identity bigint bigserial 8 byte auto_increment mediumint autoincrement integer auto_increment smallint autoincrement integer identity smallint smallserial 2 byte auto_increment tinyint autoincrement integer identity tinyint Tips - Auto Increment Support protected function modifyIncrement(Blueprint $blueprint, Fluent $column) { if (in_array($column->type, $this->serials) && $column->autoIncrement) { return ' primary key autoincrement'; } } -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 MySQL SQLite SQLServer
Postgres auto_increment int autoincrement integer identity int serial 4 byte auto_increment bigint autoincrement integer identity bigint bigserial 8 byte auto_increment mediumint autoincrement integer auto_increment smallint autoincrement integer identity smallint smallserial 2 byte auto_increment tinyint autoincrement integer identity tinyint Tips - Auto Increment Support protected function modifyIncrement(Blueprint $blueprint, Fluent $column) { if (in_array($column->type, $this->serials) && $column->autoIncrement) { return ' identity primary key'; } } -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 MySQL SQLite SQLServer
Postgres auto_increment int autoincrement integer identity int serial 4 byte auto_increment bigint autoincrement integer identity bigint bigserial 8 byte auto_increment mediumint autoincrement integer auto_increment smallint autoincrement integer identity smallint smallserial 2 byte auto_increment tinyint autoincrement integer identity tinyint Tips - Auto Increment Support -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 MySQL SQLite SQLServer
Postgres auto_increment int autoincrement integer identity int serial 4 byte auto_increment bigint autoincrement integer identity bigint bigserial 8 byte auto_increment mediumint autoincrement integer auto_increment smallint autoincrement integer identity smallint smallserial 2 byte auto_increment tinyint autoincrement integer identity tinyint Tips - Auto Increment Support protected function typeMediumInteger(Fluent $column) { return $column->autoIncrement ? 'serial' : 'integer'; } -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 MySQL SQLite SQLServer
Postgres auto_increment int autoincrement integer identity int serial 4 byte auto_increment bigint autoincrement integer identity bigint bigserial 8 byte auto_increment mediumint autoincrement integer auto_increment smallint autoincrement integer identity smallint smallserial 2 byte auto_increment tinyint autoincrement integer identity tinyint Tips - Auto Increment Support protected function typeMediumInteger(Fluent $column) { return $column->autoIncrement ? 'serial' : 'integer'; } protected function modifyIncrement(Blueprint $blueprint, Fluent $column) { if (in_array($column->type, $this->serials) && $column->autoIncrement) { return ' primary key'; } } -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 Tips • Data
Type - Numeric/Char/Time/JSON • Auto Increment Support ? • Start From Unit Test -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 Start from UnitTest
https://github.com/whatthejeff/nyancat-phpunit-resultprinter -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 Start from UnitTest
https://github.com/whatthejeff/nyancat-phpunit-resultprinter -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 Start from UnitTest
https://github.com/whatthejeff/nyancat-phpunit-resultprinter -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 Summary • PDO
Support ? • DataType • Grammar • Start from unit test -
墨墨嗓 (陳佑⽵竹) / 2017.07.01 LaravelConf Taiwan 2017 WE WANT YOU
!! •PHP 後端⼯工程師 •前端⼯工程師