-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #31 from kornofilo/development
Sprint #4
- Loading branch information
Showing
130 changed files
with
6,337 additions
and
440 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
|
||
namespace App; | ||
|
||
use Illuminate\Database\Eloquent\Model; | ||
|
||
class Anuncio extends Model | ||
{ | ||
#referncia a la tabla que se va a utilizar | ||
protected $table = "compraVenta"; | ||
|
||
public function anunciante(){ | ||
return $this->hasOne('App\User','email','email'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
namespace App; | ||
|
||
use Illuminate\Database\Eloquent\Model; | ||
|
||
class Bolsatrabajo extends Model | ||
{ | ||
#referncia a la tabla que se va a utilizar | ||
protected $table = "bolsatrabajo"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
namespace App; | ||
|
||
use Illuminate\Database\Eloquent\Model; | ||
|
||
class Carrera extends Model | ||
{ | ||
//Específicamos la tabla del modelo | ||
protected $table = "carreras"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
|
||
namespace App; | ||
|
||
use Illuminate\Database\Eloquent\Model; | ||
|
||
|
||
class Compraventa extends Model | ||
{ | ||
// | ||
protected $table = "compraventa"; | ||
|
||
|
||
|
||
public function anunciante(){ | ||
return $this->hasOne('App\User','email','email'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
|
||
namespace App; | ||
|
||
use Illuminate\Database\Eloquent\Model; | ||
|
||
|
||
class Evento extends Model | ||
{ | ||
//referncia a la tabla que se va a utilizar | ||
protected $table = "eventos"; | ||
|
||
public function anunciante(){ | ||
return $this->hasOne('App\User','email','email'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
|
||
namespace App; | ||
|
||
use Illuminate\Database\Eloquent\Model; | ||
|
||
class Facultad extends Model | ||
{ | ||
//Específicamos la tabla del modelo | ||
protected $table = "facultades"; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
|
||
namespace App; | ||
|
||
use Illuminate\Database\Eloquent\Model; | ||
|
||
class Feed extends Model | ||
{ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
namespace App; | ||
|
||
use Illuminate\Database\Eloquent\Model; | ||
|
||
class Hospedaje extends Model | ||
{ | ||
#Le dice al controlador cuales tablas va a usar | ||
protected $tabla = "hospedajes"; | ||
} |
73 changes: 73 additions & 0 deletions
73
web/app/Http/Controllers/AdminPanel/DegreesAdminController.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers\AdminPanel; | ||
|
||
use Illuminate\Http\Request; | ||
use App\Http\Controllers\Controller; | ||
//Importamos los modelos que vamos a utilizar | ||
use App\Facultad; | ||
use App\Carrera; | ||
|
||
class DegreesAdminController extends Controller | ||
{ | ||
public function index() | ||
{ | ||
$facultades = Facultad::all()->sortBy('nombre'); | ||
$carreras = Carrera::all()->sortBy("nombre"); | ||
return view('adminPanel.degreesAdmin',compact('facultades','carreras')); | ||
} | ||
|
||
## Funciones CRUD de Facultades | ||
//Función para la crear una nueva facultad en la base de datos. | ||
public function newFacultad(Request $request) | ||
{ | ||
$facultad = new Facultad; | ||
$facultad->nombre = $request->get('newFacultad'); | ||
$facultad->save(); | ||
return back()->with('success','Facultad creada exitosamente.'); | ||
} | ||
|
||
//Función para editar una facultad seleccionada. | ||
public function editFacultad(Request $request, $idFacultad) | ||
{ | ||
$facultad = Facultad::where('id', $idFacultad)->first(); | ||
$facultad->nombre = $request->get('newNameFacultad'); | ||
$facultad->save(); | ||
return back()->with('success','Nombre de la facultad editado exitosamente.'); | ||
} | ||
|
||
//Función para eliminar una facultad seleccionada de la base de datos. | ||
public function deleteFacultad($idFacultad) | ||
{ | ||
Facultad::where('id', $idFacultad)->delete(); | ||
return back()->with('success','Facultad eliminada exitosamente.'); | ||
} | ||
|
||
## Funciones CRUD de Carreras## | ||
//Función para la crear una nueva carreras en la base de datos. | ||
public function newCarrera(Request $request,$idFacultad) | ||
{ | ||
$carrera = new Carrera; | ||
$carrera->facultad_id = $idFacultad; | ||
$carrera->nombre = $request->get('newCarrera'); | ||
$carrera->save(); | ||
return back()->with('success','Carrera creada exitosamente.'); | ||
} | ||
|
||
//Función para editar una carrera seleccionada. | ||
public function editCarrera(Request $request, $idCarrera) | ||
{ | ||
$carrera = Carrera::where('id', $idCarrera)->first(); | ||
$carrera->nombre = $request->get('newNameCarrera'); | ||
$carrera->save(); | ||
return back()->with('success','Nombre de la carrera editado exitosamente.'); | ||
} | ||
|
||
//Función para eliminar una carrera seleccionada de la base de datos. | ||
public function deleteCarrera($idCarrera) | ||
{ | ||
Carrera::where('id', $idCarrera)->delete(); | ||
return back()->with('success','Carrera eliminada exitosamente.'); | ||
} | ||
|
||
} |
72 changes: 72 additions & 0 deletions
72
web/app/Http/Controllers/AdminPanel/PostsModController.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers\AdminPanel; | ||
|
||
use Illuminate\Http\Request; | ||
use App\Http\Controllers\Controller; | ||
//Importamos los modelos que vamos a utilizar | ||
use App\Tutorias; | ||
use App\Compraventa; | ||
use App\Hospedaje; | ||
|
||
class PostsModController extends Controller | ||
{ | ||
public function index() | ||
{ | ||
$tutorias = Tutorias::where('estadoPost','En Moderación')->get(); | ||
$compraVenta = Compraventa::where('estadoPost','En Moderación')->get(); | ||
$hospedajes = Hospedaje::where('estadoPost','En Moderación')->get(); | ||
return view('adminPanel.postsMod',compact('tutorias','compraVenta','hospedajes')); | ||
} | ||
|
||
##Funciones para moderar publicaciones de Compra/Venta## | ||
//Función para aprobar una publicación de Compra/Venta. | ||
public function aprobarCyVPost($idCyVPost){ | ||
$compraVenta = Compraventa::where('id', $idCyVPost)->first(); | ||
$compraVenta->estadoPost = 'Aprobada'; | ||
$compraVenta->save(); | ||
return back()->with('success','Publicación de Compra/Venta aprobada exitosamente.'); | ||
} | ||
|
||
//Función para rechazar una publicación de Tutoría. | ||
public function rechazarCyVPost($idCyVPost){ | ||
$compraVenta = Compraventa::where('id', $idCyVPost)->first(); | ||
$compraVenta->estadoPost = 'Rechazada'; | ||
$compraVenta->save(); | ||
return back()->with('success','Publicación de Compra/Venta rechazada exitosamente.'); | ||
} | ||
|
||
##Funciones para moderar publicaciones de Tutorías## | ||
//Función para aprobar una publicación de Tutoría. | ||
public function aprobarTutPost($idTutPost){ | ||
$tutoria = Tutorias::where('id', $idTutPost)->first(); | ||
$tutoria->estadoPost = 'Aprobada'; | ||
$tutoria->save(); | ||
return back()->with('success','Publicación de Tutoría aprobada exitosamente.'); | ||
} | ||
|
||
//Función para rechazar una publicación de Tutoría. | ||
public function rechazarTutPost($idTutPost){ | ||
$tutoria = Tutorias::where('id', $idTutPost)->first(); | ||
$tutoria->estadoPost = 'Rechazada'; | ||
$tutoria->save(); | ||
return back()->with('success','Publicación de Tutoría rechazada exitosamente.'); | ||
} | ||
|
||
##Funciones para moderar publicaciones de Alquiler/Hospedaje## | ||
//Función para aprobar una publicación de Alquiler/Hospedaje. | ||
public function aprobarHosPost($idHosPost){ | ||
$hospedaje = Hospedaje::where('id', $idHosPost)->first(); | ||
$hospedaje->estadoPost = 'Aprobada'; | ||
$hospedaje->save(); | ||
return back()->with('success','Publicación de Alquiler/Hospedaje aprobada exitosamente.'); | ||
} | ||
|
||
//Función para rechazar una publicación de Alquiler/Hospedaje. | ||
public function rechazarHosPost($idHosPost){ | ||
$hospedaje = Hospedaje::where('id', $idHosPost)->first(); | ||
$hospedaje->estadoPost = 'Rechazada'; | ||
$hospedaje->save(); | ||
return back()->with('success','Publicación de Alquiler/Hospedaje rechazada exitosamente.'); | ||
} | ||
} |
Oops, something went wrong.