Spaces:
Running
Running
Tello
commited on
Commit
·
d587f77
1
Parent(s):
2dedc70
no ahead
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- .gitattributes +1 -0
- Dockerfile +26 -4
- app/.env.example +59 -0
- app/app/Console/Kernel.php +27 -0
- app/app/Exceptions/Handler.php +30 -0
- app/app/Http/Controllers/AdminController.php +75 -0
- app/app/Http/Controllers/AlumnoController.php +137 -0
- app/app/Http/Controllers/Auth/ConfirmPasswordController.php +39 -0
- app/app/Http/Controllers/Auth/ForgotPasswordController.php +22 -0
- app/app/Http/Controllers/Auth/LoginController.php +40 -0
- app/app/Http/Controllers/Auth/RegisterController.php +74 -0
- app/app/Http/Controllers/Auth/ResetPasswordController.php +29 -0
- app/app/Http/Controllers/Auth/VerificationController.php +41 -0
- app/app/Http/Controllers/AvisoController.php +118 -0
- app/app/Http/Controllers/CalificacionController.php +115 -0
- app/app/Http/Controllers/Controller.php +12 -0
- app/app/Http/Controllers/GrupoController.php +94 -0
- app/app/Http/Controllers/GrupoPrefectoController.php +118 -0
- app/app/Http/Controllers/HomeController.php +28 -0
- app/app/Http/Controllers/JustificanteController.php +120 -0
- app/app/Http/Controllers/MateriaController.php +88 -0
- app/app/Http/Controllers/PeriodoController.php +92 -0
- app/app/Http/Controllers/PersonaController.php +117 -0
- app/app/Http/Controllers/ReporteController.php +120 -0
- app/app/Http/Controllers/RolController.php +89 -0
- app/app/Http/Controllers/TutorController.php +110 -0
- app/app/Http/Controllers/UsuarioController.php +118 -0
- app/app/Http/Kernel.php +68 -0
- app/app/Http/Middleware/Authenticate.php +17 -0
- app/app/Http/Middleware/EncryptCookies.php +17 -0
- app/app/Http/Middleware/PreventRequestsDuringMaintenance.php +17 -0
- app/app/Http/Middleware/RedirectIfAuthenticated.php +30 -0
- app/app/Http/Middleware/TrimStrings.php +19 -0
- app/app/Http/Middleware/TrustHosts.php +20 -0
- app/app/Http/Middleware/TrustProxies.php +28 -0
- app/app/Http/Middleware/ValidateSignature.php +22 -0
- app/app/Http/Middleware/VerifyCsrfToken.php +17 -0
- app/app/Models/Alumno.php +64 -0
- app/app/Models/Aviso.php +25 -0
- app/app/Models/Calificacion.php +26 -0
- app/app/Models/Grupo.php +31 -0
- app/app/Models/GrupoPrefecto.php +30 -0
- app/app/Models/Justificante.php +25 -0
- app/app/Models/Materia.php +20 -0
- app/app/Models/Periodo.php +21 -0
- app/app/Models/Persona.php +41 -0
- app/app/Models/Reporte.php +25 -0
- app/app/Models/Rol.php +31 -0
- app/app/Models/Tutor.php +26 -0
- app/app/Models/User.php +45 -0
.gitattributes
CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
+
*.jpg filter=lfs diff=lfs merge=lfs -text
|
Dockerfile
CHANGED
@@ -25,15 +25,37 @@ RUN tar -xf './node-v20.18.1-linux-x64.tar.xz'
|
|
25 |
|
26 |
USER root
|
27 |
|
28 |
-
RUN cp -r $HOME/node-v20.18.1-linux-x64/bin $HOME/node-v20.18.1-linux-x64/
|
29 |
|
30 |
USER ubuntu
|
31 |
RUN mkdir example-app
|
32 |
|
|
|
|
|
33 |
WORKDIR $HOME/example-app
|
34 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
|
|
|
|
|
36 |
|
37 |
-
|
38 |
-
|
39 |
-
|
|
|
|
|
|
|
|
|
|
25 |
|
26 |
USER root
|
27 |
|
28 |
+
RUN cp -r $HOME/node-v20.18.1-linux-x64/bin $HOME/node-v20.18.1-linux-x64/include $HOME/node-v20.18.1-linux-x64/lib $HOME/node-v20.18.1-linux-x64/share /usr/
|
29 |
|
30 |
USER ubuntu
|
31 |
RUN mkdir example-app
|
32 |
|
33 |
+
|
34 |
+
|
35 |
WORKDIR $HOME/example-app
|
36 |
|
37 |
+
COPY --chown=ubuntu app/ ./
|
38 |
+
|
39 |
+
RUN chomd 777 -R $HOME/example=app
|
40 |
+
|
41 |
+
RUN composer clear-cache
|
42 |
+
RUN php artisan cache:clear
|
43 |
+
RUN php artisan config:clear
|
44 |
+
RUN php artisan config:cache
|
45 |
+
RUN composer clear-cache
|
46 |
+
RUN composer install
|
47 |
+
RUN npm install
|
48 |
+
RUN cp $HOME/example-app/.env.example $HOME/example-app/.env
|
49 |
+
|
50 |
+
RUN php artisan key:generate
|
51 |
|
52 |
+
RUN chown 777 -R $HOME/example-app
|
53 |
+
RUN chown -R ubuntu:ubuntu $HOME/example-app
|
54 |
|
55 |
+
CMD \
|
56 |
+
sed -i "s|\$DB-DATABASE|$DB_DATABASE|" .env && \
|
57 |
+
sed -i "s|\$DB-USERNAME|$DB_USERNAME|" .env && \
|
58 |
+
sed -i "s|\$DB-HOST|$DB_HOST|" .env && \
|
59 |
+
sed -i "s|\$DB-PORT|$DB_PORT|" .env && \
|
60 |
+
sed -i "s|\$DB-PASSWORD|$DB_PASSWORD|" .env && \
|
61 |
+
composer clear-cache; composer install; chown -R ubuntu:ubuntu $HOME/example-app; php artisan migrate:status; php artisan serve --host=0.0.0.0 --port=7860
|
app/.env.example
ADDED
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
APP_NAME=Laravel
|
2 |
+
APP_ENV=local
|
3 |
+
APP_KEY=
|
4 |
+
APP_DEBUG=true
|
5 |
+
APP_URL=http://localhost
|
6 |
+
|
7 |
+
LOG_CHANNEL=stack
|
8 |
+
LOG_DEPRECATIONS_CHANNEL=null
|
9 |
+
LOG_LEVEL=debug
|
10 |
+
|
11 |
+
DB_CONNECTION=mysql
|
12 |
+
DB_HOST=$DB_HOST
|
13 |
+
DB_PORT=$DB_PORT
|
14 |
+
DB_DATABASE=$DB_DATABASE
|
15 |
+
DB_USERNAME=$DB_USERNAME
|
16 |
+
DB_PASSWORD=$DB_PASSWORD
|
17 |
+
|
18 |
+
BROADCAST_DRIVER=log
|
19 |
+
CACHE_DRIVER=file
|
20 |
+
FILESYSTEM_DISK=local
|
21 |
+
QUEUE_CONNECTION=sync
|
22 |
+
SESSION_DRIVER=file
|
23 |
+
SESSION_LIFETIME=120
|
24 |
+
|
25 |
+
MEMCACHED_HOST=127.0.0.1
|
26 |
+
|
27 |
+
REDIS_HOST=127.0.0.1
|
28 |
+
REDIS_PASSWORD=null
|
29 |
+
REDIS_PORT=6379
|
30 |
+
|
31 |
+
MAIL_MAILER=smtp
|
32 |
+
MAIL_HOST=mailpit
|
33 |
+
MAIL_PORT=1025
|
34 |
+
MAIL_USERNAME=null
|
35 |
+
MAIL_PASSWORD=null
|
36 |
+
MAIL_ENCRYPTION=null
|
37 |
+
MAIL_FROM_ADDRESS="hello@example.com"
|
38 |
+
MAIL_FROM_NAME="${APP_NAME}"
|
39 |
+
|
40 |
+
AWS_ACCESS_KEY_ID=
|
41 |
+
AWS_SECRET_ACCESS_KEY=
|
42 |
+
AWS_DEFAULT_REGION=us-east-1
|
43 |
+
AWS_BUCKET=
|
44 |
+
AWS_USE_PATH_STYLE_ENDPOINT=false
|
45 |
+
|
46 |
+
PUSHER_APP_ID=
|
47 |
+
PUSHER_APP_KEY=
|
48 |
+
PUSHER_APP_SECRET=
|
49 |
+
PUSHER_HOST=
|
50 |
+
PUSHER_PORT=443
|
51 |
+
PUSHER_SCHEME=https
|
52 |
+
PUSHER_APP_CLUSTER=mt1
|
53 |
+
|
54 |
+
VITE_APP_NAME="${APP_NAME}"
|
55 |
+
VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
|
56 |
+
VITE_PUSHER_HOST="${PUSHER_HOST}"
|
57 |
+
VITE_PUSHER_PORT="${PUSHER_PORT}"
|
58 |
+
VITE_PUSHER_SCHEME="${PUSHER_SCHEME}"
|
59 |
+
VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
|
app/app/Console/Kernel.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace App\Console;
|
4 |
+
|
5 |
+
use Illuminate\Console\Scheduling\Schedule;
|
6 |
+
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
|
7 |
+
|
8 |
+
class Kernel extends ConsoleKernel
|
9 |
+
{
|
10 |
+
/**
|
11 |
+
* Define the application's command schedule.
|
12 |
+
*/
|
13 |
+
protected function schedule(Schedule $schedule): void
|
14 |
+
{
|
15 |
+
// $schedule->command('inspire')->hourly();
|
16 |
+
}
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Register the commands for the application.
|
20 |
+
*/
|
21 |
+
protected function commands(): void
|
22 |
+
{
|
23 |
+
$this->load(__DIR__.'/Commands');
|
24 |
+
|
25 |
+
require base_path('routes/console.php');
|
26 |
+
}
|
27 |
+
}
|
app/app/Exceptions/Handler.php
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace App\Exceptions;
|
4 |
+
|
5 |
+
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
6 |
+
use Throwable;
|
7 |
+
|
8 |
+
class Handler extends ExceptionHandler
|
9 |
+
{
|
10 |
+
/**
|
11 |
+
* The list of the inputs that are never flashed to the session on validation exceptions.
|
12 |
+
*
|
13 |
+
* @var array<int, string>
|
14 |
+
*/
|
15 |
+
protected $dontFlash = [
|
16 |
+
'current_password',
|
17 |
+
'password',
|
18 |
+
'password_confirmation',
|
19 |
+
];
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Register the exception handling callbacks for the application.
|
23 |
+
*/
|
24 |
+
public function register(): void
|
25 |
+
{
|
26 |
+
$this->reportable(function (Throwable $e) {
|
27 |
+
//
|
28 |
+
});
|
29 |
+
}
|
30 |
+
}
|
app/app/Http/Controllers/AdminController.php
ADDED
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace App\Http\Controllers;
|
4 |
+
|
5 |
+
use Illuminate\Http\Request;
|
6 |
+
use App\Models\Role;
|
7 |
+
|
8 |
+
class AdminController extends Controller
|
9 |
+
{
|
10 |
+
public function index()
|
11 |
+
{
|
12 |
+
//$roles = Role::all();
|
13 |
+
return view('admin.index');
|
14 |
+
}
|
15 |
+
|
16 |
+
public function indexUsuarios()
|
17 |
+
{
|
18 |
+
return view('usuarios.index');
|
19 |
+
}
|
20 |
+
|
21 |
+
public function indexPersonas()
|
22 |
+
{
|
23 |
+
return view('personas.index');
|
24 |
+
}
|
25 |
+
|
26 |
+
public function indexGrupos()
|
27 |
+
{
|
28 |
+
return view('grupos.index');
|
29 |
+
}
|
30 |
+
|
31 |
+
public function indexTutores()
|
32 |
+
{
|
33 |
+
return view('tutores.index');
|
34 |
+
}
|
35 |
+
|
36 |
+
public function indexAlumnos()
|
37 |
+
{
|
38 |
+
return view('alumnos.index');
|
39 |
+
}
|
40 |
+
|
41 |
+
public function indexMaterias()
|
42 |
+
{
|
43 |
+
return view('materias.index');
|
44 |
+
}
|
45 |
+
|
46 |
+
public function indexCalificaciones()
|
47 |
+
{
|
48 |
+
return view('calificaciones.index');
|
49 |
+
}
|
50 |
+
|
51 |
+
public function indexPeriodos()
|
52 |
+
{
|
53 |
+
return view('periodos.index');
|
54 |
+
}
|
55 |
+
|
56 |
+
public function indexGrupos_Prefectos()
|
57 |
+
{
|
58 |
+
return view('grupos_prefectos.index');
|
59 |
+
}
|
60 |
+
|
61 |
+
public function indexReportes()
|
62 |
+
{
|
63 |
+
return view('repotes.index');
|
64 |
+
}
|
65 |
+
|
66 |
+
public function indexJustificantes()
|
67 |
+
{
|
68 |
+
return view('justificantes.index');
|
69 |
+
}
|
70 |
+
|
71 |
+
public function indexAvisos()
|
72 |
+
{
|
73 |
+
return view('avisos.index');
|
74 |
+
}
|
75 |
+
}
|
app/app/Http/Controllers/AlumnoController.php
ADDED
@@ -0,0 +1,137 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace App\Http\Controllers;
|
4 |
+
|
5 |
+
use App\Models\Alumno;
|
6 |
+
use App\Models\Persona;
|
7 |
+
use App\Models\Tutor;
|
8 |
+
use App\Models\Grupo;
|
9 |
+
use Illuminate\Http\Request;
|
10 |
+
use Illuminate\Support\Facades\Validator;
|
11 |
+
|
12 |
+
class AlumnoController extends Controller
|
13 |
+
{
|
14 |
+
/**
|
15 |
+
* Display a listing of the resource.
|
16 |
+
*/
|
17 |
+
public function index()
|
18 |
+
{
|
19 |
+
$alumnos = Alumno::all();
|
20 |
+
//$alumnos = Alumno::with(['persona'], ['grupo'])->first();
|
21 |
+
return view('admin.alumnos.index', ['alumnos'=>$alumnos]);
|
22 |
+
}
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Show the form for creating a new resource.
|
26 |
+
*/
|
27 |
+
public function create()
|
28 |
+
{
|
29 |
+
$personas = Persona::all();
|
30 |
+
$tutores = Tutor::all();
|
31 |
+
$grupos = Grupo::all();
|
32 |
+
return view('admin.alumnos.create', compact('personas', 'tutores', 'grupos'));
|
33 |
+
}
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Store a newly created resource in storage.
|
37 |
+
*/
|
38 |
+
public function store(Request $request)
|
39 |
+
{
|
40 |
+
//dd($request->all());
|
41 |
+
$request->validate([
|
42 |
+
'persona_id' => 'required|string|max:100',
|
43 |
+
'numero_control' => 'required|string|max:100',
|
44 |
+
'id_tutor' => 'required|string|max:100',
|
45 |
+
'id_grupo' => 'required|string|max:100',
|
46 |
+
'curp' => 'required|string|max:100',
|
47 |
+
'image_path' => 'nullable|image|mimes:jpg,jpeg,png,gif|max:2048'
|
48 |
+
]);
|
49 |
+
|
50 |
+
if ($request->hasFile('image')) {
|
51 |
+
$path = $request->file('image')->store('images', 'public');
|
52 |
+
|
53 |
+
$alumnos = new Alumno();
|
54 |
+
$alumnos->persona_id = $request->persona_id;
|
55 |
+
$alumnos->numero_control = $request->numero_control;
|
56 |
+
$alumnos->id_tutor = $request->id_tutor;
|
57 |
+
$alumnos->id_grupo = $request->id_grupo;
|
58 |
+
$alumnos->curp = $request->curp;
|
59 |
+
$alumnos->image_path = $path;
|
60 |
+
$alumnos->save();
|
61 |
+
}
|
62 |
+
|
63 |
+
return redirect()->route('alumnos.index')->with('mensaje', 'Se registro el alumno de la manera correcta')
|
64 |
+
->with('icono', 'success');
|
65 |
+
}
|
66 |
+
|
67 |
+
/**
|
68 |
+
* Display the specified resource.
|
69 |
+
*/
|
70 |
+
public function show(string $id)
|
71 |
+
{
|
72 |
+
$alumnos = Alumno::with('persona', 'tutor', 'grupo')->findOrFail($id);
|
73 |
+
$persona_id = $alumnos->persona_id;
|
74 |
+
$id_tutor = $alumnos->id_tutor;
|
75 |
+
$id_grupo = $alumnos->id_grupo;
|
76 |
+
|
77 |
+
return view('admin.alumnos.show', [
|
78 |
+
'alumnos' => $alumnos
|
79 |
+
]);
|
80 |
+
}
|
81 |
+
|
82 |
+
/**
|
83 |
+
* Show the form for editing the specified resource.
|
84 |
+
*/
|
85 |
+
public function edit(string $id)
|
86 |
+
{
|
87 |
+
$alumnos = Alumno::findOrFail($id);
|
88 |
+
$personas = Persona::all();
|
89 |
+
$tutores = Tutor::all();
|
90 |
+
$grupos = Grupo::all();
|
91 |
+
return view('admin.alumnos.edit', compact('alumnos', 'personas', 'grupos', 'tutores'));
|
92 |
+
}
|
93 |
+
|
94 |
+
/**
|
95 |
+
* Update the specified resource in storage.
|
96 |
+
*/
|
97 |
+
public function update(Request $request, string $id)
|
98 |
+
{
|
99 |
+
//dd($request->all());
|
100 |
+
$request->validate([
|
101 |
+
'persona_id' => 'required|string|max:50',
|
102 |
+
'numero_control' => 'required|string|max:50',
|
103 |
+
'id_tutor' => 'required|string|max:50',
|
104 |
+
'id_grupo' => 'required|string|max:50',
|
105 |
+
'curp' => 'required|string|max:50',
|
106 |
+
'image_path' => 'nullable|image|mimes:jpg,jpeg,png,gif|max:2048'
|
107 |
+
]);
|
108 |
+
|
109 |
+
if ($request->hasFile('image')) {
|
110 |
+
$path = $request->file('image')->store('images', 'public');
|
111 |
+
|
112 |
+
$alumnos = Alumno::findOrFail($id);
|
113 |
+
$alumnos->persona_id = $request->persona_id;
|
114 |
+
$alumnos->numero_control = $request->numero_control;
|
115 |
+
$alumnos->id_tutor = $request->id_tutor;
|
116 |
+
$alumnos->id_grupo = $request->id_grupo;
|
117 |
+
$alumnos->curp = $request->curp;
|
118 |
+
$alumnos->image_path = $path;
|
119 |
+
$alumnos->save();
|
120 |
+
}
|
121 |
+
|
122 |
+
return redirect()->route('alumnos.index')->with('mensaje', 'Alumno actualizado con éxito.')
|
123 |
+
->with('icono', 'success');
|
124 |
+
}
|
125 |
+
|
126 |
+
/**
|
127 |
+
* Remove the specified resource from storage.
|
128 |
+
*/
|
129 |
+
public function destroy(string $id)
|
130 |
+
{
|
131 |
+
$alumnos = Alumno::findOrFail($id);
|
132 |
+
$alumno->delete();
|
133 |
+
|
134 |
+
return redirect()->route('alumnos.index')->with('mensaje', 'Alumno eliminado con éxito.')
|
135 |
+
->with('icono', 'success');
|
136 |
+
}
|
137 |
+
}
|
app/app/Http/Controllers/Auth/ConfirmPasswordController.php
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace App\Http\Controllers\Auth;
|
4 |
+
|
5 |
+
use App\Http\Controllers\Controller;
|
6 |
+
use Illuminate\Foundation\Auth\ConfirmsPasswords;
|
7 |
+
|
8 |
+
class ConfirmPasswordController extends Controller
|
9 |
+
{
|
10 |
+
/*
|
11 |
+
|--------------------------------------------------------------------------
|
12 |
+
| Confirm Password Controller
|
13 |
+
|--------------------------------------------------------------------------
|
14 |
+
|
|
15 |
+
| This controller is responsible for handling password confirmations and
|
16 |
+
| uses a simple trait to include the behavior. You're free to explore
|
17 |
+
| this trait and override any functions that require customization.
|
18 |
+
|
|
19 |
+
*/
|
20 |
+
|
21 |
+
use ConfirmsPasswords;
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Where to redirect users when the intended url fails.
|
25 |
+
*
|
26 |
+
* @var string
|
27 |
+
*/
|
28 |
+
protected $redirectTo = '/home';
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Create a new controller instance.
|
32 |
+
*
|
33 |
+
* @return void
|
34 |
+
*/
|
35 |
+
public function __construct()
|
36 |
+
{
|
37 |
+
$this->middleware('auth');
|
38 |
+
}
|
39 |
+
}
|
app/app/Http/Controllers/Auth/ForgotPasswordController.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace App\Http\Controllers\Auth;
|
4 |
+
|
5 |
+
use App\Http\Controllers\Controller;
|
6 |
+
use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
|
7 |
+
|
8 |
+
class ForgotPasswordController extends Controller
|
9 |
+
{
|
10 |
+
/*
|
11 |
+
|--------------------------------------------------------------------------
|
12 |
+
| Password Reset Controller
|
13 |
+
|--------------------------------------------------------------------------
|
14 |
+
|
|
15 |
+
| This controller is responsible for handling password reset emails and
|
16 |
+
| includes a trait which assists in sending these notifications from
|
17 |
+
| your application to your users. Feel free to explore this trait.
|
18 |
+
|
|
19 |
+
*/
|
20 |
+
|
21 |
+
use SendsPasswordResetEmails;
|
22 |
+
}
|
app/app/Http/Controllers/Auth/LoginController.php
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace App\Http\Controllers\Auth;
|
4 |
+
|
5 |
+
use App\Http\Controllers\Controller;
|
6 |
+
use Illuminate\Foundation\Auth\AuthenticatesUsers;
|
7 |
+
|
8 |
+
class LoginController extends Controller
|
9 |
+
{
|
10 |
+
/*
|
11 |
+
|--------------------------------------------------------------------------
|
12 |
+
| Login Controller
|
13 |
+
|--------------------------------------------------------------------------
|
14 |
+
|
|
15 |
+
| This controller handles authenticating users for the application and
|
16 |
+
| redirecting them to your home screen. The controller uses a trait
|
17 |
+
| to conveniently provide its functionality to your applications.
|
18 |
+
|
|
19 |
+
*/
|
20 |
+
|
21 |
+
use AuthenticatesUsers;
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Where to redirect users after login.
|
25 |
+
*
|
26 |
+
* @var string
|
27 |
+
*/
|
28 |
+
protected $redirectTo = '/';
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Create a new controller instance.
|
32 |
+
*
|
33 |
+
* @return void
|
34 |
+
*/
|
35 |
+
public function __construct()
|
36 |
+
{
|
37 |
+
$this->middleware('guest')->except('logout');
|
38 |
+
$this->middleware('auth')->only('logout');
|
39 |
+
}
|
40 |
+
}
|
app/app/Http/Controllers/Auth/RegisterController.php
ADDED
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace App\Http\Controllers\Auth;
|
4 |
+
|
5 |
+
use App\Http\Controllers\Controller;
|
6 |
+
use App\Models\Usuario;
|
7 |
+
use Illuminate\Foundation\Auth\RegistersUsers;
|
8 |
+
use Illuminate\Support\Facades\Hash;
|
9 |
+
use Illuminate\Support\Facades\Validator;
|
10 |
+
|
11 |
+
class RegisterController extends Controller
|
12 |
+
{
|
13 |
+
/*
|
14 |
+
|--------------------------------------------------------------------------
|
15 |
+
| Register Controller
|
16 |
+
|--------------------------------------------------------------------------
|
17 |
+
|
|
18 |
+
| This controller handles the registration of new users as well as their
|
19 |
+
| validation and creation. By default this controller uses a trait to
|
20 |
+
| provide this functionality without requiring any additional code.
|
21 |
+
|
|
22 |
+
*/
|
23 |
+
|
24 |
+
use RegistersUsers;
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Where to redirect users after registration.
|
28 |
+
*
|
29 |
+
* @var string
|
30 |
+
*/
|
31 |
+
protected $redirectTo = '/';
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Create a new controller instance.
|
35 |
+
*
|
36 |
+
* @return void
|
37 |
+
*/
|
38 |
+
public function __construct()
|
39 |
+
{
|
40 |
+
$this->middleware('guest');
|
41 |
+
}
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Get a validator for an incoming registration request.
|
45 |
+
*
|
46 |
+
* @param array $data
|
47 |
+
* @return \Illuminate\Contracts\Validation\Validator
|
48 |
+
*/
|
49 |
+
protected function validator(array $data)
|
50 |
+
{
|
51 |
+
return Validator::make($data, [
|
52 |
+
'nombre_usuario' => ['required', 'string', 'max:255', 'unique:usuarios,nombre_usuario'],
|
53 |
+
'password' => ['required', 'string', 'min:8', 'confirmed'],
|
54 |
+
'persona_id' => ['required', 'exists:personas,id_persona'],
|
55 |
+
'id_rol' => ['required', 'exists:roles,id_rol'],
|
56 |
+
]);
|
57 |
+
}
|
58 |
+
|
59 |
+
/**
|
60 |
+
* Create a new user instance after a valid registration.
|
61 |
+
*
|
62 |
+
* @param array $data
|
63 |
+
* @return \App\Models\Usuario
|
64 |
+
*/
|
65 |
+
protected function create(array $data)
|
66 |
+
{
|
67 |
+
return Usuario::create([
|
68 |
+
'nombre_usuario' => $data['nombre_usuario'],
|
69 |
+
'password' => Hash::make($data['password']),
|
70 |
+
'persona_id' => $data['persona_id'],
|
71 |
+
'id_rol' => $data['id_rol']
|
72 |
+
]);
|
73 |
+
}
|
74 |
+
}
|
app/app/Http/Controllers/Auth/ResetPasswordController.php
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace App\Http\Controllers\Auth;
|
4 |
+
|
5 |
+
use App\Http\Controllers\Controller;
|
6 |
+
use Illuminate\Foundation\Auth\ResetsPasswords;
|
7 |
+
|
8 |
+
class ResetPasswordController extends Controller
|
9 |
+
{
|
10 |
+
/*
|
11 |
+
|--------------------------------------------------------------------------
|
12 |
+
| Password Reset Controller
|
13 |
+
|--------------------------------------------------------------------------
|
14 |
+
|
|
15 |
+
| This controller is responsible for handling password reset requests
|
16 |
+
| and uses a simple trait to include this behavior. You're free to
|
17 |
+
| explore this trait and override any methods you wish to tweak.
|
18 |
+
|
|
19 |
+
*/
|
20 |
+
|
21 |
+
use ResetsPasswords;
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Where to redirect users after resetting their password.
|
25 |
+
*
|
26 |
+
* @var string
|
27 |
+
*/
|
28 |
+
protected $redirectTo = '/home';
|
29 |
+
}
|
app/app/Http/Controllers/Auth/VerificationController.php
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace App\Http\Controllers\Auth;
|
4 |
+
|
5 |
+
use App\Http\Controllers\Controller;
|
6 |
+
use Illuminate\Foundation\Auth\VerifiesEmails;
|
7 |
+
|
8 |
+
class VerificationController extends Controller
|
9 |
+
{
|
10 |
+
/*
|
11 |
+
|--------------------------------------------------------------------------
|
12 |
+
| Email Verification Controller
|
13 |
+
|--------------------------------------------------------------------------
|
14 |
+
|
|
15 |
+
| This controller is responsible for handling email verification for any
|
16 |
+
| user that recently registered with the application. Emails may also
|
17 |
+
| be re-sent if the user didn't receive the original email message.
|
18 |
+
|
|
19 |
+
*/
|
20 |
+
|
21 |
+
use VerifiesEmails;
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Where to redirect users after verification.
|
25 |
+
*
|
26 |
+
* @var string
|
27 |
+
*/
|
28 |
+
protected $redirectTo = '/home';
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Create a new controller instance.
|
32 |
+
*
|
33 |
+
* @return void
|
34 |
+
*/
|
35 |
+
public function __construct()
|
36 |
+
{
|
37 |
+
$this->middleware('auth');
|
38 |
+
$this->middleware('signed')->only('verify');
|
39 |
+
$this->middleware('throttle:6,1')->only('verify', 'resend');
|
40 |
+
}
|
41 |
+
}
|
app/app/Http/Controllers/AvisoController.php
ADDED
@@ -0,0 +1,118 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace App\Http\Controllers;
|
4 |
+
|
5 |
+
use App\Models\Aviso;
|
6 |
+
use App\Models\Alumno;
|
7 |
+
use App\Models\Persona;
|
8 |
+
use Illuminate\Http\Request;
|
9 |
+
|
10 |
+
class AvisoController extends Controller
|
11 |
+
{
|
12 |
+
/**
|
13 |
+
* Display a listing of the resource.
|
14 |
+
*/
|
15 |
+
public function index()
|
16 |
+
{
|
17 |
+
$avisos = Aviso::all();
|
18 |
+
return view('admin.avisos.index', ['avisos'=>$avisos]);
|
19 |
+
}
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Show the form for creating a new resource.
|
23 |
+
*/
|
24 |
+
public function create()
|
25 |
+
{
|
26 |
+
$alumnos= Alumno::all();
|
27 |
+
$personas = Persona::all();
|
28 |
+
return view('admin.avisos.create', compact('alumnos', 'personas'));
|
29 |
+
}
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Store a newly created resource in storage.
|
33 |
+
*/
|
34 |
+
public function store(Request $request)
|
35 |
+
{
|
36 |
+
$request->validate([
|
37 |
+
'id_alumno' => 'required|string|max:50',
|
38 |
+
'persona_id' => 'required|string|max:50',
|
39 |
+
'mensaje' => 'required|string|max:250',
|
40 |
+
'fecha' => 'required|date|max:50',
|
41 |
+
]);
|
42 |
+
|
43 |
+
$avisos = new Aviso();
|
44 |
+
$avisos->id_alumno = $request->id_alumno;
|
45 |
+
$avisos->persona_id = $request->persona_id;
|
46 |
+
$avisos->mensaje = $request->mensaje;
|
47 |
+
$avisos->fecha = $request->fecha;
|
48 |
+
$avisos->save();
|
49 |
+
|
50 |
+
return redirect()->route('avisos.index')->with('mensaje', 'Aviso creado con éxito.')
|
51 |
+
->with('icono', 'success');
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Display the specified resource.
|
56 |
+
*/
|
57 |
+
public function show(string $id)
|
58 |
+
{
|
59 |
+
$avisos = Aviso::with('alumno', 'persona')->findOrFail($id);
|
60 |
+
$alumno = $avisos->alumno;
|
61 |
+
$persona = $avisos->persona;
|
62 |
+
$mensaje = $avisos->mensaje;
|
63 |
+
$fecha = $avisos->fecha;
|
64 |
+
|
65 |
+
|
66 |
+
return view('admin.avisos.show', [
|
67 |
+
'alumno' => $alumno,
|
68 |
+
'persona' => $persona,
|
69 |
+
'mensaje' => $mensaje,
|
70 |
+
'fecha' => $fecha
|
71 |
+
]);
|
72 |
+
}
|
73 |
+
|
74 |
+
/**
|
75 |
+
* Show the form for editing the specified resource.
|
76 |
+
*/
|
77 |
+
public function edit(string $id)
|
78 |
+
{
|
79 |
+
$avisos = Aviso::findOrFail($id);
|
80 |
+
$alumnos = Alumno::all();
|
81 |
+
$personas = Persona::all();
|
82 |
+
return view('admin.avisos.edit', compact('alumnos', 'personas', 'avisos'));
|
83 |
+
}
|
84 |
+
|
85 |
+
/**
|
86 |
+
* Update the specified resource in storage.
|
87 |
+
*/
|
88 |
+
public function update(Request $request, string $id)
|
89 |
+
{
|
90 |
+
$request->validate([
|
91 |
+
'id_alumno' => 'nullable|string|max:50',
|
92 |
+
'persona_id' => 'nullable|string|max:50',
|
93 |
+
'mensaje' => 'required|string|max:255',
|
94 |
+
'fecha' => 'required|date|max:50'
|
95 |
+
]);
|
96 |
+
|
97 |
+
$avisos = Aviso::findOrFail($id);
|
98 |
+
$avisos->id_alumno = $request->id_alumno;
|
99 |
+
$avisos->persona_id = $request->persona_id;
|
100 |
+
$avisos->mensaje = $request->mensaje;
|
101 |
+
$avisos->fecha = $request->fecha;
|
102 |
+
$avisos->save();
|
103 |
+
|
104 |
+
return redirect()->route('avisos.index')->with('mensaje', 'Aviso actualizado con éxito.')
|
105 |
+
->with('icono', 'success');
|
106 |
+
}
|
107 |
+
|
108 |
+
/**
|
109 |
+
* Remove the specified resource from storage.
|
110 |
+
*/
|
111 |
+
public function destroy(string $id)
|
112 |
+
{
|
113 |
+
$avisos = Aviso::findOrFail($id);
|
114 |
+
$avisos->delete();
|
115 |
+
return redirect()->route('avisos.index')->with('mensaje', 'Aviso eliminado con éxito.')
|
116 |
+
->with('icono', 'success');
|
117 |
+
}
|
118 |
+
}
|
app/app/Http/Controllers/CalificacionController.php
ADDED
@@ -0,0 +1,115 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace App\Http\Controllers;
|
4 |
+
|
5 |
+
use App\Models\Calificacion;
|
6 |
+
use App\Models\Alumno;
|
7 |
+
use App\Models\Materia;
|
8 |
+
use Illuminate\Http\Request;
|
9 |
+
|
10 |
+
class CalificacionController extends Controller
|
11 |
+
{
|
12 |
+
/**
|
13 |
+
* Display a listing of the resource.
|
14 |
+
*/
|
15 |
+
public function index()
|
16 |
+
{
|
17 |
+
$calificaciones = Calificacion::all();
|
18 |
+
return view('admin.calificaciones.index', ['calificaciones'=>$calificaciones]);
|
19 |
+
}
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Show the form for creating a new resource.
|
23 |
+
*/
|
24 |
+
public function create()
|
25 |
+
{
|
26 |
+
$alumnos = Alumno::all();
|
27 |
+
$materias = Materia::all();
|
28 |
+
return view('admin.calificaciones.create', compact('alumnos', 'materias'));
|
29 |
+
}
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Store a newly created resource in storage.
|
33 |
+
*/
|
34 |
+
public function store(Request $request)
|
35 |
+
{
|
36 |
+
$request->validate([
|
37 |
+
'id_alumno' => 'required|string|max:100',
|
38 |
+
'id_materia' => 'required|string|max:100',
|
39 |
+
'calificacion' => 'required|string|max:100'
|
40 |
+
]);
|
41 |
+
|
42 |
+
$calificaciones = new Calificacion();
|
43 |
+
$calificaciones->id_alumno = $request->id_alumno;
|
44 |
+
$calificaciones->id_materia = $request->id_materia;
|
45 |
+
$calificaciones->calificacion = $request->calificacion;
|
46 |
+
$calificaciones->save();
|
47 |
+
|
48 |
+
return redirect()->route('calificaciones.index')->with('mensaje', 'Se registro la calificacion de la manera correcta')
|
49 |
+
->with('icono', 'success');
|
50 |
+
}
|
51 |
+
|
52 |
+
/**
|
53 |
+
* Display the specified resource.
|
54 |
+
*/
|
55 |
+
public function show(string $id)
|
56 |
+
{
|
57 |
+
$calificaciones = Calificacion::with('alumno', 'materia')->findOrFail($id);
|
58 |
+
$id_alumno = $calificaciones->id_alumno;
|
59 |
+
$id_materia = $calificaciones->id_materia;
|
60 |
+
$calificacion = $calificaciones->calificacion;
|
61 |
+
|
62 |
+
return view('admin.calificaciones.show', compact('calificaciones'));
|
63 |
+
|
64 |
+
return view('admin.calificaciones.show', [
|
65 |
+
'id_alumno' => $id_alumno,
|
66 |
+
'id_materia' => $id_materia,
|
67 |
+
'calificacion' => $calificacion
|
68 |
+
]);
|
69 |
+
}
|
70 |
+
|
71 |
+
/**
|
72 |
+
* Show the form for editing the specified resource.
|
73 |
+
*/
|
74 |
+
public function edit(string $id)
|
75 |
+
{
|
76 |
+
$calificaciones = Calificacion::findOrFail($id);
|
77 |
+
$alumnos = Alumno::all();
|
78 |
+
$materias = Materia::all();
|
79 |
+
return view('admin.calificaciones.edit', compact('calificaciones', 'alumnos', 'materias'));
|
80 |
+
}
|
81 |
+
|
82 |
+
/**
|
83 |
+
* Update the specified resource in storage.
|
84 |
+
*/
|
85 |
+
public function update(Request $request, string $id)
|
86 |
+
{
|
87 |
+
//dd($request->all());
|
88 |
+
$request->validate([
|
89 |
+
'id_alumno' => 'nullable|string|max:50',
|
90 |
+
'id_materia' => 'required|string|max:50',
|
91 |
+
'calificacion' => 'nullable|numeric',
|
92 |
+
]);
|
93 |
+
|
94 |
+
$calificaciones = Calificacion::findOrFail($id);
|
95 |
+
// $calificaciones->id_alumno = $request->id_alumno;
|
96 |
+
// $calificaciones->id_materia = $request->id_materia;
|
97 |
+
$calificaciones->calificacion = $request->calificacion;
|
98 |
+
$calificaciones->save();
|
99 |
+
|
100 |
+
return redirect()->route('calificaciones.index')->with('mensaje', 'Calificaion actualizada con éxito.')
|
101 |
+
->with('icono', 'success');
|
102 |
+
}
|
103 |
+
|
104 |
+
/**
|
105 |
+
* Remove the specified resource from storage.
|
106 |
+
*/
|
107 |
+
public function destroy(string $id)
|
108 |
+
{
|
109 |
+
$calificaciones = Calificacion::findOrFail($id);
|
110 |
+
$calificaciones->delete();
|
111 |
+
|
112 |
+
return redirect()->route('calificaciones.index')->with('mensaje', 'Calificacion eliminada con éxito.')
|
113 |
+
->with('icono', 'success');
|
114 |
+
}
|
115 |
+
}
|
app/app/Http/Controllers/Controller.php
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace App\Http\Controllers;
|
4 |
+
|
5 |
+
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
6 |
+
use Illuminate\Foundation\Validation\ValidatesRequests;
|
7 |
+
use Illuminate\Routing\Controller as BaseController;
|
8 |
+
|
9 |
+
class Controller extends BaseController
|
10 |
+
{
|
11 |
+
use AuthorizesRequests, ValidatesRequests;
|
12 |
+
}
|
app/app/Http/Controllers/GrupoController.php
ADDED
@@ -0,0 +1,94 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace App\Http\Controllers;
|
4 |
+
|
5 |
+
use App\Models\Grupo;
|
6 |
+
use Illuminate\Http\Request;
|
7 |
+
|
8 |
+
class GrupoController extends Controller
|
9 |
+
{
|
10 |
+
/**
|
11 |
+
* Display a listing of the resource.
|
12 |
+
*/
|
13 |
+
public function index()
|
14 |
+
{
|
15 |
+
$grupos = Grupo::all();
|
16 |
+
return view('admin.grupos.index', ['grupos'=>$grupos]);
|
17 |
+
}
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Show the form for creating a new resource.
|
21 |
+
*/
|
22 |
+
public function create()
|
23 |
+
{
|
24 |
+
return view('admin.grupos.create');
|
25 |
+
}
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Store a newly created resource in storage.
|
29 |
+
*/
|
30 |
+
public function store(Request $request)
|
31 |
+
{
|
32 |
+
$request->validate([
|
33 |
+
'grupo' => 'required|string|max:100',
|
34 |
+
'grado' => 'required|string|max:100'
|
35 |
+
]);
|
36 |
+
|
37 |
+
$grupo = new Grupo();
|
38 |
+
$grupo->grupo = $request->grupo;
|
39 |
+
$grupo->grado = $request->grado;
|
40 |
+
$grupo->save();
|
41 |
+
|
42 |
+
return redirect()->route('grupos.index')->with('mensaje', 'Grupo creado con éxito.')
|
43 |
+
->with('icono', 'success');
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Display the specified resource.
|
48 |
+
*/
|
49 |
+
public function show(string $id)
|
50 |
+
{
|
51 |
+
$grupos = Grupo::findOrFail($id);
|
52 |
+
return view('admin.grupos.show', ['grupos'=>$grupos]);
|
53 |
+
}
|
54 |
+
|
55 |
+
/**
|
56 |
+
* Show the form for editing the specified resource.
|
57 |
+
*/
|
58 |
+
public function edit(string $id)
|
59 |
+
{
|
60 |
+
$grupos = Grupo::with(['alumnos', 'gruposprefecto'])->findOrFail($id);
|
61 |
+
return view('admin.grupos.edit', compact('grupos'));
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Update the specified resource in storage.
|
66 |
+
*/
|
67 |
+
public function update(Request $request, string $id)
|
68 |
+
{
|
69 |
+
$request->validate([
|
70 |
+
'grado' => 'required|string|max:50',
|
71 |
+
'grupo' => 'required|string|max:50',
|
72 |
+
]);
|
73 |
+
|
74 |
+
$grupos = Grupo::findOrFail($id);
|
75 |
+
$grupos->grado = $request->grado;
|
76 |
+
$grupos->grupo = $request->grupo;
|
77 |
+
$grupos->save();
|
78 |
+
|
79 |
+
return redirect()->route('grupos.index')->with('mensaje', 'Grupo actualizado con éxito.')
|
80 |
+
->with('icono', 'success');
|
81 |
+
}
|
82 |
+
|
83 |
+
/**
|
84 |
+
* Remove the specified resource from storage.
|
85 |
+
*/
|
86 |
+
public function destroy(string $id)
|
87 |
+
{
|
88 |
+
$grupos = Grupo::findOrFail($id);
|
89 |
+
$grupos->delete();
|
90 |
+
|
91 |
+
return redirect()->route('grupos.index')->with('mensaje', 'Grupo eliminado con éxito.')
|
92 |
+
->with('icono', 'success');
|
93 |
+
}
|
94 |
+
}
|
app/app/Http/Controllers/GrupoPrefectoController.php
ADDED
@@ -0,0 +1,118 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace App\Http\Controllers;
|
4 |
+
|
5 |
+
use App\Models\GrupoPrefecto;
|
6 |
+
use App\Models\Grupo;
|
7 |
+
use App\Models\Periodo;
|
8 |
+
use App\Models\Persona;
|
9 |
+
use Illuminate\Http\Request;
|
10 |
+
|
11 |
+
class GrupoPrefectoController extends Controller
|
12 |
+
{
|
13 |
+
/**
|
14 |
+
* Display a listing of the resource.
|
15 |
+
*/
|
16 |
+
public function index()
|
17 |
+
{
|
18 |
+
$grupos_prefectos = GrupoPrefecto::all();
|
19 |
+
return view('admin.grupos_prefectos.index', ['grupos_prefectos'=>$grupos_prefectos]);
|
20 |
+
}
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Show the form for creating a new resource.
|
24 |
+
*/
|
25 |
+
public function create()
|
26 |
+
{
|
27 |
+
$grupos_prefectos = GrupoPrefecto::all();
|
28 |
+
$grupos = Grupo::all();
|
29 |
+
$periodos = Periodo::all();
|
30 |
+
$personas = Persona::all();
|
31 |
+
return view('admin.grupos_prefectos.create', compact('personas', 'grupos', 'periodos'));
|
32 |
+
}
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Store a newly created resource in storage.
|
36 |
+
*/
|
37 |
+
public function store(Request $request)
|
38 |
+
{
|
39 |
+
$request->validate([
|
40 |
+
'id_grupo' => 'required|string|max:50',
|
41 |
+
'id_periodo' => 'required|string|max:50',
|
42 |
+
'persona_id' => 'required|string|max:50'
|
43 |
+
]);
|
44 |
+
|
45 |
+
$grupos_prefectos = new GrupoPrefecto();
|
46 |
+
$grupos_prefectos->id_grupo = $request->id_grupo;
|
47 |
+
$grupos_prefectos->id_periodo = $request->id_periodo;
|
48 |
+
$grupos_prefectos->persona_id = $request->persona_id;
|
49 |
+
$grupos_prefectos->save();
|
50 |
+
|
51 |
+
return redirect()->route('grupos_prefectos.index')->with('mensaje', 'Grupo prefecto creado con éxito.')
|
52 |
+
->with('icono', 'success');
|
53 |
+
}
|
54 |
+
|
55 |
+
/**
|
56 |
+
* Display the specified resource.
|
57 |
+
*/
|
58 |
+
public function show(string $id)
|
59 |
+
{
|
60 |
+
$grupos_prefectos = GrupoPrefecto::with('persona', 'grupo', 'periodo')->findOrFail($id);
|
61 |
+
$nombre_persona = $grupos_prefectos->persona->nombre;
|
62 |
+
$nombre_grupo = $grupos_prefectos->grupo->grupo;
|
63 |
+
$nombre_periodo = $grupos_prefectos->periodo->nombre_periodo;
|
64 |
+
|
65 |
+
|
66 |
+
return view('admin.grupos_prefectos.show', [
|
67 |
+
'nombre_persona' => $nombre_persona,
|
68 |
+
'nombre_grupo' => $nombre_grupo,
|
69 |
+
'nombre_periodo' => $nombre_periodo
|
70 |
+
]);
|
71 |
+
}
|
72 |
+
|
73 |
+
/**
|
74 |
+
* Show the form for editing the specified resource.
|
75 |
+
*/
|
76 |
+
public function edit(string $id)
|
77 |
+
{
|
78 |
+
$grupos_prefectos = GrupoPrefecto::findOrFail($id);
|
79 |
+
$grupos = Grupo::all();
|
80 |
+
$personas = Persona::all();
|
81 |
+
$periodos = Periodo::all();
|
82 |
+
return view('admin.grupos_prefectos.edit', compact('grupos_prefectos', 'grupos', 'personas', 'periodos'));
|
83 |
+
}
|
84 |
+
|
85 |
+
/**
|
86 |
+
* Update the specified resource in storage.
|
87 |
+
*/
|
88 |
+
public function update(Request $request, string $id)
|
89 |
+
{
|
90 |
+
//dd($request->all());
|
91 |
+
$request->validate([
|
92 |
+
'persona_id' => 'required|string|max:50',
|
93 |
+
'id_grupo' => 'required|string|max:50',
|
94 |
+
'id_periodo' => 'required|string|max:50'
|
95 |
+
]);
|
96 |
+
|
97 |
+
$grupos_prefectos = GrupoPrefecto::findOrFail($id);
|
98 |
+
$grupos_prefectos->persona_id = $request->persona_id;
|
99 |
+
$grupos_prefectos->id_grupo = $request->id_grupo;
|
100 |
+
$grupos_prefectos->id_periodo = $request->id_periodo;
|
101 |
+
$grupos_prefectos->save();
|
102 |
+
|
103 |
+
return redirect()->route('grupos_prefectos.index')->with('mensaje', 'Grupo prefecto actualizado con éxito.')
|
104 |
+
->with('icono', 'success');
|
105 |
+
}
|
106 |
+
|
107 |
+
/**
|
108 |
+
* Remove the specified resource from storage.
|
109 |
+
*/
|
110 |
+
public function destroy(string $id)
|
111 |
+
{
|
112 |
+
$grupos_prefectos = GrupoPrefecto::findOrFail($id);
|
113 |
+
$grupos_prefectos->delete();
|
114 |
+
|
115 |
+
return redirect()->route('grupos_prefectos.index')->with('mensaje', 'Grupo prefecto eliminado con éxito.')
|
116 |
+
->with('icono', 'success');
|
117 |
+
}
|
118 |
+
}
|
app/app/Http/Controllers/HomeController.php
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace App\Http\Controllers;
|
4 |
+
|
5 |
+
use Illuminate\Http\Request;
|
6 |
+
|
7 |
+
class HomeController extends Controller
|
8 |
+
{
|
9 |
+
/**
|
10 |
+
* Create a new controller instance.
|
11 |
+
*
|
12 |
+
* @return void
|
13 |
+
*/
|
14 |
+
public function __construct()
|
15 |
+
{
|
16 |
+
$this->middleware('auth');
|
17 |
+
}
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Show the application dashboard.
|
21 |
+
*
|
22 |
+
* @return \Illuminate\Contracts\Support\Renderable
|
23 |
+
*/
|
24 |
+
public function index()
|
25 |
+
{
|
26 |
+
return view('home');
|
27 |
+
}
|
28 |
+
}
|
app/app/Http/Controllers/JustificanteController.php
ADDED
@@ -0,0 +1,120 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace App\Http\Controllers;
|
4 |
+
|
5 |
+
use App\Models\Justificante;
|
6 |
+
use App\Models\Alumno;
|
7 |
+
use App\Models\Persona;
|
8 |
+
use Illuminate\Http\Request;
|
9 |
+
|
10 |
+
class JustificanteController extends Controller
|
11 |
+
{
|
12 |
+
/**
|
13 |
+
* Display a listing of the resource.
|
14 |
+
*/
|
15 |
+
public function index()
|
16 |
+
{
|
17 |
+
$justificantes = Justificante::all();
|
18 |
+
return view('admin.justificantes.index', ['justificantes'=>$justificantes]);
|
19 |
+
}
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Show the form for creating a new resource.
|
23 |
+
*/
|
24 |
+
public function create()
|
25 |
+
{
|
26 |
+
$alumnos= Alumno::all();
|
27 |
+
$personas = Persona::all();
|
28 |
+
return view('admin.justificantes.create', compact('alumnos', 'personas'));
|
29 |
+
}
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Store a newly created resource in storage.
|
33 |
+
*/
|
34 |
+
public function store(Request $request)
|
35 |
+
{
|
36 |
+
//dd($request->all());
|
37 |
+
$request->validate([
|
38 |
+
'id_alumno' => 'required|string|max:50',
|
39 |
+
'persona_id' => 'required|string|max:50',
|
40 |
+
'motivo' => 'required|string|max:250',
|
41 |
+
'fecha' => 'required|date|max:50',
|
42 |
+
]);
|
43 |
+
|
44 |
+
$justificantes = new Justificante();
|
45 |
+
$justificantes->id_alumno = $request->id_alumno;
|
46 |
+
$justificantes->persona_id = $request->persona_id;
|
47 |
+
$justificantes->motivo = $request->motivo;
|
48 |
+
$justificantes->fecha = $request->fecha;
|
49 |
+
$justificantes->save();
|
50 |
+
|
51 |
+
return redirect()->route('justificantes.index')->with('mensaje', 'Justificante creado con éxito.')
|
52 |
+
->with('icono', 'success');
|
53 |
+
}
|
54 |
+
|
55 |
+
/**
|
56 |
+
* Display the specified resource.
|
57 |
+
*/
|
58 |
+
public function show(string $id)
|
59 |
+
{
|
60 |
+
$justificantes = Justificante::with('alumno', 'persona')->findOrFail($id);
|
61 |
+
$alumno = $justificantes->alumno;
|
62 |
+
$persona = $justificantes->persona;
|
63 |
+
$motivo = $justificantes->motivo;
|
64 |
+
$fecha = $justificantes->fecha;
|
65 |
+
|
66 |
+
|
67 |
+
return view('admin.justificantes.show', [
|
68 |
+
'alumno' => $alumno,
|
69 |
+
'persona' => $persona,
|
70 |
+
'motivo' => $motivo,
|
71 |
+
'fecha' => $fecha
|
72 |
+
]);
|
73 |
+
}
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Show the form for editing the specified resource.
|
77 |
+
*/
|
78 |
+
public function edit(string $id)
|
79 |
+
{
|
80 |
+
$justificantes = Justificante::findOrFail($id);
|
81 |
+
$alumnos = Alumno::all();
|
82 |
+
$personas = Persona::all();
|
83 |
+
return view('admin.justificantes.edit', compact('alumnos', 'personas', 'justificantes'));
|
84 |
+
}
|
85 |
+
|
86 |
+
/**
|
87 |
+
* Update the specified resource in storage.
|
88 |
+
*/
|
89 |
+
public function update(Request $request, string $id)
|
90 |
+
{
|
91 |
+
//dd($request->all());
|
92 |
+
$request->validate([
|
93 |
+
'id_alumno' => 'nullable|string|max:50',
|
94 |
+
'persona_id' => 'nullable|string|max:50',
|
95 |
+
'motivo' => 'required|string|max:255',
|
96 |
+
'fecha' => 'required|date|max:50'
|
97 |
+
]);
|
98 |
+
|
99 |
+
$justificantes = Justificante::findOrFail($id);
|
100 |
+
$justificantes->id_alumno = $request->id_alumno;
|
101 |
+
$justificantes->persona_id = $request->persona_id;
|
102 |
+
$justificantes->motivo = $request->motivo;
|
103 |
+
$justificantes->fecha = $request->fecha;
|
104 |
+
$justificantes->save();
|
105 |
+
|
106 |
+
return redirect()->route('justificantes.index')->with('mensaje', 'Justificante actualizado con éxito.')
|
107 |
+
->with('icono', 'success');
|
108 |
+
}
|
109 |
+
|
110 |
+
/**
|
111 |
+
* Remove the specified resource from storage.
|
112 |
+
*/
|
113 |
+
public function destroy(string $id)
|
114 |
+
{
|
115 |
+
$justificantes = Justificante::findOrFail($id);
|
116 |
+
$justificantes->delete();
|
117 |
+
return redirect()->route('Justificantes.index')->with('mensaje', 'Justificante eliminado con éxito.')
|
118 |
+
->with('icono', 'success');
|
119 |
+
}
|
120 |
+
}
|
app/app/Http/Controllers/MateriaController.php
ADDED
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace App\Http\Controllers;
|
4 |
+
|
5 |
+
use App\Models\Materia;
|
6 |
+
use Illuminate\Http\Request;
|
7 |
+
|
8 |
+
class MateriaController extends Controller
|
9 |
+
{
|
10 |
+
/**
|
11 |
+
* Display a listing of the resource.
|
12 |
+
*/
|
13 |
+
public function index()
|
14 |
+
{
|
15 |
+
$materias = Materia::all();
|
16 |
+
return view('admin.materias.index', ['materias'=>$materias]);
|
17 |
+
}
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Show the form for creating a new resource.
|
21 |
+
*/
|
22 |
+
public function create()
|
23 |
+
{
|
24 |
+
return view('admin.materias.create');
|
25 |
+
}
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Store a newly created resource in storage.
|
29 |
+
*/
|
30 |
+
public function store(Request $request)
|
31 |
+
{
|
32 |
+
$request->validate([
|
33 |
+
'nombre_materia' => 'required|string|max:100',
|
34 |
+
]);
|
35 |
+
|
36 |
+
$materias = new Materia();
|
37 |
+
$materias->nombre_materia = $request->nombre_materia;
|
38 |
+
$materias->save();
|
39 |
+
|
40 |
+
return redirect()->route('materias.index')->with('mensaje', 'Se registro la materia de la manera correcta')
|
41 |
+
->with('icono', 'success');
|
42 |
+
}
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Display the specified resource.
|
46 |
+
*/
|
47 |
+
public function show(string $id)
|
48 |
+
{
|
49 |
+
$materias = Materia::findOrFail($id);
|
50 |
+
return view('admin.materias.show', ['materias'=>$materias]);
|
51 |
+
}
|
52 |
+
|
53 |
+
/**
|
54 |
+
* Show the form for editing the specified resource.
|
55 |
+
*/
|
56 |
+
public function edit(string $id)
|
57 |
+
{
|
58 |
+
$materias = Materia::findOrFail($id);
|
59 |
+
return view('admin.materias.edit', ['materias'=>$materias]);
|
60 |
+
}
|
61 |
+
|
62 |
+
/**
|
63 |
+
* Update the specified resource in storage.
|
64 |
+
*/
|
65 |
+
public function update(Request $request, string $id)
|
66 |
+
{
|
67 |
+
$request->validate([
|
68 |
+
'nombre_materia' => 'required|max:100',
|
69 |
+
]);
|
70 |
+
|
71 |
+
$materias = Materia::find($id);
|
72 |
+
$materias->nombre_materia = $request->nombre_materia;
|
73 |
+
$materias->save();
|
74 |
+
|
75 |
+
return redirect()->route('materias.index')->with('mensaje', 'Se actualizo la materia de la manera correcta')
|
76 |
+
->with('icono', 'success');
|
77 |
+
}
|
78 |
+
|
79 |
+
/**
|
80 |
+
* Remove the specified resource from storage.
|
81 |
+
*/
|
82 |
+
public function destroy(string $id)
|
83 |
+
{
|
84 |
+
Materia::destroy($id);
|
85 |
+
return redirect()->route('materias.index')->with('mensaje', 'Se elimino la materia de la manera correcta')
|
86 |
+
->with('icono', 'success');
|
87 |
+
}
|
88 |
+
}
|
app/app/Http/Controllers/PeriodoController.php
ADDED
@@ -0,0 +1,92 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace App\Http\Controllers;
|
4 |
+
|
5 |
+
use App\Models\Periodo;
|
6 |
+
use Illuminate\Http\Request;
|
7 |
+
|
8 |
+
class PeriodoController extends Controller
|
9 |
+
{
|
10 |
+
/**
|
11 |
+
* Display a listing of the resource.
|
12 |
+
*/
|
13 |
+
public function index()
|
14 |
+
{
|
15 |
+
$periodos = Periodo::all();
|
16 |
+
return view('admin.periodos.index', ['periodos'=>$periodos]);
|
17 |
+
}
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Show the form for creating a new resource.
|
21 |
+
*/
|
22 |
+
public function create()
|
23 |
+
{
|
24 |
+
return view('admin.periodos.create');
|
25 |
+
}
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Store a newly created resource in storage.
|
29 |
+
*/
|
30 |
+
public function store(Request $request)
|
31 |
+
{
|
32 |
+
$request->validate([
|
33 |
+
'nombre_periodo' => 'required|string|max:100',
|
34 |
+
'estado' => 'required|in:activo,inactivo',
|
35 |
+
]);
|
36 |
+
|
37 |
+
$periodos = new Periodo();
|
38 |
+
$periodos->nombre_periodo = $request->nombre_periodo;
|
39 |
+
$periodos->estado = $request->estado;
|
40 |
+
$periodos->save();
|
41 |
+
|
42 |
+
return redirect()->route('periodos.index')->with('mensaje', 'Se registro el periodo de la manera correcta')
|
43 |
+
->with('icono', 'success');
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Display the specified resource.
|
48 |
+
*/
|
49 |
+
public function show(string $id)
|
50 |
+
{
|
51 |
+
$periodos = Periodo::findOrFail($id);
|
52 |
+
return view('admin.periodos.show', ['periodos'=>$periodos]);
|
53 |
+
}
|
54 |
+
|
55 |
+
/**
|
56 |
+
* Show the form for editing the specified resource.
|
57 |
+
*/
|
58 |
+
public function edit(string $id)
|
59 |
+
{
|
60 |
+
$periodos = Periodo::findOrFail($id);
|
61 |
+
return view('admin.periodos.edit', ['periodos'=>$periodos]);
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Update the specified resource in storage.
|
66 |
+
*/
|
67 |
+
public function update(Request $request, string $id)
|
68 |
+
{
|
69 |
+
$request->validate([
|
70 |
+
'nombre_periodo' => 'required|max:100',
|
71 |
+
'estado' => 'required|in:activo,inactivo'
|
72 |
+
]);
|
73 |
+
|
74 |
+
$periodos = Periodo::find($id);
|
75 |
+
$periodos->nombre_periodo = $request->nombre_periodo;
|
76 |
+
$periodos->estado = $request->estado;
|
77 |
+
$periodos->save();
|
78 |
+
|
79 |
+
return redirect()->route('periodos.index')->with('mensaje', 'Se actualizo el periodo de la manera correcta')
|
80 |
+
->with('icono', 'success');
|
81 |
+
}
|
82 |
+
|
83 |
+
/**
|
84 |
+
* Remove the specified resource from storage.
|
85 |
+
*/
|
86 |
+
public function destroy(string $id)
|
87 |
+
{
|
88 |
+
Periodo::destroy($id);
|
89 |
+
return redirect()->route('periodos.index')->with('mensaje', 'Se elimino el periodo de la manera correcta')
|
90 |
+
->with('icono', 'success');
|
91 |
+
}
|
92 |
+
}
|
app/app/Http/Controllers/PersonaController.php
ADDED
@@ -0,0 +1,117 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace App\Http\Controllers;
|
4 |
+
|
5 |
+
use App\Models\Persona;
|
6 |
+
use App\Models\Rol;
|
7 |
+
use Illuminate\Http\Request;
|
8 |
+
use Illuminate\Support\Facades\Validator;
|
9 |
+
|
10 |
+
class PersonaController extends Controller
|
11 |
+
{
|
12 |
+
/**
|
13 |
+
* Display a listing of the resource.
|
14 |
+
*/
|
15 |
+
public function index()
|
16 |
+
{
|
17 |
+
$personas = Persona::all();
|
18 |
+
return view('admin.personas.index', ['personas'=>$personas]);
|
19 |
+
}
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Show the form for creating a new resource.
|
23 |
+
*/
|
24 |
+
public function create()
|
25 |
+
{
|
26 |
+
$roles = Rol::all();
|
27 |
+
return view('admin.personas.create', compact('roles'));
|
28 |
+
}
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Store a newly created resource in storage.
|
32 |
+
*/
|
33 |
+
public function store(Request $request)
|
34 |
+
{
|
35 |
+
//dd($request->all());
|
36 |
+
$request->validate([
|
37 |
+
'nombre' => 'required|string|max:255',
|
38 |
+
'apellido_paterno' => 'required|string|max:255',
|
39 |
+
'apellido_materno' => 'required|string|max:255',
|
40 |
+
'direccion' => 'required|string|max:255',
|
41 |
+
'fecha_nacimiento' => 'required|date|max:255',
|
42 |
+
'telefono' => 'required|string|max:255',
|
43 |
+
'id_rol' => 'nullable|exists:roles,id_rol'
|
44 |
+
]);
|
45 |
+
|
46 |
+
$persona = new Persona();
|
47 |
+
$persona->nombre = $request->nombre;
|
48 |
+
$persona->apellido_paterno = $request->apellido_paterno;
|
49 |
+
$persona->apellido_materno = $request->apellido_materno;
|
50 |
+
$persona->direccion = $request->direccion;
|
51 |
+
$persona->fecha_nacimiento = $request->fecha_nacimiento;
|
52 |
+
$persona->telefono = $request->telefono;
|
53 |
+
$persona->id_rol = $request->id_rol;
|
54 |
+
$persona->save();
|
55 |
+
|
56 |
+
return redirect()->route('personas.index')->with('mensaje', 'Persona creada con éxito.')
|
57 |
+
->with('icono', 'success');
|
58 |
+
}
|
59 |
+
|
60 |
+
/**
|
61 |
+
* Display the specified resource.
|
62 |
+
*/
|
63 |
+
public function show($id)
|
64 |
+
{
|
65 |
+
$personas = Persona::findOrFail($id);
|
66 |
+
$roles = Rol::all();
|
67 |
+
return view('admin.personas.show', ['personas'=>$personas]);
|
68 |
+
}
|
69 |
+
|
70 |
+
/**
|
71 |
+
* Show the form for editing the specified resource.
|
72 |
+
*/
|
73 |
+
public function edit($id)
|
74 |
+
{
|
75 |
+
$persona = Persona::with(['usuario', 'alumno', 'tutor',])->findOrFail($id);
|
76 |
+
return view('admin.personas.edit', compact('persona'));
|
77 |
+
}
|
78 |
+
|
79 |
+
/**
|
80 |
+
* Update the specified resource in storage.
|
81 |
+
*/
|
82 |
+
public function update(Request $request, string $id)
|
83 |
+
{
|
84 |
+
$request->validate([
|
85 |
+
'nombre' => 'required|string|max:50',
|
86 |
+
'apellido_paterno' => 'required|string|max:50',
|
87 |
+
'apellido_materno' => 'required|string|max:50',
|
88 |
+
'direccion' => 'required|string|max:50',
|
89 |
+
'fecha_nacimiento' => 'required|date|max:50',
|
90 |
+
'telefono' => 'required|string|max:50',
|
91 |
+
]);
|
92 |
+
|
93 |
+
$personas = Persona::findOrFail($id);
|
94 |
+
$personas->nombre = $request->nombre;
|
95 |
+
$personas->apellido_paterno = $request->apellido_paterno;
|
96 |
+
$personas->apellido_materno = $request->apellido_materno;
|
97 |
+
$personas->direccion = $request->direccion;
|
98 |
+
$personas->fecha_nacimiento = $request->fecha_nacimiento;
|
99 |
+
$personas->telefono = $request->telefono;
|
100 |
+
$personas->save();
|
101 |
+
|
102 |
+
return redirect()->route('personas.index')->with('mensaje', 'Persona actualizada con éxito.')
|
103 |
+
->with('icono', 'success');
|
104 |
+
}
|
105 |
+
|
106 |
+
/**
|
107 |
+
* Remove the specified resource from storage.
|
108 |
+
*/
|
109 |
+
public function destroy(string $id)
|
110 |
+
{
|
111 |
+
$personas = Persona::findOrFail($id);
|
112 |
+
$personas->delete();
|
113 |
+
|
114 |
+
return redirect()->route('personas.index')->with('mensaje', 'Persona eliminada con éxito.')
|
115 |
+
->with('icono', 'success');
|
116 |
+
}
|
117 |
+
}
|
app/app/Http/Controllers/ReporteController.php
ADDED
@@ -0,0 +1,120 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace App\Http\Controllers;
|
4 |
+
|
5 |
+
use App\Models\Reporte;
|
6 |
+
use App\Models\Alumno;
|
7 |
+
use App\Models\Persona;
|
8 |
+
use Illuminate\Http\Request;
|
9 |
+
|
10 |
+
class ReporteController extends Controller
|
11 |
+
{
|
12 |
+
/**
|
13 |
+
* Display a listing of the resource.
|
14 |
+
*/
|
15 |
+
public function index()
|
16 |
+
{
|
17 |
+
$reportes = Reporte::all();
|
18 |
+
return view('admin.reportes.index', ['reportes'=>$reportes]);
|
19 |
+
}
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Show the form for creating a new resource.
|
23 |
+
*/
|
24 |
+
public function create()
|
25 |
+
{
|
26 |
+
$alumnos= Alumno::all();
|
27 |
+
$personas = Persona::all();
|
28 |
+
return view('admin.reportes.create', compact('alumnos', 'personas'));
|
29 |
+
}
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Store a newly created resource in storage.
|
33 |
+
*/
|
34 |
+
public function store(Request $request)
|
35 |
+
{
|
36 |
+
//dd($request->all());
|
37 |
+
$request->validate([
|
38 |
+
'id_alumno' => 'required|string|max:50',
|
39 |
+
'persona_id' => 'required|string|max:50',
|
40 |
+
'contenido' => 'required|string|max:255',
|
41 |
+
'fecha' => 'required|date|max:50'
|
42 |
+
]);
|
43 |
+
|
44 |
+
$reportes = new Reporte();
|
45 |
+
$reportes->id_alumno = $request->id_alumno;
|
46 |
+
$reportes->persona_id = $request->persona_id;
|
47 |
+
$reportes->contenido = $request->contenido;
|
48 |
+
$reportes->fecha = $request->fecha;
|
49 |
+
$reportes->save();
|
50 |
+
|
51 |
+
return redirect()->route('reportes.index')->with('mensaje', 'Reporte creado con éxito.')
|
52 |
+
->with('icono', 'success');
|
53 |
+
}
|
54 |
+
|
55 |
+
/**
|
56 |
+
* Display the specified resource.
|
57 |
+
*/
|
58 |
+
public function show(string $id)
|
59 |
+
{
|
60 |
+
$reporte = Reporte::with('alumno', 'persona')->findOrFail($id);
|
61 |
+
$nombre_alumno = $reporte->alumno->persona->nombre;
|
62 |
+
$nombre_persona = $reporte->persona->nombre;
|
63 |
+
$contenido = $reporte->contenido;
|
64 |
+
$fecha = $reporte->fecha;
|
65 |
+
|
66 |
+
|
67 |
+
return view('admin.reportes.show', [
|
68 |
+
'nombre_alumno' => $nombre_alumno,
|
69 |
+
'nombre_persona' => $nombre_persona,
|
70 |
+
'contenido' => $contenido,
|
71 |
+
'fecha' => $fecha
|
72 |
+
]);
|
73 |
+
}
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Show the form for editing the specified resource.
|
77 |
+
*/
|
78 |
+
public function edit(string $id)
|
79 |
+
{
|
80 |
+
$reportes = Reporte::findOrFail($id);
|
81 |
+
$alumnos = Alumno::all();
|
82 |
+
$personas = Persona::all();
|
83 |
+
return view('admin.reportes.edit', compact('alumnos', 'personas', 'reportes'));
|
84 |
+
}
|
85 |
+
|
86 |
+
/**
|
87 |
+
* Update the specified resource in storage.
|
88 |
+
*/
|
89 |
+
public function update(Request $request, string $id)
|
90 |
+
{
|
91 |
+
//dd($request->all());
|
92 |
+
$request->validate([
|
93 |
+
'id_alumno' => 'nullable|string|max:50',
|
94 |
+
'persona_id' => 'nullable|string|max:50',
|
95 |
+
'contenido' => 'required|string|max:255',
|
96 |
+
'fecha' => 'required|date|max:50'
|
97 |
+
]);
|
98 |
+
|
99 |
+
$reportes = Reporte::findOrFail($id);
|
100 |
+
$reportes->id_alumno = $request->id_alumno;
|
101 |
+
$reportes->persona_id = $request->persona_id;
|
102 |
+
$reportes->contenido = $request->contenido;
|
103 |
+
$reportes->fecha = $request->fecha;
|
104 |
+
$reportes->save();
|
105 |
+
|
106 |
+
return redirect()->route('reportes.index')->with('mensaje', 'Reportes actualizado con éxito.')
|
107 |
+
->with('icono', 'success');
|
108 |
+
}
|
109 |
+
|
110 |
+
/**
|
111 |
+
* Remove the specified resource from storage.
|
112 |
+
*/
|
113 |
+
public function destroy(string $id)
|
114 |
+
{
|
115 |
+
$reportes = Reporte::findOrFail($id);
|
116 |
+
$reportes->delete();
|
117 |
+
return redirect()->route('reportes.index')->with('mensaje', 'Reporte eliminado con éxito.')
|
118 |
+
->with('icono', 'success');
|
119 |
+
}
|
120 |
+
}
|
app/app/Http/Controllers/RolController.php
ADDED
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace App\Http\Controllers;
|
4 |
+
|
5 |
+
use App\Models\Rol;
|
6 |
+
use Illuminate\Http\Request;
|
7 |
+
use Illuminate\Support\Facades\Validator;
|
8 |
+
|
9 |
+
class RolController extends Controller
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Display a listing of the resource.
|
13 |
+
*/
|
14 |
+
public function index()
|
15 |
+
{
|
16 |
+
$roles = Rol::all();
|
17 |
+
return view('admin.roles.index', ['roles'=>$roles]);
|
18 |
+
}
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Show the form for creating a new resource.
|
22 |
+
*/
|
23 |
+
public function create()
|
24 |
+
{
|
25 |
+
return view('admin.roles.create');
|
26 |
+
}
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Store a newly created resource in storage.
|
30 |
+
*/
|
31 |
+
public function store(Request $request)
|
32 |
+
{
|
33 |
+
$request->validate([
|
34 |
+
'nombre_rol' => 'required|string|max:100',
|
35 |
+
]);
|
36 |
+
|
37 |
+
$roles = new Rol();
|
38 |
+
$roles->nombre_rol = $request->nombre_rol;
|
39 |
+
$roles->save();
|
40 |
+
|
41 |
+
return redirect()->route('roles.index')->with('mensaje', 'Se registro el rol de la manera correcta')
|
42 |
+
->with('icono', 'success');
|
43 |
+
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Display the specified resource.
|
47 |
+
*/
|
48 |
+
public function show($id)
|
49 |
+
{
|
50 |
+
$roles = Rol::findOrFail($id);
|
51 |
+
return view('admin.roles.show', ['roles'=>$roles]);
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Show the form for editing the specified resource.
|
56 |
+
*/
|
57 |
+
public function edit($id)
|
58 |
+
{
|
59 |
+
$roles = Rol::findOrFail($id);
|
60 |
+
return view('admin.roles.edit', ['roles'=>$roles]);
|
61 |
+
}
|
62 |
+
|
63 |
+
/**
|
64 |
+
* Update the specified resource in storage.
|
65 |
+
*/
|
66 |
+
public function update(Request $request, string $id)
|
67 |
+
{
|
68 |
+
$request->validate([
|
69 |
+
'nombre_rol' => 'required|max:100',
|
70 |
+
]);
|
71 |
+
|
72 |
+
$roles = Rol::find($id);
|
73 |
+
$roles->nombre_rol = $request->nombre_rol;
|
74 |
+
$roles->save();
|
75 |
+
|
76 |
+
return redirect()->route('roles.index')->with('mensaje', 'Se actualizo el rol de la manera correcta')
|
77 |
+
->with('icono', 'success');
|
78 |
+
}
|
79 |
+
|
80 |
+
/**
|
81 |
+
* Remove the specified resource from storage.
|
82 |
+
*/
|
83 |
+
public function destroy($id)
|
84 |
+
{
|
85 |
+
Rol::destroy($id);
|
86 |
+
return redirect()->route('roles.index')->with('mensaje', 'Se elimino el rol de la manera correcta')
|
87 |
+
->with('icono', 'success');
|
88 |
+
}
|
89 |
+
}
|
app/app/Http/Controllers/TutorController.php
ADDED
@@ -0,0 +1,110 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace App\Http\Controllers;
|
4 |
+
|
5 |
+
use App\Models\Tutor;
|
6 |
+
use App\Models\Persona;
|
7 |
+
use Illuminate\Http\Request;
|
8 |
+
|
9 |
+
class TutorController extends Controller
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Display a listing of the resource.
|
13 |
+
*/
|
14 |
+
public function index()
|
15 |
+
{
|
16 |
+
$tutores = Tutor::all();
|
17 |
+
return view('admin.tutores.index', ['tutores'=>$tutores]);
|
18 |
+
}
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Show the form for creating a new resource.
|
22 |
+
*/
|
23 |
+
public function create()
|
24 |
+
{
|
25 |
+
$personas = Persona::all();
|
26 |
+
return view('admin.tutores.create', compact('personas'));
|
27 |
+
}
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Store a newly created resource in storage.
|
31 |
+
*/
|
32 |
+
public function store(Request $request)
|
33 |
+
{
|
34 |
+
//dd($request->all());
|
35 |
+
$request->validate([
|
36 |
+
'persona_id' => 'required|exists:personas,id_persona',
|
37 |
+
]);
|
38 |
+
|
39 |
+
$tutores = new Tutor();
|
40 |
+
$tutores->persona_id = $request->persona_id;
|
41 |
+
$tutores->save();
|
42 |
+
|
43 |
+
return redirect()->route('tutores.index')->with('mensaje', 'Tutor creado con éxito.')
|
44 |
+
->with('icono', 'success');
|
45 |
+
}
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Display the specified resource.
|
49 |
+
*/
|
50 |
+
public function show(string $id)
|
51 |
+
{
|
52 |
+
$tutor = Tutor::with('persona')->findOrFail($id);
|
53 |
+
$persona = $tutor->persona;
|
54 |
+
|
55 |
+
return view('admin.tutores.show', [
|
56 |
+
'tutor' => $tutor,
|
57 |
+
'persona' => $persona,
|
58 |
+
]);
|
59 |
+
}
|
60 |
+
|
61 |
+
/**
|
62 |
+
* Show the form for editing the specified resource.
|
63 |
+
*/
|
64 |
+
public function edit(string $id)
|
65 |
+
{
|
66 |
+
//$tutor = Tutor::all();
|
67 |
+
//$personas = Persona::all();
|
68 |
+
//return view('admin.tutores.edit', compact('tutor', 'personas'));
|
69 |
+
|
70 |
+
$tutor = Tutor::with('persona')->findOrFail($id);
|
71 |
+
return view('admin.tutores.edit', ['tutor' => $tutor]);
|
72 |
+
}
|
73 |
+
|
74 |
+
/**
|
75 |
+
* Update the specified resource in storage.
|
76 |
+
*/
|
77 |
+
public function update(Request $request, string $id)
|
78 |
+
{
|
79 |
+
//dd($request->all());
|
80 |
+
$request->validate([
|
81 |
+
'nombre' => 'required|string|max:255',
|
82 |
+
//'apellido_paterno' => 'required|string|max:255',
|
83 |
+
//'apellido_materno' => 'nullable|string|max:255',
|
84 |
+
]);
|
85 |
+
|
86 |
+
|
87 |
+
$tutor = Tutor::findOrFail($id);
|
88 |
+
$persona = $tutor->persona;
|
89 |
+
$persona->nombre = $request->nombre;
|
90 |
+
//$persona->apellido_paterno = $request->apellido_paterno;
|
91 |
+
//$persona->apellido_materno = $request->apellido_materno;
|
92 |
+
//$tutor->save();
|
93 |
+
$tutor->persona->save();
|
94 |
+
|
95 |
+
return redirect()->route('tutores.index')->with('mensaje', 'Tutor actualizado con éxito.')
|
96 |
+
->with('icono', 'success');
|
97 |
+
}
|
98 |
+
|
99 |
+
/**
|
100 |
+
* Remove the specified resource from storage.
|
101 |
+
*/
|
102 |
+
public function destroy(string $id)
|
103 |
+
{
|
104 |
+
$tutor = Tutor::find($id);
|
105 |
+
$tutor->delete();
|
106 |
+
|
107 |
+
return redirect()->route('tutores.index')->with('mensaje', 'Tutor eliminado con éxito.')
|
108 |
+
->with('icono', 'success');
|
109 |
+
}
|
110 |
+
}
|
app/app/Http/Controllers/UsuarioController.php
ADDED
@@ -0,0 +1,118 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace App\Http\Controllers;
|
4 |
+
|
5 |
+
use App\Models\Usuario;
|
6 |
+
use App\Models\Rol;
|
7 |
+
use App\Models\Persona;
|
8 |
+
use Illuminate\Http\Request;
|
9 |
+
use Illuminate\Support\Facades\Hash;
|
10 |
+
use Illuminate\Support\Facades\Validator;
|
11 |
+
|
12 |
+
class UsuarioController extends Controller
|
13 |
+
{
|
14 |
+
/**
|
15 |
+
* Display a listing of the resource.
|
16 |
+
*/
|
17 |
+
public function index()
|
18 |
+
{
|
19 |
+
$usuarios = Usuario::with('persona', 'rol')->get();
|
20 |
+
return view('admin.usuarios.index', compact('usuarios'));
|
21 |
+
}
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Show the form for creating a new resource.
|
25 |
+
*/
|
26 |
+
public function create()
|
27 |
+
{
|
28 |
+
$personas = Persona::all();
|
29 |
+
$roles = Rol::all();
|
30 |
+
return view('admin.usuarios.create', compact('personas', 'roles'));
|
31 |
+
}
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Store a newly created resource in storage.
|
35 |
+
*/
|
36 |
+
public function store(Request $request)
|
37 |
+
{
|
38 |
+
$request->validate([
|
39 |
+
'nombre_usuario' => 'required|string|max:50',
|
40 |
+
'email' => 'required|string|max:50',
|
41 |
+
'id_rol' => 'required|string|max:50',
|
42 |
+
'persona_id' => 'required|string|max:50',
|
43 |
+
'password' => 'required|confirmed'
|
44 |
+
|
45 |
+
]);
|
46 |
+
|
47 |
+
$usuarios = new Usuario();
|
48 |
+
$usuarios->nombre_usuario = $request->nombre_usuario;
|
49 |
+
$usuarios->email = $request->email;
|
50 |
+
$usuarios->id_rol = $request->id_rol;
|
51 |
+
$usuarios->persona_id = $request->persona_id;
|
52 |
+
$usuarios->password = Hash::make($request->password);
|
53 |
+
$usuarios->save();
|
54 |
+
|
55 |
+
return redirect()->route('usuarios.index')->with('mensaje', 'Usuario creado con éxito.')
|
56 |
+
->with('icono', 'success');
|
57 |
+
}
|
58 |
+
|
59 |
+
/**
|
60 |
+
* Display the specified resource.
|
61 |
+
*/
|
62 |
+
public function show($id)
|
63 |
+
{
|
64 |
+
$usuario = Usuario::with('persona', 'rol')->findOrFail($id);
|
65 |
+
$persona = $usuario->persona;
|
66 |
+
$rol = $usuario->rol;
|
67 |
+
|
68 |
+
return view('admin.usuarios.show', [
|
69 |
+
'usuario' => $usuario,
|
70 |
+
'persona' => $persona,
|
71 |
+
'rol' => $rol
|
72 |
+
]);
|
73 |
+
}
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Show the form for editing the specified resource.
|
77 |
+
*/
|
78 |
+
public function edit(string $id)
|
79 |
+
{
|
80 |
+
$usuarios = Usuario::findOrFail($id);
|
81 |
+
$personas = Persona::all();
|
82 |
+
$roles = Rol::all();
|
83 |
+
return view('admin.usuarios.edit', compact('usuarios', 'personas', 'roles'));
|
84 |
+
}
|
85 |
+
|
86 |
+
/**
|
87 |
+
* Update the specified resource in storage.
|
88 |
+
*/
|
89 |
+
public function update(Request $request, string $id)
|
90 |
+
{
|
91 |
+
$request->validate([
|
92 |
+
'nombre_usuario' => 'nullable|string|max:50',
|
93 |
+
'email' => 'required|email|max:50',
|
94 |
+
'password' => 'nullable|confirmed',
|
95 |
+
]);
|
96 |
+
|
97 |
+
$usuarios = Usuario::findOrFail($id);
|
98 |
+
$usuarios->nombre_usuario = $request->nombre_usuario;
|
99 |
+
$usuarios->email = $request->email;
|
100 |
+
$usuarios->password = Hash::make($request['password']);
|
101 |
+
$usuarios->save();
|
102 |
+
|
103 |
+
return redirect()->route('usuarios.index')->with('mensaje', 'Usuario actualizado con éxito.')
|
104 |
+
->with('icono', 'success');
|
105 |
+
}
|
106 |
+
|
107 |
+
/**
|
108 |
+
* Remove the specified resource from storage.
|
109 |
+
*/
|
110 |
+
public function destroy(string $id)
|
111 |
+
{
|
112 |
+
$usuario = Usuario::findOrFail($id);
|
113 |
+
$usuario->delete();
|
114 |
+
|
115 |
+
return redirect()->route('usuarios.index')->with('mensaje', 'Usuario eliminado con éxito.')
|
116 |
+
->with('icono', 'success');
|
117 |
+
}
|
118 |
+
}
|
app/app/Http/Kernel.php
ADDED
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace App\Http;
|
4 |
+
|
5 |
+
use Illuminate\Foundation\Http\Kernel as HttpKernel;
|
6 |
+
|
7 |
+
class Kernel extends HttpKernel
|
8 |
+
{
|
9 |
+
/**
|
10 |
+
* The application's global HTTP middleware stack.
|
11 |
+
*
|
12 |
+
* These middleware are run during every request to your application.
|
13 |
+
*
|
14 |
+
* @var array<int, class-string|string>
|
15 |
+
*/
|
16 |
+
protected $middleware = [
|
17 |
+
// \App\Http\Middleware\TrustHosts::class,
|
18 |
+
\App\Http\Middleware\TrustProxies::class,
|
19 |
+
\Illuminate\Http\Middleware\HandleCors::class,
|
20 |
+
\App\Http\Middleware\PreventRequestsDuringMaintenance::class,
|
21 |
+
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
|
22 |
+
\App\Http\Middleware\TrimStrings::class,
|
23 |
+
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
|
24 |
+
];
|
25 |
+
|
26 |
+
/**
|
27 |
+
* The application's route middleware groups.
|
28 |
+
*
|
29 |
+
* @var array<string, array<int, class-string|string>>
|
30 |
+
*/
|
31 |
+
protected $middlewareGroups = [
|
32 |
+
'web' => [
|
33 |
+
\App\Http\Middleware\EncryptCookies::class,
|
34 |
+
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
|
35 |
+
\Illuminate\Session\Middleware\StartSession::class,
|
36 |
+
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
|
37 |
+
\App\Http\Middleware\VerifyCsrfToken::class,
|
38 |
+
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
39 |
+
],
|
40 |
+
|
41 |
+
'api' => [
|
42 |
+
// \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class,
|
43 |
+
\Illuminate\Routing\Middleware\ThrottleRequests::class.':api',
|
44 |
+
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
45 |
+
],
|
46 |
+
];
|
47 |
+
|
48 |
+
/**
|
49 |
+
* The application's middleware aliases.
|
50 |
+
*
|
51 |
+
* Aliases may be used instead of class names to conveniently assign middleware to routes and groups.
|
52 |
+
*
|
53 |
+
* @var array<string, class-string|string>
|
54 |
+
*/
|
55 |
+
protected $middlewareAliases = [
|
56 |
+
'auth' => \App\Http\Middleware\Authenticate::class,
|
57 |
+
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
|
58 |
+
'auth.session' => \Illuminate\Session\Middleware\AuthenticateSession::class,
|
59 |
+
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
|
60 |
+
'can' => \Illuminate\Auth\Middleware\Authorize::class,
|
61 |
+
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
|
62 |
+
'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class,
|
63 |
+
'precognitive' => \Illuminate\Foundation\Http\Middleware\HandlePrecognitiveRequests::class,
|
64 |
+
'signed' => \App\Http\Middleware\ValidateSignature::class,
|
65 |
+
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
|
66 |
+
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
|
67 |
+
];
|
68 |
+
}
|
app/app/Http/Middleware/Authenticate.php
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace App\Http\Middleware;
|
4 |
+
|
5 |
+
use Illuminate\Auth\Middleware\Authenticate as Middleware;
|
6 |
+
use Illuminate\Http\Request;
|
7 |
+
|
8 |
+
class Authenticate extends Middleware
|
9 |
+
{
|
10 |
+
/**
|
11 |
+
* Get the path the user should be redirected to when they are not authenticated.
|
12 |
+
*/
|
13 |
+
protected function redirectTo(Request $request): ?string
|
14 |
+
{
|
15 |
+
return $request->expectsJson() ? null : route('login');
|
16 |
+
}
|
17 |
+
}
|
app/app/Http/Middleware/EncryptCookies.php
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace App\Http\Middleware;
|
4 |
+
|
5 |
+
use Illuminate\Cookie\Middleware\EncryptCookies as Middleware;
|
6 |
+
|
7 |
+
class EncryptCookies extends Middleware
|
8 |
+
{
|
9 |
+
/**
|
10 |
+
* The names of the cookies that should not be encrypted.
|
11 |
+
*
|
12 |
+
* @var array<int, string>
|
13 |
+
*/
|
14 |
+
protected $except = [
|
15 |
+
//
|
16 |
+
];
|
17 |
+
}
|
app/app/Http/Middleware/PreventRequestsDuringMaintenance.php
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace App\Http\Middleware;
|
4 |
+
|
5 |
+
use Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance as Middleware;
|
6 |
+
|
7 |
+
class PreventRequestsDuringMaintenance extends Middleware
|
8 |
+
{
|
9 |
+
/**
|
10 |
+
* The URIs that should be reachable while maintenance mode is enabled.
|
11 |
+
*
|
12 |
+
* @var array<int, string>
|
13 |
+
*/
|
14 |
+
protected $except = [
|
15 |
+
//
|
16 |
+
];
|
17 |
+
}
|
app/app/Http/Middleware/RedirectIfAuthenticated.php
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace App\Http\Middleware;
|
4 |
+
|
5 |
+
use App\Providers\RouteServiceProvider;
|
6 |
+
use Closure;
|
7 |
+
use Illuminate\Http\Request;
|
8 |
+
use Illuminate\Support\Facades\Auth;
|
9 |
+
use Symfony\Component\HttpFoundation\Response;
|
10 |
+
|
11 |
+
class RedirectIfAuthenticated
|
12 |
+
{
|
13 |
+
/**
|
14 |
+
* Handle an incoming request.
|
15 |
+
*
|
16 |
+
* @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next
|
17 |
+
*/
|
18 |
+
public function handle(Request $request, Closure $next, string ...$guards): Response
|
19 |
+
{
|
20 |
+
$guards = empty($guards) ? [null] : $guards;
|
21 |
+
|
22 |
+
foreach ($guards as $guard) {
|
23 |
+
if (Auth::guard($guard)->check()) {
|
24 |
+
return redirect(RouteServiceProvider::HOME);
|
25 |
+
}
|
26 |
+
}
|
27 |
+
|
28 |
+
return $next($request);
|
29 |
+
}
|
30 |
+
}
|
app/app/Http/Middleware/TrimStrings.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace App\Http\Middleware;
|
4 |
+
|
5 |
+
use Illuminate\Foundation\Http\Middleware\TrimStrings as Middleware;
|
6 |
+
|
7 |
+
class TrimStrings extends Middleware
|
8 |
+
{
|
9 |
+
/**
|
10 |
+
* The names of the attributes that should not be trimmed.
|
11 |
+
*
|
12 |
+
* @var array<int, string>
|
13 |
+
*/
|
14 |
+
protected $except = [
|
15 |
+
'current_password',
|
16 |
+
'password',
|
17 |
+
'password_confirmation',
|
18 |
+
];
|
19 |
+
}
|
app/app/Http/Middleware/TrustHosts.php
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace App\Http\Middleware;
|
4 |
+
|
5 |
+
use Illuminate\Http\Middleware\TrustHosts as Middleware;
|
6 |
+
|
7 |
+
class TrustHosts extends Middleware
|
8 |
+
{
|
9 |
+
/**
|
10 |
+
* Get the host patterns that should be trusted.
|
11 |
+
*
|
12 |
+
* @return array<int, string|null>
|
13 |
+
*/
|
14 |
+
public function hosts(): array
|
15 |
+
{
|
16 |
+
return [
|
17 |
+
$this->allSubdomainsOfApplicationUrl(),
|
18 |
+
];
|
19 |
+
}
|
20 |
+
}
|
app/app/Http/Middleware/TrustProxies.php
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace App\Http\Middleware;
|
4 |
+
|
5 |
+
use Illuminate\Http\Middleware\TrustProxies as Middleware;
|
6 |
+
use Illuminate\Http\Request;
|
7 |
+
|
8 |
+
class TrustProxies extends Middleware
|
9 |
+
{
|
10 |
+
/**
|
11 |
+
* The trusted proxies for this application.
|
12 |
+
*
|
13 |
+
* @var array<int, string>|string|null
|
14 |
+
*/
|
15 |
+
protected $proxies;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* The headers that should be used to detect proxies.
|
19 |
+
*
|
20 |
+
* @var int
|
21 |
+
*/
|
22 |
+
protected $headers =
|
23 |
+
Request::HEADER_X_FORWARDED_FOR |
|
24 |
+
Request::HEADER_X_FORWARDED_HOST |
|
25 |
+
Request::HEADER_X_FORWARDED_PORT |
|
26 |
+
Request::HEADER_X_FORWARDED_PROTO |
|
27 |
+
Request::HEADER_X_FORWARDED_AWS_ELB;
|
28 |
+
}
|
app/app/Http/Middleware/ValidateSignature.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace App\Http\Middleware;
|
4 |
+
|
5 |
+
use Illuminate\Routing\Middleware\ValidateSignature as Middleware;
|
6 |
+
|
7 |
+
class ValidateSignature extends Middleware
|
8 |
+
{
|
9 |
+
/**
|
10 |
+
* The names of the query string parameters that should be ignored.
|
11 |
+
*
|
12 |
+
* @var array<int, string>
|
13 |
+
*/
|
14 |
+
protected $except = [
|
15 |
+
// 'fbclid',
|
16 |
+
// 'utm_campaign',
|
17 |
+
// 'utm_content',
|
18 |
+
// 'utm_medium',
|
19 |
+
// 'utm_source',
|
20 |
+
// 'utm_term',
|
21 |
+
];
|
22 |
+
}
|
app/app/Http/Middleware/VerifyCsrfToken.php
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace App\Http\Middleware;
|
4 |
+
|
5 |
+
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware;
|
6 |
+
|
7 |
+
class VerifyCsrfToken extends Middleware
|
8 |
+
{
|
9 |
+
/**
|
10 |
+
* The URIs that should be excluded from CSRF verification.
|
11 |
+
*
|
12 |
+
* @var array<int, string>
|
13 |
+
*/
|
14 |
+
protected $except = [
|
15 |
+
//
|
16 |
+
];
|
17 |
+
}
|
app/app/Models/Alumno.php
ADDED
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace App\Models;
|
4 |
+
|
5 |
+
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
6 |
+
use Illuminate\Database\Eloquent\Model;
|
7 |
+
use Illuminate\Database\Eloquent\Relations\HasOne;
|
8 |
+
class Alumno extends Model
|
9 |
+
{
|
10 |
+
use HasFactory;
|
11 |
+
|
12 |
+
protected $table = 'alumnos';
|
13 |
+
protected $primaryKey = 'id_alumno';
|
14 |
+
protected $fillable = [
|
15 |
+
'persona_id',
|
16 |
+
'numero_control',
|
17 |
+
'id_tutor',
|
18 |
+
'id_grupo',
|
19 |
+
'curp',
|
20 |
+
'image_path'
|
21 |
+
];
|
22 |
+
|
23 |
+
//public function todos()
|
24 |
+
//{
|
25 |
+
// DB::table('alumnos')->insert
|
26 |
+
//}
|
27 |
+
|
28 |
+
public function persona()//: HasOne
|
29 |
+
{
|
30 |
+
return $this->belongsTo(Persona::class, 'persona_id');
|
31 |
+
//return $this->hasOne(Persona::Class);
|
32 |
+
}
|
33 |
+
|
34 |
+
public function tutor()
|
35 |
+
{
|
36 |
+
return $this->belongsTo(Tutor::class, 'id_tutor');
|
37 |
+
}
|
38 |
+
|
39 |
+
public function grupo()
|
40 |
+
{
|
41 |
+
return $this->belongsTo(Grupo::class, 'id_grupo');
|
42 |
+
}
|
43 |
+
|
44 |
+
public function calificaciones()
|
45 |
+
{
|
46 |
+
return $this->hasMany(Calificacion::class, 'id_alumno');
|
47 |
+
}
|
48 |
+
|
49 |
+
public function reportes()
|
50 |
+
{
|
51 |
+
return $this->hasMany(Reporte::class, 'id_alumno');
|
52 |
+
}
|
53 |
+
|
54 |
+
public function justificantes()
|
55 |
+
{
|
56 |
+
return $this->hasMany(Justificante::class, 'id_alumno');
|
57 |
+
}
|
58 |
+
|
59 |
+
public function avisos()
|
60 |
+
{
|
61 |
+
return $this->hasMany(Aviso::class, 'id_alumno');
|
62 |
+
}
|
63 |
+
|
64 |
+
}
|
app/app/Models/Aviso.php
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace App\Models;
|
4 |
+
|
5 |
+
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
6 |
+
use Illuminate\Database\Eloquent\Model;
|
7 |
+
|
8 |
+
class Aviso extends Model
|
9 |
+
{
|
10 |
+
use HasFactory;
|
11 |
+
|
12 |
+
protected $table = 'avisos';
|
13 |
+
protected $primaryKey = 'id_aviso';
|
14 |
+
|
15 |
+
public function alumno()
|
16 |
+
{
|
17 |
+
return $this->belongsTo(Alumno::class, 'id_alumno');
|
18 |
+
}
|
19 |
+
|
20 |
+
public function persona()
|
21 |
+
{
|
22 |
+
return $this->belongsTo(Persona::class, 'persona_id');
|
23 |
+
}
|
24 |
+
|
25 |
+
}
|
app/app/Models/Calificacion.php
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace App\Models;
|
4 |
+
|
5 |
+
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
6 |
+
use Illuminate\Database\Eloquent\Model;
|
7 |
+
|
8 |
+
class Calificacion extends Model
|
9 |
+
{
|
10 |
+
use HasFactory;
|
11 |
+
|
12 |
+
protected $table = 'calificaciones';
|
13 |
+
protected $primaryKey = 'id_calificacion';
|
14 |
+
protected $fillable = ['id_alumno', 'id_materia', 'calificacion'];
|
15 |
+
|
16 |
+
public function alumno()
|
17 |
+
{
|
18 |
+
return $this->belongsTo(Alumno::class, 'id_alumno');
|
19 |
+
}
|
20 |
+
|
21 |
+
public function materia()
|
22 |
+
{
|
23 |
+
return $this->belongsTo(Materia::class, 'id_materia');
|
24 |
+
}
|
25 |
+
|
26 |
+
}
|
app/app/Models/Grupo.php
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace App\Models;
|
4 |
+
|
5 |
+
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
6 |
+
use Illuminate\Database\Eloquent\Model;
|
7 |
+
|
8 |
+
class Grupo extends Model
|
9 |
+
{
|
10 |
+
use HasFactory;
|
11 |
+
|
12 |
+
protected $table = 'grupos';
|
13 |
+
protected $primaryKey = 'id_grupo';
|
14 |
+
protected $fillable = ['grado', 'grupo'];
|
15 |
+
|
16 |
+
public function alumnos()
|
17 |
+
{
|
18 |
+
return $this->hasMany(Alumno::class, 'id_grupo');
|
19 |
+
}
|
20 |
+
|
21 |
+
public function persona()
|
22 |
+
{
|
23 |
+
return $this->hasMany(Persona::class, 'persona_id');
|
24 |
+
}
|
25 |
+
|
26 |
+
public function gruposPrefecto()
|
27 |
+
{
|
28 |
+
return $this->hasMany(GrupoPrefecto::class, 'id_grupo');
|
29 |
+
}
|
30 |
+
|
31 |
+
}
|
app/app/Models/GrupoPrefecto.php
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace App\Models;
|
4 |
+
|
5 |
+
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
6 |
+
use Illuminate\Database\Eloquent\Model;
|
7 |
+
|
8 |
+
class GrupoPrefecto extends Model
|
9 |
+
{
|
10 |
+
use HasFactory;
|
11 |
+
|
12 |
+
protected $table = 'grupos_prefectos';
|
13 |
+
protected $primaryKey = 'id_grupo_prefecto';
|
14 |
+
|
15 |
+
public function grupo()
|
16 |
+
{
|
17 |
+
return $this->belongsTo(Grupo::class, 'id_grupo');
|
18 |
+
}
|
19 |
+
|
20 |
+
public function persona()
|
21 |
+
{
|
22 |
+
return $this->belongsTo(Persona::class, 'persona_id');
|
23 |
+
}
|
24 |
+
|
25 |
+
public function periodo()
|
26 |
+
{
|
27 |
+
return $this->belongsTo(Periodo::class, 'id_periodo');
|
28 |
+
}
|
29 |
+
|
30 |
+
}
|
app/app/Models/Justificante.php
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace App\Models;
|
4 |
+
|
5 |
+
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
6 |
+
use Illuminate\Database\Eloquent\Model;
|
7 |
+
|
8 |
+
class Justificante extends Model
|
9 |
+
{
|
10 |
+
use HasFactory;
|
11 |
+
|
12 |
+
protected $table = 'justificantes';
|
13 |
+
protected $primaryKey = 'id_justificante';
|
14 |
+
|
15 |
+
public function alumno()
|
16 |
+
{
|
17 |
+
return $this->belongsTo(Alumno::class, 'id_alumno');
|
18 |
+
}
|
19 |
+
|
20 |
+
public function persona()
|
21 |
+
{
|
22 |
+
return $this->belongsTo(Persona::class, 'persona_id');
|
23 |
+
}
|
24 |
+
|
25 |
+
}
|
app/app/Models/Materia.php
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace App\Models;
|
4 |
+
|
5 |
+
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
6 |
+
use Illuminate\Database\Eloquent\Model;
|
7 |
+
|
8 |
+
class Materia extends Model
|
9 |
+
{
|
10 |
+
use HasFactory;
|
11 |
+
|
12 |
+
protected $table = 'materias';
|
13 |
+
protected $primaryKey = 'id_materia';
|
14 |
+
|
15 |
+
public function calificaciones()
|
16 |
+
{
|
17 |
+
return $this->hasMany(Calificacion::class, 'id_materia');
|
18 |
+
}
|
19 |
+
|
20 |
+
}
|
app/app/Models/Periodo.php
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace App\Models;
|
4 |
+
|
5 |
+
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
6 |
+
use Illuminate\Database\Eloquent\Model;
|
7 |
+
|
8 |
+
class Periodo extends Model
|
9 |
+
{
|
10 |
+
use HasFactory;
|
11 |
+
|
12 |
+
protected $table = 'periodos';
|
13 |
+
protected $primaryKey = 'id_periodo';
|
14 |
+
protected $fillable = ['nombre', 'estado'];
|
15 |
+
|
16 |
+
public function gruposPrefecto()
|
17 |
+
{
|
18 |
+
return $this->hasMany(GrupoPrefecto::class, 'id_periodo');
|
19 |
+
}
|
20 |
+
|
21 |
+
}
|
app/app/Models/Persona.php
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace App\Models;
|
4 |
+
|
5 |
+
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
6 |
+
use Illuminate\Database\Eloquent\Model;
|
7 |
+
|
8 |
+
class Persona extends Model
|
9 |
+
{
|
10 |
+
use HasFactory;
|
11 |
+
|
12 |
+
protected $table = 'personas';
|
13 |
+
protected $primaryKey = 'id_persona';
|
14 |
+
|
15 |
+
public function usuario()
|
16 |
+
{
|
17 |
+
return $this->hasMany(Usuario::class, 'persona_id', 'id_persona');
|
18 |
+
}
|
19 |
+
|
20 |
+
public function alumno()
|
21 |
+
{
|
22 |
+
return $this->belongsTo(Alumno::class, 'persona_id');
|
23 |
+
}
|
24 |
+
|
25 |
+
public function tutor()
|
26 |
+
{
|
27 |
+
return $this->hasMany(Tutor::class, 'persona_id');
|
28 |
+
}
|
29 |
+
|
30 |
+
public function rol()
|
31 |
+
{
|
32 |
+
return $this->belongsTo(Rol::class, 'id_rol');
|
33 |
+
}
|
34 |
+
|
35 |
+
public function grupoPrefecto()
|
36 |
+
{
|
37 |
+
return $this->hasMany(GrupoPrefecto::class, 'id_grupo_prefecto');
|
38 |
+
}
|
39 |
+
|
40 |
+
|
41 |
+
}
|
app/app/Models/Reporte.php
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace App\Models;
|
4 |
+
|
5 |
+
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
6 |
+
use Illuminate\Database\Eloquent\Model;
|
7 |
+
|
8 |
+
class Reporte extends Model
|
9 |
+
{
|
10 |
+
use HasFactory;
|
11 |
+
|
12 |
+
protected $table = 'reportes';
|
13 |
+
protected $primaryKey = 'id_reporte';
|
14 |
+
|
15 |
+
public function alumno()
|
16 |
+
{
|
17 |
+
return $this->belongsTo(Alumno::class, 'id_alumno');
|
18 |
+
}
|
19 |
+
|
20 |
+
public function persona()
|
21 |
+
{
|
22 |
+
return $this->belongsTo(Persona::class, 'persona_id');
|
23 |
+
}
|
24 |
+
|
25 |
+
}
|
app/app/Models/Rol.php
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace App\Models;
|
4 |
+
|
5 |
+
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
6 |
+
use Illuminate\Database\Eloquent\Model;
|
7 |
+
|
8 |
+
class Rol extends Model
|
9 |
+
{
|
10 |
+
use HasFactory;
|
11 |
+
|
12 |
+
protected $table = 'roles';
|
13 |
+
protected $primaryKey = 'id_rol';
|
14 |
+
|
15 |
+
public function usuarios()
|
16 |
+
{
|
17 |
+
return $this->belongsToMany(Usuario::class, 'usuario_rol', 'rol_id', 'usuario_id');
|
18 |
+
|
19 |
+
}
|
20 |
+
|
21 |
+
public function roles()
|
22 |
+
{
|
23 |
+
return $this->belongsToMany(Rol::class, 'usuario_rol', 'usuario_id', 'rol_id');
|
24 |
+
}
|
25 |
+
|
26 |
+
public function grupos()
|
27 |
+
{
|
28 |
+
return $this->belongsToMany(Grupo::class, 'grupos_prefectos', 'id_rol', 'id_grupo');
|
29 |
+
}
|
30 |
+
|
31 |
+
}
|
app/app/Models/Tutor.php
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace App\Models;
|
4 |
+
|
5 |
+
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
6 |
+
use Illuminate\Database\Eloquent\Model;
|
7 |
+
|
8 |
+
class Tutor extends Model
|
9 |
+
{
|
10 |
+
use HasFactory;
|
11 |
+
|
12 |
+
protected $table = 'tutores';
|
13 |
+
protected $primaryKey = 'id_tutor';
|
14 |
+
protected $fillable = ['persona_id'];
|
15 |
+
|
16 |
+
public function persona()
|
17 |
+
{
|
18 |
+
return $this->belongsTo(Persona::class, 'persona_id');
|
19 |
+
}
|
20 |
+
|
21 |
+
public function alumnos()
|
22 |
+
{
|
23 |
+
return $this->hasMany(Alumno::class, 'id_tutor');
|
24 |
+
}
|
25 |
+
|
26 |
+
}
|
app/app/Models/User.php
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
//namespace App\Models;
|
4 |
+
|
5 |
+
// use Illuminate\Contracts\Auth\MustVerifyEmail;
|
6 |
+
//use Illuminate\Database\Eloquent\Factories\HasFactory;
|
7 |
+
//use Illuminate\Foundation\Auth\User as Authenticatable;
|
8 |
+
//use Illuminate\Notifications\Notifiable;
|
9 |
+
//use Laravel\Sanctum\HasApiTokens;
|
10 |
+
|
11 |
+
//class User extends Authenticatable
|
12 |
+
//{
|
13 |
+
//use HasApiTokens, HasFactory, Notifiable;
|
14 |
+
|
15 |
+
/**
|
16 |
+
* The attributes that are mass assignable.
|
17 |
+
*
|
18 |
+
//* @var array<int, string>
|
19 |
+
*/
|
20 |
+
//protected $fillable = [
|
21 |
+
//'name',
|
22 |
+
//'email',
|
23 |
+
//'password',
|
24 |
+
//];
|
25 |
+
|
26 |
+
/**
|
27 |
+
* The attributes that should be hidden for serialization.
|
28 |
+
*
|
29 |
+
//* @var array<int, string>
|
30 |
+
*/
|
31 |
+
//protected $hidden = [
|
32 |
+
//'password',
|
33 |
+
//'remember_token',
|
34 |
+
//];
|
35 |
+
|
36 |
+
/**
|
37 |
+
* The attributes that should be cast.
|
38 |
+
*
|
39 |
+
//* @var array<string, string>
|
40 |
+
*/
|
41 |
+
//protected $casts = [
|
42 |
+
//'email_verified_at' => 'datetime',
|
43 |
+
//'password' => 'hashed',
|
44 |
+
//];
|
45 |
+
//}
|