示例#1
0
 /**
  * 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();
     }
 }
示例#2
0
 /**
  * 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();
 }
示例#3
0
 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');
 }
示例#4
0
 public function addMappings(Fluent $builder)
 {
     $builder->bigIncrements('id');
     $builder->singleTableInheritance()->column('type');
     $builder->carbonDateTime('createdAt');
     $builder->carbonDateTime('updatedAt');
     $builder->events()->prePersist('onPrePersist')->preUpdate('onPreUpdate');
 }
示例#5
0
 /**
  * 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]);
 }
示例#7
0
 /**
  * Load the object's metadata through the Metadata Builder object.
  *
  * @param Fluent $builder
  */
 public function map(Fluent $builder)
 {
     $builder->string('address')->columnName('email')->unique();
 }
示例#8
0
 /**
  * @param Fluent $builder
  */
 public function map(Fluent $builder)
 {
     $this->setType($builder->getBuilder());
     $this->mapping->map($builder);
     $builder->build();
 }
示例#9
0
 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();
 }
示例#11
0
 /**
  * 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();
 }
示例#12
0
 /**
  * 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);
     }
 }
示例#13
0
 /**
  * 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();
 }
示例#15
0
 /**
  * @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);
 }