Initial commit of testapi
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
class SmartdokProfile extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'smartdok_profiles';
|
||||
public $incrementing = false;
|
||||
protected $keyType = 'string';
|
||||
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'username',
|
||||
'name',
|
||||
];
|
||||
|
||||
/**
|
||||
* The projects that belong to the profile.
|
||||
*/
|
||||
public function projects(): BelongsToMany {
|
||||
return $this->belongsToMany(
|
||||
Project::class,
|
||||
'project_smartdok_profile',
|
||||
'smartdok_profile_id',
|
||||
'project_id'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* The work hours entries for the profile.
|
||||
*/
|
||||
public function workHours(): HasMany {
|
||||
return $this->hasMany(WorkHour::class, 'user_id', 'id');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user