Ejemplo n.º 1
0
 public function getScript($id)
 {
     $scripts = [];
     $cats = array_unique(DB::table('scripts')->lists('type'));
     foreach ($cats as $script_type) {
         $script = Game::findOrFail($id)->scripts;
         if (count($script) == 0) {
             $scripts[$script_type][0] = new Game();
             $scripts[$script_type][0]->id = -1;
             $scripts[$script_type][0]->name = '---';
         } else {
             foreach ($script as $s) {
                 if ($s->type == $script_type) {
                     $scripts[$script_type][] = $s;
                 }
             }
         }
     }
     $script_list = [];
     foreach (Script::all() as $script) {
         $script_list[$script->id] = '[' . $script->type . '] ' . $script->name;
     }
     return View::make('admin.game_scripts', ['game' => Game::findOrFail($id), 'scripts' => $scripts, 'script_list' => $script_list]);
 }
Ejemplo n.º 2
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     return View::make('admin.script_list', ['scripts' => Script::all()]);
 }