Merge pull request #3112 from CihanSenturk/add-put-method

Added put method
This commit is contained in:
Cüneyt Şentürk 2023-12-11 15:29:11 +03:00 committed by GitHub
commit 6805ed7832
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 10 additions and 10 deletions

View File

@ -18,7 +18,7 @@ class DateFormat
*/ */
public function handle($request, Closure $next) 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 = new \stdClass();
$columns->fields = [ $columns->fields = [
'paid_at', 'paid_at',

View File

@ -16,7 +16,7 @@ class Dropzone
*/ */
public function handle($request, Closure $next) public function handle($request, Closure $next)
{ {
if (! in_array($request->method(), ['POST', 'PATCH'])) { if (! in_array($request->method(), ['POST', 'PATCH', 'PUT'])) {
return $next($request); return $next($request);
} }

View File

@ -19,7 +19,7 @@ class Money
*/ */
public function handle($request, Closure $next) public function handle($request, Closure $next)
{ {
if (($request->method() != 'POST') && ($request->method() != 'PATCH')) { if (! in_array($request->method(), ['POST', 'PATCH', 'PUT'])) {
return $next($request); return $next($request);
} }

View File

@ -34,7 +34,7 @@ class User extends FormRequest
$email = 'required|email:rfc,dns'; $email = 'required|email:rfc,dns';
if ($this->getMethod() == 'PATCH') { if (in_array($this->getMethod(), ['PATCH', 'PUT'])) {
// Updating user // Updating user
if (is_numeric($this->user)) { if (is_numeric($this->user)) {
$id = $this->user; $id = $this->user;

View File

@ -20,7 +20,7 @@ class Transaction extends FormRequest
$type = config('type.transaction.' . $type . '.route.parameter'); $type = config('type.transaction.' . $type . '.route.parameter');
// Check if store or update // Check if store or update
if ($this->getMethod() == 'PATCH') { if (in_array($this->getMethod(), ['PATCH', 'PUT'])) {
$model = $this->isApi() ? 'transaction' : $type; $model = $this->isApi() ? 'transaction' : $type;
$id = is_numeric($this->$model) ? $this->$model : $this->{$model}->getAttribute('id'); $id = is_numeric($this->$model) ? $this->$model : $this->{$model}->getAttribute('id');

View File

@ -26,7 +26,7 @@ class Contact extends FormRequest
$company_id = (int) $this->request->get('company_id'); $company_id = (int) $this->request->get('company_id');
// Check if store or update // Check if store or update
if ($this->getMethod() == 'PATCH') { if (in_array($this->getMethod(), ['PATCH', 'PUT'])) {
$model = $this->isApi() ? 'contact' : $type; $model = $this->isApi() ? 'contact' : $type;
$id = is_numeric($this->$model) ? $this->$model : $this->$model->getAttribute('id'); $id = is_numeric($this->$model) ? $this->$model : $this->$model->getAttribute('id');

View File

@ -25,8 +25,8 @@ class Document extends FormRequest
$type = config('type.document.' . $type . '.route.parameter'); $type = config('type.document.' . $type . '.route.parameter');
// Check if store or update // Check if store or update. Todo: check if this is the best way to do this
if ($this->getMethod() == 'PATCH') { if (in_array($this->getMethod(), ['PATCH', 'PUT'])) {
$model = $this->isApi() ? 'document' : $type; $model = $this->isApi() ? 'document' : $type;
$id = is_numeric($this->$model) ? $this->$model : $this->{$model}->getAttribute('id'); $id = is_numeric($this->$model) ? $this->$model : $this->{$model}->getAttribute('id');

View File

@ -14,7 +14,7 @@ class Currency extends FormRequest
public function rules() public function rules()
{ {
// Check if store or update // 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'); $id = is_numeric($this->currency) ? $this->currency : $this->currency->getAttribute('id');
} else { } else {
$id = null; $id = null;

View File

@ -14,7 +14,7 @@ class Tax extends FormRequest
public function rules() public function rules()
{ {
// Check if store or update // 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'); $id = is_numeric($this->tax) ? $this->tax : $this->tax->getAttribute('id');
$enabled = 'integer|boolean'; $enabled = 'integer|boolean';
} else { } else {