예제 #1
0
 function create()
 {
     $this->respondTo('html', function () {
         $request = $this->getRequest();
         $response = $this->getResponse();
         try {
             Author::create($request->getParams());
             $response->redirect('App\\Admin\\Controllers\\AuthorController', 'index');
         } catch (ValidationException $e) {
             $flash = $this->getSession()->getFlashBag();
             $flash->set('inputs', $request->getParams()->all());
             $flash->set('errors', $e->getErrors());
             $response->redirect('App\\Admin\\Controllers\\AuthorController', 'add');
         }
     });
 }