/**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $val = $this->categoryRepository->getCreateForm();
     if (!$val->isValid()) {
         return Redirect::back()->withInput()->withErrors($val->getErrors());
     }
     if (!($record = $this->categoryRepository->create($val->getInputData()))) {
         return Redirect::back()->with('errors', $this->categoryRepository->errors())->withInput();
     }
     return Redirect::action('AdminCategoriesController@index')->with('success', 'Category Created');
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param $id
  * @return Response
  */
 public function store($id)
 {
     $commentable_id = Input::get('commentable_id');
     $commentable_type = Input::get('commentable_type');
     $val = $this->commentRepository->getCreateForm();
     if (!$val->isValid()) {
         return Redirect::back()->withInput()->withErrors($val->getErrors());
     }
     if (!($record = $this->commentRepository->create(array_merge(['user_id' => Auth::user()->id, 'commentable_id' => $commentable_id, 'commentable_type' => $commentable_type], $val->getInputData())))) {
         return Redirect::back()->with('errors', $this->commentRepository->errors())->withInput();
     }
     if ($commentable_type == 'EventModel') {
         return Redirect::action('EventsController@show', $id)->with('success', trans('word.comment_posted'));
     } else {
         return Redirect::action('BlogsController@show', $id)->with('success', trans('word.comment_posted'));
     }
 }
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $val = $this->contactRepository->getCreateForm();
     if (!$val->isValid()) {
         return Redirect::back()->with('errors', $val->getErrors())->withInput();
     }
     $contact = $this->contactRepository->getFirst();
     if ($contact) {
         if (!$this->contactRepository->update($contact->id, $val->getInputData())) {
             return Redirect::back()->with('errors', $this->contactRepository->errors())->withInput();
         }
     } else {
         if (!$this->contactRepository->create($val->getInputData())) {
             return Redirect::back()->with('errors', $this->contactRepository->errors())->withInput();
         }
     }
     return Redirect::action('AdminContactsController@index')->with('success', 'Saved');
 }