maksimru /
composite-primary-keys
| 1 | <?php |
||
| 2 | |||
| 3 | namespace MaksimM\CompositePrimaryKeys\Tests\Stubs; |
||
| 4 | |||
| 5 | use Illuminate\Database\Eloquent\Model; |
||
| 6 | use MaksimM\CompositePrimaryKeys\Http\Traits\HasCompositePrimaryKey; |
||
| 7 | |||
| 8 | class TestBinaryRole extends Model |
||
| 9 | { |
||
| 10 | use HasCompositePrimaryKey; |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 11 | |||
| 12 | protected $table = 'binary_roles'; |
||
| 13 | |||
| 14 | public $timestamps = false; |
||
| 15 | |||
| 16 | protected $primaryKey = 'role_id'; |
||
| 17 | |||
| 18 | protected $binaryColumns = [ |
||
| 19 | 'role_id', |
||
| 20 | ]; |
||
| 21 | |||
| 22 | protected $fillable = [ |
||
| 23 | 'name', |
||
| 24 | ]; |
||
| 25 | |||
| 26 | public function users() |
||
| 27 | { |
||
| 28 | return $this->hasMany(TestBinaryUser::class, 'binary_role_id', 'role_id'); |
||
| 29 | } |
||
| 30 | |||
| 31 | public function hex_users() |
||
| 32 | { |
||
| 33 | return $this->hasMany(TestBinaryUserHex::class, 'binary_role_id', 'role_id'); |
||
| 34 | } |
||
| 35 | } |
||
| 36 |