Created
March 7, 2016 00:20
-
-
Save aaoliveira/be9351d7d9a0a071a39f to your computer and use it in GitHub Desktop.
Classe seguimentos
This file contains hidden or 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 Illuminate\Database\Eloquent\Model; | |
/** | |
* Class Segment. | |
*/ | |
class Segment extends Model | |
{ | |
public $timestamps = false; | |
protected $fillable = [ | |
'description', | |
'company_id', | |
]; | |
protected $guarded = []; | |
protected function initEnsinoInfantil($companyId, $empresa) | |
{ | |
$data = [ | |
[ | |
'company_id' => $companyId, | |
'description' => 'Educação Infantil', | |
], | |
]; | |
// 1 - maneira | |
$infantilSave = $this->save($data); // falha | |
// 2 - maneira | |
$infantilSave = parente::create($data); // falha | |
// 3 - maneira | |
$infantilSave = Model::create($data); // falha | |
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; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment