コード例 #1
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store($postTypeId, PostRequest $request)
 {
     //if(!$this->authUser->can('create-edit-news') && !$this->authUser->is('superadmin'))
     //	App::abort(403, 'Access denied');
     $input = $request->all();
     //create the post
     $post = $this->postRepos->create($input);
     //upload the image via service
     if (isset($input['image'])) {
         $this->postService->uploadImage($post, $input['image']);
     }
     //add seo polymorphic model
     $seo = new Seo();
     $seo->updateFromInput($input);
     $post->seo()->save($seo);
     Flash::success('Post was created successfully.');
     return Redirect::route('admin.posts.list', [$postTypeId]);
 }