Пример #1
0
 public function editPreparation($product)
 {
     $item = Item::find($product->organizations->first()->pivot->id);
     $itemtags = $item->tags->lists(['id'])->toArray();
     $book = $product->is;
     $bookauthors = $book->authors->lists(['id'])->toArray();
     $categories = $this->getCategoriesByRecursion($item->cat_id);
     $authors = Author::get()->lists('full_name', 'id');
     $editors = ['' => ''] + Editor::lists('e_name', 'id')->all();
     $tags = Tag::lists('tag_name', 'id');
     return compact('product', 'itemtags', 'authors', 'editors', 'categories', 'tags', 'book', 'item', 'bookauthors', 'categories');
 }
Пример #2
0
 public function addNewEditor($request)
 {
     $data = array();
     $rules = ['name' => 'required|min:3|alpha'];
     $messages = ['name.required' => 'Το όνομα είναι υποχρεωτικό', 'name.min' => 'Το όνομα του εκδότη πρέπει να είναι τουλάχιστον 3 χαρακτήρες', 'name.alpha' => 'Το όνομα του εκδότη πρέπει να είναι Αγγλικοί ή Ελληνικοί χαρακτήρες'];
     if ($request->ajax()) {
         $validator = \Validator::make($request->all(), $rules, $messages);
         if ($validator->fails()) {
             return \Response::json($validator->errors()->all(), 422);
         } else {
             $editor = Editor::create(['e_name' => Str::upper($request->get('name'))]);
             if ($editor) {
                 $data['sweetalert'] = ['title' => 'Συγχαρητήρια', 'body' => 'ο εκδότης προστέθηκε με επιτυχία', 'level' => 'success'];
                 $data['editor']['name'] = $editor->e_name;
                 $data['editor']['id'] = $editor->id;
             } else {
                 $data['sweetalert'] = ['title' => 'Πρόβλημα', 'body' => 'ο εκδότης ΔΕΝ  αποθηκεύτηκε...', 'level' => 'error'];
             }
             return \Response::json($data);
         }
     }
 }
 /**
  * Create contact for editor.
  *
  * @param App\Models\Editor  $editor
  * @param array  $inputs
  * @return void
  */
 public function saveContact($editor, $inputs)
 {
     $contact = new $this->contact($inputs);
     $editor->contact()->save($contact);
 }