public function update(array $data)
 {
     $contents = $this->contents->findOrFail($data['id']);
     if (!$contents) {
         throw new \App\Exceptions\CampagneUpdateException('Update of content failed');
     }
     $contents->fill($data);
     // if we changed the image
     if (isset($data['image'])) {
         $contents->image = $data['image'];
     }
     // if we changed the lien
     if (isset($data['lien'])) {
         $helper = new Helper();
         $contents->lien = $helper->sanitizeUrl($data['lien']);
     }
     $contents->updated_at = date('Y-m-d G:i:s');
     $contents->save();
     return $contents;
 }
Exemplo n.º 2
0
 /**
  * Sorting bloc newsletter
  * POST remove
  * AJAX
  * @return Response
  */
 public function sortingGroup(Request $request)
 {
     $model = new \App\Droit\Arret\Entities\Groupe();
     $helper = new Helper();
     $data = $request->all();
     $groupe_rang = $data['groupe_rang'];
     $groupe_id = $data['groupe_id'];
     $arrets = $helper->prepareCategories($groupe_rang);
     $groupe = $model->find($groupe_id);
     $groupe->arrets()->sync($arrets);
     print_r($groupe);
 }