krafthaus / bauhaus

Laravel 4 Admin Generator
http://bauhaus.krafthaus.nl/
GNU General Public License v2.0
1 stars 0 forks source link

[feature request] Add other buttons/links/whatever to a list #24

Open that0n3guy opened 10 years ago

that0n3guy commented 10 years ago

I didn't see a way to easily add a button/link to a list. I know I could do this with an model accessor, but is that the best way to do this?

jspekken commented 10 years ago

Something like this?

$mapper->button('http://google.com')->label('To Google');
$mapper->link('http://google.com')->label('To Google');
that0n3guy commented 10 years ago

That works, but how do you put an edit & view button in the same collumn. Or how do I put a list of data in the column. I'm currently doing it like:

// in configureList
$mapper->string('create_comparison')->label('DIQC');

 // and I have this in my model:
    public function getCreateComparisonAttribute()
    {
        $diqr = $this;

        $view = View::make('partials.comparisonlist', compact('diqr'));

        return $view->render();
    }

This works perfectly as it allows me to use a view and pass variables to the view, but this doesn't belong in my model.

Something like this would be very flexible:

$mapper->view('partials.comparisonlist', compact('diqr'))->label('To Google');