laravel-nami-api/src/Region.php

20 lines
370 B
PHP
Raw Normal View History

2021-04-10 00:48:04 +02:00
<?php
namespace Zoomyboy\LaravelNami;
use Illuminate\Support\Arr;
use Illuminate\Database\Eloquent\Model;
class Region extends Model {
protected $guarded = [];
public static function fromNami($item) {
return new self([
'id' => $item['id'],
'name' => preg_replace('/\s*\(.*?\)/', '', $item['descriptor'])
]);
}
}