@@ -9,9 +9,9 @@ discard block |
||
9 | 9 | |
10 | 10 | class ReportController extends Controller |
11 | 11 | { |
12 | - private $model; |
|
12 | + private $model; |
|
13 | 13 | |
14 | - /** |
|
14 | + /** |
|
15 | 15 | * Create a new controller instance. |
16 | 16 | * |
17 | 17 | * @return void |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | $validator = \Validator::make($request->all(), $rules); |
32 | 32 | |
33 | 33 | if ($validator->fails()) { |
34 | - return response()->json(['status' => 'error', 'errors' => $validator->errors()]); |
|
34 | + return response()->json(['status' => 'error', 'errors' => $validator->errors()]); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | $user = $this->model->where('id', $request->user()->id)->first(); |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | $validator = \Validator::make($request->all(), $rules); |
88 | 88 | |
89 | 89 | if ($validator->fails()) { |
90 | - return response()->json(['status' => 'error', 'errors' => $validator->errors()]); |
|
90 | + return response()->json(['status' => 'error', 'errors' => $validator->errors()]); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | $user = $this->model->where('id', $request->user()->id)->first(); |
@@ -11,40 +11,40 @@ |
||
11 | 11 | |
12 | 12 | class RegisterController extends Controller |
13 | 13 | { |
14 | - public function register(Request $request) |
|
15 | - { |
|
16 | - $rules = [ |
|
17 | - 'name' => 'required', |
|
18 | - 'email' => 'required|email|unique:users,email', |
|
19 | - 'password' => 'required|string|min:6|confirmed', |
|
20 | - ]; |
|
14 | + public function register(Request $request) |
|
15 | + { |
|
16 | + $rules = [ |
|
17 | + 'name' => 'required', |
|
18 | + 'email' => 'required|email|unique:users,email', |
|
19 | + 'password' => 'required|string|min:6|confirmed', |
|
20 | + ]; |
|
21 | 21 | |
22 | - $validator = \Validator::make($request->all(), $rules); |
|
22 | + $validator = \Validator::make($request->all(), $rules); |
|
23 | 23 | |
24 | - if ($validator->fails()) { |
|
25 | - return response()->json(['status' => 'error', 'errors' => $validator->errors()], 422); |
|
26 | - } |
|
24 | + if ($validator->fails()) { |
|
25 | + return response()->json(['status' => 'error', 'errors' => $validator->errors()], 422); |
|
26 | + } |
|
27 | 27 | |
28 | - $data = $request->all(); |
|
28 | + $data = $request->all(); |
|
29 | 29 | |
30 | - $token = str_random(50); |
|
30 | + $token = str_random(50); |
|
31 | 31 | |
32 | - $user = new User; |
|
33 | - $user->name = $data['name']; |
|
34 | - $user->email = $data['email']; |
|
35 | - $user->password = bcrypt($data['password']); |
|
36 | - $user->image = '/profiles/default.png'; |
|
37 | - $user->token = $token; |
|
38 | - $user->save(); |
|
32 | + $user = new User; |
|
33 | + $user->name = $data['name']; |
|
34 | + $user->email = $data['email']; |
|
35 | + $user->password = bcrypt($data['password']); |
|
36 | + $user->image = '/profiles/default.png'; |
|
37 | + $user->token = $token; |
|
38 | + $user->save(); |
|
39 | 39 | |
40 | - $url = config('app.url_frontend_react') . "/confirmation/{$token}"; |
|
40 | + $url = config('app.url_frontend_react') . "/confirmation/{$token}"; |
|
41 | 41 | |
42 | - $user->notify(new RegisterNotification($user, $token, $url)); |
|
42 | + $user->notify(new RegisterNotification($user, $token, $url)); |
|
43 | 43 | |
44 | - return response()->json(['status' => 'success', 'message' => 'Conta criada com sucesso, verifique seu e-mail para ativar seu cadastro.']); |
|
45 | - } |
|
44 | + return response()->json(['status' => 'success', 'message' => 'Conta criada com sucesso, verifique seu e-mail para ativar seu cadastro.']); |
|
45 | + } |
|
46 | 46 | |
47 | - public function confirmation($token) |
|
47 | + public function confirmation($token) |
|
48 | 48 | { |
49 | 49 | $user = User::where('token', $token)->first(); |
50 | 50 |
@@ -9,12 +9,12 @@ |
||
9 | 9 | |
10 | 10 | class LoginController extends Controller |
11 | 11 | { |
12 | - public function logout() |
|
13 | - { |
|
14 | - if (\Auth::check()) { |
|
15 | - \Auth::user()->oauthAccessToken()->delete(); |
|
16 | - } |
|
12 | + public function logout() |
|
13 | + { |
|
14 | + if (\Auth::check()) { |
|
15 | + \Auth::user()->oauthAccessToken()->delete(); |
|
16 | + } |
|
17 | 17 | |
18 | - return response()->json(['status' => 'success', 'message' => 'Logout realizado com sucesso']); |
|
19 | - } |
|
18 | + return response()->json(['status' => 'success', 'message' => 'Logout realizado com sucesso']); |
|
19 | + } |
|
20 | 20 | } |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | |
13 | 13 | class PasswordResetController extends Controller |
14 | 14 | { |
15 | - /** |
|
15 | + /** |
|
16 | 16 | * Create token password reset |
17 | 17 | * |
18 | 18 | * @param [string] email |
@@ -20,31 +20,31 @@ discard block |
||
20 | 20 | */ |
21 | 21 | public function forget(Request $request) |
22 | 22 | { |
23 | - $rules = [ |
|
24 | - 'email' => 'required|string|email', |
|
25 | - ]; |
|
23 | + $rules = [ |
|
24 | + 'email' => 'required|string|email', |
|
25 | + ]; |
|
26 | 26 | |
27 | - $validator = \Validator::make($request->all(), $rules); |
|
27 | + $validator = \Validator::make($request->all(), $rules); |
|
28 | 28 | |
29 | - if ($validator->fails()) { |
|
30 | - return response()->json(['status' => 'error', 'errors' => $validator->errors()], 422); |
|
31 | - } |
|
29 | + if ($validator->fails()) { |
|
30 | + return response()->json(['status' => 'error', 'errors' => $validator->errors()], 422); |
|
31 | + } |
|
32 | 32 | |
33 | - $user = User::where('email', $request->email)->first(); |
|
33 | + $user = User::where('email', $request->email)->first(); |
|
34 | 34 | |
35 | 35 | if (!$user) { |
36 | - return response()->json(['status' => 'error', 'message' => 'Não encontramos nenhum usuário com esse endereço de e-mail.']); |
|
36 | + return response()->json(['status' => 'error', 'message' => 'Não encontramos nenhum usuário com esse endereço de e-mail.']); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | $passwordReset = PasswordResetApi::updateOrCreate([ |
40 | - 'email' => $user->email |
|
40 | + 'email' => $user->email |
|
41 | 41 | ],[ |
42 | - 'email' => $user->email, |
|
43 | - 'token' => str_random(60) |
|
42 | + 'email' => $user->email, |
|
43 | + 'token' => str_random(60) |
|
44 | 44 | ]); |
45 | 45 | |
46 | 46 | if ($user && $passwordReset) { |
47 | - $user->notify(new PasswordResetRequest($passwordReset->token)); |
|
47 | + $user->notify(new PasswordResetRequest($passwordReset->token)); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | return response()->json(['status' => 'success', 'message' => 'O link para redefinição de senha foi enviado para o seu e-mail!']); |
@@ -59,10 +59,10 @@ discard block |
||
59 | 59 | */ |
60 | 60 | public function showReset($token) |
61 | 61 | { |
62 | - $passwordReset = PasswordResetApi::where('token', $token)->first(); |
|
62 | + $passwordReset = PasswordResetApi::where('token', $token)->first(); |
|
63 | 63 | |
64 | 64 | if (!$passwordReset) { |
65 | - return response()->json(['status' => 'error', 'message' => 'O token para recuperação de senha é inválido.']); |
|
65 | + return response()->json(['status' => 'error', 'message' => 'O token para recuperação de senha é inválido.']); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | if (Carbon::parse($passwordReset->updated_at)->addMinutes(720)->isPast()) { |
@@ -87,17 +87,17 @@ discard block |
||
87 | 87 | */ |
88 | 88 | public function reset(Request $request) |
89 | 89 | { |
90 | - $rules = [ |
|
91 | - 'email' => 'required|string|email', |
|
90 | + $rules = [ |
|
91 | + 'email' => 'required|string|email', |
|
92 | 92 | 'password' => 'required|string|confirmed', |
93 | 93 | 'token' => 'required|string' |
94 | - ]; |
|
94 | + ]; |
|
95 | 95 | |
96 | - $validator = \Validator::make($request->all(), $rules); |
|
96 | + $validator = \Validator::make($request->all(), $rules); |
|
97 | 97 | |
98 | - if ($validator->fails()) { |
|
99 | - return response()->json(['status' => 'error', 'errors' => $validator->errors()], 422); |
|
100 | - } |
|
98 | + if ($validator->fails()) { |
|
99 | + return response()->json(['status' => 'error', 'errors' => $validator->errors()], 422); |
|
100 | + } |
|
101 | 101 | |
102 | 102 | $passwordReset = PasswordResetApi::where([ |
103 | 103 | ['token', $request->token], |
@@ -105,13 +105,13 @@ discard block |
||
105 | 105 | ])->first(); |
106 | 106 | |
107 | 107 | if (!$passwordReset) { |
108 | - return response()->json(['status' => 'error', 'message' => 'O token para recuperação de senha é inválido.']); |
|
108 | + return response()->json(['status' => 'error', 'message' => 'O token para recuperação de senha é inválido.']); |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | $user = User::where('email', $passwordReset->email)->first(); |
112 | 112 | |
113 | 113 | if (!$user) { |
114 | - return response()->json(['status' => 'error', 'message' => 'Não podemos encontrar um usuário com esse endereço de e-mail.']); |
|
114 | + return response()->json(['status' => 'error', 'message' => 'Não podemos encontrar um usuário com esse endereço de e-mail.']); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | $user->password = bcrypt($request->password); |
@@ -38,7 +38,7 @@ |
||
38 | 38 | |
39 | 39 | $passwordReset = PasswordResetApi::updateOrCreate([ |
40 | 40 | 'email' => $user->email |
41 | - ],[ |
|
41 | + ], [ |
|
42 | 42 | 'email' => $user->email, |
43 | 43 | 'token' => str_random(60) |
44 | 44 | ]); |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | |
8 | 8 | class ReportController extends Controller |
9 | 9 | { |
10 | - /** |
|
10 | + /** |
|
11 | 11 | * Create a new controller instance. |
12 | 12 | * |
13 | 13 | * @return void |
@@ -19,13 +19,13 @@ discard block |
||
19 | 19 | |
20 | 20 | public function statement() |
21 | 21 | { |
22 | - $statements = []; |
|
23 | - return view('report.statement', compact('statements')); |
|
22 | + $statements = []; |
|
23 | + return view('report.statement', compact('statements')); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | public function getStatementByPeriod(Request $request) |
27 | 27 | { |
28 | - $this->validate($request, [ |
|
28 | + $this->validate($request, [ |
|
29 | 29 | 'dateStart' => 'required|date', |
30 | 30 | 'dateEnd' => 'required|date', |
31 | 31 | ]); |
@@ -54,8 +54,8 @@ discard block |
||
54 | 54 | |
55 | 55 | public function charts() |
56 | 56 | { |
57 | - $categories = []; |
|
58 | - return view('report.charts', compact('categories')); |
|
57 | + $categories = []; |
|
58 | + return view('report.charts', compact('categories')); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | public function sumChartsByPeriod(Request $request) |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | $total_pays = $billPays->sum('value'); |
50 | 50 | $total_receives = $billReceives->sum('value'); |
51 | 51 | |
52 | - return view('report.statement', compact('billPays','billReceives','total_pays','total_receives','statements')); |
|
52 | + return view('report.statement', compact('billPays', 'billReceives', 'total_pays', 'total_receives', 'statements')); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | public function charts() |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | ->where('status', '1') |
85 | 85 | ->get(); |
86 | 86 | |
87 | - return view('report.charts', compact('categoriesPay','categoriesReceive')); |
|
87 | + return view('report.charts', compact('categoriesPay', 'categoriesReceive')); |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | } |
@@ -22,12 +22,12 @@ |
||
22 | 22 | */ |
23 | 23 | public function user() |
24 | 24 | { |
25 | - return $this->belongsTo('App\User'); |
|
25 | + return $this->belongsTo('App\User'); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | public function getCreatedAtAttribute($value) |
29 | 29 | { |
30 | - $data = date('H:i d/m/Y', strtotime($value)); |
|
31 | - return str_replace(':', 'h', $data); |
|
30 | + $data = date('H:i d/m/Y', strtotime($value)); |
|
31 | + return str_replace(':', 'h', $data); |
|
32 | 32 | } |
33 | 33 | } |
@@ -10,16 +10,16 @@ |
||
10 | 10 | |
11 | 11 | public function user() |
12 | 12 | { |
13 | - return $this->belongsTo('App\User'); |
|
13 | + return $this->belongsTo('App\User'); |
|
14 | 14 | } |
15 | 15 | |
16 | 16 | public function pays() |
17 | 17 | { |
18 | - return $this->hasMany('App\BillPay'); |
|
18 | + return $this->hasMany('App\BillPay'); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | public function receives() |
22 | 22 | { |
23 | - return $this->hasMany('App\BillReceive'); |
|
23 | + return $this->hasMany('App\BillReceive'); |
|
24 | 24 | } |
25 | 25 | } |
@@ -52,8 +52,8 @@ discard block |
||
52 | 52 | protected function mapWebRoutes() |
53 | 53 | { |
54 | 54 | Route::middleware('web') |
55 | - ->namespace($this->namespace) |
|
56 | - ->group(base_path('routes/web.php')); |
|
55 | + ->namespace($this->namespace) |
|
56 | + ->group(base_path('routes/web.php')); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | /** |
@@ -66,8 +66,8 @@ discard block |
||
66 | 66 | protected function mapApiRoutes() |
67 | 67 | { |
68 | 68 | Route::prefix('api') |
69 | - ->middleware('api') |
|
70 | - ->namespace($this->namespace) |
|
71 | - ->group(base_path('routes/api.php')); |
|
69 | + ->middleware('api') |
|
70 | + ->namespace($this->namespace) |
|
71 | + ->group(base_path('routes/api.php')); |
|
72 | 72 | } |
73 | 73 | } |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | */ |
23 | 23 | public function user() |
24 | 24 | { |
25 | - return $this->belongsTo('App\User'); |
|
25 | + return $this->belongsTo('App\User'); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | /** |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | */ |
33 | 33 | public function likes() |
34 | 34 | { |
35 | - return $this->belongsToMany('App\User', 'likes', 'content_id', 'user_id'); |
|
35 | + return $this->belongsToMany('App\User', 'likes', 'content_id', 'user_id'); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | /** |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | |
49 | 49 | public function getPublishedAtAttribute($value) |
50 | 50 | { |
51 | - $data = date('H:i d/m/Y', strtotime($value)); |
|
52 | - return str_replace(':', 'h', $data); |
|
51 | + $data = date('H:i d/m/Y', strtotime($value)); |
|
52 | + return str_replace(':', 'h', $data); |
|
53 | 53 | } |
54 | 54 | } |