mirror of
https://github.com/Einundzwanzig-Podcast/einundzwanzig-portal.git
synced 2025-12-11 06:46:47 +00:00
52 lines
1.2 KiB
PHP
52 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Spatie\Sluggable\HasSlug;
|
|
use Spatie\Sluggable\SlugOptions;
|
|
|
|
class Lecturer extends Model
|
|
{
|
|
use HasFactory;
|
|
use HasSlug;
|
|
|
|
/**
|
|
* The attributes that aren't mass assignable.
|
|
* @var array
|
|
*/
|
|
protected $guarded = [];
|
|
|
|
/**
|
|
* The attributes that should be cast to native types.
|
|
* @var array
|
|
*/
|
|
protected $casts = [
|
|
'id' => 'integer',
|
|
'team_id' => 'integer',
|
|
'active' => 'boolean',
|
|
];
|
|
|
|
/**
|
|
* Get the options for generating the slug.
|
|
*/
|
|
public function getSlugOptions(): SlugOptions
|
|
{
|
|
return SlugOptions::create()
|
|
->generateSlugsFrom(['name'])
|
|
->saveSlugsTo('slug')
|
|
->usingLanguage('de');
|
|
}
|
|
|
|
public function team(): \Illuminate\Database\Eloquent\Relations\BelongsTo
|
|
{
|
|
return $this->belongsTo(Team::class);
|
|
}
|
|
|
|
public function courses(): \Illuminate\Database\Eloquent\Relations\HasMany
|
|
{
|
|
return $this->hasMany(Course::class);
|
|
}
|
|
}
|