/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { $title = "Creer Devis"; $opp = array(); $categories = Category::all(); $options = Option::all(); foreach ($options as $o) { $opp[$o->category_id][$o->id] = $o->name; } return view('Quotations/quotation', ['title' => $title, 'categories' => $categories, 'opp' => $opp]); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { $opp = array(); $categories = Category::orderBy('id', 'DESC')->get(); $title = "Catégories"; $options = Option::all(); foreach ($options as $o) { $opp[$o->category_id][$o->id] = $o; } return view('Categories/categories', ['title' => $title, 'categories' => $categories, 'opp' => $opp]); }
/** * Get all the scenario data for the game to start * * @return JSON data */ public function getStartupData() { $newOptions = $newPeople = array(); $scenarios = Scenario::all(); $options = Option::all(); $people = OptionPerson::all(); foreach ($scenarios as &$s) { foreach ($options as $o) { foreach ($people as $p) { if ($p['option_id'] == $o['id']) { $newPeople[] = array('person_id' => $p['person_id'], 'fatigue' => $p['fatigue'], 'motivation1' => $p['motivation1'], 'motivation2' => $p['motivation2'], 'option_id' => $p['option_id']); } } if ($o['scenario_id'] == $s['id']) { $newOptions[] = array('name' => $o['name'], 'hint' => $o['hint'], 'description' => $o['description'], 'people' => $newPeople); } $newPeople = array(); } $s['options'] = $newOptions; $newOptions = array(); } return $scenarios; }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { return Option::all(); }
public function all_Category() { $listAllcategories = array(); $all_options = Option::all(); $all_categories = Category::all(); foreach ($all_categories as $category) { foreach ($all_options as $opt) { if ($opt['category_id'] == $category['id']) { $listAllcategories[$category->id]['name'] = $category->name_category; $listAllcategories[$category->id]['options'][$opt->id]['name'] = $opt->name; $listAllcategories[$category->id]['options'][$opt->id]['description'] = $opt->description; } } } return $listAllcategories; }
/** * Bootstrap any application services. * * @return void */ public function boot() { view()->composer('layout', function ($view) { $view->with('footerData', Option::all()); }); }
/** * Get all user options. * The missing user options are merged with the default ones * * @param bool * * @return \Illuminate\Database\Eloquent\Collection (of Option) */ public function getOptions($onlyAssignable = false) { // Get default generic options $options = Option::all(); // Get user options $userOptions = $this->options->each(function (&$o) { $o->value = $o->pivot->value; unset($o->pivot); }); // Merge both (user options have priority) $options = $options->merge($userOptions); // Remove assignable? if ($onlyAssignable) { $options = $options->filter(function ($o) { return $o->assignable; }); } return $options; }