bishopb / laravel-forums

Forums and discussion boards for Laravel 4
GNU General Public License v2.0
15 stars 11 forks source link

Mark as PHP 5.5 or fix "Can't use method return value in write context" error #3

Closed neamtua closed 10 years ago

neamtua commented 10 years ago

I ran into this while running forum:connect:

{"error":{"type":"Symfony\Component\Debug\Exception\FatalErrorException","message":"Can't use method return value in write context","file":"\/home\/simpxyz\/vendor\/bishopb\/laravel-forums\/src\/models\/AuditingObserver.php","line":65}}

So either correct the following function in AuditingObserver.php or mark the package as PHP 5.5.

protected function needs(\Eloquent $model, $attribute)
    {
        $attr = $model->getAttribute($attribute);
        return (
            (
                in_array($attribute, $model->getAuditors()) && // audit column in model &
                empty($attr)        // column not already set
            ) ?
            true :
            false
        );
    }

I could do a PR if you'd like.