|
@@ -22,7 +22,14 @@ class QuickCreate implements Renderable
|
|
|
* @var Collection
|
|
|
*/
|
|
|
protected $fields;
|
|
|
-
|
|
|
+ /**
|
|
|
+ * @var string
|
|
|
+ */
|
|
|
+ protected $action;
|
|
|
+ /**
|
|
|
+ * @var string
|
|
|
+ */
|
|
|
+ protected $method;
|
|
|
/**
|
|
|
* QuickCreate constructor.
|
|
|
*
|
|
@@ -32,6 +39,8 @@ class QuickCreate implements Renderable
|
|
|
{
|
|
|
$this->parent = $grid;
|
|
|
$this->fields = Collection::make();
|
|
|
+ $this->action = request()->url();
|
|
|
+ $this->method = "POST";
|
|
|
}
|
|
|
|
|
|
protected function formatPlaceholder($placeholder)
|
|
@@ -260,10 +269,30 @@ class QuickCreate implements Renderable
|
|
|
|
|
|
return "admin::grid.quick-create.{$name}";
|
|
|
}
|
|
|
+ /**
|
|
|
+ * @param $action
|
|
|
+ * @return $this
|
|
|
+ */
|
|
|
+ public function action($action)
|
|
|
+ {
|
|
|
+ $this->action = admin_url($action);
|
|
|
+ return $this;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @param string $method
|
|
|
+ * @return $this
|
|
|
+ */
|
|
|
+ public function method($method = "POST")
|
|
|
+ {
|
|
|
+ $this->method = $method;
|
|
|
+ return $this;
|
|
|
+ }
|
|
|
|
|
|
protected function script()
|
|
|
{
|
|
|
- $url = request()->url();
|
|
|
+ $url = $this->action;
|
|
|
+ $method = $this->method;
|
|
|
|
|
|
$uniqueName = $this->parent->getName();
|
|
|
|
|
@@ -305,7 +334,7 @@ class QuickCreate implements Renderable
|
|
|
|
|
|
$.ajax({
|
|
|
url: '{$url}',
|
|
|
- type: 'POST',
|
|
|
+ type: '{$method}',
|
|
|
data: $(this).serialize(),
|
|
|
success: function(data) {
|
|
|
ctr.attr('submitting', '');
|