Skip to content

Commit 19de012

Browse files
committed
[BF] use Request because of namespace conflict
1 parent 1c17616 commit 19de012

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/Traits/CanBeCreatedOnTheFly.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
namespace Webfactor\Laravel\Backpack\InstantFields;
44

5+
use Illuminate\Http\Request;
6+
57
trait CanBeCreatedOnTheFly
68
{
79
/**
@@ -35,7 +37,7 @@ public function ajaxCreate()
3537
{
3638
$this->crud->hasAccessOrFail('create');
3739

38-
return \View::make('backpack_ajax.create')
40+
return \View::make('webfactor::modal.create')
3941
->with('action', 'create')
4042
->with('entity', $this->getAjaxEntity())
4143
->with('crud', $this->crud)
@@ -46,12 +48,13 @@ public function ajaxCreate()
4648
}
4749

4850
/**
49-
* Checks permission and tries to store on-the-fly entity
51+
* Checks permission and tries to store on-the-fly entity. If you want to enable request validation,
52+
* please copy this method in your EntityCrudController and replace Request by your StoreRequest.
5053
*
5154
* @param StoreRequest $request
5255
* @return \Illuminate\Http\JsonResponse
5356
*/
54-
public function ajaxStore(StoreRequest $request)
57+
public function ajaxStore(Request $request)
5558
{
5659
if (!$this->crud->hasAccess('create')) {
5760
return $this->ajaxRespondNoPermission();
@@ -93,4 +96,4 @@ private function ajaxRespondError()
9396
{
9497
return response()->json(['errors' => 'Could not save'], 422);
9598
}
96-
}
99+
}

0 commit comments

Comments
 (0)