-
Notifications
You must be signed in to change notification settings - Fork 920
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
video type needs two fields ? #213
Comments
@MarcBrillault if your column is called "extract" you only need to add 1 field. Not sure why you're creating 2 fields, can you share your code? |
Here is my migration code:
And the code in DiscCrudController:
When I do that, without adding the "extract_link" field in the migration, I have the above error. |
The "extract" field needs to be TEXT as its more than likely longer than 255. But I'm confirming now that all you need is $this->crud->addField(
[
'name' => 'extract',
'label' => 'Extrait',
'type' => 'video',
]
); In your model, make sure its cast as an object. Ignore the extract_link, field that is irrelevant and not needed to worry about, its purely a dummy field for the javascript. Make sure you have no get/set mutators on the field. I've just tested on 2 different installs and its working as expected, so there must be a configuration issue your end thats conflicting. Also make sure you don't have anything like "extract_link" in your $fillable, basically remove any of your code that even acknowledges the existence of _link, you do not need to worry about that. Additionally try a composer update, just to make sure your on the latest, and make sure you have no customly published views overwriting the core one |
I still have the problem (And yes, I have made a composer update). I'll try to test it on a fresh install this evening, I'll let you know. |
I made a fresh install (base, crud and generators). I made the simplest possible migration:
I generated all the files with And I added this to Http/Controllers/Admin/DiscCrudController.php:
And I still have the issue. I uploaded my Laravel installation (minus the vendor dir) here : http://files.brillault.fr/dev/testBackpack.zip |
Hi guys, Found it! The zip helped, thank you. I think the problem is that there is a video_link input that reaches the create() and store() methods. If $fillable isn't specified, the CRUD will try to store all inputs. And it can't store video_link, because there is no such column. @MarcBrillault , you can fix this by specifying in @OwenMelbz , I think to prevent this problem ever happening again we could remove the video_link input from the "video" field type. Or just remove its name? I think that should work. What do you think? Cheers! |
Thanks to both of you ;) |
Merged @OwenMelbz 's PR, so it's now fixed. Thanks guys. Cheers! |
I followed the steps mentioned here : https://laravel-backpack.readme.io/docs/crud-fields#video and had an issue :
SQLSTATE[42S22]: Column not found: 1054 Champ 'extract_link' inconnu dans field list
It seems I have to create two fields, xxx, and xxx_link in order for the video type to work.
Is it really necessary ? The video field already contains the link, as it is stored as json.
The text was updated successfully, but these errors were encountered: