예제 #1
0
 function index()
 {
     $this->respondTo('html', function () {
         $authors = Author::findAll();
         $flash = $this->getSession()->getFlashBag();
         $data['authors'] = $authors;
         $data['errors'] = $flash->get('errors');
         $this->render(new TwigView('admin/author/index.html', $data));
     });
 }
예제 #2
0
 public function editAuthors($id)
 {
     $this->respondTo('html', function () use($id) {
         $product = Product::find($id);
         if ($product == null) {
             $this->getResponse()->redirect('App\\Admin\\Controllers\\ProductController', 'index');
             return;
         }
         $flash = $this->getSession()->getFlashBag();
         $errors = $flash->get('errors');
         $all_authors = Author::findAll();
         $data = ['method' => 'editAuthors', 'page_title' => sprintf("%s - Edit", $product->name), 'product' => $product, 'all_authors' => $all_authors, 'errors' => $errors];
         $this->render(new TwigView('admin/product/edit_authors.html', $data));
     });
 }