belongsTo('App\User', 'user_id'); } public function code() { return $this->belongsTo('App\Models\Codes', 'code_unique_id'); } public function code_ean() { return $this->belongsTo('App\Models\CodesEAN', 'code_ean_id'); } public function instant_win() { return $this->hasOne('App\Models\InstantWin', 'participation_id'); } public function reduction() { return $this->hasOne('App\Models\Reductions', 'reduction_id'); } public function getCodeEanValueAttribute() { $code = CodesEAN::find($this->code_ean_id)->code; return $code; } }