I made a checklist with the possible sizes of a certain product but its storing the ids instead of the specific size. This is the size field display. I have the size field code like this: How do I change it to store the size’s name? Answer I solved this by creating a pivot table between merch and sizes and
Tag: laravel-backpack
Is having an “id” column in a table mandatory to work with BackPack?
I have a table with columns color_id and list_id. When I load a page with that specific model in Laravel BackPack, it throws an error: In general, this is correct. I do not have an id column since it’s a pivot table. I assumed adding custom sorting would solve the problem so I added the following line in my controller’s
Passing a list of menu items to the sidebar in Backpack Laravel
I’m trying to send a list to sidebar_content.blade.php. The idea would be getting the menu items from a database. I guess I should add the variable to the @include in every subview in the “chain”, but I don’t know which controller (if any) starts that chain. I have read the docs and tried to find tutorials, projects or people asking
Update Laravel Database table with cURL Get Response
I am trying to execute a cURL GET request and use the response to update my table, but getting the following error: TypeError IlluminateDatabaseEloquentBuilder::create(): Argument #1 ($attributes) must be of type array, string given, called in /home/vagrant/code/bp/vendor/laravel/framework/src/Illuminate/Support/Traits/ForwardsCalls.php on line 23 A similar GET request through Postman returns the following response structure: Controller: M3customCrudController.php Answer First – use Http facade, not
Laravel: How to separate array from query result into variables?
I have something like this: How to separate the ‘column’ and ‘count’ into variables? Answer Use native PHP functions; array_keys and array_values. For more details, read the below links; https://www.php.net/manual/en/function.array-keys.php https://www.php.net/manual/en/function.array-values.php
Laravel Backpack, Show Address (Json) in Column
I want to show the name field from address json (using algolia), how do i do that? I tried this: But can’t manage to work. Also, it always return error. In preview, i want to show full address too, but only got json return. Thanks in advance Answer Managed to work with Custom Fields. Controller: Create a custom field at:
Laravel Backpack – Set extra attributes before page save
In my PageTemplates.php I have a field like this: Now I would like to save also the latitude and longitude of the address they give in (if it can be found). I’ve copied the PageCrudController and changed the config in config/backpack/pagemanager.php to: In my store function I have: But what do I place in the if statement? How can I