Skip to content

Instantly share code, notes, and snippets.

@Mulkave
Created June 8, 2016 21:09
Show Gist options
  • Save Mulkave/bd293944af0a60d6be487bfd2e03a808 to your computer and use it in GitHub Desktop.
Save Mulkave/bd293944af0a60d6be487bfd2e03a808 to your computer and use it in GitHub Desktop.
<?php
namespace Directory\Domains\Http\Jobs;
use Directory\Foundation\AbstractJob;
use Illuminate\Routing\ResponseFactory;
class RespondWithJsonJob extends AbstractJob
{
private $content;
private $status;
private $headers;
private $options;
public function __construct($content, $status = 200, array $headers = [], $options = 0)
{
$this->content = $content;
$this->status = $status;
$this->headers = $headers;
$this->options = $options;
}
public function handle(ResponseFactory $response)
{
return $response->json($this->content, $this->status, $this->headers, $this->options);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment