22 lines
408 B
PHP
22 lines
408 B
PHP
<?php
|
|
|
|
namespace App\ModelObservers;
|
|
|
|
use App\Album;
|
|
|
|
class AlbumObserver
|
|
{
|
|
public function creating(Album $album)
|
|
{
|
|
// Re-generate the alias and path
|
|
$album->generateAlias();
|
|
$album->generateUrlPath();
|
|
}
|
|
|
|
public function updating(Album $album)
|
|
{
|
|
// Re-generate the alias and path
|
|
$album->generateAlias();
|
|
$album->generateUrlPath();
|
|
}
|
|
} |