Fix setting drop downs not being saved properly #148

This commit is contained in:
Nabeel Shahzad
2018-01-21 13:36:03 -05:00
parent c732268bd7
commit e86fd64235
2 changed files with 26 additions and 3 deletions

View File

@@ -1,5 +1,26 @@
<?php
if(!function_exists('list_to_assoc')) {
/**
* Converts a straight list into an assoc array with
* key and value being the same. Mainly for a select box
*
* e.g.:
* [ 0 => 'item1', 1 => 'item2']
* to:
* ['item1' => 'item1', 'item2' => 'item2']
*
* @param array $list
* @return \Illuminate\Support\Collection
*/
function list_to_assoc(array $list)
{
return collect($list)->mapWithKeys(function ($item) {
return [$item => $item];
});
}
}
if (!function_exists('skin_view')) {
/**
* Render a skin