SoFunction
Updated on 2025-03-02

orm gets the attribute value in the association table

ORM—Relational Object Model

Object Relational Mapping (ORM, or O/RM, or O/R mapping) is a program technology used to realize the conversion between data of different types of systems in object-oriented programming languages. Effectively speaking, it actually creates a "virtual object database" that can be used in programming languages.

The Eloquent ORM in laravel is used to interact with data tables, where each database table will interact with a corresponding "model". If you want to know, please check the official document or Baidu on your own. The attribute value code in the association table is as follows:

/**
 * [getContactAttribute Get Seller Contact]
 */
public function getContactAttribute()
{
return $this->hasOne('App\Http\Models\Supplier', 'SupplierId', 'SupplierId')->first()->contact;
}

The above is the orm acquisition attribute values ​​in the association table introduced by the editor. I hope it will be helpful to everyone!