Skip to content

Commit 94ce0c7

Browse files
author
Your Name
committed
all
2 parents b9a7c20 + 0847126 commit 94ce0c7

File tree

10,528 files changed

+1920677
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

10,528 files changed

+1920677
-0
lines changed

.DS_Store

6 KB
Binary file not shown.

.gitignore

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/node_modules
2+
/public/hot
3+
/public/storage
4+
/storage/*.key
5+
/vendor
6+
/.idea
7+
/.vscode
8+
/.vagrant
9+
Homestead.json
10+
Homestead.yaml
11+
npm-debug.log
12+
yarn-error.log
13+
.env

app/.DS_Store

6 KB
Binary file not shown.

app/Console/Kernel.php

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
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+
* The Artisan commands provided by your application.
12+
*
13+
* @var array
14+
*/
15+
protected $commands = [
16+
//
17+
];
18+
19+
/**
20+
* Define the application's command schedule.
21+
*
22+
* @param \Illuminate\Console\Scheduling\Schedule $schedule
23+
* @return void
24+
*/
25+
protected function schedule(Schedule $schedule)
26+
{
27+
// $schedule->command('inspire')
28+
// ->hourly();
29+
}
30+
31+
/**
32+
* Register the commands for the application.
33+
*
34+
* @return void
35+
*/
36+
protected function commands()
37+
{
38+
$this->load(__DIR__.'/Commands');
39+
40+
require base_path('routes/console.php');
41+
}
42+
}

app/Exceptions/CsvException.php

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?php namespace App\Exceptions;
2+
3+
use Exception;
4+
5+
class CsvException extends Exception {}

app/Exceptions/CustomException.php

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php namespace App\Exceptions;
2+
3+
use Exception;
4+
5+
class CustomException extends Exception {
6+
public $dataArray;
7+
8+
public function __construct($dataArray, $message, $code, Exception $previous = NULL)
9+
{
10+
parent::__construct($message, $code, $previous);
11+
$this->dataArray = $dataArray;
12+
}
13+
}
14+
// throw new CustomException;

app/Exceptions/Handler.php

+86
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
<?php
2+
3+
namespace App\Exceptions;
4+
5+
use Exception;
6+
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
7+
use Symfony\Component\HttpKernel\Exception\HttpException;
8+
use Illuminate\Database\QueryException;
9+
use App\Exceptions\CustomException;
10+
use App\Exceptions\ImporterException;
11+
use App\Exceptions\CsvException;
12+
13+
class Handler extends ExceptionHandler
14+
{
15+
/**
16+
* A list of the exception types that are not reported.
17+
*
18+
* @var array
19+
*/
20+
protected $dontReport = [
21+
//
22+
];
23+
24+
/**
25+
* A list of the inputs that are never flashed for validation exceptions.
26+
*
27+
* @var array
28+
*/
29+
protected $dontFlash = [
30+
'password',
31+
'password_confirmation',
32+
];
33+
34+
/**
35+
* Report or log an exception.
36+
*
37+
* @param \Exception $exception
38+
* @return void
39+
*/
40+
public function report(Exception $exception)
41+
{
42+
parent::report($exception);
43+
}
44+
45+
/**
46+
* Render an exception into an HTTP response.
47+
*
48+
* @param \Illuminate\Http\Request $request
49+
* @param \Exception $exception
50+
* @return \Illuminate\Http\Response
51+
*/
52+
public function render($request, Exception $exception)
53+
{
54+
55+
56+
$list_desings_ids = array('23000', '500','300','310','404');
57+
58+
if ($exception instanceof CsvException) {
59+
return response()->view('errors.310', [], 300);
60+
}
61+
else if ($exception instanceof CustomException) {
62+
return response()->view('errors.importador', ['exception' => $exception], 300);
63+
}
64+
else if ($exception instanceof ImporterException) {
65+
return response()->view('errors.importador', ['exception' => $exception], 300);
66+
}
67+
else if ($exception instanceof QueryException) {
68+
return response()->view('errors.500', ['exception' => $exception], 300);
69+
70+
}
71+
else if ($exception instanceof HttpException) {
72+
return response()->view('errors.500', ['exception' => $exception], 300);
73+
74+
}
75+
else if(in_array($exception->getCode(), $list_desings_ids))
76+
{
77+
return response()->view('errors.' . $exception->getCode(), ['exception' => $exception]);
78+
79+
}
80+
else {
81+
return parent::render($request, $exception);
82+
}
83+
84+
85+
}
86+
}

app/Exceptions/ImporterException.php

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?php namespace App\Exceptions;
2+
3+
use Exception;
4+
5+
class ImporterException extends Exception {}

app/Http/Controllers/.DS_Store

