@@ -6,7 +6,7 @@ |
||
| 6 | 6 | |
| 7 | 7 | class PasswordResetApi extends Model |
| 8 | 8 | { |
| 9 | - protected $table = 'password_resets_api'; |
|
| 9 | + protected $table = 'password_resets_api'; |
|
| 10 | 10 | |
| 11 | 11 | protected $fillable = ['email', 'token']; |
| 12 | 12 | } |
@@ -71,7 +71,7 @@ |
||
| 71 | 71 | { |
| 72 | 72 | $categories = auth()->user()->categories()->get(); |
| 73 | 73 | $bill_receive = auth()->user()->bill_receives()->findOrFail($id); |
| 74 | - return view('bill_receives.edit', compact('bill_receive','categories')); |
|
| 74 | + return view('bill_receives.edit', compact('bill_receive', 'categories')); |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | /** |
@@ -72,7 +72,7 @@ |
||
| 72 | 72 | { |
| 73 | 73 | $categories = auth()->user()->categories()->get(); |
| 74 | 74 | $bill_pay = auth()->user()->bill_pays()->findOrFail($id); |
| 75 | - return view('bill_pays.edit', compact('bill_pay','categories')); |
|
| 75 | + return view('bill_pays.edit', compact('bill_pay', 'categories')); |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | /** |
@@ -90,7 +90,7 @@ |
||
| 90 | 90 | { |
| 91 | 91 | $this->validate($request, [ |
| 92 | 92 | 'name' => 'required|string|max:255', |
| 93 | - 'email' => 'required|string|email|max:255|unique:users,email,'.$id |
|
| 93 | + 'email' => 'required|string|email|max:255|unique:users,email,' . $id |
|
| 94 | 94 | ]); |
| 95 | 95 | |
| 96 | 96 | $user = $this->user->whereNotIn('id', [auth()->user()->id, 1])->findOrFail($id); |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | */ |
| 25 | 25 | public function index() |
| 26 | 26 | { |
| 27 | - $dateStart = date('Y-m-d', mktime(0, 0, 0, date('m')-1 , 1 , date('Y'))); |
|
| 27 | + $dateStart = date('Y-m-d', mktime(0, 0, 0, date('m') - 1, 1, date('Y'))); |
|
| 28 | 28 | $dateEnd = date('Y-m-d', mktime(23, 59, 59, date('m'), date("t"), date('Y'))); |
| 29 | 29 | |
| 30 | 30 | $billPays = auth()->user()->bill_pays()->selectRaw('bill_pays.*, categories.name as category_name') |
@@ -61,6 +61,6 @@ discard block |
||
| 61 | 61 | ->where('status', '1') |
| 62 | 62 | ->get(); |
| 63 | 63 | |
| 64 | - return view('home', compact('billPays','billReceives','total_pays','total_receives','categoriesPay','categoriesReceive','dateStart','dateEnd','statements')); |
|
| 64 | + return view('home', compact('billPays', 'billReceives', 'total_pays', 'total_receives', 'categoriesPay', 'categoriesReceive', 'dateStart', 'dateEnd', 'statements')); |
|
| 65 | 65 | } |
| 66 | 66 | } |
@@ -8,9 +8,9 @@ discard block |
||
| 8 | 8 | |
| 9 | 9 | class AuthController extends Controller |
| 10 | 10 | { |
| 11 | - private $model; |
|
| 11 | + private $model; |
|
| 12 | 12 | |
| 13 | - /** |
|
| 13 | + /** |
|
| 14 | 14 | * Create a new controller instance. |
| 15 | 15 | * |
| 16 | 16 | * @return void |
@@ -20,37 +20,37 @@ discard block |
||
| 20 | 20 | $this->model = $model; |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | - public function profile(Request $request) |
|
| 24 | - { |
|
| 25 | - $user = $this->model->where('id', $request->user()->id)->first(); |
|
| 23 | + public function profile(Request $request) |
|
| 24 | + { |
|
| 25 | + $user = $this->model->where('id', $request->user()->id)->first(); |
|
| 26 | 26 | |
| 27 | - if (!$user) { |
|
| 28 | - return response()->json(['status' => 'error', 'message' => 'Opss. Usuário não foi encontrado, favor verifique se esta logado.']); |
|
| 29 | - } |
|
| 27 | + if (!$user) { |
|
| 28 | + return response()->json(['status' => 'error', 'message' => 'Opss. Usuário não foi encontrado, favor verifique se esta logado.']); |
|
| 29 | + } |
|
| 30 | 30 | |
| 31 | 31 | //$user->image = asset($user->image); |
| 32 | 32 | |
| 33 | - return response()->json(['status' => 'success', 'data' => $user]); |
|
| 34 | - } |
|
| 33 | + return response()->json(['status' => 'success', 'data' => $user]); |
|
| 34 | + } |
|
| 35 | 35 | |
| 36 | - public function profileUpdate(Request $request) |
|
| 37 | - { |
|
| 38 | - $user = User::where('id', $request->user()->id)->first(); |
|
| 36 | + public function profileUpdate(Request $request) |
|
| 37 | + { |
|
| 38 | + $user = User::where('id', $request->user()->id)->first(); |
|
| 39 | 39 | |
| 40 | - if (!$user) { |
|
| 41 | - return response()->json(['status' => 'error', 'message' => 'Opss. Usuário não foi encontrado, favor verifique se esta logado.']); |
|
| 42 | - } |
|
| 40 | + if (!$user) { |
|
| 41 | + return response()->json(['status' => 'error', 'message' => 'Opss. Usuário não foi encontrado, favor verifique se esta logado.']); |
|
| 42 | + } |
|
| 43 | 43 | |
| 44 | 44 | $rules = [ |
| 45 | 45 | 'name' => 'required', |
| 46 | - 'email' => 'required|email|unique:users,email,' . $request->user()->id, |
|
| 47 | - 'password' => 'required|string|min:6|confirmed', |
|
| 46 | + 'email' => 'required|email|unique:users,email,' . $request->user()->id, |
|
| 47 | + 'password' => 'required|string|min:6|confirmed', |
|
| 48 | 48 | ]; |
| 49 | 49 | |
| 50 | - $validator = \Validator::make($request->all(), $rules); |
|
| 50 | + $validator = \Validator::make($request->all(), $rules); |
|
| 51 | 51 | |
| 52 | 52 | if ($validator->fails()) { |
| 53 | - return response()->json(['status' => 'error', 'errors' => $validator->errors()]); |
|
| 53 | + return response()->json(['status' => 'error', 'errors' => $validator->errors()]); |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | /* |
@@ -59,41 +59,41 @@ discard block |
||
| 59 | 59 | } |
| 60 | 60 | */ |
| 61 | 61 | |
| 62 | - $data = [ |
|
| 63 | - 'name' => $request->input('name'), |
|
| 64 | - 'email' => $request->input('email'), |
|
| 65 | - 'password' => bcrypt($request->input('password')), |
|
| 66 | - ]; |
|
| 62 | + $data = [ |
|
| 63 | + 'name' => $request->input('name'), |
|
| 64 | + 'email' => $request->input('email'), |
|
| 65 | + 'password' => bcrypt($request->input('password')), |
|
| 66 | + ]; |
|
| 67 | 67 | |
| 68 | 68 | if ($request->image) { |
| 69 | - $time = time(); |
|
| 70 | - $directoryPai = 'profiles'; |
|
| 71 | - $directoryImage = $directoryPai . DIRECTORY_SEPARATOR . 'profile_id_' . $user->id; |
|
| 72 | - $ext = substr($request->image, 11, strpos($request->image, ';') - 11); |
|
| 73 | - $urlImage = $directoryImage . DIRECTORY_SEPARATOR . $time . '.' . $ext; |
|
| 74 | - $file = str_replace('data:image/' . $ext . ';base64,', '', $request->image); |
|
| 75 | - $file = base64_decode($file); |
|
| 69 | + $time = time(); |
|
| 70 | + $directoryPai = 'profiles'; |
|
| 71 | + $directoryImage = $directoryPai . DIRECTORY_SEPARATOR . 'profile_id_' . $user->id; |
|
| 72 | + $ext = substr($request->image, 11, strpos($request->image, ';') - 11); |
|
| 73 | + $urlImage = $directoryImage . DIRECTORY_SEPARATOR . $time . '.' . $ext; |
|
| 74 | + $file = str_replace('data:image/' . $ext . ';base64,', '', $request->image); |
|
| 75 | + $file = base64_decode($file); |
|
| 76 | 76 | |
| 77 | - if (!file_exists($directoryPai)) { |
|
| 77 | + if (!file_exists($directoryPai)) { |
|
| 78 | 78 | mkdir($directoryPai, 0777); |
| 79 | - } |
|
| 80 | - if ($user->image) { |
|
| 79 | + } |
|
| 80 | + if ($user->image) { |
|
| 81 | 81 | $imgUser = str_replace(asset('/'), '', $user->image); |
| 82 | 82 | if (file_exists($imgUser)) { |
| 83 | - unlink($imgUser); |
|
| 83 | + unlink($imgUser); |
|
| 84 | + } |
|
| 84 | 85 | } |
| 85 | - } |
|
| 86 | - if (!file_exists($directoryImage)) { |
|
| 86 | + if (!file_exists($directoryImage)) { |
|
| 87 | 87 | mkdir($directoryImage, 0777); |
| 88 | - } |
|
| 88 | + } |
|
| 89 | 89 | |
| 90 | - file_put_contents($urlImage, $file); |
|
| 91 | - $data['image'] = $urlImage; |
|
| 90 | + file_put_contents($urlImage, $file); |
|
| 91 | + $data['image'] = $urlImage; |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | - $user->update($data); |
|
| 94 | + $user->update($data); |
|
| 95 | 95 | //$user->image = asset($user->image); |
| 96 | 96 | |
| 97 | - return response()->json(['status' => 'success', 'data' => $user]); |
|
| 98 | - } |
|
| 97 | + return response()->json(['status' => 'success', 'data' => $user]); |
|
| 98 | + } |
|
| 99 | 99 | } |
| 100 | 100 | \ No newline at end of file |
@@ -8,9 +8,9 @@ discard block |
||
| 8 | 8 | |
| 9 | 9 | class BillReceiveController extends Controller |
| 10 | 10 | { |
| 11 | - private $model; |
|
| 11 | + private $model; |
|
| 12 | 12 | |
| 13 | - /** |
|
| 13 | + /** |
|
| 14 | 14 | * Create a new controller instance. |
| 15 | 15 | * |
| 16 | 16 | * @return void |
@@ -24,13 +24,13 @@ discard block |
||
| 24 | 24 | { |
| 25 | 25 | $user = $this->model->where('id', $request->user()->id)->first(); |
| 26 | 26 | |
| 27 | - if (!$user) { |
|
| 28 | - return response()->json(['status' => 'error', 'message' => 'Opss. Usuário não foi encontrado, favor verifique se esta logado.']); |
|
| 29 | - } |
|
| 27 | + if (!$user) { |
|
| 28 | + return response()->json(['status' => 'error', 'message' => 'Opss. Usuário não foi encontrado, favor verifique se esta logado.']); |
|
| 29 | + } |
|
| 30 | 30 | |
| 31 | - $bill_receives = $user->bill_receives()->with('category')->get(); |
|
| 31 | + $bill_receives = $user->bill_receives()->with('category')->get(); |
|
| 32 | 32 | |
| 33 | - return response()->json(['status' => 'success', 'data' => $bill_receives]); |
|
| 33 | + return response()->json(['status' => 'success', 'data' => $bill_receives]); |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | public function store(Request $request) |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | $validator = \Validator::make($request->all(), $rules); |
| 47 | 47 | |
| 48 | 48 | if ($validator->fails()) { |
| 49 | - return response()->json(['status' => 'error', 'errors' => $validator->errors()], 422); |
|
| 49 | + return response()->json(['status' => 'error', 'errors' => $validator->errors()], 422); |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | $user = $this->model->where('id', $request->user()->id)->first(); |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | public function show(Request $request, $id) |
| 64 | 64 | { |
| 65 | 65 | if (!$id) { |
| 66 | - return response()->json(['status' => 'error', 'message' => 'Conta a receber não informada']); |
|
| 66 | + return response()->json(['status' => 'error', 'message' => 'Conta a receber não informada']); |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | $user = $this->model->where('id', $request->user()->id)->first(); |
@@ -94,11 +94,11 @@ discard block |
||
| 94 | 94 | $validator = \Validator::make($request->all(), $rules); |
| 95 | 95 | |
| 96 | 96 | if ($validator->fails()) { |
| 97 | - return response()->json(['status' => 'error', 'errors' => $validator->errors()], 422); |
|
| 97 | + return response()->json(['status' => 'error', 'errors' => $validator->errors()], 422); |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | if (!$id) { |
| 101 | - return response()->json(['status' => 'error', 'message' => 'Conta a receber não informada']); |
|
| 101 | + return response()->json(['status' => 'error', 'message' => 'Conta a receber não informada']); |
|
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | $user = $this->model->where('id', $request->user()->id)->first(); |
@@ -127,11 +127,11 @@ discard block |
||
| 127 | 127 | $validator = \Validator::make($request->all(), $rules); |
| 128 | 128 | |
| 129 | 129 | if ($validator->fails()) { |
| 130 | - return response()->json(['status' => 'error', 'errors' => $validator->errors()], 422); |
|
| 130 | + return response()->json(['status' => 'error', 'errors' => $validator->errors()], 422); |
|
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | if (!$id) { |
| 134 | - return response()->json(['status' => 'error', 'message' => 'Conta a receber não informada']); |
|
| 134 | + return response()->json(['status' => 'error', 'message' => 'Conta a receber não informada']); |
|
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | $user = $this->model->where('id', $request->user()->id)->first(); |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | public function destroy(Request $request, $id) |
| 155 | 155 | { |
| 156 | 156 | if (!$id) { |
| 157 | - return response()->json(['status' => 'error', 'message' => 'Conta a receber não informada']); |
|
| 157 | + return response()->json(['status' => 'error', 'message' => 'Conta a receber não informada']); |
|
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | $user = $this->model->where('id', $request->user()->id)->first(); |
@@ -8,9 +8,9 @@ discard block |
||
| 8 | 8 | |
| 9 | 9 | class BillPayController extends Controller |
| 10 | 10 | { |
| 11 | - private $model; |
|
| 11 | + private $model; |
|
| 12 | 12 | |
| 13 | - /** |
|
| 13 | + /** |
|
| 14 | 14 | * Create a new controller instance. |
| 15 | 15 | * |
| 16 | 16 | * @return void |
@@ -24,13 +24,13 @@ discard block |
||
| 24 | 24 | { |
| 25 | 25 | $user = $this->model->where('id', $request->user()->id)->first(); |
| 26 | 26 | |
| 27 | - if (!$user) { |
|
| 28 | - return response()->json(['status' => 'error', 'message' => 'Opss. Usuário não foi encontrado, favor verifique se esta logado.']); |
|
| 29 | - } |
|
| 27 | + if (!$user) { |
|
| 28 | + return response()->json(['status' => 'error', 'message' => 'Opss. Usuário não foi encontrado, favor verifique se esta logado.']); |
|
| 29 | + } |
|
| 30 | 30 | |
| 31 | - $bill_pays = $user->bill_pays()->with('category')->get(); |
|
| 31 | + $bill_pays = $user->bill_pays()->with('category')->get(); |
|
| 32 | 32 | |
| 33 | - return response()->json(['status' => 'success', 'data' => $bill_pays]); |
|
| 33 | + return response()->json(['status' => 'success', 'data' => $bill_pays]); |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | public function store(Request $request) |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | $validator = \Validator::make($request->all(), $rules); |
| 46 | 46 | |
| 47 | 47 | if ($validator->fails()) { |
| 48 | - return response()->json(['status' => 'error', 'errors' => $validator->errors()], 422); |
|
| 48 | + return response()->json(['status' => 'error', 'errors' => $validator->errors()], 422); |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | $user = $this->model->where('id', $request->user()->id)->first(); |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | public function show(Request $request, $id) |
| 63 | 63 | { |
| 64 | 64 | if (!$id) { |
| 65 | - return response()->json(['status' => 'error', 'message' => 'Conta a pagar não informada']); |
|
| 65 | + return response()->json(['status' => 'error', 'message' => 'Conta a pagar não informada']); |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | $user = $this->model->where('id', $request->user()->id)->first(); |
@@ -93,11 +93,11 @@ discard block |
||
| 93 | 93 | $validator = \Validator::make($request->all(), $rules); |
| 94 | 94 | |
| 95 | 95 | if ($validator->fails()) { |
| 96 | - return response()->json(['status' => 'error', 'errors' => $validator->errors()], 422); |
|
| 96 | + return response()->json(['status' => 'error', 'errors' => $validator->errors()], 422); |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | if (!$id) { |
| 100 | - return response()->json(['status' => 'error', 'message' => 'Conta a pagar não informada']); |
|
| 100 | + return response()->json(['status' => 'error', 'message' => 'Conta a pagar não informada']); |
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | $user = $this->model->where('id', $request->user()->id)->first(); |
@@ -126,11 +126,11 @@ discard block |
||
| 126 | 126 | $validator = \Validator::make($request->all(), $rules); |
| 127 | 127 | |
| 128 | 128 | if ($validator->fails()) { |
| 129 | - return response()->json(['status' => 'error', 'errors' => $validator->errors()], 422); |
|
| 129 | + return response()->json(['status' => 'error', 'errors' => $validator->errors()], 422); |
|
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | if (!$id) { |
| 133 | - return response()->json(['status' => 'error', 'message' => 'Conta a pagar não informada']); |
|
| 133 | + return response()->json(['status' => 'error', 'message' => 'Conta a pagar não informada']); |
|
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | $user = $this->model->where('id', $request->user()->id)->first(); |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | public function destroy(Request $request, $id) |
| 154 | 154 | { |
| 155 | 155 | if (!$id) { |
| 156 | - return response()->json(['status' => 'error', 'message' => 'Conta a pagar não informada']); |
|
| 156 | + return response()->json(['status' => 'error', 'message' => 'Conta a pagar não informada']); |
|
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | $user = $this->model->where('id', $request->user()->id)->first(); |
@@ -8,9 +8,9 @@ discard block |
||
| 8 | 8 | |
| 9 | 9 | class CategoryController extends Controller |
| 10 | 10 | { |
| 11 | - private $model; |
|
| 11 | + private $model; |
|
| 12 | 12 | |
| 13 | - /** |
|
| 13 | + /** |
|
| 14 | 14 | * Create a new controller instance. |
| 15 | 15 | * |
| 16 | 16 | * @return void |
@@ -24,13 +24,13 @@ discard block |
||
| 24 | 24 | { |
| 25 | 25 | $user = $this->model->where('id', $request->user()->id)->first(); |
| 26 | 26 | |
| 27 | - if (!$user) { |
|
| 28 | - return response()->json(['status' => 'error', 'message' => 'Opss. Usuário não foi encontrado, favor verifique se esta logado.']); |
|
| 29 | - } |
|
| 27 | + if (!$user) { |
|
| 28 | + return response()->json(['status' => 'error', 'message' => 'Opss. Usuário não foi encontrado, favor verifique se esta logado.']); |
|
| 29 | + } |
|
| 30 | 30 | |
| 31 | - $categories = $user->categories()->get(); |
|
| 31 | + $categories = $user->categories()->get(); |
|
| 32 | 32 | |
| 33 | - return response()->json(['status' => 'success', 'data' => $categories]); |
|
| 33 | + return response()->json(['status' => 'success', 'data' => $categories]); |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | public function store(Request $request) |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | $validator = \Validator::make($request->all(), $rules); |
| 43 | 43 | |
| 44 | 44 | if ($validator->fails()) { |
| 45 | - return response()->json(['status' => 'error', 'errors' => $validator->errors()], 422); |
|
| 45 | + return response()->json(['status' => 'error', 'errors' => $validator->errors()], 422); |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | $user = $this->model->where('id', $request->user()->id)->first(); |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | public function show(Request $request, $id) |
| 60 | 60 | { |
| 61 | 61 | if (!$id) { |
| 62 | - return response()->json(['status' => 'error', 'message' => 'Categoria não informada']); |
|
| 62 | + return response()->json(['status' => 'error', 'message' => 'Categoria não informada']); |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | $user = $this->model->where('id', $request->user()->id)->first(); |
@@ -86,11 +86,11 @@ discard block |
||
| 86 | 86 | $validator = \Validator::make($request->all(), $rules); |
| 87 | 87 | |
| 88 | 88 | if ($validator->fails()) { |
| 89 | - return response()->json(['status' => 'error', 'errors' => $validator->errors()], 422); |
|
| 89 | + return response()->json(['status' => 'error', 'errors' => $validator->errors()], 422); |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | if (!$id) { |
| 93 | - return response()->json(['status' => 'error', 'message' => 'Categoria não informada']); |
|
| 93 | + return response()->json(['status' => 'error', 'message' => 'Categoria não informada']); |
|
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | $user = $this->model->where('id', $request->user()->id)->first(); |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | public function destroy(Request $request, $id) |
| 114 | 114 | { |
| 115 | 115 | if (!$id) { |
| 116 | - return response()->json(['status' => 'error', 'message' => 'Categoria não informada']); |
|
| 116 | + return response()->json(['status' => 'error', 'message' => 'Categoria não informada']); |
|
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | $user = $this->model->where('id', $request->user()->id)->first(); |