cloudcake / laravel-approval

Attach an approval process to any model, approve and disapprove from any other model, for Laravel.
MIT License
143 stars 15 forks source link

How to show the records for approval (Help/Advice) #12

Closed afarral closed 4 years ago

afarral commented 4 years ago

Hi I was wondering how you can show the records to be approved, ideally in a table with an approve and reject button. Thanks

stephenlake commented 4 years ago

https://github.com/stephenlake/laravel-approval/issues/6

afarral commented 4 years ago

Thank you for that, i have that, the issue i am having is how to access and loop through the json modifications to show this, e.g "modifcations"=>"......... "enddate": {modified": "27/11/2019" .........

as <td>enddate</td><td> 27/11/2019</td>

FireShot Capture 015 -  - 127 0 0 1

stephenlake commented 4 years ago

Thank you for that, i have that, the issue i am having is how to access and loop through the json modifications to show this

This is more of a general PHP question than anything - unrelated to this package.

PHP:

foreach ($modification->modifications as $key => $modification) {
     echo "{$key}: {$modification['modified']}".PHP_EOL;
}

Blade:

@foreach ($modification->modifications as $key => $modification)
      {{ $key }}: {{ $modification['modified'] }}
@endforeach

Collections:

collect($modification->modifications)->each(function ($modification, $key) {
    echo "{$key}: {$modification['modified']}".PHP_EOL;
});