Learner\Repositories\Eloquent\SeriesRepository::create PHP Method

create() public method

Create a new Series.
public create ( array $data ) : array
$data array
return array
    public function create($data)
    {
        $newSeries = $this->getNew();
        $newSeries->title = $data['title'];
        $newSeries->slug = str_slug($data['slug']);
        $newSeries->description = $data['description'];
        $newSeries->image = $data['image'];
        $newSeries->save();
        $newSeries->categories()->sync($data['categories']);
        return $this->findByIdWithRelation($newSeries->id, static::$relations)->toArray();
    }