public function store()
    {
        try {
            $component = execute(new CreateComponentCommand(
                Binput::get('name'),
                Binput::get('description'),
                Binput::get('status'),
                Binput::get('link'),
                Binput::get('order'),
                Binput::get('group_id'),
                (bool) Binput::get('enabled', true),
                Binput::get('meta', null)
            ));
        } catch (QueryException $e) {
            throw new BadRequestHttpException();
        }

        if (Binput::has('tags')) {
            $component->tags()->delete();

            // The component was added successfully, so now let's deal with the tags.
            Collection::make(preg_split('/ ?, ?/', $tags))->map(function ($tag) {
                return trim($tag);
            })->map(function ($tag) {
                return execute(new CreateTagCommand($tag));
            })->each(function ($tag) use ($component) {
                execute(new ApplyTagCommand($component, $tag));
            });
        }

        return $this->item($component);
    }
public function store()
    {
        try {
            $component = execute(new CreateComponentCommand(
                Binput::get('name'),
                Binput::get('description'),
                Binput::get('status'),
                Binput::get('link'),
                Binput::get('order'),
                Binput::get('group_id'),
                (bool) Binput::get('enabled', true),
                Binput::get('meta', null)
            ));
        } catch (QueryException $e) {
            throw new BadRequestHttpException();
        }

        if (Binput::has('tags')) {
            $component->tags()->delete();

            // The component was added successfully, so now let's deal with the tags.
            Collection::make(preg_split('/ ?, ?/', $tags))->map(function ($tag) {
                return trim($tag);
            })->map(function ($tag) {
                return execute(new CreateTagCommand($tag));
            })->each(function ($tag) use ($component) {
                execute(new ApplyTagCommand($component, $tag));
            });
        }

        return $this->item($component);
    }
public function store ( ) { try { $ component = execute ( new CreateComponentCommand ( Binput :: get ( 'name' ) , Binput :: get ( 'description' ) , Binput :: get ( 'status' ) , Binput :: get ( 'link' ) , Binput :: get ( 'order' ) , Binput :: get ( 'group_id' ) , ( bool ) Binput :: get ( 'enabled' , true ) , Binput :: get ( 'meta' , null ) ) ) ; } catch ( QueryException $ e ) { throw new BadRequestHttpException ( ) ; } if ( Binput :: has ( 'tags' ) ) { $ component -> tags ( ) -> delete ( ) ; // The component was added successfully, so now let's deal with the tags. Collection :: make ( preg_split ( '/ ?, ?/' , $ tags ) ) -> map ( function ( $ tag ) { return trim ( $ tag ) ; } ) -> map ( function ( $ tag ) { return execute ( new CreateTagCommand ( $ tag ) ) ; } ) -> each ( function ( $ tag ) use ( $ component ) { execute ( new ApplyTagCommand ( $ component , $ tag ) ) ; } ) ; } return $ this -> item ( $ component ) ; }
Create a new component.

@return \Illuminate\Http\JsonResponse
Create a new component .