Skip to content
This repository has been archived by the owner on Apr 12, 2020. It is now read-only.

Entrega Proyecto 1 #26

Open
wants to merge 41 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
10905e0
ultimo commit
gaston95 Apr 30, 2019
e0f2abb
Procfile for Heroku
gaston95 Apr 30, 2019
556c445
Update database.php
gaston95 Apr 30, 2019
6a8ed21
Update database.php
gaston95 Apr 30, 2019
e8399e1
Update database.php
gaston95 Apr 30, 2019
c30e50e
Update database.php
gaston95 May 1, 2019
11f7104
Ultimo commit
gaston95 May 1, 2019
852d757
agrega categorias
gaston95 May 1, 2019
ef32a4b
Agrega Categoria
gaston95 May 1, 2019
46632f3
Update ColeccionController.php
gaston95 May 1, 2019
d3bfc99
Update ColeccionController.php
gaston95 May 1, 2019
e87a6c7
Update ColeccionController.php
gaston95 May 1, 2019
ddb2e25
Update ColeccionController.php
gaston95 May 1, 2019
3140e5a
Update ColeccionController.php
gaston95 May 1, 2019
2edb3c5
Update CategoriaController.php
gaston95 May 1, 2019
e0b824e
Update home.blade.php
gaston95 May 1, 2019
f838fe1
Modificiaciones
gaston95 May 5, 2019
07a1135
Update web.php
gaston95 May 6, 2019
d25d6fd
Update Coleccion.blade.php
gaston95 May 6, 2019
abcb729
Update Coleccion.blade.php
gaston95 May 6, 2019
dc0917c
Update LoginController.php
gaston95 May 7, 2019
33a7c8c
Update User.php
gaston95 May 7, 2019
49bb30d
Update home.blade.php
gaston95 May 7, 2019
116b7dc
Update home.blade.php
gaston95 May 7, 2019
23775b1
Update Coleccion.blade.php
gaston95 May 7, 2019
75d3894
Update 2014_10_12_000000_create_users_table.php
gaston95 May 7, 2019
1f7435c
Create 2019_05_07_193029_datos_c.php
gaston95 May 7, 2019
5fd159e
Update categoria.php
gaston95 May 7, 2019
e91656e
Modificaciones route
gaston95 May 7, 2019
eb4dec6
Listo
gaston95 May 7, 2019
f6a32f8
Final
gaston95 May 7, 2019
47521e8
Update edit.blade.php
gaston95 May 7, 2019
560842c
Update home.blade.php
gaston95 May 9, 2019
abe0e92
Update User.php
gaston95 May 9, 2019
f664633
Update LoginController.php
gaston95 May 9, 2019
98a6ce3
Update login.blade.php
gaston95 May 9, 2019
2f69230
9/5/19
gaston95 May 9, 2019
4aec5ba
18:05
gaston95 May 9, 2019
ae6331f
mod seguridad
gaston95 May 9, 2019
6c0b41b
Update ColeccionController.php
gaston95 May 9, 2019
3046f8f
Update CategoriaController.php
gaston95 May 9, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

web: vendor/bin/heroku-php-apache2 public/
39 changes: 38 additions & 1 deletion app/Http/Controllers/Auth/LoginController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@

use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\AuthenticatesUsers;

