I am having trouble calling a method in my Account class.
Here is the method defined in my class:
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Account extends Model
{
protected $fillable = ['customer_id','bookmaker_id', 'balance', 'profit'];
public function addProfit($amountToAdd) {
$this->profit = $this->profit + $amountToAdd;
}
.......
......
Here is my method call in my controller
$account->addProfit(5);
I have established that I am returning a single account record with the dd($account) command, so it appears it's definitely a problem with the method.
However, I get this message when I try to run the code:
BadMethodCallException in Macroable.php line 81:
Method addProfit does not exist.
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/20hjqhZ
via IFTTT
Aucun commentaire:
Enregistrer un commentaire