mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2024-11-30 20:54:04 -06:00
45 lines
966 B
PHP
45 lines
966 B
PHP
<?php
|
|
|
|
namespace FireflyIII\Http\Requests;
|
|
|
|
use Auth;
|
|
use Input;
|
|
|
|
/**
|
|
* Class BillFormRequest
|
|
*
|
|
* @package FireflyIII\Http\Requests
|
|
*/
|
|
class CurrencyFormRequest extends Request
|
|
{
|
|
/**
|
|
* @return bool
|
|
*/
|
|
public function authorize()
|
|
{
|
|
// Only allow logged in users
|
|
return Auth::check();
|
|
}
|
|
|
|
/**
|
|
* @return array
|
|
*/
|
|
public function rules()
|
|
{
|
|
|
|
$rules = [
|
|
'code' => 'required|min:3|max:3|unique:transaction_currencies,code',
|
|
'name' => 'required|max:48|min:1|unique:transaction_currencies,name',
|
|
'symbol' => 'required|min:1|max:8|unique:transaction_currencies,symbol',
|
|
];
|
|
if (intval(Input::get('id')) > 0) {
|
|
$rules = [
|
|
'code' => 'required|min:3|max:3',
|
|
'name' => 'required|max:48|min:1',
|
|
'symbol' => 'required|min:1|max:8',
|
|
];
|
|
}
|
|
|
|
return $rules;
|
|
}
|
|
} |