PHP code example of danhunsaker / eloquent-mutant-caster
1. Go to this page and download the library: Download danhunsaker/eloquent-mutant-caster library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
danhunsaker / eloquent-mutant-caster example snippets
use Danhunsaker\Eloquent\Traits\MutantCaster;
use Illuminate\Database\Eloquent\Model;
class BaseModel extends Model
{
use MutantCaster;
}
public function getMyNewAwesomeTypeAttribute($value)
{
return new MyNewAwesomeType($value);
}
public function setMyNewAwesomeTypeAttribute($key, $value)
{
$this->attributes[$key] = $value->prepForDatabaseStorage();
return $this;
}
use Danhunsaker\Eloquent\Traits\CastIP;
use Danhunsaker\Eloquent\Traits\MutantCaster;
use Illuminate\Database\Eloquent\Model;
class BaseModel extends Model
{
use MutantCaster, CastIP;
protected $casts = [
'field' => 'ip',
];
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.