<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
coding-wisely / laravel-slug-auto-generator example snippets
// config for CodingWisely/SlugGenerator
// replace it with your model column
return [
'sluggable_field' => 'name',
'groupable_field' => null, // 'category_id',
];
use CodingWisely\SlugGenerator\SlugGenerator;
use Illuminate\Database\Eloquent\Model;
class YourModel extends Model
{
use SlugGenerator;
// Your model's attributes and methods...
// override config file with
public static function getSluggableField(): string
{
return 'title'; // your own field on Model
}
// if you want to have unique slugs in different categories (groupable, such as project_id, team_id, category_id, etc.)
public static function getGroupableField(): ?string
{
return 'category_id'; // your own field on Model
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.