public function all() { $attributes = parent::all(); if (!$this->has('followed_up')) { $attributes['followed_up'] = 0; } $this->replace($attributes); return parent::all(); }
public function all() { if ($this->get('role') == 'agent' && !$this->route()->hasParameter('id')) { $attributes = parent::all(); // you can add fields $attributes['username'] = AgentHelper::getNextAgentCode(); $this->replace($attributes); } return parent::all(); }