create.

@param array $data

@return Tweet $post
353973
public function create(array $data) {
    $tweet = new Tweet();

    $media = new Media();
    $media->setUrl($data['user']['profile_image_url']);

    $author = new Author();
    $author->setProfilePicture($media);
    $author->setIdentifier($data['user']['id']);
    $author->setName($data['user']['name']);
    $author->setLink('https://twitter.com/' . $data['user']['screen_name']);
    $author->setUsername($data['user']['screen_name']);

    $tweet
        ->setFollowersCount($data['user']['followers_count'])
        ->setIdentifier($data['id'])
        ->setMessage($data['full_text'])
        ->setCreatedAt(new \DateTime($data['created_at']))
        ->setAuthor($author);

    if (isset($data['retweeted_status']['full_text'])) {
      $tweet->setMessage($data['retweeted_status']['full_text']);
    }

    $this->addTweetReferences($tweet, $data);
    $this->addTweetMedias($tweet, $data);

    return $tweet;
  }
304311
protected function create(array $data)
    {
        $user = UserModel::create($data);
        return User::find($user->id);
    }
1225260
public static function makeFromApi(array $data)
    {
        if (isset($data['event'])) {
            switch ($data['event']) {
                case Type::MESSAGE:
                    return new Message($data);
                case Type::SUBSCRIBED:
                    return new Subscribed($data);
                case Type::CONVERSATION:
                    return new Conversation($data);
                case Type::UNSUBSCRIBED:
                    return new Unsubscribed($data);
                case Type::DELIVERED:
                    return new Delivered($data);
                case Type::SEEN:
                    return new Seen($data);
                case Type::FAILED:
                    return new Failed($data);
                case Type::WEBHOOK:
                    return new Webhook($data);
            }
        }
        throw new ApiException('Unknow event data');
    }
814267
public function create(array $data)
    {
        $playlistItem = new YoutubePlaylistItem();

        $snippet = $data['snippet'];

        $author = new Author();
        $author->setIdentifier($snippet['channelId']);
        $author->setName($snippet['channelTitle']);
        $author->setUsername($snippet['channelTitle']);

        $playlistItem
            ->setIdentifier($data['id'])
            ->setMessage($snippet['title'])
            ->setCreatedAt(new \DateTime($snippet['publishedAt']))
            ->setAuthor($author);

        $media = $this->getBestThumbnailRes($snippet['thumbnails']);
        $media->setLink('https://www.youtube.com/watch?v=' . $snippet['resourceId']['videoId']);

        $playlistItem->addMedia($media);

        return $playlistItem;
    }
71936
public function create(array $data)
    {
        $response = $this->httpPost('/3/invoices', ['Invoice' => $data]);

        if (!$this->hydrator) {
            return $response;
        }

        // Use any valid status code here
        if (201 !== $response->getStatusCode()) {
            $this->handleErrors($response);
        }

        return $this->hydrator->hydrate($response, Model::class);
    }
1236996
public static function fromArray(array $data)
    {
        return new PreCommit(
            new Undefined(false),
            new Enabled($data['enabled']),
            PreCommitExecuteFactory::fromArray($data['execute']),
            isset($data['message']) ? MessagesFactory::fromArray($data['message']) : MessagesFactory::setUndefined()
        );
    }
1042433
public function create($data = [])
    {
        // Create a random hash
        $hash = $this->hash();

        // Store the file in the tokens storage
        $data = array_merge($data, ['token' => $hash, 'timestamp' => time()]);
        $stored = file_put_contents($this->path($hash), json_encode($data));

        // Return the data or false in case of failure
        return ($stored)? $data : false;
    }
666281
protected function create(array $data)
    {
        $admin = new Admin();

        $fields           = $this->tableFields();
        $data['password'] = bcrypt($data['password']);
        foreach ($fields as $field) {
            if (isset($data[$field])) {
                $admin->$field = $data[$field];
            }
        }

        $admin->save();
        $admin->roles()->sync(request('role_id'));
        $this->sendConfirmationNotification($admin, request('password'));

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

        if (isset($data['assets'])) {
            $self->setAssets($data['assets']);
        }
        if (isset($data['locales'])) {
            $self->setLocales($data['locales']);
        }

        return $self;
    }
1296036
protected function create(array $data)
    {
        return User::create([
            'name' => $data['name'],
            'email' => $data['email'],
            'password' => bcrypt($data['password']),
            'token' => $this->userRepository->createToken(),
            'active' => 1,
        ]);
    }
845427
public function create(array $data) : Model
    {
        $model_class = $this->getModelName();
        return $this->postCreate($data, $model_class::create($this->preCreate($this->parseData($data))));
    }
1063890
public function create(array $data)
  {
    $VoucherType = new VoucherType();
    $VoucherType->setConnection($this->databaseConnectionName);
    $VoucherType->fill($data)->save();

    return $VoucherType;
  }
1197364
public static function createFromData(array $data)
    {
        if (!isset($data['method'])) {
            throw new DomainException(self::REQUIRED_METHOD);
        }

        if (!in_array($data['method'], self::$availableMethods, true)) {
            throw new DomainException(
                sprintf(self::UNSUPPORTED_METHOD, implode(',', self::$availableMethods))
            );
        }

        return parent::createFromData($data);
    }
1284151
public function create(array $data)
    {
        $scene = '';
        if (func_num_args() === 2) {
            $scene = func_get_arg(1);
        }

        $this->setOriginal($data);

        $this->setData($this->guardResult($data, $scene));

        if ($this->fireEvent('creating', $data) === false) {
            return false;
        }

        $model = $this->driver->create($this->getData());

        $this->fireEvent('created', $model);

        return $model;
    }
307328
public static function createFromData(array $data)
    {
        if (!isset($data['method'])) {
            throw new DomainException(self::MSG_REQUIRED_METHOD);
        }

        switch ($data['method']) {
            case PaymentMethod::METHOD_ACH:
                $paymentInstrument = new AchInstrument($data);

                break;
            case PaymentMethod::METHOD_CASH:
                $paymentInstrument = new CashInstrument($data);

                break;
            case PaymentMethod::METHOD_PAYMENT_CARD:
                $paymentInstrument = new PaymentCardInstrument($data);

                break;
            case PaymentMethod::METHOD_PAYPAL:
                $paymentInstrument = new PayPalInstrument($data);

                break;
            default:
                throw new DomainException(
                    sprintf(self::MSG_UNSUPPORTED_METHOD, implode(',', self::$supportMethods))
                );
        }

        return $paymentInstrument;
    }
532556
public function create(array $data)
    {
        $model = $this->app->make($this->model());
        $model->fill($data);

        $wasSaved = $model->save();

        if ($wasSaved) {
            return $this->find($model->id);
        }

        $errorMessage = "Não foi possível salvar.";

        if (method_exists($model, 'isValid')) {
            $exception = new ValidationException();
            $exception->setMessages($model->getValidationErrors()->all());

            throw $exception;
        }
        throw new ApiException($errorMessage);

    }
572139
protected function create(array $data)
    {
        if (null === $this->resultFactory) {
            $this->resultFactory = new Factory();
        }

        return $this->resultFactory->create($data);
    }