Skip to content

Commit

Permalink
Feat: Ordenar Medicos segun su Especialidad
Browse files Browse the repository at this point in the history
  • Loading branch information
StevenU21 committed Dec 11, 2022
1 parent d7d1ff7 commit eec39d0
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 5 deletions.
20 changes: 20 additions & 0 deletions app/Http/Controllers/Api/SpecialtyController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

namespace App\Http\Controllers\Api;

use App\Http\Controllers\Controller;
use App\Models\Specialty;
use Illuminate\Http\Request;

class SpecialtyController extends Controller
{
public function doctors(Specialty $specialty)
{
return $specialty->users()->get(
[
'users.id',
'users.name'
]
);
}
}
1 change: 1 addition & 0 deletions app/Models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class User extends Authenticatable
protected $hidden = [
'password',
'remember_token',
'pivot'
];

public function specialties(){
Expand Down
2 changes: 1 addition & 1 deletion resources/views/appointments/create.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@

<script src="{{ asset('js/plugins/bootstrap-datepicker/dist/js/bootstrap-datepicker.min.js')}}"></script>

<script>
<script></script>
let $doctor;
$(function(){
const $specialty = $('#specialty');
Expand Down
16 changes: 12 additions & 4 deletions routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@
Route::put('/especialidades/{specialty}', [App\Http\Controllers\admin\SpecialtyController::class, 'update']);
Route::delete('/especialidades/{specialty}', [App\Http\Controllers\admin\SpecialtyController::class, 'destroy']);

//Rutas de Medicos
//Ruta de Medicos
Route::resource('medicos','App\Http\Controllers\admin\DoctorController');

//Rutas de Pacientes
//Ruta de Pacientes
Route::resource('pacientes','App\Http\Controllers\admin\PatientController');
});

Expand All @@ -45,9 +45,17 @@
});

//Rutas de Pacientes
Route::get('/reservarcitas/create', [App\Http\Controllers\AppointmentController::class, 'create']);
Route::get('/miscitas', [App\Http\Controllers\AppointmentController::class, 'store']);
Route::middleware('auth')->group(function()
{
Route::get('/reservarcitas/create', [App\Http\Controllers\AppointmentController::class, 'create']);
Route::get('/miscitas', [App\Http\Controllers\AppointmentController::class, 'store']);
//Json
Route::get('/especialidades/{specialty}/medicos', [App\Http\Controllers\Api\SpecialtyController::class, 'doctors']);
});


Route::get('/home', [App\Http\Controllers\HomeController::class, 'index'])->name('home');




0 comments on commit eec39d0

Please sign in to comment.