Пример #1
0
 public function testArrayDivide()
 {
     $array = array('name' => 'taylor');
     list($keys, $values) = array_divide($array);
     $this->assertEquals(array('name'), $keys);
     $this->assertEquals(array('taylor'), $values);
 }
Пример #2
0
 protected function buildTee()
 {
     $array = [];
     $selected = !isset($this->model->id) ? [] : $this->model->permissions()->lists('id')->toArray();
     list($keys, $values) = array_divide($this->permissiongroup->getOrderdGroups());
     foreach ($keys as $key) {
         $group = $this->permissiongroup->find($key);
         $parent = $group->parent_id != null ? 'group_' . $group->parent_id : '#';
         array_push($array, ['id' => 'group_' . $group->id, 'parent' => $parent, 'text' => $group->name, 'li_attr' => ['group' => '1']]);
         if ($group->permissions->count()) {
             foreach ($group->permissions as $permission) {
                 $permission_array = ['id' => $permission->id, 'parent' => 'group_' . $group->id, 'text' => $permission->display_name, 'li_attr' => ['group' => '0']];
                 if (!empty($selected) && in_array($permission->id, $selected)) {
                     $permission_array['state'] = ['selected' => 'true'];
                 }
                 $dependencies = $permission->dependencies()->lists('dependency_id');
                 if ($dependencies->count() > 0) {
                     $permission_array['text'] = $permission->display_name . '[D]';
                 }
                 $permission_array['li_attr']['dependencies'] = $dependencies->all();
                 array_push($array, $permission_array);
             }
         }
     }
     return json_encode($array);
 }
Пример #3
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $pages = Category::orderBy('parent_id', 'ASC')->orderBy('category_order', 'ASC')->get()->toArray();
     $Tree = new Tree();
     $tree = $Tree->buildTree($pages);
     list($keys, $values) = array_divide($tree);
     return $values;
 }
Пример #4
0
 public function leads_by_source()
 {
     $lead_sources = $this->reporting->leads_by_source();
     list($keys, $values) = array_divide($lead_sources);
     $leads = $this->reporting->setLeadsBySourceGroup();
     //dd($leads);
     return view('admin.leadrouter.all_leads_by_source', compact('leads', 'keys', 'values'));
 }
Пример #5
0
 /**
  * Show aliased output for arrays.
  *
  * @return array
  */
 public function toArray()
 {
     $array = parent::toArray();
     $replacements = array_flip($this->aliases);
     list($keys, $values) = array_divide($array);
     $keys = array_map(function ($key) use($replacements) {
         return array_key_exists($key, $replacements) ? $replacements[$key] : $key;
     }, $keys);
     return array_combine($keys, $values);
 }
Пример #6
0
 function hris_array_map($array)
 {
     $content = [];
     $keys = array_divide($array)[0];
     for ($i = 0; $i <= count(last($array)) - 1; $i++) {
         $virtual = [];
         foreach ($keys as $key) {
             $virtual = array_add($virtual, $key, $array[$key][$i]);
         }
         array_push($content, $virtual);
     }
     return $content;
 }
 public function getEdit($id)
 {
     if (!$this->hasPermission('edit.user')) {
         return response()->view('errors.401', [], 401);
     }
     if ($this->user->id == $id) {
         return redirect('/user/myaccount/' . $id);
     }
     $roles = Role::all();
     $user = User::find($id);
     list($permissions, $values) = array_divide($user->permissions);
     return view('user.edit', compact('user', 'roles', 'permissions'));
 }
 public function columns()
 {
     $checkbox_str = '';
     if (auth()->user()->can($this->getRouteName() . '_delete')) {
         $checkbox_str = $this->datatable_addtions['checkbox'];
     }
     $str = "";
     $array = array_dot($this->model->datatable_fields);
     foreach (array_divide($this->model->datatable_fields)[0] as $value) {
         $className = isset($array[$value . '.className']) ? 'className: "' . $array[$value . '.className'] . '", ' : '';
         $str .= "{ data: '" . $value . "', name: '" . $value . "'," . $className . " title:'" . trans('messages.' . $value) . "', orderable: " . strbool($array[$value . '.orderable']) . ", searchable: " . strbool($array[$value . '.searchable']) . " },";
     }
     return "[" . $checkbox_str . $str . $this->datatable_addtions['action'] . "]";
 }
 /**
  * Display a listing of admins
  *
  * @return Response
  */
 public function index()
 {
     if ($this->modelName) {
         if (Input::has('sorting')) {
             $row = $this->modelWrapper->findOrFail((int) Input::get('id'));
             $row->fill(array('sorting' => (int) Input::get('sorting')));
             $this->modelWrapper->hasMethod('updateUniques') ? $row->updateUniques() : $row->save();
             return Response::make('OK', 200);
         }
         // FIXME:
         if ($filter = Input::get('filter')) {
             if (isset($filter['category.title'])) {
                 $rows = $this->modelWrapper->getByCategory(Category::where('alias', $filter['category.title'])->firstOrFail());
             }
         } else {
             // TODO: check if exists, validate: Eloquent/Ardent/Custom
             $obj = $this->modelWrapper->model();
             !$this->modelWrapper->hasMethod('withTrashed') ?: ($obj = $obj::withTrashed());
             if ($orderBy = Input::get('orderBy')) {
                 list($field, $dir) = array_divide($orderBy);
                 //$this->modelWrapper->orderBy($field[0],$dir[0]);
                 call_user_func_array(array($obj, "orderBy"), array($field[0], $dir[0]));
             }
             // normal or static call
             if (get_class($obj) === $this->modelName) {
                 // WTF???
                 if (method_exists($obj, 'paginate')) {
                     $rows = $this->modelWrapper->paginate(Config::get('reactiveadmin::rows_count'));
                 } else {
                     $rows = $this->modelWrapper->all();
                 }
             } else {
                 $rows = method_exists($obj, 'paginate') ? $obj->paginate(Config::get('reactiveadmin::rows_count')) : $obj->get();
             }
         }
         $this->layout->content = View::make($this->viewsPath . '.index')->with('rows', $rows);
     } else {
         $this->layout->content = View::make('reactiveadmin::dashboard');
     }
 }
Пример #10
0
 private static function match($method, $uri)
 {
     foreach (self::method($method) as $route => $action) {
         if (Str::contains($route, "(")) {
             list($search, $replace) = array_divide(self::$optional);
             $key = str_replace($search, $replace, $route, $count);
             if ($count > 0) {
                 $key .= str_repeat(')?', $count);
             }
             $pattern = "#^" . strtr($key, self::$patterns) . "\$#u";
             if (preg_match($pattern, $uri, $parameters)) {
                 return new Route($method, $route, $action, array_slice($parameters, 1));
             }
         }
     }
 }
Пример #11
0
 public function uitstoreSession(Request $request)
 {
     list($keys, $values) = array_divide($request->all());
     $request->session()->put($keys[0], $values[0]);
     return response()->json($request->session()->all(), 200);
 }
Пример #12
0
 protected function equipSort($data, $section, $sort)
 {
     list($keys, $values) = array_divide(Admin::TAXONOMY);
     $taxes = Utils::array_starts_with($keys, $section);
     $sorts = [];
     foreach ($taxes as $tax) {
         $sorts[] = explode('-', $tax)[1];
     }
     $data['sorts'] = $sorts;
     $data['sort'] = $sort;
     $data['TRANS_TAXONOMY'] = Admin::TRANS_TAXONOMY;
     return $data;
 }
 public function analyze(Request $request)
 {
     if ($request->isMethod('post')) {
         $this->validate($request, ['sintoma' => 'required'], ['sintoma.required' => 'Debe seleccionar un síntoma para continuar']);
         if ($request->session()->has('session_sintomas')) {
             // Acá busca si el elemento no está en el array de session, para agregarlo
             $sessionSymptoms = $request->session()->get('session_sintomas');
             if (!in_array($request->sintoma, $sessionSymptoms)) {
                 $sessionSymptoms[] = $request->sintoma;
                 $request->session()->put(['session_sintomas' => $sessionSymptoms]);
             }
         } else {
             $request->session()->put(['session_sintomas' => [$request->sintoma]]);
         }
     }
     $sessionSymptoms = $request->session()->get('session_sintomas');
     // Buscamos en la tabla de reglas con los síntomas obtenidos de la sesión primero buscando
     // por síntomas  y después buscando por número de regla
     $rules = Rule::with('symptom')->whereIn('symptom_id', $sessionSymptoms)->get()->groupBy('number');
     //dd($rules, $sessionSymptoms);
     list($rulesKeys) = array_divide($rules->toArray());
     // Después buscamos en la tabla de reglas en base a número de su regla
     // obtenido en la anterior operación
     $rules = Rule::with('symptom')->whereIn('number', $rulesKeys)->get()->groupBy('number');
     //Agrupamos los interiores de las reglas en base al número de su síntoma
     $rules = $rules->map(function ($symptoms, $key) {
         return $symptoms->groupBy('symptom_id');
     });
     // Filtramos solo las reglas que contengan un número de síntomas igual a
     // los de la sesión o mayores y que los síntomas de la sesión estén
     // contenidos en cada una de las reglas.
     // Ej: [1,7,9] >= [1, 9] && [1,9] = [1,9]
     $rules = $rules->filter(function ($rule) use($sessionSymptoms) {
         list($symptomKeys) = array_divide($rule->toArray());
         $intersect = array_intersect($sessionSymptoms, $symptomKeys);
         if ($rule->count() >= count($sessionSymptoms) && $intersect == $sessionSymptoms) {
             return true;
         }
     });
     //dd($rules, $sessionSymptoms);
     $symptomsForSelect = [];
     $diagnosticId = 0;
     $maxSymptomKey = 0;
     //dd($rules);
     foreach ($rules as $key => $ruleNumber) {
         list($symptomKeys) = array_divide($ruleNumber->toArray());
         $difference = array_diff($symptomKeys, $sessionSymptoms);
         // Contamos el arreglo de sintomas para saber cual es el que tendrá
         // más elementos y lo asignamos a la variable maxSymptomKey
         if (count($symptomKeys) > $maxSymptomKey) {
             $maxSymptomKey = count($symptomKeys);
         }
         //dd($difference, $symptomKeys);
         // Si esta vacío significa que no hay diferencias
         if (empty($difference)) {
             // tomamos el primer elemento del primer elemento de la coleccion
             // (está ordenado por id_sintoma)
             $diseaseKey = $ruleNumber->first()->first()->disease_id;
             $diagnosticId = $this->generateDiagnostic($diseaseKey, $request->user()->id);
             $request->session()->forget('session_sintomas');
             return redirect()->route('user::diagnosticos::show', $this->encode($diagnosticId));
         } elseif ($symptomKeys == $difference) {
             alert('No se encontró ninguna enfermedad con los síntomas brindados, intente de nuevo', 'danger');
             return redirect()->route('user::diagnosticos::create');
         } else {
             $tempSymptoms = Symptom::findOrFail($difference);
             foreach ($tempSymptoms as $tempSymptom) {
                 $symptomsForSelect[$tempSymptom->id] = $tempSymptom->name;
             }
         }
     }
     // Si se acabaron los síntomas o si los síntomas en sesión son mayores
     // al mayor arreglo por regla entonces es porque la enfermedad es
     // indetectable con los síntomas ingresados.
     // Ej: Máxima Regla = [1, 3, 9, 10]
     // Ej: Síntoma en sesión = [1, 3, 4, 5, 9, 10, 13]
     $numberSessionSymtoms = count($request->session()->get('session_sintomas'));
     if (empty($symptomsForSelect) || $numberSessionSymtoms > $maxSymptomKey) {
         alert('No se encontró ninguna enfermedad con los síntomas brindados, intente de nuevo', 'danger');
         return redirect()->route('user::diagnosticos::create');
     }
     // Listar los síntomas escogidos
     $tempSymptoms = Symptom::findOrFail($request->session()->get('session_sintomas'));
     foreach ($tempSymptoms as $tempSymptom) {
         $showSymptoms[$tempSymptom->id] = $tempSymptom->name;
     }
     return view('user.diagnostic.create')->with('showSymptoms', $showSymptoms)->with('sintomas', $symptomsForSelect);
 }
 private function checkIfRuleExists($symptomsArray)
 {
     $rules = Rule::with('symptom')->whereIn('symptom_id', $symptomsArray)->get()->groupBy('number');
     list($rulesKeys) = array_divide($rules->toArray());
     $rules = Rule::with('symptom')->whereIn('number', $rulesKeys)->get()->groupBy('number');
     $rules = $rules->map(function ($symptoms, $key) {
         return $symptoms->groupBy('symptom_id');
     });
     $rules = $rules->filter(function ($rule) use($symptomsArray) {
         list($symptomKeys) = array_divide($rule->toArray());
         $intersect = array_intersect($symptomsArray, $symptomKeys);
         if ($rule->count() >= count($symptomsArray) && $intersect == $symptomsArray) {
             return true;
         }
     });
     $maxSymptomKey = 0;
     foreach ($rules as $key => $ruleNumber) {
         list($symptomKeys) = array_divide($ruleNumber->toArray());
         $difference = array_diff($symptomKeys, $symptomsArray);
         if (empty($difference)) {
             return true;
         } elseif ($symptomKeys == $difference) {
             return false;
         }
     }
 }
Пример #15
0
function game_rules_update_process()
{
    global $wpdb;
    if ($_POST) {
        extract($_POST);
        $number = count($team);
        if ($number % 2 == 0) {
            if ($action == 'update_rules') {
                //echo $updateleaguename;
                $getCompId = $wpdb->get_row("SELECT * FROM wp_terms WHERE name = '{$updateleaguename}'");
                $getLeagueCompId = $getCompId->term_id;
                $getLeagueCompName = $getCompId->name;
                /////////////// Add Events
                $numRp = 0;
                $getDevideNumber = array_divide($team, $team_pools);
                $countArr = count($getDevideNumber);
                for ($arr = 0; $arr < $countArr; $arr++) {
                    $getcountArr[] = count($getDevideNumber[$arr]);
                }
                if (count(array_unique($getcountArr)) === 1) {
                    for ($xbr = 0; $xbr < count($getcountArr); $xbr++) {
                        $ids = $getDevideNumber[$xbr];
                        $getTermTx = get_the_terms($ids[$xbr], 'sp_venue');
                        $combinations = array();
                        //$ids = array_unique($ids); // remove duplicates
                        $num_ids = count($ids);
                        $each_team_match = $play_x_games;
                        for ($x = 0; $x < $each_team_match; $x++) {
                            $sr = 1;
                            for ($i = 0; $i < $num_ids; $i++) {
                                for ($j = $i + 1; $j < $num_ids; $j++) {
                                    shuffle($ids);
                                    $combinations = array($ids[$i], $ids[$j]);
                                    shuffle($combinations);
                                    $vendueId = $getTermTx[$numRp]->term_id;
                                    //echo  $combinations[0] .' vs '.$combinations[1].'</b><br>'; sp_event
                                    $startDate = time();
                                    $dateTime = date('Y-m-d H:i:s', strtotime('+1 day', $startDate));
                                    $my_post = array('post_title' => get_the_title($combinations[0]) . ' vs ' . get_the_title($combinations[1]), 'post_content' => get_the_title($combinations[0]) . ' vs ' . get_the_title($combinations[1]), 'post_type' => 'sp_event', 'post_status' => $eventstatus, 'post_date' => $dateTime, 'post_date_gmt' => $dateTime, 'post_author' => 1);
                                    wp_insert_post($my_post);
                                    $post_id = $wpdb->insert_id;
                                    add_post_meta($post_id, 'sp_season', $season);
                                    add_post_meta($post_id, 'sp_league', $league);
                                    add_post_meta($post_id, 'sp_team', $combinations[0]);
                                    add_post_meta($post_id, 'sp_team', $combinations[1]);
                                    add_post_meta($post_id, 'sp_format', 'league');
                                    $addleage = $wpdb->query("insert into wp_term_relationships set object_id = '{$post_id}', term_taxonomy_id = '{$getLeagueCompId}'  ");
                                    $addseason = $wpdb->query("insert into wp_term_relationships set object_id = '{$post_id}', term_taxonomy_id = '{$season}'  ");
                                    $addseason = $wpdb->query("insert into wp_term_relationships set object_id = '{$post_id}', term_taxonomy_id = '{$vendueId}'  ");
                                }
                            }
                        }
                    }
                    foreach ($_POST as $key => $val) {
                        //update_option('_'.$key,);
                        if ($key != 'action' and $key != 'submit') {
                            update_option('_' . $key, $val);
                        }
                    }
                    //////////////// create playoff
                    $startDate = time();
                    $dateTime = date('Y-m-d H:i:s', strtotime('+1 day', $startDate));
                    //playoffRounds
                    $my_post = array('post_title' => $getLeagueCompName . ' Playoff', 'post_content' => $getLeagueCompName . ' Playoff', 'post_type' => 'sp_tournament', 'post_status' => $eventstatus, 'post_date' => $dateTime, 'post_date_gmt' => $dateTime, 'post_author' => 1);
                    wp_insert_post($my_post);
                    $post_id = $wpdb->insert_id;
                    add_post_meta($post_id, 'sp_rounds', $playoffRounds);
                    if ($playoffRounds == 2) {
                        $roundLebels = 'a:2:{i:0;s:10:"Semi Final";i:1;s:5:"Final";}';
                        add_post_meta($post_id, 'sp_labels', $roundLebels);
                        add_post_meta($post_id, 'sp_events', 'a:3:{i:0;s:1:"0";i:1;s:1:"0";i:2;s:1:"0";}');
                    } else {
                        if ($playoffRounds == 3) {
                            $roundLebels = 'a:3:{i:0;s:7:"Quarter";i:1;s:10:"Semi Final";i:2;s:5:"Final";}';
                            add_post_meta($post_id, 'sp_labels', $roundLebels);
                            add_post_meta($post_id, 'sp_events', 'a:7:{i:0;s:1:"0";i:1;s:1:"0";i:2;s:1:"0";i:3;s:1:"0";i:4;s:1:"0";i:5;s:1:"0";i:6;s:1:"0";}');
                        }
                    }
                    //////////////// end create playoff
                    $success = array('success' => '1', 'error' => '0');
                    // Redirect for displaying message
                    $new_url .= add_query_arg($success, get_permalink());
                    wp_redirect($new_url, 303);
                } else {
                    $error = array('success' => '0', 'error' => '3');
                    // Redirect for displaying message
                    $new_url .= add_query_arg($error, get_permalink());
                    wp_redirect($new_url, 303);
                }
                ////////////// Add Events End
            }
        } else {
            $error = array('success' => '0', 'error' => '2');
            // Redirect for displaying message
            $new_url .= add_query_arg($error, get_permalink());
            wp_redirect($new_url, 303);
        }
    }
}
Пример #16
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     list($keys, $values) = array_divide($this->_plan_courses->toArray());
     $plans = Plan::whereIn('course_id', $keys)->get();
     return view('plans.index', compact('plans'));
 }
Пример #17
0
 protected static function wildcards($key)
 {
     list($search, $replace) = array_divide(static::$optional);
     $key = str_replace($search, $replace, $key, $count);
     if ($count > 0) {
         $key .= str_repeat(')?', $count);
     }
     return strtr($key, static::$patterns);
 }
Пример #18
0
 private function systemMenu($data = null)
 {
     $system = [];
     $data = !empty($data) ?: $this->user_domain_menu['systems'];
     $nav = config('menu.nav.main');
     $drops = [];
     $systems = array_except($nav, strtolower($this->user_domain));
     $system_domains = array_divide($systems)[0];
     $x = array_divide(array_divide($data)[1]);
     $drops = $x[1];
     $names = array();
     // goes back to the config menu
     if (!empty($drops)) {
         foreach ($drops as $index => $drop) {
             if (isset($drop['name'])) {
                 $got = array_get($nav, strtolower($drop['name']));
                 $system[$drop['name']] = $got;
             }
         }
     }
     // goes throw the system name indexes
     // calls the names form the main menu and create drop downs
     return $system;
 }
Пример #19
0
 /**
  * Prepare the defined keys.
  *
  * @return array
  */
 public function getPreparedKeys()
 {
     list($tables, $keys) = array_divide($this->getKeys());
     return array_map([$this, 'buildCollection'], $tables, $keys);
 }
