コード例 #1
0
ファイル: routes.php プロジェクト: kinnngg-lenz/csacerc
| This route group applies the "web" middleware group to every route
| it contains. The "web" middleware group is defined in your HTTP
| kernel and includes session state, CSRF protection, and more.
|
*/
Route::group(['middleware' => ['web', 'fw-block-bl']], function () {
    /**
     * Landing Page
     */
    Route::get('/', ['as' => 'welcome', function () {
        $news = App\News::whereType(0)->latest()->first();
        $event = App\Event::latest()->first();
        $codewars = App\CodeWarQuestion::latest()->limit(3)->get();
        $questions = App\Question::wherePublic(1)->approved()->latest()->limit(3)->get();
        $aluminis = App\Alumini::where('speech', '!=', 'null')->get()->random(2);
        $users = App\User::whereBanned(0)->latest()->limit(3)->get();
        $picture = App\Photo::whereGallery(1)->get()->random();
        $technews = App\News::whereType(1)->latest()->first();
        $qotd = App\Quote::getQotd();
        $shouts = App\Shout::limit(15)->latest()->get();
        $shouts = $shouts->sortBy('created_at');
        $urls = ['http://numbersapi.com/random/', 'http://numbersapi.com/random/year/', 'http://numbersapi.com/random/date'];
        try {
            $didyouknow = file_get_contents($urls[array_rand($urls)]);
        } catch (Exception $e) {
            $didyouknow = "This website is hosted on a VPS with 1GB of RAM and is developed using PHP as backend, MySQL & Redis for database storage, and Sockets for real time events.";
        }
        $data = ['news' => $news, 'event' => $event, 'aluminis' => $aluminis, 'codewars' => $codewars, 'questions' => $questions, 'users' => $users, 'picture' => $picture, 'technews' => $technews, 'qotd' => $qotd, 'shouts' => $shouts, 'didyouknow' => $didyouknow];
        return view('welcome', $data);
    }]);
    /**