Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
5 / 5 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| License | |
100.00% |
5 / 5 |
|
100.00% |
1 / 1 |
5 | |
100.00% |
1 / 1 |
| wantsToDrive | |
100.00% |
5 / 5 |
|
100.00% |
1 / 1 |
5 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Engelsystem\Models\User; |
| 6 | |
| 7 | use Illuminate\Database\Eloquent\Factories\HasFactory; |
| 8 | use Illuminate\Database\Query\Builder as QueryBuilder; |
| 9 | |
| 10 | /** |
| 11 | * @property bool $has_car |
| 12 | * @property bool $drive_forklift |
| 13 | * @property bool $drive_car |
| 14 | * @property bool $drive_3_5t |
| 15 | * @property bool $drive_7_5t |
| 16 | * @property bool $drive_12t |
| 17 | * @property bool $drive_confirmed |
| 18 | * @property bool $ifsg_certificate_light |
| 19 | * @property bool $ifsg_certificate |
| 20 | * @property bool $ifsg_confirmed |
| 21 | * |
| 22 | * @method static QueryBuilder|License[] whereHasCar($value) |
| 23 | * @method static QueryBuilder|License[] whereDriveForklift($value) |
| 24 | * @method static QueryBuilder|License[] whereDriveCar($value) |
| 25 | * @method static QueryBuilder|License[] whereDrive35T($value) |
| 26 | * @method static QueryBuilder|License[] whereDrive75T($value) |
| 27 | * @method static QueryBuilder|License[] whereDrive12T($value) |
| 28 | * @method static QueryBuilder|License[] whereDriveConfirmed($value) |
| 29 | * @method static QueryBuilder|License[] whereIfsgCertificateLight($value) |
| 30 | * @method static QueryBuilder|License[] whereIfsgCertificate($value) |
| 31 | * @method static QueryBuilder|License[] whereIfsgConfirmed($value) |
| 32 | */ |
| 33 | class License extends HasUserModel |
| 34 | { |
| 35 | use HasFactory; |
| 36 | |
| 37 | /** @var string The table associated with the model */ |
| 38 | protected $table = 'users_licenses'; // phpcs:ignore |
| 39 | |
| 40 | /** @var array<string, bool> Default attributes */ |
| 41 | protected $attributes = [ // phpcs:ignore |
| 42 | 'has_car' => false, |
| 43 | 'drive_forklift' => false, |
| 44 | 'drive_car' => false, |
| 45 | 'drive_3_5t' => false, |
| 46 | 'drive_7_5t' => false, |
| 47 | 'drive_12t' => false, |
| 48 | 'drive_confirmed' => false, |
| 49 | 'ifsg_certificate_light' => false, |
| 50 | 'ifsg_certificate' => false, |
| 51 | 'ifsg_confirmed' => false, |
| 52 | ]; |
| 53 | |
| 54 | /** |
| 55 | * The attributes that are mass assignable. |
| 56 | * |
| 57 | * @var array<string> |
| 58 | */ |
| 59 | protected $fillable = [ // phpcs:ignore |
| 60 | 'user_id', |
| 61 | 'has_car', |
| 62 | 'drive_forklift', |
| 63 | 'drive_car', |
| 64 | 'drive_3_5t', |
| 65 | 'drive_7_5t', |
| 66 | 'drive_12t', |
| 67 | 'drive_confirmed', |
| 68 | 'ifsg_certificate_light', |
| 69 | 'ifsg_certificate', |
| 70 | 'ifsg_confirmed', |
| 71 | ]; |
| 72 | |
| 73 | /** @var array<string> */ |
| 74 | protected $casts = [ // phpcs:ignore |
| 75 | 'user_id' => 'integer', |
| 76 | 'has_car' => 'boolean', |
| 77 | 'drive_forklift' => 'boolean', |
| 78 | 'drive_car' => 'boolean', |
| 79 | 'drive_3_5t' => 'boolean', |
| 80 | 'drive_7_5t' => 'boolean', |
| 81 | 'drive_12t' => 'boolean', |
| 82 | 'drive_confirmed' => 'boolean', |
| 83 | 'ifsg_certificate_light' => 'boolean', |
| 84 | 'ifsg_certificate' => 'boolean', |
| 85 | 'ifsg_confirmed' => 'boolean', |
| 86 | ]; |
| 87 | |
| 88 | /** |
| 89 | * If the user wants to drive at the event |
| 90 | */ |
| 91 | public function wantsToDrive(): bool |
| 92 | { |
| 93 | return $this->drive_forklift |
| 94 | || $this->drive_car |
| 95 | || $this->drive_3_5t |
| 96 | || $this->drive_7_5t |
| 97 | || $this->drive_12t; |
| 98 | } |
| 99 | } |