Initial commit of testapi
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
|
||||
class WorkHour extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'work_hours';
|
||||
|
||||
protected $fillable = [
|
||||
'user_id',
|
||||
'project_id',
|
||||
'ordinary_hours',
|
||||
'work_date',
|
||||
'comment'
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'work_date' => 'date',
|
||||
];
|
||||
|
||||
/**
|
||||
* The profile that owns the work hour entry.
|
||||
*/
|
||||
public function user(): BelongsTo {
|
||||
return $this->belongsTo(SmartdokProfile::class, 'user_id', 'id');
|
||||
}
|
||||
|
||||
/**
|
||||
* The project linked to this work hour entry.
|
||||
*/
|
||||
public function project(): BelongsTo {
|
||||
return $this->belongsTo(Project::class, 'project_id');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user