File tree 2 files changed +25
-1
lines changed
2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -151,6 +151,17 @@ public static function getApp($appid)
151
151
return $ app ;
152
152
}
153
153
154
+
155
+ /**
156
+ * @param $appName
157
+ * @return mixed|null
158
+ * @throws GuzzleException
159
+ */
160
+ public static function findApp ($ appName )
161
+ {
162
+ return self ::where ('name ' , $ appName )->first ()->appid ;
163
+ }
164
+
154
165
/**
155
166
* @param $appid
156
167
* @return mixed|null
Original file line number Diff line number Diff line change @@ -207,6 +207,19 @@ public function edit(int $id): View
207
207
*/
208
208
public static function storelogic (Request $ request , $ id = null ): Item
209
209
{
210
+ if ($ request ->input ('optimistic ' )) {
211
+ $ request ->merge (['app ' => Application::findApp ($ request ->input ('title ' ))]);
212
+ $ request ->merge ((array )json_decode (ItemController::appload ($ request )));
213
+
214
+ # FIXME: I need to fix some param naming here to make it work
215
+ $ request ->merge ([
216
+ /* 'pinned' => 1,*/
217
+ /* 'tags' => [0],*/
218
+ 'icon ' => $ request ->input ('iconview ' ),
219
+ 'appdescription ' => $ request ->input ('description ' ),
220
+ ]);
221
+ }
222
+
210
223
$ application = Application::single ($ request ->input ('appid ' ));
211
224
$ validatedData = $ request ->validate ([
212
225
'title ' => 'required|max:255 ' ,
@@ -366,7 +379,7 @@ public function restore(int $id): RedirectResponse
366
379
*
367
380
* @throws GuzzleException
368
381
*/
369
- public function appload (Request $ request ): ?string
382
+ public static function appload (Request $ request ): ?string
370
383
{
371
384
$ output = [];
372
385
$ appid = $ request ->input ('app ' );
You can’t perform that action at this time.
0 commit comments