nova updates

This commit is contained in:
Benjamin Takats
2022-12-01 17:03:52 +01:00
parent 93fd52cd1f
commit ef510043c3
16 changed files with 178 additions and 58 deletions

View File

@@ -33,7 +33,7 @@ class City extends Model
public function getSlugOptions(): SlugOptions
{
return SlugOptions::create()
->generateSlugsFrom('name')
->generateSlugsFrom(['country.code', 'name'])
->saveSlugsTo('slug')
->usingLanguage('de');
}

View File

@@ -4,29 +4,41 @@ 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',
'id' => 'integer',
'team_id' => 'integer',
'active' => 'boolean',
'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);

View File

@@ -4,28 +4,40 @@ namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Spatie\Sluggable\HasSlug;
use Spatie\Sluggable\SlugOptions;
class Venue 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',
'id' => 'integer',
'city_id' => 'integer',
];
/**
* Get the options for generating the slug.
*/
public function getSlugOptions(): SlugOptions
{
return SlugOptions::create()
->generateSlugsFrom(['city.slug', 'name',])
->saveSlugsTo('slug')
->usingLanguage('de');
}
public function city(): \Illuminate\Database\Eloquent\Relations\BelongsTo
{
return $this->belongsTo(City::class);