Home >Backend Development >PHP Tutorial >orm gets the attribute value in the association table, the attribute value in the orm table_PHP tutorial
ORM - Relational Object Model
The Eloquent ORM in laravel is used to interact with data tables. Each database table will interact with a corresponding "model". If you want to know more, please check the official documentation or Baidu. The code to obtain the attribute value in the association table is as follows:
/** * [getContactAttribute 获取卖家联系人] */ public function getContactAttribute() { return $this->hasOne('App\Http\Models\Supplier', 'SupplierId', 'SupplierId')->first()->contact; }