예제 #1
0
 public function index($gamertag)
 {
     try {
         $account = Account::with('h5.playlists.stock')->where('seo', Text::seoGamertag($gamertag))->firstOrFail();
         return view('halo5.profile', ['account' => $account, 'title' => $account->gamertag . ($account->isPandaLove() ? " (Panda Love Member)" : null), 'medals' => Medal::orderBy('difficulty', 'ASC')->get(), 'mMedals' => $account->h5->medals]);
     } catch (ModelNotFoundException $e) {
         \App::abort(404, 'We could not find this Halo5 Profile.');
     }
 }
예제 #2
0
    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
        $client = new Client();
        $this->info('Getting new Medal data from 343');
        $medals = $client->getMedals();
        if (is_array($medals)) {
            $this->info('We found a lot of medals. ' . count($medals) . ' to be exact.');
            $this->info('Purging table to make room for new medals');
            DB::table('halo5_medals')->truncate();
            $contents = <<<EOF
.medal {
    display: inline-block;
}

EOF;
            foreach ($medals as $medal) {
                $this->info('Adding: ' . $medal['name']);
                $m = new Medal();
                $m->name = $medal['name'];
                $m->description = $medal['description'];
                $m->classification = $medal['classification'];
                $m->difficulty = $medal['difficulty'];
                $m->contentId = $medal['id'];
                $m->save();
                $contents .= <<<EOF
.medal-{$medal['id']} { /* {$medal['name']} */
    background: url('/css/images/h5-medals.png') no-repeat -{$medal['spriteLocation']['left']}px -{$medal['spriteLocation']['top']}px;
    width: {$medal['spriteLocation']['width']}px;
    height: {$medal['spriteLocation']['height']}px;
}

EOF;
            }
            // Lets do CSS work now
            $m = $medals[0];
            $this->info('Writing new sprite file...');
            $sprite = file_get_contents($m['spriteLocation']['spriteSheetUri']);
            Storage::put('resources/images/h5-medals.png', $sprite);
            Storage::put('resources/css/h5-sprites.css', $contents);
        }
    }