@@ -53,8 +53,7 @@ public function index()
53
53
if (property_exists ($ model , 'translatable ' ))
54
54
{
55
55
$ this ->data ['entries ' ] = $ model ::where ('translation_lang ' , \Lang::locale ())->get ();
56
- }
57
- else
56
+ } else
58
57
{
59
58
$ this ->data ['entries ' ] = $ model ::all ();
60
59
}
@@ -106,7 +105,7 @@ public function create()
106
105
* Store a newly created resource in the database.
107
106
*
108
107
* @param StoreRequest $request - type injection used for validation using Requests
109
- * @return Response
108
+ * @return \Illuminate\Http\RedirectResponse
110
109
*/
111
110
public function storeCrud (StoreRequest $ request = null )
112
111
{
@@ -124,7 +123,7 @@ public function storeCrud(StoreRequest $request = null)
124
123
// if it's a relationship with a pivot table, also sync that
125
124
$ this ->prepareFields ();
126
125
foreach ($ this ->crud ['fields ' ] as $ k => $ field ) {
127
- if (isset ($ field ['pivot ' ]) && $ field ['pivot ' ]== true && \Request::has ($ field ['name ' ]))
126
+ if (isset ($ field ['pivot ' ]) && $ field ['pivot ' ] == true && \Request::has ($ field ['name ' ]))
128
127
{
129
128
$ model ::find ($ item ->id )->$ field ['name ' ]()->attach (\Request::input ($ field ['name ' ]));
130
129
}
@@ -182,7 +181,7 @@ public function edit($id)
182
181
* Update the specified resource in the database.
183
182
*
184
183
* @param UpdateRequest $request - type injection used for validation using Requests
185
- * @return Response
184
+ * @return \Illuminate\Http\RedirectResponse
186
185
*/
187
186
public function updateCrud (UpdateRequest $ request = null )
188
187
{
@@ -198,7 +197,7 @@ public function updateCrud(UpdateRequest $request = null)
198
197
199
198
// if it's a relationship with a pivot table, also sync that
200
199
foreach ($ this ->crud ['fields ' ] as $ k => $ field ) {
201
- if (isset ($ field ['pivot ' ]) && $ field ['pivot ' ]== true && \Request::has ($ field ['name ' ]))
200
+ if (isset ($ field ['pivot ' ]) && $ field ['pivot ' ] == true && \Request::has ($ field ['name ' ]))
202
201
{
203
202
$ model ::find (\Request::input ('id ' ))->$ field ['name ' ]()->sync (\Request::input ($ field ['name ' ]));
204
203
}
@@ -235,7 +234,7 @@ public function show($id)
235
234
* Remove the specified resource from storage.
236
235
*
237
236
* @param int $id
238
- * @return Response
237
+ * @return string
239
238
*/
240
239
public function destroy ($ id )
241
240
{
@@ -279,8 +278,7 @@ public function reorder($lang = false)
279
278
$ this ->data ['entries ' ] = $ model ::where ('translation_lang ' , $ lang )->get ();
280
279
$ this ->data ['languages ' ] = \Backpack \LangFileManager \app \Models \Language::all ();
281
280
$ this ->data ['active_language ' ] = $ lang ;
282
- }
283
- else
281
+ } else
284
282
{
285
283
$ this ->data ['entries ' ] = $ model ::all ();
286
284
}
@@ -323,8 +321,7 @@ public function saveReorder()
323
321
$ count ++;
324
322
}
325
323
}
326
- }
327
- else
324
+ } else
328
325
{
329
326
return false ;
330
327
}
@@ -358,7 +355,7 @@ public function showDetailsRow($id)
358
355
$ this ->data ['languages ' ] = \Backpack \LangFileManager \app \Models \Language::all ();
359
356
$ this ->data ['languages_already_translated_in ' ] = $ this ->data ['entry ' ]->translationLanguages ();
360
357
$ this ->data ['languages_to_translate_in ' ] = $ this ->data ['languages ' ]->diff ($ this ->data ['languages_already_translated_in ' ]);
361
- $ this ->data ['languages_to_translate_in ' ] = $ this ->data ['languages_to_translate_in ' ]->reject (function ($ item ) {
358
+ $ this ->data ['languages_to_translate_in ' ] = $ this ->data ['languages_to_translate_in ' ]->reject (function ($ item ) {
362
359
return $ item ->abbr == \Lang::locale ();
363
360
});
364
361
}
@@ -381,8 +378,7 @@ public function translateItem($id, $lang)
381
378
if ($ existing_translation )
382
379
{
383
380
$ new_entry = $ existing_translation ;
384
- }
385
- else
381
+ } else
386
382
{
387
383
// get the info for that entry
388
384
$ new_entry_attributes = $ this ->data ['entry ' ]->getAttributes ();
@@ -421,22 +417,21 @@ protected function compactFakeFields($request) {
421
417
// go through each defined field
422
418
foreach ($ this ->crud ['fields ' ] as $ k => $ field ) {
423
419
// if it's a fake field
424
- if (isset ($ this ->crud ['fields ' ][$ k ]['fake ' ]) && $ this ->crud ['fields ' ][$ k ]['fake ' ]== true ) {
420
+ if (isset ($ this ->crud ['fields ' ][$ k ]['fake ' ]) && $ this ->crud ['fields ' ][$ k ]['fake ' ] == true ) {
425
421
// add it to the request in its appropriate variable - the one defined, if defined
426
422
if (isset ($ this ->crud ['fields ' ][$ k ]['store_in ' ])) {
427
423
$ request [$ this ->crud ['fields ' ][$ k ]['store_in ' ]][$ this ->crud ['fields ' ][$ k ]['name ' ]] = $ request [$ this ->crud ['fields ' ][$ k ]['name ' ]];
428
424
429
425
$ remove_fake_field = array_pull ($ request , $ this ->crud ['fields ' ][$ k ]['name ' ]);
430
- if (!in_array ($ this ->crud ['fields ' ][$ k ]['store_in ' ], $ fake_field_columns_to_encode , true )){
426
+ if (!in_array ($ this ->crud ['fields ' ][$ k ]['store_in ' ], $ fake_field_columns_to_encode , true )) {
431
427
array_push ($ fake_field_columns_to_encode , $ this ->crud ['fields ' ][$ k ]['store_in ' ]);
432
428
}
433
- }
434
- else //otherwise in the one defined in the $crud variable
429
+ } else //otherwise in the one defined in the $crud variable
435
430
{
436
431
$ request ['extras ' ][$ this ->crud ['fields ' ][$ k ]['name ' ]] = $ request [$ this ->crud ['fields ' ][$ k ]['name ' ]];
437
432
438
433
$ remove_fake_field = array_pull ($ request , $ this ->crud ['fields ' ][$ k ]['name ' ]);
439
- if (!in_array ('extras ' , $ fake_field_columns_to_encode , true )){
434
+ if (!in_array ('extras ' , $ fake_field_columns_to_encode , true )) {
440
435
array_push ($ fake_field_columns_to_encode , 'extras ' );
441
436
}
442
437
}
@@ -469,16 +464,15 @@ protected function getFakeColumnsAsArray() {
469
464
470
465
foreach ($ this ->crud ['fields ' ] as $ k => $ field ) {
471
466
// if it's a fake field
472
- if (isset ($ this ->crud ['fields ' ][$ k ]['fake ' ]) && $ this ->crud ['fields ' ][$ k ]['fake ' ]== true ) {
467
+ if (isset ($ this ->crud ['fields ' ][$ k ]['fake ' ]) && $ this ->crud ['fields ' ][$ k ]['fake ' ] == true ) {
473
468
// add it to the request in its appropriate variable - the one defined, if defined
474
469
if (isset ($ this ->crud ['fields ' ][$ k ]['store_in ' ])) {
475
- if (!in_array ($ this ->crud ['fields ' ][$ k ]['store_in ' ], $ fake_field_columns_to_encode , true )){
470
+ if (!in_array ($ this ->crud ['fields ' ][$ k ]['store_in ' ], $ fake_field_columns_to_encode , true )) {
476
471
array_push ($ fake_field_columns_to_encode , $ this ->crud ['fields ' ][$ k ]['store_in ' ]);
477
472
}
478
- }
479
- else //otherwise in the one defined in the $crud variable
473
+ } else //otherwise in the one defined in the $crud variable
480
474
{
481
- if (!in_array ('extras ' , $ fake_field_columns_to_encode , true )){
475
+ if (!in_array ('extras ' , $ fake_field_columns_to_encode , true )) {
482
476
array_push ($ fake_field_columns_to_encode , 'extras ' );
483
477
}
484
478
}
@@ -536,8 +530,7 @@ protected function prepareFields($entry = false)
536
530
if (isset ($ this ->crud ['create_fields ' ]))
537
531
{
538
532
$ this ->crud ['fields ' ] = $ this ->crud ['create_fields ' ];
539
- }
540
- elseif (isset ($ this ->crud ['update_fields ' ]))
533
+ } elseif (isset ($ this ->crud ['update_fields ' ]))
541
534
{
542
535
$ this ->crud ['fields ' ] = $ this ->crud ['update_fields ' ];
543
536
}
@@ -569,8 +562,9 @@ protected function prepareFields($entry = false)
569
562
570
563
// if no field type is defined, assume the "text" field type
571
564
foreach ($ this ->crud ['fields ' ] as $ k => $ field ) {
572
- if (!isset ($ this ->crud ['fields ' ][$ k ]['type ' ]))
573
- $ this ->crud ['fields ' ][$ k ]['type ' ] = 'text ' ;
565
+ if (!isset ($ this ->crud ['fields ' ][$ k ]['type ' ])) {
566
+ $ this ->crud ['fields ' ][$ k ]['type ' ] = 'text ' ;
567
+ }
574
568
}
575
569
576
570
// if an entry was passed, we're preparing for the update form, not create
0 commit comments