⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.14
Server IP:
178.33.27.10
Server:
Linux cpanel.dev-unit.com 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
Server Software:
Apache/2.4.62 (Unix) OpenSSL/1.0.2k-fips
PHP Version:
8.2.25
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
home
/
id
/
taxi.dev-unit.com
/
app
/
Base
/
Filters
/
View File Name :
BaseFilter.php
<?php namespace App\Base\Filters; use App\Base\Libraries\QueryFilter\FilterContract; use Exception; abstract class BaseFilter implements FilterContract { /** * Allowed status filter values. * * @var array */ protected $allowedStatusValues = []; /** * Apply status filter. * * @param \Illuminate\Database\Eloquent\Builder $builder * @param string $status * @throws Exception */ protected function applyStatus($builder, $status) { if (!in_array($status, $this->allowedStatusValues)) { return; } $method = 'status' . studly_case($status); if (!method_exists($this, $method)) { throw new Exception("Undefined method '{$method}' in custom filter."); } $this->$method($builder); } /** * Validates city id. * * @param string $cityId * @param string $field * @throws Exception */ protected function validateCity($cityId, $field = 'city') { if (!is_valid_city_id($cityId)) { throw new Exception("Invalid {$field}."); } } /** * Validates date time string. * Returns the Carbon instance of the date if valid. * * @param string $date * @param string $field * @return \Carbon\Carbon * @throws Exception */ protected function validateDateTime($date, $field = 'date') { if (($date = is_valid_date($date)) === false) { throw new Exception("Invalid {$field}."); } return $date; } /** * Validates date time string. * Returns the Carbon instance of the date (Resets the time to 00:00:00) if valid. * * @param string $date * @param string $field * @return \Carbon\Carbon * @throws Exception */ protected function validateDate($date, $field = 'date') { return $this->validateDateTime($date, $field)->startOfDay(); } }