/** * Adds only relations * * @param Fluent $builder */ public function addRelations(Fluent $builder) { $users = $builder->belongsToMany($this->relations['users'][0], $this->relations['users'][1])->mappedBy($this->relations['users'][2]); if ($this->joinTable) { $users->joinTable($this->joinTable); } if ($this->permissions) { $builder->hasMany($this->relations['permissions'][0], $this->relations['permissions'][1])->mappedBy($this->name)->cascadeAll()->orphanRemoval(); } }
/** * Load the object's metadata through the Metadata Builder object. * * @param Fluent $builder */ public function map(Fluent $builder) { $builder->table('users')->charset('utf8mb4'); $builder->bigIncrements('id'); $builder->string('username')->unique(); $builder->string('email')->unique(); $builder->string('password'); $builder->rememberToken(); $builder->timestamps(); $builder->softDelete(); }
public function map(Fluent $builder) { $builder->increments('id'); $builder->string('name'); $builder->belongsTo(StubEntity::class, 'parent')->inversedBy('parent'); $builder->hasMany(StubEntity::class, 'children')->mappedBy('parent'); $builder->hasOne(StubEntity::class, 'one')->ownedBy('theOther'); $builder->belongsToMany(StubEntity::class, 'many')->owns('theWorld'); }
public function addMappings(Fluent $builder) { $builder->bigIncrements('id'); $builder->singleTableInheritance()->column('type'); $builder->carbonDateTime('createdAt'); $builder->carbonDateTime('updatedAt'); $builder->events()->prePersist('onPrePersist')->preUpdate('onPreUpdate'); }
/** * Load the object's metadata through the Metadata Builder object. * * @param Fluent $builder */ public function map(Fluent $builder) { $builder->string('hash')->columnName('password'); }
/** * Adds only relations * * @param Fluent $builder */ public function addRelations(Fluent $builder) { $builder->belongsTo($this->relations['user'][0], $this->relations['user'][1]); }
/** * Load the object's metadata through the Metadata Builder object. * * @param Fluent $builder */ public function map(Fluent $builder) { $builder->string('address')->columnName('email')->unique(); }
/** * @param Fluent $builder */ public function map(Fluent $builder) { $this->setType($builder->getBuilder()); $this->mapping->map($builder); $builder->build(); }
public function map(Fluent $builder) { $builder->increments('id'); $builder->string('name'); }
/** * Adds only relations * * @param Fluent $builder */ public function addRelations(Fluent $builder) { $builder->belongsTo($this->relations['role'][0], $this->relations['role'][1])->primary(); }
/** * Load the object's metadata through the Metadata Builder object. * * @param Fluent $builder */ public function map(Fluent $builder) { $builder->string('firstName')->nullable(); $builder->string('lastName')->nullable(); }
/** * Load the object's metadata through the Metadata Builder object. * * @param Fluent $builder */ public function map(Fluent $builder) { if ($this->table) { $builder->table($this->table); } }
/** * Load the object's metadata through the Metadata Builder object. * * @param Fluent $builder */ public function map(Fluent $builder) { $builder->string('name'); }
public function addMappings(Fluent $builder) { $builder->belongsTo($this->relations['user'][0], $this->relations['user'][1])->nullable(); }
/** * @param string $key * @param Fluent $builder * @return OneToMany */ private function hasMany($key, Fluent $builder) { return $builder->hasMany($this->relations[$key][0], $this->relations[$key][1])->mappedBy($this->name); }