1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-14 07:02:34 +01:00
invoiceninja/app/Http/Requests/Activity/ShowActivityRequest.php

50 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
*/
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();
if(isset($input['entity_id']))
$input['entity_id'] = $this->decodePrimaryKey($input['entity_id']);
$this->replace($input);
2019-09-27 06:31:13 +02:00
}
}