ifox
01/10/2023, 1:03 PMelkex
01/10/2023, 1:27 PMKoili
01/10/2023, 2:19 PMphp
use App\Models\Page;
use App\Repositories\PageRepository;
use Illuminate\Database\Seeder;
class PageFaqSeeder extends Seeder
{
public function run()
{
app(PageRepository::class)->create([
'published' => true,
'title' => 'Frequently asked questions',
'description' => 'Frequently asked questions',
// should i pass something like 'slugAttributes' here? what should the attributes contain?
]);
}
}
The page repository is just the default twill repository that gets generated with composer
php
//.. skipped imports
class PageRepository extends ModuleRepository
{
use HandleBlocks, HandleTranslations, HandleSlugs, HandleMedias;
// should i add some overrides to HandleSlugs here?
public function __construct(Page $model)
{
$this->model = $model;
}
}
And the model itself is the default one that gets generated when making a module with translations, blocks slugs and medias.
I tried inspecting the HandleSlugs behaviours but cant seem to make sense of it.
In short:
Seeder doesnt generate localized slug entry in DB, because i dont know how to pass slug name/localisations to the repository.Harings Rob
01/10/2023, 2:23 PMKoili
01/10/2023, 2:23 PMHarings Rob
01/10/2023, 2:24 PMphp
'slug' => ['en' => 'my-title'],
ifox
01/10/2023, 2:30 PMKoili
01/10/2023, 2:34 PMKoili
01/10/2023, 2:34 PMarray to string conversion
errorErwin
01/10/2023, 2:35 PM<?php
namespace App\Twill\Block;
use A17\Twill\Services\Blocks\Block;
class VacArchiveBlock extends Block
{
public function getData(array $data, \A17\Twill\Models\Block $block): array
{
$data = parent::getData($data, $block);
dd($data);
return $data;
}
}
Its not going thru the class, does anyone have tips on how i could get this working?Koili
01/10/2023, 2:35 PMKoili
01/10/2023, 2:35 PMHarings Rob
01/10/2023, 2:41 PMErwin
01/10/2023, 2:42 PM$this->blocks()->get()
ifox
01/10/2023, 2:49 PMrenderBlocks
contextHarings Rob
01/10/2023, 2:50 PMErwin
01/10/2023, 3:32 PMifox
01/10/2023, 3:37 PMLinq2
01/11/2023, 11:21 AMifox
01/11/2023, 11:24 AMLinq2
01/11/2023, 11:34 AMkalle
01/11/2023, 11:38 AMLinq2
01/11/2023, 11:38 AMLinq2
01/11/2023, 11:49 AMkalle
01/11/2023, 11:51 AMLinq2
01/11/2023, 11:54 AMifox
01/11/2023, 12:58 PMjefsev
01/11/2023, 1:08 PMjefsev
01/11/2023, 1:09 PMifox
01/11/2023, 1:19 PM