public function handle()
    {
        $input = $this->getCommandInput();

        $resource = Resource::fromFile($input->resourceFile, $input->languageFileName);

        $destenationFile = $this->getDestenationFile($input->modelName, $input->modelDirectory);

        if ($this->hasErrors($resource, $destenationFile)) {
            return false;
        }

        $fields = $resource->fields;
        if ($input->useSoftDelete) {
            $fields = $this->upsertDeletedAt($fields);
        }

        $stub = $this->getStubContent('model');
        $primaryField = $this->getPrimaryField($fields);
        $relations = $this->getRelationMethods($resource->relations, $fields);

        return $this->replaceTable($stub, $resource->getTableName($input->table))
            ->replaceModelName($stub, $input->modelName)
            ->replaceNamespace($stub, $this->getNamespace($input->modelName, $input->modelDirectory))
            ->replaceSoftDelete($stub, $input->useSoftDelete)
            ->replaceTimestamps($stub, $this->getTimeStampsStub($input->useTimeStamps, $resource->isCreateAndUpdateAtManaged()))
            ->replaceFillable($stub, $this->getFillables($stub, $fields))
            ->replaceDateFields($stub, $this->getDateFields($stub, $fields))
            ->replaceCasts($stub, $this->getCasts($stub, $fields))
            ->replacePrimaryKey($stub, $this->getNewPrimaryKey($primaryField, $input->primaryKey))
            ->replaceRelationshipPlaceholder($stub, $relations)
            ->replaceAccessors($stub, $this->getAccessors($fields))
            ->replaceMutators($stub, $this->getMutators($fields))
            ->createFile($destenationFile, $stub)
            ->info('A model was crafted successfully.');
    }