Commit 983c2ceb authored by alissonalbuquerque's avatar alissonalbuquerque
Browse files

add model de Unidade

parent 22696224
...@@ -5,37 +5,30 @@ namespace App\Models; ...@@ -5,37 +5,30 @@ namespace App\Models;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
class Unidade extends Model class Unidade extends Model
{ {
const ARCOVERDE = 1;
const CARUARU = 2;
const GARANHUNS = 3;
const NAZARE_DA_MATA = 4;
const PALMARES = 5;
const PETROLINA = 6;
const RECIFE = 7;
const REGIAO_METROPOLITANA = 8;
const SALGUEIRO = 9;
const SERRA_TALHADA = 10;
/** /**
* @param integer $value * References table unidade
* @return array|string *
* @var string
*/ */
public static function listUnidades($value = null) protected $table = "unidade";
{
$values = [
self::ARCOVERDE => 'Arcoverde', /**
self::CARUARU => 'Caruaru', * The attributes that are mass assignable.
self::GARANHUNS => 'Garanhuns', *
self::NAZARE_DA_MATA => 'Nazaré da Mata', * @var array
self::PALMARES => 'Palmares', */
self::PETROLINA => 'Petrolina', protected $fillable = ['name'];
self::RECIFE => 'Recife',
self::REGIAO_METROPOLITANA => 'Região Metropolitana',
self::SALGUEIRO => 'Salgueiro',
self::SERRA_TALHADA => 'Serra Talhada',
];
return $value != null? $values[$value] : $values; /**
* @return string
*/
public function __toString()
{
return $this->name;
} }
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment