* #118 - wip * #118 - keys * #118 - fix * #118 - fix menu * #118 - fix to policies and added translations * #118 - wip * #118 - tests * #118 - fix * #118 - fix * #118 - fix * Update resources/lang/pl.json Co-authored-by: Ewelina Lasowy <56546832+EwelinaLasowy@users.noreply.github.com> * #118 - cr fix Co-authored-by: EwelinaLasowy <ewelina.lasowy@blumilk.pl> Co-authored-by: Ewelina Lasowy <56546832+EwelinaLasowy@users.noreply.github.com>
This commit is contained in:
31
app/Eloquent/Models/Key.php
Normal file
31
app/Eloquent/Models/Key.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Toby\Eloquent\Models;
|
||||
|
||||
use Database\Factories\KeyFactory;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
/**
|
||||
* @property int $id
|
||||
* @property User $user
|
||||
*/
|
||||
class Key extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $guarded = [];
|
||||
|
||||
public function user(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
|
||||
protected static function newFactory(): KeyFactory
|
||||
{
|
||||
return KeyFactory::new();
|
||||
}
|
||||
}
|
@@ -74,6 +74,11 @@ class User extends Authenticatable
|
||||
return $this->hasMany(Vacation::class);
|
||||
}
|
||||
|
||||
public function keys(): HasMany
|
||||
{
|
||||
return $this->hasMany(Key::class);
|
||||
}
|
||||
|
||||
public function hasRole(Role $role): bool
|
||||
{
|
||||
return $this->role === $role;
|
||||
|
Reference in New Issue
Block a user