Esempio n. 1
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param FormBuilder $formBuilder
  * @param  int        $id
  *
  * @return \Illuminate\Http\Response
  */
 public function edit(FormBuilder $formBuilder, $id)
 {
     $site = Site::whereId($id)->first();
     Helper::allow('site-edit', $site);
     //make consistent with the autocomplete
     $site->city_id = $site->city->name . ' (' . $site->city->province->name . ')';
     $form = $formBuilder->create('App\\Http\\Forms\\SiteForm', ['method' => 'PUT', 'url' => route('sites.update', $site->id), 'model' => $site]);
     $form->add('submit', 'submit', ['label' => 'Update your business', 'attr' => ['class' => 'btn btn-primary btn-block']]);
     $form->add('edit', 'hidden', ['default_value' => '1']);
     $form->modify('name', 'text', ['attr' => ['readonly']]);
     if ($site->barangay) {
         $form->modify('barangay_name', 'text', ['default_value' => $site->barangay->name]);
     }
     $title = 'Update ' . $site->name;
     $var = City::cityListForAutoComplete();
     return view('sites.create', compact('form', 'title', 'var', 'site'));
 }