This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
Hi, I'm having trouble creating a plugin with a fileupload form widget. Here are the fields i have.
public function formExtendFields($form)
{
$form->addTabFields([
'landnaam' => [
'label' => 'Officiële naam',
'comment' => 'De Officiële landnaam.',
'placeholder' => 'Nederland',
'tab' => 'Algemeen',
],
'hoofdstad' => [
'label' => 'Officiële Hoofdstad',
'comment' => 'De Hoofdstad van het land',
'placeholder' => 'Amsterdam',
'tab' => 'Algemeen',
],
'vlag' => [
'label' => 'Vlag',
'comment' => 'De Officiële vlag van het land',
'type' => 'fileupload',
'mode' => 'image',
'imageHeight' => '260',
'imageWidth' => '260',
'tab' => 'Algemeen',
],
]);
}
Last updated
What is the problem? What kind of error do you get? I can give you advice in Dutch if you want too.
Last updated
Advice in dutch is for me mutch easer, but I geuss it here not the right place... Sorry, i forgot the paste the error. Call to undefined method October\Rain\Database\QueryBuilder::vlag() /home/domain/subdomain/test2/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php line 1992
I thought I have to create a function vlag() but I don't know where and what to place in it.
You need to make sure that vlag is defined as a relation in the model. So it might be
public $attachMany = [
'vlags' => ['System\Models\File']
];
or
public $attachOne = [
'vlag' => ['System\Models\File']
];
dankjewel!
Thanks I have read About relations but did not understand I have to create a relation for file upload...
Tanks for the help, the upload works now!
Bedankt!
Last updated
1-5 of 5