Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/oop/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何使用parent$table属性从父类上的子类运行Eloquent create()?_Php_Oop_Inheritance_Eloquent_Attributes - Fatal编程技术网

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”表上创建一条记录。如何在父类上运行“从子类创建”和使用父属性