-
Notifications
You must be signed in to change notification settings - Fork 456
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #673 from portabilis/portabilis-patch-2019-10-25
[2.2] Portabilis patch 25/10/2019
- Loading branch information
Showing
16 changed files
with
364 additions
and
126 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
namespace App\Services; | ||
|
||
use App\Models\Student; | ||
|
||
class StudentService | ||
{ | ||
/** | ||
* Verifica se o aluno tem alguma matricula em andamento | ||
* | ||
* @param int $studentId | ||
* @param int|null $levelId | ||
* @return boolean | ||
*/ | ||
public function hasInProgressRegistration($studentId, $levelId = null) | ||
{ | ||
$student = Student::find($studentId); | ||
|
||
if (!$student) { | ||
return false; | ||
} | ||
|
||
$query = $student->registrations()->where('status', 3); | ||
|
||
if ($levelId) { | ||
$query->where('level_id', $levelId); | ||
} | ||
|
||
return $query->orderBy('year', 'desc') | ||
->exists(); | ||
} | ||
} |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
32 changes: 32 additions & 0 deletions
32
...e/migrations/2019_10_24_083313_cria_parametro_ordena_alunos_por_sequencial_enturmacao.php
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
use Illuminate\Support\Facades\Schema; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Database\Migrations\Migration; | ||
|
||
class CriaParametroOrdenaAlunosPorSequencialEnturmacao extends Migration | ||
{ | ||
/** | ||
* Run the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function up() | ||
{ | ||
Schema::table('pmieducar.instituicao', function (Blueprint $table) { | ||
$table->boolean('ordenar_alunos_sequencial_enturmacao')->default(false); | ||
}); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function down() | ||
{ | ||
Schema::table('pmieducar.instituicao', function (Blueprint $table) { | ||
$table->dropColumn('ordenar_alunos_sequencial_enturmacao'); | ||
}); | ||
} | ||
} |
Oops, something went wrong.