📜  laravel self - PHP 代码示例

📅  最后修改于: 2022-03-11 14:53:55.987000             🧑  作者: Mango

代码示例1
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);
  }
}