2017-04-17 21:31:45 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\ModelObservers;
|
|
|
|
|
|
|
|
use App\Album;
|
|
|
|
|
|
|
|
class AlbumObserver
|
|
|
|
{
|
|
|
|
public function creating(Album $album)
|
|
|
|
{
|
|
|
|
// Re-generate the alias and path
|
2017-04-18 20:17:09 +01:00
|
|
|
if (is_null($album->url_alias))
|
|
|
|
{
|
|
|
|
$album->generateAlias();
|
|
|
|
}
|
2017-04-17 21:31:45 +01:00
|
|
|
|
2017-04-18 20:17:09 +01:00
|
|
|
if (is_null($album->url_path))
|
|
|
|
{
|
|
|
|
$album->generateUrlPath();
|
|
|
|
}
|
2017-04-17 21:31:45 +01:00
|
|
|
}
|
|
|
|
}
|