samedi 28 avril 2018

Attempting to clean up code -> errorexception must return a relationship instance

I'm trying to clean up code in my view so removing the logic, and calling a method instead.

This was my original line in index.blade.php

@if($Tenancy->accepted == 0 && $Tenancy->request_sent != 1)

I changed it to this

@elseif($Tenancy->addTenancy)

And moved the logic to my Tenancy model like so

public function addTenancy()
{
    return $this->accepted == 0 && $this->request_sent == 0;
}

I'm not looking for a relationship. Any idea about this error.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire