question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug] Unable to cast repeatable into fake columns , it cant show the saved data

See original GitHub issue

Bug report

For the new repeatable i need to cast the columns but if the repeatable is inside a fake column, that is already cast, the repeatable cant retrieve the data and it always empty

What I did

I have a fake columns in my model with cast as array In the crud controller i have a repeatable with ‘fake’ => true, ‘store_in’ => ‘extras’,

What I expected to happen

All the data saved in the repeatable shows up

What happened

Repeatable is always empty

Is it a bug in the latest version of Backpack?

Yes

After I run composer update backpack/crud the bug… is it still there? Yes

Backpack, Laravel, PHP, DB version

When I run php artisan backpack:version the output is:

PHP VERSION:

PHP 8.1.4 (cli) (built: Apr 4 2022 13:30:33) (NTS) Copyright © The PHP Group Zend Engine v4.1.4, Copyright © Zend Technologies with Zend OPcache v8.1.4, Copyright ©, by Zend Technologies

LARAVEL VERSION:

v9.5.1@35be2599c9ac3d58bf1578895c2e85ea4848a0d7

BACKPACK VERSION:

5.0.11@337163b7e9a0e63413474bd3ee800a198f83c8e9

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
SebastianCordianocommented, Apr 19, 2022

@tabacitu @pxpm I think i found a rude solution for that

What i do: In the crud controller i overwrote the store/edit methods , with a function to encode the fields with a custom parameter , called ‘encode’, and replace the current request, here the code: `

private function encodeFields(){
        $request = $this->crud->getRequest()->request->all();    
        $operation= $this->crud->getCurrentOperation();
        $fields = $this->crud->get($operation.'.fields');
        foreach($fields as $field){
            if(isset($field['encode']) && $field['encode']){
                $request[$field['name']]=json_encode($this->crud->getRequest()->request->all()[$field['name']]);
            }
        }
        $this->crud->getRequest()->request->replace($request);
}
public function store(){
        $this->encodeFields();

	$response = $this->traitStore();
        return $response;
}

` That allowed the repeatable to retrieve the data and store it without problems

Idk if that helps you , but is a solution for this specif case

1reaction
SebastianCordianocommented, Apr 14, 2022

@pxpm Just assume the case for the PageManager: I create various template for the pages , all the data will be stored inside the extras (fake column) , inside that template i need a repeatable for various reason (ex: slider, listing or just n block all displayed the same but with different data), in that case i was unable to use it there ?

Read more comments on GitHub >

github_iconTop Results From Across the Web

R message "Can't subset columns that don't exist. x Locations ...
I am trying to do a background correction on my data sets that has only 3 columns, when submitting my code I get...
Read more >
Database Engine events and errors - SQL Server
Consult this MSSQL error code list to find explanations for error messages for SQL Server database engine events.
Read more >
column alias doesnt work in v5.1.6 connector - MySQL Bugs
Hi Vathsalya and thanks for your report. I can not consider "column alias doesnt work" as a bug report. I do not see...
Read more >
How to Troubleshoot and Fix Excel Pivot Table Errors
Note: To change the way that error values show in a pivot table layout ... Tip: If you create an Excel Table from...
Read more >
Data definition language (DDL) statements in ... - Google Cloud
TRUE if dataset and its table names are case-insensitive, otherwise FALSE . If not previously set, ... You cannot have collation on columns...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found