Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

laravel self

class Instrument extends Model
{
  protected $appends = ['benchmark'];
  
  public function getBenchmarkAttribute()
  {
    // this is equivalent to Instrument::find($this->benchmark_id)
    return self::find($this->benchmark_id);
  }
}
 
PREVIOUS NEXT
Tagged: #laravel
ADD COMMENT
Topic
Name
2+6 =