snipe-it/app/Http/Requests/AssetCheckinRequest.php

39 lines
764 B
PHP
Raw Normal View History

2016-03-25 01:18:05 -07:00
<?php
namespace App\Http\Requests;
class AssetCheckinRequest extends Request
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
2024-10-02 15:15:32 -07:00
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
$settings = \App\Models\Setting::getSettings();
2024-10-02 15:37:11 -07:00
2024-10-02 15:15:32 -07:00
$rules = [];
if($settings->require_checkinout_notes) {
2024-11-26 12:04:54 -08:00
$rules['note'] = 'string|required';
2024-10-02 15:15:32 -07:00
}
return $rules;
}
2016-03-25 01:18:05 -07:00
public function response(array $errors)
{
return $this->redirector->back()->withInput()->withErrors($errors, $this->errorBag);
}
}