user
06/03/2021, 10:19 PMuser
06/03/2021, 10:24 PMifox
06/03/2021, 10:49 PMtwill.block_editor.repeaters
not twill.repeaters
, you can just remove it now thoughifox
06/03/2021, 10:50 PMuser
06/03/2021, 11:13 PM@php
$cinemas = app()->make(\App\Repositories\CinemaRepository::class)->listAll('name');
@endphp
@formField('select', [
'name' => 'cinema',
'label' => 'Cinema',
'options' => $cinemas
])
@formField('date_picker', [
'name' => 'published_at',
'label' => 'Time'
])
@twillRepeaterTitle('Seance')
@twillRepeaterTrigger('Add Seance')
However, I could save the picked cinema with the related model(checked from db), saw the picked id from the dropdown in the "getFormFields" but the picked cinema does not seem selected on the "cinemas" dropdown. Do you have any guess?user
06/03/2021, 11:16 PMifox
06/03/2021, 11:30 PMifox
06/03/2021, 11:31 PMcinema
column on a Seance model?ifox
06/03/2021, 11:32 PMifox
06/03/2021, 11:32 PMuser
06/04/2021, 5:08 AMhtml
<div>
{!! $project->image('cover_image', 'desktop') !!}
</div>
This shows me the full image even though I have cropped ituser
06/04/2021, 6:05 AMclass Seance extends Model
{
protected $fillable = [
'published',
'movie_id',
'cinema_id',
'published_at',
'booking_url',
'type'
];
public function movie()
{
return $this->belongsTo(Movie::class);
}
public function cinema()
{
return $this->belongsTo(Cinema::class);
}
}
user
06/04/2021, 6:05 AMclass SeanceRepository extends ModuleRepository
{
public function __construct(Seance $model)
{
$this->model = $model;
}
public function getFormFields($object)
{
$fields = parent::getFormFields($object);
return $fields;
}
public function afterSave($object, $fields)
{
/** @var Seance $object */
$object->cinema_id = $fields['cinema'];
$object->save();
parent::afterSave($object, $fields);
}
}
Rayderxx
06/04/2021, 8:26 AMifox
06/04/2021, 8:28 AMcinema_id
as the name of the select field, you shouldn't need that code in the repouser
06/04/2021, 9:52 AMRayderxx
06/04/2021, 9:56 AMuser
06/04/2021, 9:56 AMRayderxx
06/04/2021, 9:57 AMuser
06/04/2021, 10:22 AMifox
06/04/2021, 10:52 AMphp artisan twill:update
?user
06/04/2021, 10:55 AMuser
06/04/2021, 10:55 AMuser
06/04/2021, 10:55 AM@formField('browser', [
'moduleName' => 'cinemas',
'name' => 'cinema',
'label' => 'Cinema',
'max' => 1,
])
@formField('date_picker', [
'name' => 'published_at',
'label' => 'Time'
])
@twillRepeaterTitle('Seance')
@twillRepeaterTrigger('Add Seance')
user
06/04/2021, 10:56 AMuser
06/04/2021, 10:58 AMRayderxx
06/04/2021, 11:07 AMpablobarrios
06/04/2021, 11:14 AMuser
06/04/2021, 11:24 AM<?php
namespace App\Repositories;
use A17\Twill\Repositories\ModuleRepository;
use App\Models\Seance;
class SeanceRepository extends ModuleRepository
{
public function __construct(Seance $model)
{
$this->model = $model;
}
protected $browsers = [
'cinema' => [
'titleKey' => 'name'
]
];
}
Many thanks guys @User @User @User I wish I can get some beer for you from here 🙂