Skip to content
This repository has been archived by the owner on Aug 22, 2023. It is now read-only.

Commit

Permalink
Compatible with exceptions caused by think-helper.
Browse files Browse the repository at this point in the history
  • Loading branch information
leeqvip committed Mar 6, 2020
1 parent 0ff167a commit 406e0b3
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Adapter.php
Expand Up @@ -36,6 +36,10 @@ public function loadPolicy($model)
$rows = $this->casbinRule->select()->toArray();

foreach ($rows as $row) {
if(is_object($row) && method_exists($row, 'toArray')){
$row= $row->toArray();
}

$line = implode(', ', array_filter(array_slice($row, 1), function ($val) {
return '' != $val && !is_null($val);
}));
Expand Down

0 comments on commit 406e0b3

Please sign in to comment.