Luís Novais
09/16/2021, 10:12 PMuser
09/17/2021, 10:18 AMifox
09/17/2021, 10:25 AM'translated' => true, and the model would need to use the`laravel-translatable` trait.KP
09/17/2021, 11:05 AMuser
09/17/2021, 12:39 PMrronik
09/17/2021, 12:39 PM@formField('medias', [
'name' => 'thumbnail',
'label' => 'Thumbnail',
'required' => true,
])
- Added $mediasParams in vendor\area17\twill\src\Models\Setting.php:
public $mediasParams = [
'thumbnail' => [
'default' => [
[
'name' => 'default',
'ratio' => 0,
],
],
],
];
- The **HasMedias **Trait is icluded in the Setting Model and **HandleMedias **Trait is included in the SettingRepository
For some reason the cropping option isnt showing in the form and when i submit the form i get this error:
"Trying to access array offset on value of type null" in vendor/area17/twill/src/Repositories/SettingRepository.php:147
145. public function getCrops($role)
146. {
147. return $this->config->get('twill.settings.crops')[$role];
148. }pboivin
09/17/2021, 12:42 PMconfig/twill.php
Here's a quick example : https://github.com/area17/twill/discussions/977pboivin
09/17/2021, 12:46 PMrronik
09/17/2021, 12:46 PMrronik
09/17/2021, 1:06 PMifox
09/17/2021, 1:08 PMpboivin
09/17/2021, 1:10 PM$setting = Setting::firstWhere('key', 'setting_name');
$img = $setting->imageObject('role_name');ifox
09/17/2021, 1:11 PMrronik
09/17/2021, 1:12 PMchrispymm
09/17/2021, 1:24 PMEsrat
09/19/2021, 1:41 AMpboivin
09/19/2021, 12:57 PMclass Post extends Model
{
public $filesParams = ['attachment'];
// ...
}
class PostRequest extends Request
{
public function rulesForCreate()
{
// ...
}
public function rulesForUpdate()
{
return [
'medias.attachment' => 'required'
];
}
}Sami
09/20/2021, 1:16 PMa_id doesn't have a default value"
Let's say I have entity A and B. A has many B's and B belongs to A. So entity B has a_id defined as:
$table->foreignId('a_id')->constrained()->onDelete('cascade');Sami
09/20/2021, 1:16 PMSami
09/20/2021, 1:18 PMafterSave function looks like this
php
public function afterSave($object, $fields)
{
$this->updateBrowser($object, $fields, 'a');
parent::afterSave($object, $fields);
}Sami
09/20/2021, 1:19 PMbeforeSave too but no successpboivin
09/20/2021, 1:20 PM->nullable() in there to allow for an empty browser fieldSami
09/20/2021, 1:20 PMparent_id and then as a_id - it's the same, I just messed up 😄Sami
09/20/2021, 1:22 PMSami
09/20/2021, 1:22 PMafatmustafa
09/20/2021, 7:46 PMLuís Novais
09/20/2021, 9:17 PMpboivin
09/20/2021, 9:24 PMLuís Novais
09/20/2021, 9:30 PMpboivin
09/20/2021, 9:31 PM