22
33namespace Webfactor \Laravel \Backpack \InstantFields ;
44
5+ use Illuminate \Http \Request ;
6+
57trait 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