/**
  * @param mixed $response
  */
 public function handleDispatchResponse($response)
 {
     // Catch a Redirect response
     if ($response instanceof RedirectResponse) {
         ResponseException::chain($response)->fire();
     }
 }
 public function testChaining()
 {
     $object = m::mock('mock');
     $object->shouldReceive('foo')->with(1, 2, 'foo')->once();
     $object->shouldReceive('bar')->with('var')->once();
     $this->setExpectedException('DeSmart\\ResponseException\\Exception');
     ResponseException::chain($object)->foo(1, 2, 'foo')->bar('var')->fire();
 }
 /**
  * Redirect to the content configuration form.
  *
  * Right after the content block has been created, we can hook into the
  * save method and redirect to a configuration form. There we can set
  * the needed params required for this content block to work.
  *
  * It uses the ResponseException instead of the normal Redirect object.
  * This is because a normal redirect will not work, because that
  * object is never returned as a view. But now we throw a special
  * exception that will do the trick for us.
  *
  * @param Content $content
  */
 public function onSaved(Content $content)
 {
     if (Request::ajax()) {
         return;
     }
     $redirect = Redirect::to(\URL::route('admin.content.config.edit', $content->id) . '?mode=view');
     return ResponseException::chain($redirect)->fire();
 }
Example #4
0
 /**
  * @param Model          $model
  * @param CrudController $controller
  */
 public function onSaved(Model $model, CrudController $controller)
 {
     // We are only interested in a resource controller
     if (!$controller instanceof ResourceController) {
         return;
     }
     // Redirect to the newly created resource
     $page = Page::whereController($model->controller . '@create')->first();
     ResponseException::chain(Redirect::route($page->alias))->fire();
 }
 /**
  * @param Model          $model
  * @param CrudController $controller
  */
 public function onSaved(Model $model, CrudController $controller)
 {
     // We are only interested in a resource controller
     if (!$controller instanceof ResourceController) {
         return;
     }
     // Redirect to the newly created resource
     $route = Str::slug($model->title);
     ResponseException::chain(Redirect::route($route))->fire();
 }