Skip to content

Commit

Permalink
Add localizable resource
Browse files Browse the repository at this point in the history
  • Loading branch information
David Arias committed Oct 25, 2017
1 parent 4d8f603 commit c11f18a
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions src/Http/Resources/Localizable.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

namespace Locale\Http\Resources;

use Illuminate\Http\Resources\Json\Resource;

/**
* Class Localizable
*
* @since 1.0.0
* @package Locale\Http\Resources
*
* @property string locale_id
*/
abstract class Localizable extends Resource
{
/**
* Customize the response for a request.
*
* @param \Illuminate\Http\Request $request
* @param \Illuminate\Http\JsonResponse $response
*/
public function withResponse($request, $response)
{
if ($this->locale_id) {
$response->header("Content-Language", $this->locale_id);
}
}
}

0 comments on commit c11f18a

Please sign in to comment.