Exemplo n.º 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();
     }
 }
Exemplo n.º 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();
 }
Exemplo n.º 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');
 }
Exemplo n.º 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');
 }
Exemplo n.º 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');
 }
Exemplo n.º 6
0
 /**
  * Adds only relations
  *
  * @param Fluent $builder
  */
 public function addRelations(Fluent $builder)
 {
     $builder->belongsTo($this->relations['user'][0], $this->relations['user'][1]);
 }
Exemplo n.º 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();
 }
Exemplo n.º 8
0
 /**
  * @param Fluent $builder
  */
 public function map(Fluent $builder)
 {
     $this->setType($builder->getBuilder());
     $this->mapping->map($builder);
     $builder->build();
 }
Exemplo n.º 9
0
 public function map(Fluent $builder)
 {
     $builder->increments('id');
     $builder->string('name');
 }
Exemplo n.º 10
0
 /**
  * Adds only relations
  *
  * @param Fluent $builder
  */
 public function addRelations(Fluent $builder)
 {
     $builder->belongsTo($this->relations['role'][0], $this->relations['role'][1])->primary();
 }
Exemplo n.º 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();
 }
Exemplo n.º 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);
     }
 }
Exemplo n.º 13
0
 /**
  * Load the object's metadata through the Metadata Builder object.
  *
  * @param Fluent $builder
  */
 public function map(Fluent $builder)
 {
     $builder->string('name');
 }
Exemplo n.º 14
0
 public function addMappings(Fluent $builder)
 {
     $builder->belongsTo($this->relations['user'][0], $this->relations['user'][1])->nullable();
 }
Exemplo n.º 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);
 }