public function store($payload)
    {
        $payload = $this->parseBlocks($payload, 'blog');

        $payload['title'] = htmlentities($payload['title']);
        $payload['url'] = Cms::convertToURL($payload['url']);
        $payload['is_published'] = (isset($payload['is_published'])) ? (bool) $payload['is_published'] : 0;
        $payload['published_at'] = (isset($payload['published_at']) && !empty($payload['published_at'])) ? Carbon::parse($payload['published_at'])->format('Y-m-d H:i:s') : Carbon::now(config('app.timezone'))->format('Y-m-d H:i:s');

        if (isset($payload['hero_image'])) {
            $file = request()->file('hero_image');
            $path = app(FileService::class)->saveFile($file, 'public/images', [], true);
            $payload['hero_image'] = $path['name'];
        }

        return $this->model->create($payload);
    }
public function store($payload)
    {
        $payload = $this->parseBlocks($payload, 'blog');

        $payload['title'] = htmlentities($payload['title']);
        $payload['url'] = Cms::convertToURL($payload['url']);
        $payload['is_published'] = (isset($payload['is_published'])) ? (bool) $payload['is_published'] : 0;
        $payload['published_at'] = (isset($payload['published_at']) && !empty($payload['published_at'])) ? Carbon::parse($payload['published_at'])->format('Y-m-d H:i:s') : Carbon::now(config('app.timezone'))->format('Y-m-d H:i:s');

        if (isset($payload['hero_image'])) {
            $file = request()->file('hero_image');
            $path = app(FileService::class)->saveFile($file, 'public/images', [], true);
            $payload['hero_image'] = $path['name'];
        }

        return $this->model->create($payload);
    }
public function store ( $ payload ) { $ payload = $ this -> parseBlocks ( $ payload , 'blog' ) ; $ payload [ 'title' ] = htmlentities ( $ payload [ 'title' ] ) ; $ payload [ 'url' ] = Cms :: convertToURL ( $ payload [ 'url' ] ) ; $ payload [ 'is_published' ] = ( isset ( $ payload [ 'is_published' ] ) ) ? ( bool ) $ payload [ 'is_published' ] : 0 ; $ payload [ 'published_at' ] = ( isset ( $ payload [ 'published_at' ] ) && ! empty ( $ payload [ 'published_at' ] ) ) ? Carbon :: parse ( $ payload [ 'published_at' ] ) -> format ( 'Y-m-d H:i:s' ) : Carbon :: now ( config ( 'app.timezone' ) ) -> format ( 'Y-m-d H:i:s' ) ; if ( isset ( $ payload [ 'hero_image' ] ) ) { $ file = request ( ) -> file ( 'hero_image' ) ; $ path = app ( FileService :: class ) -> saveFile ( $ file , 'public/images' , [ ] , true ) ; $ payload [ 'hero_image' ] = $ path [ 'name' ] ; } return $ this -> model -> create ( $ payload ) ; }
Stores Blog into database.

@param array $input

@return Blog
Stores Blog into database .