blue-twilight/app/ModelObservers/AlbumObserver.php

22 lines
370 B
PHP

<?php
namespace App\ModelObservers;
use App\Album;
class AlbumObserver
{
public function creating(Album $album)
{
// Re-generate the alias and path
if (is_null($album->url_alias))
{
$album->generateAlias();
}
if (is_null($album->url_path))
{
$album->generateUrlPath();
}
}
}