I'm doing a migration and I want the execution of "artisan migrate" to stop until a field does not have the value 'CONTACT_INFO' inside.
What I want to do is an exception when I detect that this value is not there.
public function up()
{
$emailConfiguration = EConfig::where('clave','CONTACTO_NAME')->get()->first();
$eConfig = EConfig::find($emailConfiguration->pages_id);
$Languages = Language::all();
foreach ($Languages as $key => $lang) {
$exists = !is_null($eConfig->pages_id);
if ($exists) {
$value = $eConfig->detail()->where('language_id', $lang->languages_id)->first()->pages_valor;
if (strpos($value,'CONTACTO_INFO') == false) {
InvalidOrderException::reportable(function (InvalidOrderException $e) {
echo 'error';
});
}
}
}
}