Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace App\Http\Requests;
- use App\Helpers\Helper;
- use Illuminate\Foundation\Http\FormRequest;
- class PlanRequest extends FormRequest
- {
- /**
- * Determine if the user is authorized to make this request.
- *
- * @return bool
- */
- public function authorize()
- {
- return true;
- }
- public function rules()
- {
- return [
- 'name' => 'required|string|max:255|unique:plans,name',
- 'price' => 'required|numeric|min:0'
- ];
- }
- public function attributes()
- {
- return __('attributes.admin.plan');
- }
- public function all($keys = null)
- {
- $a = parent::all();
- $a['price'] = Helper::numericToDB($a['price']);
- return $a;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement