<?phpuse\Illuminate\Support\Facades\Schema;useJenssegers\Eloquent\ModelasEloquent;classMysqlBookextendsEloquent{protected$connection='mysql';protected$table='books';protectedstatic$unguarded=true;protected$primaryKey='title';publicfunctionauthor(){return$this->belongsTo('User','author_id');}/** * Check if we need to run the schema * @return [type] [description] */publicstaticfunctionexecuteSchema(){$schema=Schema::connection('mysql');if(!$schema->hasTable('books')){Schema::connection('mysql')->create('books',function($table){$table->string('title');$table->string('author_id');$table->timestamps();});}}}