original_string: public function updateComponentAction(Component $component)
      {
          $componentData = Binput::get('component');
          $tags = Arr::pull($componentData, 'tags');
  
          try {
              $component = execute(new UpdateComponentCommand(
                  $component,
                  $componentData['name'],
                  $componentData['description'],
                  $componentData['status'],
                  $componentData['link'],
                  $componentData['order'],
                  $componentData['group_id'],
                  $componentData['enabled'],
                  null, // Meta data cannot be supplied through the dashboard yet.
                  true // Silent since we're not really making changes to the component (this should be optional)
              ));
          } catch (ValidationException $e) {
              return cachet_redirect('dashboard.components.edit', [$component->id])
                  ->withInput(Binput::all())
                  ->withTitle(sprintf('%s %s', trans('dashboard.notifications.whoops'), trans('dashboard.components.edit.failure')))
                  ->withErrors($e->getMessageBag());
          }
  
          $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 cachet_redirect('dashboard.components.edit', [$component->id])
              ->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('dashboard.components.edit.success')));
      }
code: public function updateComponentAction(Component $component)
      {
          $componentData = Binput::get('component');
          $tags = Arr::pull($componentData, 'tags');
  
          try {
              $component = execute(new UpdateComponentCommand(
                  $component,
                  $componentData['name'],
                  $componentData['description'],
                  $componentData['status'],
                  $componentData['link'],
                  $componentData['order'],
                  $componentData['group_id'],
                  $componentData['enabled'],
                  null, // Meta data cannot be supplied through the dashboard yet.
                  true // Silent since we're not really making changes to the component (this should be optional)
              ));
          } catch (ValidationException $e) {
              return cachet_redirect('dashboard.components.edit', [$component->id])
                  ->withInput(Binput::all())
                  ->withTitle(sprintf('%s %s', trans('dashboard.notifications.whoops'), trans('dashboard.components.edit.failure')))
                  ->withErrors($e->getMessageBag());
          }
  
          $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 cachet_redirect('dashboard.components.edit', [$component->id])
              ->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('dashboard.components.edit.success')));
      }
code_tokens: public function updateComponentAction ( Component $ component ) { $ componentData = Binput :: get ( 'component' ) ; $ tags = Arr :: pull ( $ componentData , 'tags' ) ; try { $ component = execute ( new UpdateComponentCommand ( $ component , $ componentData [ 'name' ] , $ componentData [ 'description' ] , $ componentData [ 'status' ] , $ componentData [ 'link' ] , $ componentData [ 'order' ] , $ componentData [ 'group_id' ] , $ componentData [ 'enabled' ] , null , // Meta data cannot be supplied through the dashboard yet. true // Silent since we're not really making changes to the component (this should be optional) ) ) ; } catch ( ValidationException $ e ) { return cachet_redirect ( 'dashboard.components.edit' , [ $ component -> id ] ) -> withInput ( Binput :: all ( ) ) -> withTitle ( sprintf ( '%s %s' , trans ( 'dashboard.notifications.whoops' ) , trans ( 'dashboard.components.edit.failure' ) ) ) -> withErrors ( $ e -> getMessageBag ( ) ) ; } $ 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 cachet_redirect ( 'dashboard.components.edit' , [ $ component -> id ] ) -> withSuccess ( sprintf ( '%s %s' , trans ( 'dashboard.notifications.awesome' ) , trans ( 'dashboard.components.edit.success' ) ) ) ; }
docstring: Updates a component.
  
  @param \CachetHQ\Cachet\Models\Component $component
  
  @return \Illuminate\Http\RedirectResponse
docstring_tokens: Updates a component .