Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| Worklog | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
| creator | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Engelsystem\Models; |
| 6 | |
| 7 | use Carbon\Carbon; |
| 8 | use Engelsystem\Models\User\User; |
| 9 | use Engelsystem\Models\User\UsesUserModel; |
| 10 | use Illuminate\Database\Eloquent\Factories\HasFactory; |
| 11 | use Illuminate\Database\Eloquent\Relations\BelongsTo; |
| 12 | use Illuminate\Database\Query\Builder as QueryBuilder; |
| 13 | |
| 14 | /** |
| 15 | * @property int $id |
| 16 | * @property int $creator_id |
| 17 | * @property float $hours |
| 18 | * @property string $description |
| 19 | * @property Carbon $worked_at |
| 20 | * @property bool $night_shift |
| 21 | * @property Carbon|null $created_at |
| 22 | * @property Carbon|null $updated_at |
| 23 | * |
| 24 | * @property-read User $creator |
| 25 | * |
| 26 | * @method static QueryBuilder|Worklog[] whereId($value) |
| 27 | * @method static QueryBuilder|Worklog[] whereCreatorId($value) |
| 28 | * @method static QueryBuilder|Worklog[] whereWorkedAt($value) |
| 29 | * @method static QueryBuilder|Worklog[] whereHours($value) |
| 30 | * @method static QueryBuilder|Worklog[] whereDescription($value) |
| 31 | */ |
| 32 | class Worklog extends BaseModel |
| 33 | { |
| 34 | use HasFactory; |
| 35 | use UsesUserModel; |
| 36 | |
| 37 | /** @var bool Enable timestamps */ |
| 38 | public $timestamps = true; // phpcs:ignore |
| 39 | |
| 40 | /** @var array<string, string> */ |
| 41 | protected $casts = [ // phpcs:ignore |
| 42 | 'user_id' => 'integer', |
| 43 | 'creator_id' => 'integer', |
| 44 | 'hours' => 'float', |
| 45 | 'worked_at' => 'datetime', |
| 46 | 'night_shift' => 'boolean', |
| 47 | ]; |
| 48 | |
| 49 | /** |
| 50 | * The attributes that are mass assignable. |
| 51 | * |
| 52 | * @var array<string> |
| 53 | */ |
| 54 | protected $fillable = [ // phpcs:ignore |
| 55 | 'user_id', |
| 56 | 'creator_id', |
| 57 | 'hours', |
| 58 | 'description', |
| 59 | 'worked_at', |
| 60 | 'night_shift', |
| 61 | ]; |
| 62 | |
| 63 | public function creator(): BelongsTo |
| 64 | { |
| 65 | return $this->belongsTo(User::class, 'creator_id'); |
| 66 | } |
| 67 | } |