- Add Phone/Email fields to LocationAddressModel allowedFields - Fix saveLocation() to throw exceptions instead of returning error arrays - Update controller to properly handle model responses - Include actual database error message in transaction failures
24 lines
832 B
PHP
24 lines
832 B
PHP
<?php
|
|
namespace App\Models\Location;
|
|
use App\Models\BaseModel;
|
|
|
|
class LocationAddressModel extends BaseModel {
|
|
protected $table = 'locationaddress';
|
|
protected $primaryKey = 'LocationID';
|
|
protected $allowedFields = ['LocationID', 'Street1', 'Street2', 'City', 'Province', 'PostCode',
|
|
'GeoLocationSystem', 'GeoLocationData', 'Phone', 'Email', 'CreateDate', 'EndDate'];
|
|
|
|
protected $useTimestamps = true;
|
|
protected $createdField = 'CreateDate';
|
|
protected $updatedField = '';
|
|
protected $useSoftDeletes = true;
|
|
protected $deletedField = 'EndDate';
|
|
|
|
protected $beforeInsert = ['normalizeDatesToUTC'];
|
|
protected $beforeUpdate = ['normalizeDatesToUTC'];
|
|
protected $afterFind = ['convertDatesToUTCISO'];
|
|
protected $afterInsert = ['convertDatesToUTCISO'];
|
|
protected $afterUpdate = ['convertDatesToUTCISO'];
|
|
|
|
}
|