diff --git a/app/Http/Controllers/CitasController.php b/app/Http/Controllers/CitasController.php new file mode 100644 index 0000000..a664895 --- /dev/null +++ b/app/Http/Controllers/CitasController.php @@ -0,0 +1,58 @@ +get(); + + //return $Citas; + return view ('admin.Citas.index',compact('Citas')); + } + + public function create() + { + $User =User::get(); + return view('admin.Citas.create'); + } + + public function store(Request $request) + { + $input = $request->all(); + Citas::create($input); + return redirect('Citas')->with('flash_message', 'Citas Addedd!'); + } + + public function show($id) + { + $Citas =Citas::find($id); + return view('admin.Citas.show')->with('Citas', $Citas); + } + + public function edit($id) + { + $Citas =Citas::find($id); + return view('admin.Citas.edit')->with('Citas', $Citas); + } + + public function update(Request $request, $id) + { + $Citas =Citas::find($id); + $input = $request->all(); + $Citas->update($input); + return redirect('Citas')->with('flash_message', 'Citas Updated!'); + } + + public function destroy($id) + { + Citas::destroy($id); + return redirect('Citas')->with('flash_message', 'Citas deleted!'); + } +} diff --git a/app/Models/Citas.php b/app/Models/Citas.php new file mode 100644 index 0000000..66dd604 --- /dev/null +++ b/app/Models/Citas.php @@ -0,0 +1,19 @@ +belongsTo(User::class,'id'); + } +} diff --git a/database/migrations/2014_09_21_000000_create_users_table.php b/database/migrations/2014_09_21_000000_create_users_table.php index c77b3f0..fb98a62 100644 --- a/database/migrations/2014_09_21_000000_create_users_table.php +++ b/database/migrations/2014_09_21_000000_create_users_table.php @@ -15,13 +15,15 @@ public function up() { Schema::create('users', function (Blueprint $table) { $table->Increments('id'); - $table->string('name'); + $table->string('rol'); $table->string('username')->unique(); $table->string('estado')->nullable()->default('1'); $table->string('email')->unique(); $table->timestamp('email_verified_at')->nullable(); $table->string('password')->nullable(); $table->rememberToken(); + $table->Integer('id_persona')->unsigned(); + $table->foreign('id_persona')->references('id_persona')->on('personas'); $table->timestamps(); }); } diff --git a/resources/views/admin/Citas/create.blade.php b/resources/views/admin/Citas/create.blade.php new file mode 100644 index 0000000..4fa022f --- /dev/null +++ b/resources/views/admin/Citas/create.blade.php @@ -0,0 +1,19 @@ + +
+
Crear Cita
+
+ +
+ {!! csrf_field() !!} +
+
+
+
+
+
+
+
+ +
+
+
diff --git a/resources/views/admin/Citas/edit.blade.php b/resources/views/admin/Citas/edit.blade.php new file mode 100644 index 0000000..7686347 --- /dev/null +++ b/resources/views/admin/Citas/edit.blade.php @@ -0,0 +1,22 @@ + +
+
Editar tipo de Patologia
+
+ +
+ {!! csrf_field() !!} + @method("PATCH") + +
+
+
+
+
+
+
+
+ +
+
+
+ diff --git a/resources/views/admin/Citas/index.blade.php b/resources/views/admin/Citas/index.blade.php new file mode 100644 index 0000000..c46114e --- /dev/null +++ b/resources/views/admin/Citas/index.blade.php @@ -0,0 +1,51 @@ + +
+
+
+
+
+

Citas

+
+
+ + Add New + +
+
+
+ + + + + + + + + + + + @foreach($Citas as $item) + + + + + + + + @endforeach + +
#FechaDescripcionPacienteAcciones
{{ $loop->iteration }}{{ $item->fecha_cita }}{{ $item->detalles_cita }}{{ $item->id_secretaria->name}} + +
+ @method('DELETE') + {{ csrf_field() }} + +
+
+
+
+
+
+
+
+
diff --git a/routes/web.php b/routes/web.php index 9b2fc4e..01e9a89 100644 --- a/routes/web.php +++ b/routes/web.php @@ -1,5 +1,6 @@