Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

Laravel return empty relationship on model when condition is true

public function shop(): BelongsTo
{
    if(true) {
        return new BelongsTo($this->newQuery(), $this, '', '', '');
    }
    return $this->belongsTo('AppModelsShop');
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #Laravel #return #empty #relationship #model #condition #true
ADD COMMENT
Topic
Name
7+3 =