コード例 #1
0
ファイル: StubEntityMapping.php プロジェクト: guiwoda/fluent
 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');
 }
コード例 #2
0
 /**
  * Adds only relations
  *
  * @param Fluent $builder
  */
 public function addRelations(Fluent $builder)
 {
     $builder->belongsTo($this->relations['user'][0], $this->relations['user'][1]);
 }
コード例 #3
0
 /**
  * Adds only relations
  *
  * @param Fluent $builder
  */
 public function addRelations(Fluent $builder)
 {
     $builder->belongsTo($this->relations['role'][0], $this->relations['role'][1])->primary();
 }
コード例 #4
0
 public function addMappings(Fluent $builder)
 {
     $builder->belongsTo($this->relations['user'][0], $this->relations['user'][1])->nullable();
 }