Пример #20
0
 /**
  * Translate route URI wildcards into regular expressions.
  *
  * @param  string  $key
  * @return string
  */
 protected static function wildcards($key)
 {
     list($search, $replace) = array_divide(static::$optional);
     // For optional parameters, first translate the wildcards to their
     // regex equivalent, sans the ")?" ending. We'll add the endings
     // back on when we know the replacement count.
     $key = str_replace($search, $replace, $key, $count);
     if ($count > 0) {
         $key .= str_repeat(')?', $count);
     }
     return strtr($key, static::$patterns);
 }
Пример #21
0
 /**
  * Display a listing of the resource.
  *
  * @return View
  */
 public function index()
 {
     $search = null !== \Input::get('search') ? \Input::get('search') : "";
     $structure = $this->structure;
     $searchableField = isset($structure['searchable_fields']) ? $structure['searchable_fields'] : 'name';
     $required = array();
     $models = array();
     $rows = array();
     $paginate = !empty($this->paginate) ? $this->paginate : 20;
     if (strlen($search) >= 0) {
         if (isset($structure['index']['self'])) {
             if (is_array($structure['index']['self'])) {
                 foreach ($structure['index']['self'] as $self => $title) {
                     $required[$self]['title'] = $title;
                 }
             }
         }
         if (isset($structure['index']['relations'])) {
             if (is_array($structure['index']['relations'])) {
                 foreach ($structure['index']['relations'] as $relation => $array) {
                     foreach ($array as $key => $value) {
                         $required[$relation . '.' . $key]['title'] = $value;
                     }
                     $relations[] = $relation;
                 }
             }
         }
         $paginatedModels = new $structure['model']();
         if (isset($relations)) {
             $paginatedModels = $paginatedModels::with($relations);
         }
         if (is_array($searchableField)) {
             $paginatedModels = $paginatedModels->where($searchableField[0], 'LIKE', "%{$search}%");
             unset($searchableField[0]);
             foreach ($searchableField as $field) {
                 $paginatedModels = $paginatedModels->orWhere($field, 'LIKE', "%{$search}%");
             }
         } else {
             $paginatedModels = $paginatedModels->where($searchableField, 'LIKE', "%{$search}%");
         }
         $paginatedModels = $paginatedModels->orderBy('id', 'desc')->paginate($paginate);
         $models = $paginatedModels->items();
         foreach ($models as $key => $model) {
             $models[$key]->revealHidden();
         }
         list($required_keys) = array_divide($required);
         foreach ($models as $model_key => $model) {
             foreach ($required_keys as $required_key) {
                 $title = $required[$required_key]['title'];
                 $value = $model->{$required_key};
                 if (!isset($value)) {
                     $address = explode('.', "{$required_key}");
                     if (is_array($model[$address[0]])) {
                         foreach ($model[$address[0]] as $sub) {
                             $value .= array_get($sub, $address[1]) . ", ";
                         }
                     }
                 }
                 $rows[array_get($model, 'id')][$title] = $value;
             }
         }
     }
     return \View::make($this->view['index'])->with(array('rows' => $rows, 'search' => $search, 'structure' => $structure, 'pagination' => $paginatedModels));
 }
