Php 如何使用parent$table属性从父类上的子类运行Eloquent create()?
我有以下课程Php 如何使用parent$table属性从父类上的子类运行Eloquent create()?,php,oop,inheritance,eloquent,attributes,Php,Oop,Inheritance,Eloquent,Attributes,我有以下课程 class Business extends Eloquent { protected $table = 'business'; protected $fillable = [{stuff}]; } class Employee extends Business { protected $table = 'employee'; protected $fillable = [{stuff}]; public function bu
class Business extends Eloquent {
protected $table = 'business';
protected $fillable = [{stuff}];
}
class Employee extends Business {
protected $table = 'employee';
protected $fillable = [{stuff}];
public function business_create(array $attributes = []) {
parent::create($attributes);
}
}
当我尝试运行business_create()时,Eloquent尝试在“employee”表上创建一条记录。如何在父类上运行“从子类创建”和使用父属性