protected function getFactoryAttributes(Model $model)
    {
        // This package allows developers to specify attributes for single locales
        // in their factory definitions with the attribute:locale syntax,
        // but the Eloquent\FactoryBuilder's raw() method interprets them as regular attributes,
        // and if we were to make() the model and then call getAttribute() everytime,
        // such attributes would cause Translatable to run a query for each model instance.
        // We'll resort to binding a closure to the factory to get the defined states,
        // and pass them as custom attributes to raw().
        // This has the added bonus over make()->getAttributes() of delaying the calling
        // of any closure in factory definitions/states, allowing them to receive the model
        // with more attributes set and the inserted primary keys as arguments,
        // like the closure custom attributes passed to Populator.
        $factory = app(Eloquent\Factory::class);

        $states = $this->isTranslation($model) ? $this->translationStates : $this->states;

        $modelClass = get_class($model);

        $modelIsDefined = call_user_func(\Closure::bind(function () use ($modelClass) {
            return isset($this->definitions[$modelClass]);
        }, $factory, $factory));

        if (!$modelIsDefined) {
            // If the model is not defined in the factory and the developer didn't apply any state,
            // that means he doesn't need the factory for this model, so we'll return an empty array.
            if (!$states) {
                return [];
            }

            // If the model doesn't have a factory definition,
            // but the developer still wants to apply states,
            // we'll create a dummy definition of the model to allow it.
            $factory->define($modelClass, function () {
                return [];
            });
        }

        return $factory->raw($modelClass, $this->getStateAttributes($factory, $states, $modelClass));
    }
protected function getFactoryAttributes(Model $model)
    {
        // This package allows developers to specify attributes for single locales
        // in their factory definitions with the attribute:locale syntax,
        // but the Eloquent\FactoryBuilder's raw() method interprets them as regular attributes,
        // and if we were to make() the model and then call getAttribute() everytime,
        // such attributes would cause Translatable to run a query for each model instance.
        // We'll resort to binding a closure to the factory to get the defined states,
        // and pass them as custom attributes to raw().
        // This has the added bonus over make()->getAttributes() of delaying the calling
        // of any closure in factory definitions/states, allowing them to receive the model
        // with more attributes set and the inserted primary keys as arguments,
        // like the closure custom attributes passed to Populator.
        $factory = app(Eloquent\Factory::class);

        $states = $this->isTranslation($model) ? $this->translationStates : $this->states;

        $modelClass = get_class($model);

        $modelIsDefined = call_user_func(\Closure::bind(function () use ($modelClass) {
            return isset($this->definitions[$modelClass]);
        }, $factory, $factory));

        if (!$modelIsDefined) {
            // If the model is not defined in the factory and the developer didn't apply any state,
            // that means he doesn't need the factory for this model, so we'll return an empty array.
            if (!$states) {
                return [];
            }

            // If the model doesn't have a factory definition,
            // but the developer still wants to apply states,
            // we'll create a dummy definition of the model to allow it.
            $factory->define($modelClass, function () {
                return [];
            });
        }

        return $factory->raw($modelClass, $this->getStateAttributes($factory, $states, $modelClass));
    }
protected function getFactoryAttributes ( Model $ model ) { // This package allows developers to specify attributes for single locales // in their factory definitions with the attribute:locale syntax, // but the Eloquent\FactoryBuilder's raw() method interprets them as regular attributes, // and if we were to make() the model and then call getAttribute() everytime, // such attributes would cause Translatable to run a query for each model instance. // We'll resort to binding a closure to the factory to get the defined states, // and pass them as custom attributes to raw(). // This has the added bonus over make()->getAttributes() of delaying the calling // of any closure in factory definitions/states, allowing them to receive the model // with more attributes set and the inserted primary keys as arguments, // like the closure custom attributes passed to Populator. $ factory = app ( Eloquent \ Factory :: class ) ; $ states = $ this -> isTranslation ( $ model ) ? $ this -> translationStates : $ this -> states ; $ modelClass = get_class ( $ model ) ; $ modelIsDefined = call_user_func ( \ Closure :: bind ( function ( ) use ( $ modelClass ) { return isset ( $ this -> definitions [ $ modelClass ] ) ; } , $ factory , $ factory ) ) ; if ( ! $ modelIsDefined ) { // If the model is not defined in the factory and the developer didn't apply any state, // that means he doesn't need the factory for this model, so we'll return an empty array. if ( ! $ states ) { return [ ] ; } // If the model doesn't have a factory definition, // but the developer still wants to apply states, // we'll create a dummy definition of the model to allow it. $ factory -> define ( $ modelClass , function ( ) { return [ ] ; } ) ; } return $ factory -> raw ( $ modelClass , $ this -> getStateAttributes ( $ factory , $ states , $ modelClass ) ) ; }
Get the model factory attributes of the model being built.

@param  Model $model
@return array
Get the model factory attributes of the model being built .