Example #1
0
 /**
  * @param int $id
  * @param Media $document
  * @return \Kris\LaravelFormBuilder\Form
  */
 protected function getEditForm($id, Media $document)
 {
     $attributes = ['name' => $document->name, 'public_url' => $document->getPublicURL()];
     foreach ($document->translations as $translation) {
         $attributes[$translation->locale] = $translation->toArray();
     }
     return $this->form('Reactor\\Html\\Forms\\Documents\\EditForm', ['url' => route('reactor.documents.update', $id), 'model' => $attributes]);
 }
 /**
  * Updates a resources from a ajax request
  *
  * @param Request $request
  * @return response
  */
 public function updateJson(Request $request)
 {
     $this->authorize('EDIT_DOCUMENTS');
     $document = Media::findOrFail($request->input('document'));
     $document->update($request->all());
     $this->notify(null, 'updated_media', $document);
     return response()->json($document->summarize());
 }