maelstrom-cms / toolkit

A CMS Toolkit built on Laravel and React
https://www.maelstrom-cms.com
61 stars 6 forks source link

[Question] Text Links to a route #3

Closed andrewminion-luminfire closed 4 years ago

andrewminion-luminfire commented 4 years ago

I’m trying to use a TextLinkColumn column type to provide a link to a specific route using an attribute from my models:

            [
                'label' => 'View Docs',
                'name' => route('web.docsets.show', 'slug'),
                'labelText' => 'View Docs',
                'type' => 'TextLinkColumn',
            ],

If I set name in the array above to just 'slug', then I get a relative URL (it appends the slug to the current URL). If I set to route as above, I end up with null/empty href attributes.

Is it possible to generate a link to a specified URL using an attribute from each model?

Thanks

OwenMelbz commented 4 years ago

You can created a computed property on your model, and load that accessor on the table view which contains the full URL e.g.

https://www.maelstrom-cms.com/advance/entry-transformer.html#appending-attributes

Otherwise you can use a full transformer to append your custom fields to the data.

Does that give you what you need!?

OwenMelbz commented 4 years ago

@andrewminion-luminfire any luck?

I'm going to close the ticket as it's not a bug report, but will continue to respond if you need.

andrewminion-luminfire commented 4 years ago

Sorry, haven’t had a chance to get back to this yet, but that should work. Thanks!