create name before creating a new role instance.

@param array $data

@return EloquentRole
276
public function create(array $data)
    {
        if (! array_key_exists('name', $data)) {
            $data['name'] = Str::slug($data['display_name']);
        }

        return parent::create($data);
    }
58455
public function createOrUpdateUser($data)
    {
        if (! isset($data['login']) && isset($data['email'])) {
            $data['login'] = $data['email'];
        } elseif (! isset($data['email']) && isset($data['login'])) {
            $data['email'] = $data['login'];
        }

        if (isset($data['principal-id']) && $data['principal-id']) {
            return $this->updateUser($data);
        } else {
            return $this->createUser($data);
        }
    }
536594
public static function createExisting($data)
    {
        $newRequest = new static($data);
        $newRequest->setId($data['id']);
        $newRequest->setExists(true);

        return $newRequest;
    }
1092146
public function create($data)
    {
    	try {
		    $data = is_object( $data ) ? $data : (object) $data;
		    $id   = 0;
		    try {
			    $entity = new \erdiko\users\entities\Role();
			    $entity->setName( $data->name );
			    $entity->setActive( $data->active );

			    $this->_em->persist( $entity );
			    $this->_em->flush();

			    $id = intval( $entity->getId() );
		    } catch ( \Exception $e ) {
			    \error_log( $e->getMessage() );
			    throw new \Exception( "Could not create Role." );
		    }

		    return (int) $id;
	    } catch (\Exception $e) {
    		throw new \Exception($e->getMessage());
	    }
    }
826027
public static function createFromArray(array $data)
    {
        $self = new self();

        if (isset($data['id'])) {
            $self->setId($data['id']);
        }
        if (isset($data['type'])) {
            $self->setType($data['type']);
        }
        if (isset($data['translated'])) {
            $self->setTranslated($data['translated']);
        }
        if (isset($data['flagged'])) {
            $self->setFlagged($data['flagged']);
        }
        if (isset($data['status'])) {
            $self->setStatus($data['status']);
        }
        if (isset($data['translation'])) {
            $self->setTranslation($data['translation']);
        }
        if (isset($data['revision'])) {
            $self->setRevision($data['revision']);
        }
        if (isset($data['comments'])) {
            $self->setComments($data['comments']);
        }
        if (isset($data['modified'])) {
            $self->setModified($data['modified']);
        }
        if (isset($data['author'])) {
            $self->setAuthor($data['author']);
        }
        if (isset($data['flagger'])) {
            $self->setFlagger($data['flagger']);
        }
        if (isset($data['locale'])) {
            $self->setLocale($data['locale']);
        }
        if (isset($data['plurals'])) {
            $self->setPlurals($data['plurals']);
        }

        return $self;
    }
180885
public static function createFromData(array $data)
    {
        if (!isset($data['type'])) {
            throw new DomainException(self::MSG_REQUIRED_TYPE);
        }

        if (!in_array($data['type'], self::allowedRejectionTypes(), true)) {
            throw new DomainException(self::MSG_UNSUPPORTED_TYPE);
        }

        return new self($data);
    }
317124
public function create($data)
    {
        $data = $this->retrieveData($data);
        $insertData = [
            'role_id'=> $this->getRoleId(),
            'resource' => $data['resource'],
            'methods'=> implode(',', $data['methods']),
        ];
        $this->table->insert($insertData);

        return $data;
    }
236973
public function mapRoles(array $data)
    {
        $roleData = array();
        foreach ($data as $row) {
            $roleData[$row['ezrole_id']][] = $row;
        }

        $roles = array();
        foreach ($roleData as $data) {
            $roles[] = $this->mapRole($data);
        }

        return $roles;
    }
1247915
public static function createFromArray(array $data)
    {
        $self = new self();

        if (isset($data['id'])) {
            $self->setId($data['id']);
        }
        if (isset($data['name'])) {
            $self->setName($data['name']);
        }
        if (isset($data['code'])) {
            $self->setCode($data['code']);
        }

        return $self;
    }
1330376
public function create(array $data)
    {
        $user = User::create([
            'name'                  => $data['name'],
            'email'                 => $data['email'],
            'password'              => bcrypt($data['password']),
            'birthday_at'           => $data['birthday_at'],
            'locale'                => $data['locale'],
            'gender'                => $data['gender'],
            'city'                  => $data['city'],
            'about'                 => $data['about'],
            'profession'            => $data['profession'],
            'hobbies'               => $data['hobbies'],
            'homepage'              => $data['homepage'],
            'skype'                 => $data['skype'],
            'facebook'              => $data['facebook'],
            'twitter'               => $data['twitter'],
            'main_character'        => $data['main_character'],
            'main_guild'            => $data['main_guild'],
            'favorite_race'         => $data['favorite_race'],
            'favorite_spec'         => $data['favorite_spec'],
            'favorite_instance'     => $data['favorite_instance'],
            'favorite_battleground' => $data['favorite_battleground'],
        ]);

        return $user;
    }
1104237
public function create($data)
    {
        $descriptor = new AuthorDescriptor($data->getName());
        $descriptor->setDescription((string) $data);

        return $descriptor;
    }
650973
protected function getOrCreateObject(?array $data = null)
    {
        if ($data === null) {
            return null;
        }

        return $this->objectManager->getOrCreateObject(
            $this->getClassName(),
            $data
        );
    }
511817
public function createNewRecord($data) {

        $email = new $this->model;

        $email->email_type_id = $data['email_type_id'];
        $email->title         = $data['title'];
        $email->description   = $data['description'];
        $email->comments      = $data['comments'];
        $email->created_at    = $data['created_at'];
        $email->created_by    = $data['created_by'];
        $email->updated_at    = $data['updated_at'];
        $email->updated_by    = $data['updated_by'];
        $email->locked_at     = null;
        $email->locked_by     = null;

        if ($email->save()) {

            // Return the new ID
            return $email->id;
        }

        return false;
    }
69081
public static function createFromArray(array $data)
    {
        $self = new self();

        foreach ($data as $translation) {
            $self->addTranslation(Translation::createFromArray($translation));
        }

        return $self;
    }
1321470
public function create(array $data)
    {
        $response = $this->request->post("boards", $data);
        return new Board($this->master, $response);
    }
712390
public static function create(array $data): Model
    {
        $insert = new Insert(static::getTableName(), $data, static::getAdapterConnection());
        $insert->exec();

        if (static::$autoIncrement) {
            // ID should be fetched if $data contains ID, so, let's check
            if (is_string(static::$primaryKey) && isset($data[static::$primaryKey])) {
                // there there, we already have it, let's do nothing
            } else {
                $data[static::$primaryKey] = static::getLastInsertId();
            }
        }

        return new static($data);
    }
1192997
public function mapRoleAssignments(array $data)
    {
        $roleAssignmentData = array();
        foreach ($data as $row) {
            $id = (int)$row['id'];
            $roleId = (int)$row['role_id'];
            $contentId = (int)$row['contentobject_id'];
            // if user already have full access to a role, continue
            if (isset($roleAssignmentData[$roleId][$contentId])
              && $roleAssignmentData[$roleId][$contentId] instanceof RoleAssignment) {
                continue;
            }

            $limitIdentifier = $row['limit_identifier'];
            if (!empty($limitIdentifier)) {
                $roleAssignmentData[$roleId][$contentId][$limitIdentifier][$id] = new RoleAssignment(
                    array(
                        'id' => $id,
                        'roleId' => $roleId,
                        'contentId' => $contentId,
                        'limitationIdentifier' => $limitIdentifier,
                        'values' => array($row['limit_value']),
                    )
                );
            } else {
                $roleAssignmentData[$roleId][$contentId] = new RoleAssignment(
                    array(
                        'id' => $id,
                        'roleId' => $roleId,
                        'contentId' => $contentId,
                    )
                );
            }
        }

        $roleAssignments = array();
        array_walk_recursive(
            $roleAssignmentData,
            function ($roleAssignment) use (&$roleAssignments) {
                $roleAssignments[] = $roleAssignment;
            }
        );

        return $roleAssignments;
    }