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
2968ef74
Commit
2968ef74
authored
Jul 22, 2022
by
alissonalbuquerque
Browse files
Add correcoes de refatoracao de query e de usuario com multiplos perfis
parent
7225f6dc
Changes
33
Hide whitespace changes
Inline
Side-by-side
app/Queries/UserTypeQuery.php
0 → 100644
View file @
2968ef74
<?php
namespace
App\Queries
;
use
App\Models\UserType
;
class
UserTypeQuery
extends
CustomQuery
{
public
function
__construct
()
{
$this
->
query
=
UserType
::
where
([]);
self
::
$instance
=
$this
;
}
}
database/migrations/2014_10_12_000000_create_users_table.php
View file @
2968ef74
...
...
@@ -15,7 +15,6 @@ class CreateUsersTable extends Migration
{
Schema
::
create
(
'users'
,
function
(
Blueprint
$table
)
{
$table
->
id
();
$table
->
tinyInteger
(
'type'
);
$table
->
string
(
'name'
);
$table
->
string
(
'email'
)
->
unique
();
$table
->
timestamp
(
'email_verified_at'
)
->
nullable
();
...
...
database/migrations/2022_03_12_020002_update_user_table.php
View file @
2968ef74
...
...
@@ -13,11 +13,11 @@ class UpdateUserTable extends Migration
*/
public
function
up
()
{
Schema
::
table
(
'users'
,
function
(
Blueprint
$table
)
{
$table
->
integer
(
'type'
)
->
default
(
0
)
->
change
();
$table
->
string
(
'document'
)
->
default
(
""
)
->
change
();
$table
->
integer
(
'status'
)
->
default
(
1
)
->
change
();
});
//
Schema::table('users', function (Blueprint $table) {
//
$table->integer('type')->default(0)->change();
//
$table->string('document')->default("")->change();
//
$table->integer('status')->default(1)->change();
//
});
}
/**
...
...
database/migrations/2022_03_22_225548_create_ensino_aulas_table.php
View file @
2968ef74
...
...
@@ -16,6 +16,7 @@ class CreateEnsinoAulasTable extends Migration
Schema
::
create
(
'ensino_aulas'
,
function
(
Blueprint
$table
)
{
$table
->
id
();
$table
->
foreignId
(
'user_pad_id'
)
->
notNull
();
$table
->
tinyInteger
(
'dimensao'
)
->
nullable
();
$table
->
string
(
'cod_atividade'
)
->
notNull
();
$table
->
string
(
'componente_curricular'
)
->
notNull
();
$table
->
string
(
'curso'
)
->
notNull
();
...
...
@@ -37,4 +38,5 @@ class CreateEnsinoAulasTable extends Migration
{
Schema
::
dropIfExists
(
'ensino_aulas'
);
}
}
database/migrations/2022_07_17_193918_create_avaliacao_table.php
View file @
2968ef74
...
...
@@ -15,11 +15,14 @@ class CreateAvaliacaoTable extends Migration
{
Schema
::
create
(
'avaliacao'
,
function
(
Blueprint
$table
)
{
$table
->
id
();
$table
->
integer
(
'ch_semanal'
)
->
notNull
();
$table
->
integer
(
'status'
)
->
notNull
();
$table
->
string
(
'descricao'
)
->
notNull
();
$table
->
integer
(
'tarefa_id'
)
->
notNull
();
$table
->
foreignId
(
'avaliador_id'
)
->
notNull
();
$table
->
unsignedBigInteger
(
'tarefa_id'
)
->
notNull
();
$table
->
foreignId
(
'avaliador_id'
)
->
nullable
();
$table
->
tinyInteger
(
'type'
)
->
notNull
();
$table
->
tinyInteger
(
'status'
)
->
notNull
();
$table
->
string
(
'descricao'
)
->
nullable
();
$table
->
integer
(
'ch_semanal'
)
->
nullable
();
$table
->
integer
(
'ch_total'
)
->
nullable
();
$table
->
timestamps
();
$table
->
softDeletes
();
});
...
...
database/migrations/2022_07_22_024613_create_user_type_table.php
0 → 100644
View file @
2968ef74
<?php
use
Illuminate\Database\Migrations\Migration
;
use
Illuminate\Database\Schema\Blueprint
;
use
Illuminate\Support\Facades\Schema
;
class
CreateUserTypeTable
extends
Migration
{
/**
* Run the migrations.
*
* @return void
*/
public
function
up
()
{
Schema
::
create
(
'user_type'
,
function
(
Blueprint
$table
)
{
$table
->
id
();
$table
->
foreignId
(
'user_id'
);
$table
->
tinyInteger
(
'type'
);
$table
->
tinyInteger
(
'status'
);
$table
->
boolean
(
'selected'
);
$table
->
timestamps
();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public
function
down
()
{
Schema
::
dropIfExists
(
'user_type'
);
}
}
database/seeders/DatabaseSeeder.php
View file @
2968ef74
...
...
@@ -24,6 +24,7 @@ class DatabaseSeeder extends Seeder
PadSeeder
::
class
,
DisciplinaSeeder
::
class
,
EvaluatorSeeder
::
class
,
UserTypeSeeder
::
class
]);
}
...
...
database/seeders/PadSeeder.php
View file @
2968ef74
...
...
@@ -4,7 +4,7 @@ namespace Database\Seeders;
use
App\Models\PAD
;
use
App\Models\User
;
use
App\Models\Util\Status
;
use
Illuminate\Database\Seeder
;
class
PadSeeder
extends
Seeder
...
...
@@ -21,7 +21,7 @@ class PadSeeder extends Seeder
'nome'
=>
"2022.1"
,
'data_inicio'
=>
"2022-02-01"
,
'data_fim'
=>
"2022-06-01"
,
'status'
=>
0
'status'
=>
Status
::
ATIVO
,
]);
PAD
::
create
([
...
...
@@ -29,7 +29,7 @@ class PadSeeder extends Seeder
'nome'
=>
"2022.2"
,
'data_inicio'
=>
"2022-07-01"
,
'data_fim'
=>
"2022-12-01"
,
'status'
=>
1
'status'
=>
Status
::
ATIVO
,
]);
}
}
database/seeders/UserSeeder.php
View file @
2968ef74
...
...
@@ -5,6 +5,7 @@ namespace Database\Seeders;
use
App\Models\Curso
;
use
App\Models\Unidade
;
use
App\Models\User
;
use
App\Models\Util\Status
;
use
Illuminate\Database\Seeder
;
use
Illuminate\Support\Facades\DB
;
use
Illuminate\Support\Facades\Hash
;
...
...
@@ -23,13 +24,12 @@ class UserSeeder extends Seeder
foreach
(
$ids
as
$id
)
{
User
::
create
([
'type'
=>
User
::
TYPE_TEACHER
,
'name'
=>
"Professor
{
$id
}
"
,
'email'
=>
"professor
{
$id
}
@upe.br"
,
'email_verified_at'
=>
null
,
'password'
=>
Hash
::
make
(
'@professor'
),
'document'
=>
"00000000
{
$id
}
"
,
'status'
=>
User
::
STATUS_AC
TIV
E
,
'status'
=>
Status
::
A
TIV
O
,
'campus_id'
=>
3
,
'curso_id'
=>
1
,
]);
...
...
@@ -37,39 +37,36 @@ class UserSeeder extends Seeder
// UserAdmin
User
::
create
([
'type'
=>
User
::
TYPE_ADMIN
,
'name'
=>
"Admin"
,
'email'
=>
"admin@upe.br"
,
'email_verified_at'
=>
null
,
'password'
=>
Hash
::
make
(
'@admin'
),
'document'
=>
"100000000"
,
'status'
=>
User
::
STATUS_AC
TIV
E
,
'status'
=>
Status
::
A
TIV
O
,
'campus_id'
=>
NULL
,
'curso_id'
=>
NULL
,
]);
//UserDirector
User
::
create
([
'type'
=>
User
::
TYPE_DIRECTOR
,
'name'
=>
"Director"
,
'email'
=>
"director@upe.br"
,
'email_verified_at'
=>
null
,
'password'
=>
Hash
::
make
(
'@director'
),
'document'
=>
"100000000"
,
'status'
=>
User
::
STATUS_AC
TIV
E
,
'status'
=>
Status
::
A
TIV
O
,
'campus_id'
=>
1
,
'curso_id'
=>
1
,
]);
//UserDirector
User
::
create
([
'type'
=>
User
::
TYPE_COORDINATOR
,
'name'
=>
"Coordinator"
,
'email'
=>
"coordinator@upe.br"
,
'email_verified_at'
=>
null
,
'password'
=>
Hash
::
make
(
'@coordinator'
),
'document'
=>
"100000000"
,
'status'
=>
User
::
STATUS_AC
TIV
E
,
'status'
=>
Status
::
A
TIV
O
,
'campus_id'
=>
1
,
'curso_id'
=>
1
,
]);
...
...
database/seeders/UserTypeSeeder.php
0 → 100644
View file @
2968ef74
<?php
namespace
Database\Seeders
;
use
App\Models\User
;
use
App\Models\UserType
;
use
App\Models\Util\Status
;
use
Illuminate\Database\Seeder
;
class
UserTypeSeeder
extends
Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public
function
run
()
{
$teachers
=
[
1
,
2
,
3
,
4
,
5
];
foreach
(
$teachers
as
$teacher
)
{
UserType
::
create
([
'user_id'
=>
$teacher
,
'type'
=>
UserType
::
TEACHER
,
'status'
=>
Status
::
INATIVO
,
'selected'
=>
true
,
]);
}
UserType
::
create
([
'user_id'
=>
6
,
'type'
=>
UserType
::
ADMIN
,
'status'
=>
Status
::
INATIVO
,
'selected'
=>
true
,
]);
}
}
resources/views/layouts/user-dashboard/dashboard_teacher.blade.php
View file @
2968ef74
...
...
@@ -16,7 +16,7 @@
<h3
class=
"text-center"
>
<i
class=
"bi bi-book-half"
></i>
</h3>
<h5
class=
"text-center"
>
PAD: {{ $userPad->pad->nome }}
</h4>
<h5
class=
"text-center"
>
Status: {{ $userPad->pad->
getS
tatusAs
Text
() }}
</h4>
<h5
class=
"text-center"
>
Status: {{ $userPad->pad->
s
tatusAs
String
() }}
</h4>
<a
class=
"stretched-link"
href=
"{{ route('pad_view', ['id' => $userPad->id]) }}"
></a>
</div>
</div>
...
...
resources/views/pad/admin/index.blade.php
View file @
2968ef74
...
...
@@ -55,7 +55,7 @@
<
td
>
{{
$pad
->
nome
}}
</
td
>
<
td
>
{{
$pad
->
getDateInicio
()
}}
</
td
>
<
td
>
{{
$pad
->
getDateFim
()
}}
</
td
>
<
td
>
{{
$pad
->
getS
tatusAs
Text
()
}}
</
td
>
<
td
>
{{
$pad
->
s
tatusAs
String
()
}}
</
td
>
<
td
>
@
include
(
'components.buttons.btn-edit'
,
[
'btn_class'
=>
'btn btn-primary'
,
...
...
resources/views/pad/teacher/index.blade.php
View file @
2968ef74
...
...
@@ -26,7 +26,7 @@
<
h1
class
=
"text-center"
>
<
i
class
=
"bi bi-journal-bookmark-fill"
></
i
>
</
h1
>
@
endif
<
h5
class
=
"text-center"
>
PAD
:
{{
$userPad
->
pad
->
nome
}}
</
h4
>
<
h5
class
=
"text-center"
>
Status
:
{{
$userPad
->
pad
->
getS
tatusAs
Text
()
}}
</
h4
>
<
h5
class
=
"text-center"
>
Status
:
{{
$userPad
->
pad
->
s
tatusAs
String
()
}}
</
h4
>
<
a
class
=
"stretched-link"
href
=
"{{ route('pad_view', ['id' =>
$userPad->id
]) }}"
></
a
>
</
div
>
</
div
>
...
...
Prev
1
2
Next
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