Laravel return empty relationship on model when condition is true

92

public function shop(): BelongsTo
{
    if(true) {
        return new BelongsTo($this->newQuery(), $this, '', '', '');
    }
    return $this->belongsTo('App\Models\Shop');
}

Comments

Submit
0 Comments