protected function prepareConfig()
    {
        $config = config("entity", []);

        $entity = $this->entity;

        if(!isset($config[$entity])){

            throw new \Exception("No configuration found for entity {$entity}.");

        }

        // assign the given config
        $this->config = $config[$entity] + [
            'attributes'    => [],
            'relationships' => [],
            'scope'         => Scope::DISABLED,
        ];

        // merge attribute defaults
        foreach($this->config['attributes'] as $attr => $values){

            $this->config['attributes'][$attr] = $this->applyAttributeDefaults($values);

        }

        // merge relationship defaults
        foreach($this->config['relationships'] as $rel => $values){

            $this->config['relationships'][$rel] = $this->applyRelationshipDefaults($values);
        }

        $this->fillable(array_keys($this->config['attributes']));
    }
protected function prepareConfig()
    {
        $config = config("entity", []);

        $entity = $this->entity;

        if(!isset($config[$entity])){

            throw new \Exception("No configuration found for entity {$entity}.");

        }

        // assign the given config
        $this->config = $config[$entity] + [
            'attributes'    => [],
            'relationships' => [],
            'scope'         => Scope::DISABLED,
        ];

        // merge attribute defaults
        foreach($this->config['attributes'] as $attr => $values){

            $this->config['attributes'][$attr] = $this->applyAttributeDefaults($values);

        }

        // merge relationship defaults
        foreach($this->config['relationships'] as $rel => $values){

            $this->config['relationships'][$rel] = $this->applyRelationshipDefaults($values);
        }

        $this->fillable(array_keys($this->config['attributes']));
    }
protected function prepareConfig ( ) { $ config = config ( "entity" , [ ] ) ; $ entity = $ this -> entity ; if ( ! isset ( $ config [ $ entity ] ) ) { throw new \ Exception ( "No configuration found for entity {$entity}." ) ; } // assign the given config $ this -> config = $ config [ $ entity ] + [ 'attributes' => [ ] , 'relationships' => [ ] , 'scope' => Scope :: DISABLED , ] ; // merge attribute defaults foreach ( $ this -> config [ 'attributes' ] as $ attr => $ values ) { $ this -> config [ 'attributes' ] [ $ attr ] = $ this -> applyAttributeDefaults ( $ values ) ; } // merge relationship defaults foreach ( $ this -> config [ 'relationships' ] as $ rel => $ values ) { $ this -> config [ 'relationships' ] [ $ rel ] = $ this -> applyRelationshipDefaults ( $ values ) ; } $ this -> fillable ( array_keys ( $ this -> config [ 'attributes' ] ) ) ; }
Reload the configuration and set fillable attributes.
Reload the configuration and set fillable attributes .