1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-11 21:52:35 +01:00
invoiceninja/app/Http/Requests/Activity/ShowActivityRequest.php

51 lines
1.2 KiB
PHP
Raw Normal View History

2019-09-27 06:31:13 +02:00
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
2019-09-27 06:31:13 +02:00
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
2023-01-28 23:21:40 +01:00
* @copyright Copyright (c) 2023. Invoice Ninja LLC (https://invoiceninja.com)
2019-09-27 06:31:13 +02:00
*
2021-06-16 08:58:16 +02:00
* @license https://www.elastic.co/licensing/elastic-license
2019-09-27 06:31:13 +02:00
*/
namespace App\Http\Requests\Activity;
use App\Http\Requests\Request;
2023-07-18 05:15:40 +02:00
use App\Utils\Traits\MakesHash;
2019-09-27 06:31:13 +02:00
class ShowActivityRequest extends Request
{
2023-07-18 05:15:40 +02:00
use MakesHash;
2019-09-27 06:31:13 +02:00
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
2024-01-14 05:05:00 +01:00
public function authorize(): bool
2019-09-27 06:31:13 +02:00
{
2023-07-18 05:15:40 +02:00
return true;
}
public function rules()
{
return [
2023-07-18 05:17:19 +02:00
'entity' => 'bail|required|in:invoice,quote,credit,purchase_order,payment,client,vendor,expense,task,project,subscription,recurring_invoice,',
2023-07-18 05:15:40 +02:00
'entity_id' => 'bail|required|exists:'.$this->entity.'s,id,company_id,'.auth()->user()->company()->id,
];
}
public function prepareForValidation()
{
$input = $this->all();
2023-10-26 04:57:44 +02:00
if(isset($input['entity_id'])) {
2023-07-18 05:15:40 +02:00
$input['entity_id'] = $this->decodePrimaryKey($input['entity_id']);
2023-10-26 04:57:44 +02:00
}
2023-07-18 05:15:40 +02:00
$this->replace($input);
2019-09-27 06:31:13 +02:00
}
}