Locker\Repository\Lrs\EloquentRepository::constructStore PHP Method

constructStore() protected method

Constructs a store.
protected constructStore ( Model $model, array $data, array $opts ) : Model
$model Illuminate\Database\Eloquent\Model Model to be stored.
$data array
$opts array
return Illuminate\Database\Eloquent\Model
    protected function constructStore(Model $model, array $data, array $opts)
    {
        // Merges and validates data with defaults.
        $data = array_merge($this->defaults, $data, ['owner_id' => new \MongoId($opts['user']->_id), 'users' => [['_id' => new \MongoId($opts['user']->_id), 'email' => $opts['user']->email, 'name' => $opts['user']->name, 'role' => 'admin']]]);
        $this->validateData($data);
        // Sets properties on model.
        $model->title = $data['title'];
        $model->description = $data['description'];
        $model->owner_id = $data['owner_id'];
        $model->users = $data['users'];
        return $model;
    }