Пример #22
0
 /**
  * Prepare modifiers for preg replace
  * @param  array $modifiers Unprepared modifiers
  * @return array            Prepared modifiers
  */
 protected function prepareModifiers($modifiers)
 {
     // Flip array (keys connot be used as reference)
     $modifiers = array_flip($modifiers);
     foreach ($modifiers as $value => &$key) {
         $key = '/\\[(' . $key . ')\\]/';
     }
     // Flip agains
     $modifiers = array_flip($modifiers);
     return array_divide($modifiers);
 }
Пример #23
0
 public function comparar(ParserCFID $parsed)
 {
     $array1 = $this->parsed;
     $array2 = $parsed->parsed;
     $intersect = array_intersect_assoc($array1, $array2);
     list($keys, $values) = array_divide($intersect);
     $array1 = array_except($array1, $keys);
     $array2 = array_except($array2, $keys);
     //Elementos que son diferentes
     $return = array();
     foreach ($array1 as $key => $val) {
         if (array_key_exists($key, $array2)) {
             if ($val != $array2[$key]) {
                 $return[$key] = array($val, $array2[$key]);
             }
             array_forget($array2, $key);
         } else {
             $return[$key] = array($val, "");
         }
     }
     foreach ($array2 as $key => $val) {
         $return[$key] = array("", $val);
         // estos elementos no estan en el array 1
     }
     return $return;
 }
Пример #24
0
<?php

Breadcrumbs::register('dashboard', function ($breadcrumbs) {
    $breadcrumbs->push(trans('messages.dashboard'), route('admin.dashboard.index'), ['icon' => config('menus')['dashboard']['icon']]);
});
$models = array_divide(array_where(config('menus'), function ($key, $value) {
    return $key != 'dashboard';
}))[0];
foreach ($models as $model) {
    Breadcrumbs::register($model . '.index', function ($breadcrumbs) use($model) {
        $breadcrumbs->parent('dashboard');
        $breadcrumbs->push(trans('messages.' . $model), route('admin.' . $model . '.index'));
    });
    Breadcrumbs::register($model . '.create', function ($breadcrumbs, $table) use($model) {
        $breadcrumbs->parent($model . '.index');
        $breadcrumbs->push(trans('messages.create') . $table, route('admin.' . $model . '.create'));
    });
    Breadcrumbs::register($model . '.edit', function ($breadcrumbs, $table) use($model) {
        $breadcrumbs->parent($model . '.index');
        $breadcrumbs->push(trans('messages.edit') . $table, route('admin.' . $model . '.edit'));
    });
}
 /**
  * Determine which of many entities that were attempted to be saved were validated and return original input for those entities.
  * Original input can then be used for indexing
  * @param  array $entity_attributes_keyed_with_model_object_ids original attribute input
  * @param  array $invalid_object_ids                            array for entity object ids that were not validated / installed
  * @return array                                                array of original entities that were validated and installed
  */
 public function validatedEntityAttributes($entity_attributes_keyed_with_model_object_ids, $invalid_object_ids)
 {
     $validated_entities = array_where($entity_attributes_keyed_with_model_object_ids, function ($key, $value) use($invalid_object_ids) {
         if (in_array($key, $invalid_object_ids)) {
             return false;
         }
         return true;
     });
     list($keys, $values) = array_divide($validated_entities);
     //pull values to establish fresh numbered keys
     return $values;
 }