title: Get only the name attribute of the variable send from controller
body: <p>I have this code below:</p>
  
  <pre><code> &lt;script  type="text/javascript"&gt;
          var rtypes = {!!  $registration_type !!}       
  &lt;/script&gt;
  </code></pre>
  
  <p>With this in the source code it appears:</p>
  
  <pre><code>var rtypes = [{"id":1,"name":"general","description":"description geral","capacity":100},{"id":2,"name":"plus","description":"description plus","capacity":10}]
  </code></pre>
  
  <p>But I would like to have only the registration type names like "['general', 'plus', ...];"</p>
  
  <p>Do you know how to get only the name attribute in the JS?</p>
  
  <p><strong>Method that returns the view:</strong></p>
  
  <pre><code> public function edit($id)
      {
          $conf = Conf::find($id);
          $registrationType = RegistrationType::where('conf_id', $id)-&gt;get();
          return view('questions.edit')
              -&gt;with('registration_type', $registrationType)
      }
  </code></pre>