2019-09-27 06:31:13 +02:00
|
|
|
<?php
|
|
|
|
/**
|
2020-09-06 11:38:10 +02:00
|
|
|
* 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
|
|
|
|
*/
|
|
|
|
public function authorize() : bool
|
|
|
|
{
|
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
|
|
|
}
|
2019-12-30 22:59:12 +01:00
|
|
|
}
|