Skip to content

Instantly share code, notes, and snippets.

@uno-de-piera
Created September 8, 2018 09:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save uno-de-piera/aee5cd7cf045e085b2e23b90cf36e007 to your computer and use it in GitHub Desktop.
Save uno-de-piera/aee5cd7cf045e085b2e23b90cf36e007 to your computer and use it in GitHub Desktop.
<?php
public static function boot () {
parent::boot();
static::saving(function(Course $course) {
if( ! \App::runningInConsole() ) {
$course->slug = str_slug($course->name, "-");
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment