| 1 | <?php  | 
            ||
| 9 | abstract class Responder  | 
            ||
| 10 | { | 
            ||
| 11 | /**  | 
            ||
| 12 | * The response payload.  | 
            ||
| 13 | *  | 
            ||
| 14 | * @var mixed  | 
            ||
| 15 | */  | 
            ||
| 16 | protected $payload;  | 
            ||
| 17 | |||
| 18 | /**  | 
            ||
| 19 | * Laraflash for flashing to session.  | 
            ||
| 20 | *  | 
            ||
| 21 | * @var \DevMarketer\LaraFlash\LaraFlash  | 
            ||
| 22 | */  | 
            ||
| 23 | protected $flash;  | 
            ||
| 24 | |||
| 25 | /**  | 
            ||
| 26 | * Construct a new base Responder.  | 
            ||
| 27 | *  | 
            ||
| 28 | * @param \Illuminate\Http\Request $request  | 
            ||
| 29 | * @param \DevMarketer\LaraFlash\LaraFlash $flash  | 
            ||
| 30 | */  | 
            ||
| 31 | public function __construct(Request $request, LaraFlash $flash)  | 
            ||
| 36 | |||
| 37 | /**  | 
            ||
| 38 | * Send a response.  | 
            ||
| 39 | *  | 
            ||
| 40 | * @return mixed  | 
            ||
| 41 | */  | 
            ||
| 42 | abstract public function respond();  | 
            ||
| 43 | |||
| 44 | /**  | 
            ||
| 45 | * Add the payload to the response.  | 
            ||
| 46 | *  | 
            ||
| 47 | * @param mixed $payload  | 
            ||
| 48 | *  | 
            ||
| 49 | * @return $this  | 
            ||
| 50 | */  | 
            ||
| 51 | public function withPayload($payload)  | 
            ||
| 57 | |||
| 58 | /**  | 
            ||
| 59 | * Add the request to the response.  | 
            ||
| 60 | *  | 
            ||
| 61 | * @param \Illuminate\Http\Request $request  | 
            ||
| 62 | *  | 
            ||
| 63 | * @return $this  | 
            ||
| 64 | */  | 
            ||
| 65 | public function withRequest(Request $request)  | 
            ||
| 71 | |||
| 72 | /**  | 
            ||
| 73 | * Flash data to the session.  | 
            ||
| 74 | *  | 
            ||
| 75 | * @param string $key  | 
            ||
| 76 | * @param mixed $value  | 
            ||
| 77 | */  | 
            ||
| 78 | protected function flash($message, array $options = [])  | 
            ||
| 82 | }  | 
            ||
| 83 |