Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Walter Felipe
pad-upe
Commits
ba3f1d59
Commit
ba3f1d59
authored
Mar 23, 2022
by
alissonalbuquerque
Browse files
add correcoes de consulta em EnsinoAula Model
parent
df0ed09c
Changes
2
Hide whitespace changes
Inline
Side-by-side
app/Models/Tabelas/Ensino/EnsinoAula.php
View file @
ba3f1d59
<?php
namespace
App\Models
;
namespace
App\Models
\Tabelas\Ensino
;
use
App\Queries\PlanejamentoQuery
;
use
Illuminate\Database\Eloquent\Factories\HasFactory
;
use
Illuminate\Database\Eloquent\Model
;
...
...
@@ -97,10 +98,11 @@ class EnsinoAula extends Model
}
/**
* @return
PlanejamentoQuery|Builder
* @return
array
*/
public
function
getPlanejamentos
()
{
return
PlanejamentoQuery
::
whereInCodDimensao
(
$this
->
codesDimensao
);
$query
=
new
PlanejamentoQuery
();
return
$query
->
whereInCodDimensao
(
$this
->
codesDimensao
)
->
get
();
}
}
app/Queries/PlanejamentoQuery.php
View file @
ba3f1d59
...
...
@@ -4,24 +4,37 @@ namespace App\Queries;
use
App\Models\Planejamento
;
class
PlanejamentoQuery
extends
Planejamento
{
class
PlanejamentoQuery
extends
Query
{
public
function
__construct
(
$init
=
[])
{
$this
->
query
=
Planejamento
::
where
(
$init
);
}
/**
* @param integer $dimensao
* @param string $expression
* @return Builder
*/
public
function
whereDimensao
(
int
$dimensao
,
string
$expression
=
'='
)
{
return
$this
->
query
->
where
(
'dimensao'
,
$expression
,
$dimensao
);
}
/**
* @param integer $cod_dimensao
* @param string $expression
* @return Builder
*/
public
static
function
whereCodDimensao
(
string
$cod_dimensao
,
string
$expression
=
'='
)
{
return
Planejamento
::
where
(
'cod_dimensao'
,
$expression
,
$cod_dimensao
);
public
function
whereCodDimensao
(
string
$cod_dimensao
,
string
$expression
=
'='
)
{
return
$this
->
query
->
where
(
'cod_dimensao'
,
$expression
,
$cod_dimensao
);
}
/**
* @param
integer $
dimensao
* @param
array $codes_
dimensao
* @param string $expression
* @return Builder
*/
public
static
function
whereDimensao
(
int
$
dimensao
,
string
$expression
=
'='
)
{
return
Planejamento
::
where
(
'dimensao'
,
$expression
,
$
dimensao
);
public
function
where
InCod
Dimensao
(
$codes_
dimensao
)
{
return
$this
->
query
->
whereIn
(
'cod_dimensao'
,
$codes_
dimensao
);
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment