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.

[4.1][Bug] translatable fake field - unexpected behavior or documentation issue

See original GitHub issue

Bug report

What I did

My field

CRUD::field('text')->type('summernote')->label('Text')->fake(true)->store_in('content_i18n');

My model

namespace App\Models;

use Backpack\CRUD\app\Models\Traits\CrudTrait;
use Backpack\CRUD\app\Models\Traits\SpatieTranslatable\HasTranslations;
use Illuminate\Database\Eloquent\Model;

class ProjectContent extends Model
{
    use CrudTrait;
    use HasTranslations;

    protected $table = 'project_contents';
    protected $guarded = ['id'];
    protected $translatable = ['content_i18n'];
    protected $casts = ['content_i18n' => 'array'];
    protected $fakeColumns = ['content_i18n'];

What I expected to happen

Works as expected, $model->content_i18n - return array in admin - showing storing data

What happened

If i add content_i18n to $cats and $translatable: $model->content_i18n - return string admin: data not showing db: {"ru": {"text": "<p>asdfasdfasfd</p>"}}

If i add content_i18n to $translatable only: $model->content_i18n - return string admin: data showing db: {"ru": {"text": "<p>asdfasdfasfd</p>"}}

What I’ve already tried to fix it

nothing

Backpack, Laravel, PHP, DB version

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

### PHP VERSION:
PHP 7.4.6 (cli) (built: May 14 2020 10:38:36) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.6, Copyright (c), by Zend Technologies

### LARAVEL VERSION:
v7.13.0@6fa69bfbd57744a5bbec5538ce483919b3fd625f

### BACKPACK VERSION:
4.1.6@cbd4143d3eb8302916012af205565cd3183f274f

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
pxpmcommented, May 29, 2020

Oh I see now @lotarbo, it’s outside the crud panel. Sorry you already wrote it, but I was mislead by the title.

You need to get the entry with the fake fields parsed, like we do on CRUD.

Route::get('test', function() {
$product = \App\Models\Product::whereNotNull('extras')->orderBy('id','desc')->first()->withFakes();
dd($product->meta_title);
});

This should get you going. 😃

Going to close this as I think there is no bug here.

If i am wrong, please re-open.

Best, Pedro

0reactions
lotarbocommented, May 28, 2020

@pxpm i forked demo and add some sample code, pliz check https://github.com/lotarbo/demo/commit/a2b1ad1025b40f5b0038724e79f9e02c4312946f

when i visit /test url i get this image

Also, in demo

image

dd($product->extras, $product->meta_title); returns image

Read more comments on GitHub >

github_iconTop Results From Across the Web

BIG-IP 14.1.4.1 Fixes and Known Issues - AskF5 - F5 Networks
Workaround: There are three workarounds: -- Use the GUI to download and reimport: 1. Download the cert and key. 2. Delete the cert...
Read more >
Release Notes for Cisco vEdge Devices and Cisco SD-WAN ...
Important Notes, Known Behavior, and Workaround. Cisco vManage Release 20.3.1 implements a hardened security posture to comply with FedRamp ...
Read more >
Logic Bugs in IoT Platforms and Systems: A Review - arXiv
When an unexpected transition is triggered by attackers, serious consequence could happen (bug 7 and bug 8). Sensor Data Out of Synchronization.
Read more >
(PDF) The Vital Bug Location Methodology i - ResearchGate
PDF | : In this document we discuss the methodology for locating bugs within the VITAL workbench. Authors: John Domingue, Marc Eisenstadt, ...
Read more >
CVE Reference Map for Source BUGTRAQ
BUGTRAQ:19940315 Security problem in sendmail versions 8. ... Infonautic's getdoc.cgi may allow unauthorized access to documents, CVE-2000-0288.
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