ifox
11/02/2021, 10:05 AMpublic $mediasParams = [
'project' => [
'flex' => [
[
'name' => 'free',
'ratio' => 0,
]
],
]
];`Sebastlan
11/02/2021, 10:05 AM`Sebastlan
11/02/2021, 10:05 AMchrispymm
11/02/2021, 1:53 PMmy-event, if there is a collison beyond that, use my-event-{d-m-Y}.chrispymm
11/02/2021, 1:54 PMchrispymm
11/02/2021, 1:57 PMgetSuffixSlug from the HasSlug trait in my Model:chrispymm
11/02/2021, 1:58 PMprotected function getSuffixSlug()
{
return $this->startsAt ? $this->starts_at->format('d-m-Y') : $this->id;
}chrispymm
11/02/2021, 2:02 PM$nb_variation_slug private property, which seems to use a simple incrementor suffix until it reaches that value, then fall back to getSuffixSlug.chrispymm
11/02/2021, 2:02 PMpboivin
11/02/2021, 2:29 PMsuffixSlugIfExisting() in your model? (it's technically private but should work since HasSlugs is a trait and not a base class).
I haven't tested but I think this line can be adapted to skip the check on nb_variation_slug and proceed directly with `getSuffixSlug()`:
https://github.com/area17/twill/blob/2.x/src/Models/Behaviors/HasSlug.php#L223
Does this make sense?chrispymm
11/02/2021, 2:30 PMchrispymm
11/02/2021, 2:30 PMprivate function suffixSlugIfExisting($slugParams)
{
$slugBackup = $slugParams['slug'];
$table = $this->getSlugsTable();
unset($slugParams['active']);
$qCheck = DB::table($table);
$qCheck->whereNull($this->getDeletedAtColumn());
foreach ($slugParams as $key => $value) {
$qCheck->where($key, '=', $value);
}
if ($qCheck->first() != null) {
if (!empty($slugParams['slug'])) {
$slugParams['slug'] = $slugBackup."-".$this->getSuffixSlug();
}
}
return $slugParams['slug'];
}
protected function getSuffixSlug()
{
return $this->startsAt ? $this->starts_at->format('d-m-Y') : $this->id;
}pboivin
11/02/2021, 2:33 PMlorem-ipsum), then suffix every duplicate with the item's ID (or date)... Did you run into any issues when updating existing slugs?chrispymm
11/02/2021, 2:33 PMchrispymm
11/02/2021, 2:35 PMmy-event, then if a second is created manually in the ui it would give it my-event-{$id} (as the starts_at date wouldn't be set). but if created programatically (when all the data is present) would give my-event-{d-m-Y}chrispymm
11/02/2021, 2:36 PMchrispymm
11/02/2021, 2:39 PMchrispymm
11/02/2021, 2:39 PMpboivin
11/02/2021, 2:40 PMHasSlugs could be refactored to make it a bit more obvious what needs to be adapted for custom slug suffixes...chrispymm
11/02/2021, 2:42 PMifox
11/02/2021, 2:43 PMifox
11/02/2021, 2:45 PMchrispymm
11/02/2021, 2:56 PMIvan Markov
11/02/2021, 4:04 PMIvan Markov
11/02/2021, 4:07 PMIvan Markov
11/02/2021, 4:32 PMpazunino
11/02/2021, 8:09 PMpboivin
11/02/2021, 8:19 PMroutes/admin.php and twill-navigation.php. From there, you can be sure that users can't interact with it. Then, you can remove all the associated views and classes (model, controller, repository, etc.)ifox
11/02/2021, 8:20 PMifox
11/02/2021, 8:20 PM