6 KB
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
<?php
2+
3+
namespace App\Http\Controllers;
4+
5+
use Illuminate\Http\Request;
6+
7+
use App\User;
8+
use App\Http\Requests;
9+
use App\Http\Controllers\Controller;
10+
use Auth;
11+
use DB;
12+
class AdminRESTController extends Controller
13+
{
14+
15+
public function userCountries($idUser)
16+
{
17+
$response = array();
18+
$userCountries = DB::table('user_country')->where('id_user',$idUser)->select('id_country')->get();
19+
foreach ($userCountries as $country) {
20+
array_push($response, $country->id_country);
21+
}
22+
return $response;
23+
}
24+
25+
public function saveUserCountries($userId, Request $request)
26+
{
27+
$request_params = $request->all();
28+
$userId = $userId;
29+
$rowArray = array();
30+
$queryArray = array();
31+
DB::statement('SET FOREIGN_KEY_CHECKS=0;');
32+
DB::table('user_country')->where('id_user', $userId)->delete();
33+
34+
foreach ($request_params as $countryId) {
35+
$rowArray = array('id_user' => $userId, 'id_country' => $countryId);
36+
array_push($queryArray,$rowArray);
37+
}
38+
39+
DB::table('user_country')->insert($queryArray);
40+
DB::statement('SET FOREIGN_KEY_CHECKS=1;');
41+
return;
42+
}
43+
/**
44+
* Display a listing of the resource.
45+
*
46+
* @return Response
47+
*/
48+
public function index()
49+
{
50+
return User::all();
51+
}
52+
53+
/**
54+
* Show the form for creating a new resource.
55+
*
56+
* @return Response
57+
*/
58+
public function create()
59+
{
60+
//
61+
}
62+
63+
/**
64+
* Store a newly created resource in storage.
65+
*
66+
* @param Request $request
67+
* @return Response
68+
*/
69+
public function store(Request $request)
70+
{
71+
//
72+
}
73+
74+
/**
75+
* Display the specified resource.
76+
*
77+
* @param int $id
78+
* @return Response
79+
*/
80+
public function show($id)
81+
{
82+
//
83+
}
84+
85+
/**
86+
* Show the form for editing the specified resource.
87+
*
88+
* @param int $id
89+
* @return Response
90+
*/
91+
public function edit($id)
92+
{
93+
//
94+
}
95+
96+
/**
97+
* Update the specified resource in storage.
98+
*
99+
* @param Request $request
100+
* @param int $id
101+
* @return Response
102+
*/
103+
public function update(Request $request, $id)
104+
{
105+
//
106+
}
107+
108+
/**
109+
* Remove the specified resource from storage.
110+
*
111+
* @param int $id
112+
* @return Response
113+
*/
114+
public function destroy($id)
115+
{
116+
//
117+
}
118+
119+
public function logged(){
120+
return Auth::user();
121+
}
122+
}

app/Http/Controllers/Auth/.DS_Store

6 KB
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
<?php
2+
3+
namespace App\Http\Controllers\Auth;
4+
5+
use App\User;
6+
use Validator;
7+
8+
use Illuminate\Http\Request;
9+
10+
use App\User;
11+
use App\Http\Controllers\Controller;
12+
13+
14+
use Illuminate\Contracts\Auth\Guard;
15+
16+
class AuthController extends Controller {
17+
/*
18+
|--------------------------------------------------------------------------
19+
| Registration & Login Controller
20+
|--------------------------------------------------------------------------
21+
|
22+
| This controller handles the registration of new users, as well as the
23+
| authentication of existing users. By default, this controller uses
24+
| a simple trait to add these behaviors. Why don't you explore it?
25+
|
26+
*/
27+
// protected $redirectTo = '/panel';
28+
protected $redirectTo = '/confirmation-email';
29+
30+
/**
31+
* Create a new authentication controller instance.
32+
*
33+
* @param \Illuminate\Contracts\Auth\Guard $auth
34+
* @param \Illuminate\Contracts\Auth\Registrar $registrar
35+
* @return void
36+
*/
37+
public function __construct(Guard $auth)
38+
{
39+
$this->auth = $auth;
40+
$this->middleware('guest', ['except' => ['getLogout', 'getRegister', 'postRegister']]);
41+
}
42+
/**
43+
* Show the application registration form.
44+
*
45+
* @return \Illuminate\Http\Response
46+
*/
47+
public function getRegister()
48+
{
49+
return $this->showRegistrationForm();
50+
}
51+
public function postRegister(Request $request)
52+
{
53+
$validator = $this->validator($request->all());
54+
55+
if ($validator->fails()) {
56+
$this->throwValidationException(
57+
$request, $validator
58+
);
59+
}
60+
61+
// Removed to prevent auto login
62+
//Auth::guard($this->getGuard())->login($this->create($request->all()));
63+
$this->create($request->all());
64+
65+
66+
return redirect($this->redirectPath());
67+
}
68+
/**
69+
* Show the application registration form.
70+
*
71+
* @return \Illuminate\Http\Response
72+
*/
73+
public function showRegistrationForm()
74+
{
75+
if (property_exists($this, 'registerView')) {
76+
return view($this->registerView);
77+
}
78+
79+
return view('auth.register');
80+
}
81+
}

0 commit comments

Comments
 (0)