public function getSourceIncomingAttribute()
{
if (!array_key_exists('total_profit', $this->attributes))
{
$this->attributes['total_profit'] = $this->source_incoming - $this->source_selfcost;
}
return $this->attributes['total_profit'];
}
$custom_field_name = [];
на $custom_field_name = array();
Для того, чтобы корректно формулировать проблему или задачу вовсе не обязательно быть супергуру.