initial commit
This commit is contained in:
commit
1e1aa7d461
215 changed files with 35140 additions and 0 deletions
18
app/Models/Traits/HasSlug.php
Normal file
18
app/Models/Traits/HasSlug.php
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models\Traits;
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
trait HasSlug
|
||||
{
|
||||
public function setSlugAttribute($value)
|
||||
{
|
||||
$this->attributes['slug'] = Str::slug($value);
|
||||
}
|
||||
|
||||
public function scopeSlug($q, $value)
|
||||
{
|
||||
return $q->where('slug', Str::slug($value));
|
||||
}
|
||||
}
|
||||
Reference in a new issue