Example #1
0
 /**
  * Show the application dashboard.
  *
  * @return \Illuminate\Http\Response
  */
 public function index(Request $request)
 {
     $messages = $request->user()->receivedMessages()->with('sender')->with('receiver')->latest()->groupBy('sender_id')->get();
     $shouts = Shout::limit(15)->latest()->get();
     $shouts = $shouts->sortBy('created_at');
     $aluminis = $request->user()->aluminis()->latest()->get();
     return view('home')->withMessages($messages)->withShouts($shouts)->withAluminis($aluminis);
 }
 public function getShouts(Request $request)
 {
     $last = $request->get('last') ?: 0;
     $shouts = Shout::where('id', '>', $last)->orderBy('id', 'desc')->limit(100)->get();
     return $shouts->transform(function (Shout $shout) {
         return ['id' => $shout->id, 'html' => view('shout', compact('shout'))->render()];
     });
 }
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     $position = Cache::get(self::class, 0);
     if (!isset($this->shouts[$position])) {
         return;
     }
     Shout::create(['message' => $this->shouts[$position]]);
     Cache::forever(self::class, ++$position);
 }
 /**
  * @param $id
  * @param Request $request
  * @return mixed
  */
 public function destroy($id, Request $request)
 {
     $shout = Shout::findOrFail($id);
     if ($request->user()->isAdmin()) {
         $shout->delete();
         return back()->with('success', "Success! Shout deleted");
     } else {
         return back()->with('error', "Sorry! You are not authorized for that action");
     }
 }
 /**
  * Execute the command.
  */
 public function handle()
 {
     Shout::create(['message' => $this->message]);
 }
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $shoutouts = Shout::all();
     return view('shoutouts.index', ['shouts' => $shoutouts]);
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int $id
  * @param Request $request
  * @return \Illuminate\Http\Response
  */
 public function destroy($id, Request $request)
 {
     $shout = Shout::findOrFail($id);
     if ($request->user()->can('delete', $shout)) {
         $shout->delete();
         return back()->withNotification("Success! Shout deleted")->withType("success");
     } else {
         return back()->withNotification("Sorry! You are not authorized for that action")->withType("Danger");
     }
 }
Example #8
0
    $style = Input::get('style', $default);
    $html = <<<EOT
<body style='text-align: left;'>
<table><tr>
<td valign=top>
<div>
<form method=get action="display">

<textarea name="style" cols="60" rows="30">
{$style}
</textarea>
<br /><br />
<input type="text" name="q" size=30 /><br />
<input type="submit" value="go" />
</form>
</div>
</td>
<td valign=top>
<div style='text-align: center; display:table-cell;
background-position:center middle; vertical-align: middle;
width:480px; height: 640px; background-image:url(http://d3gbrb95pfitbz.cloudfront.net/message_photo/1436241183_5447329.jpeg); margin:0px; padding:0px;background-size: cover;'>

EOT;
    $style = urlencode($style);
    $html .= "<img width=480px src='image?style={$style}&q={$string}' /></div></td></tr></table></body>";
    return (new Response())->setContentType('text/html')->setContent($html);
});
require 'route_editor.php';
Route::get('/', function () {
    return (new Response())->setContentType('image/gif')->setContent(Shout::emptyImage());
});