Merge pull request #3112 from CihanSenturk/add-put-method
Added put method
This commit is contained in:
commit
6805ed7832
|
|
@ -18,7 +18,7 @@ class DateFormat
|
|||
*/
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
if (($request->method() == 'POST') || ($request->method() == 'PATCH')) {
|
||||
if (in_array($request->method(), ['POST', 'PATCH', 'PUT'])) {
|
||||
$columns = new \stdClass();
|
||||
$columns->fields = [
|
||||
'paid_at',
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ class Dropzone
|
|||
*/
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
if (! in_array($request->method(), ['POST', 'PATCH'])) {
|
||||
if (! in_array($request->method(), ['POST', 'PATCH', 'PUT'])) {
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ class Money
|
|||
*/
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
if (($request->method() != 'POST') && ($request->method() != 'PATCH')) {
|
||||
if (! in_array($request->method(), ['POST', 'PATCH', 'PUT'])) {
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ class User extends FormRequest
|
|||
|
||||
$email = 'required|email:rfc,dns';
|
||||
|
||||
if ($this->getMethod() == 'PATCH') {
|
||||
if (in_array($this->getMethod(), ['PATCH', 'PUT'])) {
|
||||
// Updating user
|
||||
if (is_numeric($this->user)) {
|
||||
$id = $this->user;
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ class Transaction extends FormRequest
|
|||
$type = config('type.transaction.' . $type . '.route.parameter');
|
||||
|
||||
// Check if store or update
|
||||
if ($this->getMethod() == 'PATCH') {
|
||||
if (in_array($this->getMethod(), ['PATCH', 'PUT'])) {
|
||||
$model = $this->isApi() ? 'transaction' : $type;
|
||||
|
||||
$id = is_numeric($this->$model) ? $this->$model : $this->{$model}->getAttribute('id');
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ class Contact extends FormRequest
|
|||
$company_id = (int) $this->request->get('company_id');
|
||||
|
||||
// Check if store or update
|
||||
if ($this->getMethod() == 'PATCH') {
|
||||
if (in_array($this->getMethod(), ['PATCH', 'PUT'])) {
|
||||
$model = $this->isApi() ? 'contact' : $type;
|
||||
|
||||
$id = is_numeric($this->$model) ? $this->$model : $this->$model->getAttribute('id');
|
||||
|
|
|
|||
|
|
@ -25,8 +25,8 @@ class Document extends FormRequest
|
|||
|
||||
$type = config('type.document.' . $type . '.route.parameter');
|
||||
|
||||
// Check if store or update
|
||||
if ($this->getMethod() == 'PATCH') {
|
||||
// Check if store or update. Todo: check if this is the best way to do this
|
||||
if (in_array($this->getMethod(), ['PATCH', 'PUT'])) {
|
||||
$model = $this->isApi() ? 'document' : $type;
|
||||
|
||||
$id = is_numeric($this->$model) ? $this->$model : $this->{$model}->getAttribute('id');
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ class Currency extends FormRequest
|
|||
public function rules()
|
||||
{
|
||||
// Check if store or update
|
||||
if ($this->getMethod() == 'PATCH') {
|
||||
if (in_array($this->getMethod(), ['PATCH', 'PUT'])) {
|
||||
$id = is_numeric($this->currency) ? $this->currency : $this->currency->getAttribute('id');
|
||||
} else {
|
||||
$id = null;
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ class Tax extends FormRequest
|
|||
public function rules()
|
||||
{
|
||||
// Check if store or update
|
||||
if ($this->getMethod() == 'PATCH') {
|
||||
if (in_array($this->getMethod(), ['PATCH', 'PUT'])) {
|
||||
$id = is_numeric($this->tax) ? $this->tax : $this->tax->getAttribute('id');
|
||||
$enabled = 'integer|boolean';
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Reference in New Issue