Created
March 7, 2016 01:10
-
-
Save aaoliveira/a535667893c5fda0a0f9 to your computer and use it in GitHub Desktop.
Model Sement
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace app\Models; | |
use Exception; | |
use Illuminate\Database\Eloquent\Model; | |
/** | |
* Class Segment. | |
*/ | |
class Segment extends Model | |
{ | |
public $timestamps = false; | |
protected $fillable = [ | |
'description', | |
'company_id', | |
]; | |
protected $guarded = []; | |
public static function initEnsinoInfantil($companyId, $empresa) | |
{ | |
$data = [ | |
[ | |
'company_id' => $companyId, | |
'description' => 'Educação Infantil', | |
], | |
]; | |
$infantilSave = self::create($data); | |
if (!$infantilSave) { | |
throw new Exception("Não foi possivel realizar o cadastro dos seguimentos de series ensino infantil da escola {$empresa}. Por favor, tente novamente ou entre em contato com o Administrador."); | |
} | |
return $infantilSave; | |
} | |
public static function initFundamentalI($companyId, $empresa) | |
{ | |
$data = [ | |
[ | |
'company_id' => $companyId, | |
'description' => 'Ensino Fundamental I', | |
], | |
]; | |
$fundamental = self::create($data); | |
if (!$fundamental) { | |
throw new Exception("Não foi possivel realizar o cadastro dos seguimentos de series ensino fundamental I da escola {$empresa}. Por favor, tente novamente ou entre em contato com o Administrador."); | |
} | |
return $fundamental; | |
} | |
public static function initFundamentalII($companyId, $empresa) | |
{ | |
$data = [ | |
[ | |
'company_id' => $companyId, | |
'description' => 'Ensino Fundamental II', | |
], | |
]; | |
$fundamental = self::create($data); | |
if (!$fundamental) { | |
throw new Exception("Não foi possivel realizar o cadastro dos seguimentos de series ensino fundamental II da escola {$empresa}. Por favor, tente novamente ou entre em contato com o Administrador."); | |
} | |
return $fundamental; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment