vendredi 13 octobre 2017

Unable to recreate DataRow for relationship in Laravel Voyager

I upgraded to laravel 5.5 and Voyager 1.0 and am using mysql on a vagrant box.

I want to add an entry on the data_rows table for a relationship between a User and a Store. I'm able to create the entry using Voyager's gui.

creating relationship gui view of relationship Which creates the corresponding table entry enter image description here When i copy all of these values into my seeder

$dataRow = $this->dataRow($storeDataType, 'store_belongsto_user_relationship');
if (!$dataRow->exists) {
    $dataRow->fill([
        'type'         => 'relationship',
        'display_name' => 'Manager',
        'required'     => 0,
        'browse'       => 1,
        'read'         => 1,
        'edit'         => 1,
        'add'          => 1,
        'delete'       => 1,
        'details'      => '{"model":"App\\User","table":"users","type":"belongsTo","column":"manager_id","key":"id","label":"email","pivot_table":"ad_store","pivot":"0"}',
        'order'        => 20,
    ])->save();
}

and run my db migrations with my custom seeders, If I reload the /database/stores/bread/edit page I get an error thrown for accessing the property of a non-object triggered on this line.

<?php if($relationshipDetails->type == 'belongsTo'): ?><?php echo e('flexed'); ?><?php endif; ?>

Which implies that the json stored in the details field is invalid. I don't understand how that can be though when I copied it to my seeder verbatim. Is there some other entry added on another table or cached that my seeder doesn't account for? I've crawled through the db entries and can't find anything obvious.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire