Exemplo n.º 1
0
 private function loadQuote($id, $target)
 {
     try {
         $quote = new \App\Quote();
         if ($target == 'prev') {
             $quote->loadPrev($id);
         } elseif ($target == 'next') {
             $quote->loadNext($id);
         } else {
             $quote->load($id);
         }
         getSystem()->render('home', $quote->toArray());
     } catch (\Exception $e) {
         getSystem()->getRender()->error(500, "Error while loading quote", $e);
     }
 }
Exemplo n.º 2
0
|
*/
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);
    }]);
    /**
     * Coming Soon Page
     */
    Route::get('/comingsoon', function () {
Exemplo n.º 3
0
<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
Route::get('/', function () {
    return view('quotes')->with('quotes', \App\Quote::all());
});
Route::post('/', function () {
    $quote = new \App\Quote(\Input::all());
    $quote->save();
    return redirect('/');
});