use Socialite;//esti
use App\User;
class LoginController extends Controller
{
/*
Expand All @@ -20,6 +21,42 @@ class LoginController extends Controller

use AuthenticatesUsers;

/** clase usada por socialite
* redirect (): se encarga de enviar al usuario al proveedor de OAuth
*
* @return \Illuminate\Http\Response
*/
public function redirectToProvider($provider)
{
return Socialite::driver($provider)->redirect();
}

/**
*
* user () : leerá la solicitud entrante y recuperará la información del usuario del proveedor.
* @return \Illuminate\Http\Response
*/
public function handleProviderCallback($provider)
{

$user = Socialite::driver($provider)->user();

$createUser = User::FirstOrCreate(
[
'email' => $user->getEmail()
],
[
'name' => $user->getName()

]);
auth()->login($createUser);
return redirect('/home');




}

/**
* Where to redirect users after login.
*
Expand Down
127 changes: 127 additions & 0 deletions app/Http/Controllers/CategoriaController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\auto;
use App\Http\Request\CategoriaFormRequest;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\DB;
class CategoriaController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
return "hola desde el controlador";
}

/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
//
}

/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request,$id)
{

if(Auth::id()==$id)
{
$Auto=new auto();//nuestro modelo
$Auto->id=Auth::id();
if(!empty($request->input('name')) and !empty($request->input('cv')))
{
$Auto->auto=$request->input('name');
$Auto->categoria=$request->input('categoria');
$Auto->cv=$request->input('cv');
$Auto->publico=false;
$Auto->save();
}
}
else
abort(403,"403 usuario no autorizado");
return redirect('/home');

}

/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function BuscarPorCategoria($name)
{
return $name;
}

/**
* Show the form for editing the specified resource.
*Compruebo si esta publico lo hago privado y si esta privado lo hago publico
* @param int $id
* @return \Illuminate\Http\Response
*/
public function edit($nom,$id)
{
$idAuto= DB::select('select id from autos where auto=:nom and id=:id', ['nom' => $nom,'id'=>$id]);

if(Auth::user()->id==$idAuto[0]->id)
{
$publico=DB::select ('select publico from autos where auto =:nom and id =:id',['nom'=>$nom,'id'=> Auth::id(),]);

if($publico[0]->publico==0)
$caters = DB::select('update autos Set publico = :dat where id = :id and auto = :nom', ['dat' => true,'nom'=>$nom,'id'=> Auth::id()]);
else
$caters = DB::select('update autos Set publico = :dat where id = :id and auto = :nom', ['dat' => false,'nom'=>$nom,'id'=> Auth::id()]);
}
else
abort(403,"403 usuario no autorizado");

return redirect('home');

}

/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
{
//no
}

/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy($nom,$cate,$id)
{

$idAuto= DB::select('select id from autos where categoria= :cate and auto=:nom and id=:id', ['nom' => $nom,'cate'=>$cate,'id'=>$id]);

if(Auth::user()->id==$idAuto[0]->id)
$caters = DB::select('delete from autos where categoria= :cate and auto=:nom and id=:id', ['nom' => $nom,'cate'=>$cate,'id'=>$id]);
else
abort(403,"403 usuario no autorizado");
return redirect('home');

}
}
105 changes: 105 additions & 0 deletions app/Http/Controllers/ColeccionController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

/*use App\Http\Request;*/
use App\Http\Controllers\Controller;
use App\User;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Auth;
use App\Http\Request\ColeccionFormRequest;

//use App\Categoria;
use App\categoria;

class ColeccionController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index($id)
{
$caters = DB::select('select categoria from categorias ');
$autos = DB::select('select auto ,categoria,cv from autos where id = :id and publico =:dat' , ['id' => $id, 'dat' => true]);
return view('Coleccion', ['caters' => $caters ,'autos' => $autos ]);

}

/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
//
}

/**
* Store a newly created resource in storage.
* quedo la implementacion para agregar las categorias pero
* por decision de implementacion se estrablecieron 3 categorias por defecto
* por lo que no se realizan los chequeos de autenticacion
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
if(!empty($request->input('name')))
{
$categoria=new categoria();//nuestro modelo
$categoria->categoria=$request->input('name');
$categoria->save();
}
return redirect('/home');
}

/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
//
}

/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function edit($id)
{
//
}

/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
{
//
}

/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
//
}
}
36 changes: 36 additions & 0 deletions app/Http/Controllers/HomeController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\DB;


class HomeController extends Controller
{
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('auth');
}

/**
* Show the application dashboard.
*
* @return \Illuminate\Contracts\Support\Renderable
*/
public function index()
{
//$caters = DB::select('select categoria from categorias where id='Auth::id()'', [1]);
$caters = DB::select('select categoria from categorias ');
$autos = DB::select('select auto ,categoria,cv,publico from autos where id = :id', ['id' => Auth::id()]);
return view('home', ['caters' => $caters ,'autos' => $autos ]);
//return view('home', ['caters' => $caters ]);
// return view('home');
}
}
18 changes: 18 additions & 0 deletions app/Http/Controllers/PersonalController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

class PersonalController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
return view('Persona');
}
}
10 changes: 10 additions & 0 deletions app/Http/Controllers/SocialAuthController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

class SocialAuthController extends Controller
{
//
}
Loading