@@ -35,7 +35,8 @@ |
||
| 35 | 35 | * @param string $hash |
| 36 | 36 | * @return Notification |
| 37 | 37 | */ |
| 38 | - public static function logNew($userId, $message, $type, $hash) { |
|
| 38 | + public static function logNew($userId, $message, $type, $hash) |
|
| 39 | + { |
|
| 39 | 40 | $existingNotifications = Notification::where('user_id', $userId)->where('hash', $hash)->first(); |
| 40 | 41 | if ($existingNotifications) { |
| 41 | 42 | return $existingNotifications; |
@@ -18,7 +18,8 @@ |
||
| 18 | 18 | return $this->belongsToMany('\BB\Entities\User')->withTimestamps(); |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | - public static function findByName($name) { |
|
| 21 | + public static function findByName($name) |
|
| 22 | + { |
|
| 22 | 23 | $role = self::where('name', $name)->first(); |
| 23 | 24 | if ($role) { |
| 24 | 25 | return $role; |
@@ -2,6 +2,6 @@ |
||
| 2 | 2 | |
| 3 | 3 | abstract class Event { |
| 4 | 4 | |
| 5 | - // |
|
| 5 | + // |
|
| 6 | 6 | |
| 7 | 7 | } |
@@ -1,6 +1,7 @@ |
||
| 1 | 1 | <?php namespace BB\Events; |
| 2 | 2 | |
| 3 | -abstract class Event { |
|
| 3 | +abstract class Event |
|
| 4 | +{ |
|
| 4 | 5 | |
| 5 | 6 | // |
| 6 | 7 | |
@@ -9,43 +9,43 @@ discard block |
||
| 9 | 9 | |
| 10 | 10 | class Handler extends ExceptionHandler { |
| 11 | 11 | |
| 12 | - /** |
|
| 13 | - * A list of the exception types that should not be reported. |
|
| 14 | - * |
|
| 15 | - * @var array |
|
| 16 | - */ |
|
| 17 | - protected $dontReport = [ |
|
| 12 | + /** |
|
| 13 | + * A list of the exception types that should not be reported. |
|
| 14 | + * |
|
| 15 | + * @var array |
|
| 16 | + */ |
|
| 17 | + protected $dontReport = [ |
|
| 18 | 18 | HttpException::class, |
| 19 | 19 | NotFoundHttpException::class, |
| 20 | 20 | ModelNotFoundException::class, |
| 21 | 21 | MethodNotAllowedHttpException::class, |
| 22 | 22 | FormValidationException::class, |
| 23 | 23 | AuthenticationException::class, //These are logged separately below |
| 24 | - ]; |
|
| 24 | + ]; |
|
| 25 | 25 | |
| 26 | - /** |
|
| 27 | - * Report or log an exception. |
|
| 28 | - * |
|
| 29 | - * This is a great spot to send exceptions to Sentry, Bugsnag, etc. |
|
| 30 | - * |
|
| 31 | - * @param \Exception $e |
|
| 32 | - * @return void |
|
| 33 | - */ |
|
| 34 | - public function report(Exception $e) |
|
| 35 | - { |
|
| 26 | + /** |
|
| 27 | + * Report or log an exception. |
|
| 28 | + * |
|
| 29 | + * This is a great spot to send exceptions to Sentry, Bugsnag, etc. |
|
| 30 | + * |
|
| 31 | + * @param \Exception $e |
|
| 32 | + * @return void |
|
| 33 | + */ |
|
| 34 | + public function report(Exception $e) |
|
| 35 | + { |
|
| 36 | 36 | //The parent will log exceptions that aren't of the types above |
| 37 | - parent::report($e); |
|
| 38 | - } |
|
| 37 | + parent::report($e); |
|
| 38 | + } |
|
| 39 | 39 | |
| 40 | - /** |
|
| 41 | - * Render an exception into an HTTP response. |
|
| 42 | - * |
|
| 43 | - * @param \Illuminate\Http\Request $request |
|
| 44 | - * @param \Exception $e |
|
| 45 | - * @return \Illuminate\Http\Response |
|
| 46 | - */ |
|
| 47 | - public function render($request, Exception $e) |
|
| 48 | - { |
|
| 40 | + /** |
|
| 41 | + * Render an exception into an HTTP response. |
|
| 42 | + * |
|
| 43 | + * @param \Illuminate\Http\Request $request |
|
| 44 | + * @param \Exception $e |
|
| 45 | + * @return \Illuminate\Http\Response |
|
| 46 | + */ |
|
| 47 | + public function render($request, Exception $e) |
|
| 48 | + { |
|
| 49 | 49 | if ($e instanceof FormValidationException) { |
| 50 | 50 | if ($request->wantsJson()) { |
| 51 | 51 | return \Response::json($e->getErrors(), 422); |
@@ -92,8 +92,8 @@ discard block |
||
| 92 | 92 | return \Response::json(['error' => $e->getMessage()], $e->getStatusCode()); |
| 93 | 93 | } |
| 94 | 94 | } |
| 95 | - return parent::render($request, $e); |
|
| 96 | - } |
|
| 95 | + return parent::render($request, $e); |
|
| 96 | + } |
|
| 97 | 97 | |
| 98 | 98 | /** |
| 99 | 99 | * Render an exception using Whoops. |
@@ -7,7 +7,8 @@ discard block |
||
| 7 | 7 | use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException; |
| 8 | 8 | use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; |
| 9 | 9 | |
| 10 | -class Handler extends ExceptionHandler { |
|
| 10 | +class Handler extends ExceptionHandler |
|
| 11 | +{ |
|
| 11 | 12 | |
| 12 | 13 | /** |
| 13 | 14 | * A list of the exception types that should not be reported. |
@@ -82,8 +83,7 @@ discard block |
||
| 82 | 83 | $e = new HttpException(404, $e->getMessage()); |
| 83 | 84 | } |
| 84 | 85 | |
| 85 | - if (config('app.debug') && $this->shouldReport($e) && !$request->wantsJson()) |
|
| 86 | - { |
|
| 86 | + if (config('app.debug') && $this->shouldReport($e) && !$request->wantsJson()) { |
|
| 87 | 87 | return $this->renderExceptionWithWhoops($e); |
| 88 | 88 | } |
| 89 | 89 | |
@@ -7,7 +7,7 @@ discard block |
||
| 7 | 7 | |
| 8 | 8 | class AuthController extends Controller { |
| 9 | 9 | |
| 10 | - /* |
|
| 10 | + /* |
|
| 11 | 11 | |-------------------------------------------------------------------------- |
| 12 | 12 | | Registration & Login Controller |
| 13 | 13 | |-------------------------------------------------------------------------- |
@@ -18,21 +18,21 @@ discard block |
||
| 18 | 18 | | |
| 19 | 19 | */ |
| 20 | 20 | |
| 21 | - use AuthenticatesAndRegistersUsers; |
|
| 21 | + use AuthenticatesAndRegistersUsers; |
|
| 22 | 22 | |
| 23 | - /** |
|
| 24 | - * Create a new authentication controller instance. |
|
| 25 | - * |
|
| 26 | - * @param \Illuminate\Contracts\Auth\Guard $auth |
|
| 27 | - * @param \Illuminate\Contracts\Auth\Registrar $registrar |
|
| 28 | - * @return void |
|
| 29 | - */ |
|
| 30 | - public function __construct(Guard $auth, Registrar $registrar) |
|
| 31 | - { |
|
| 32 | - $this->auth = $auth; |
|
| 33 | - $this->registrar = $registrar; |
|
| 23 | + /** |
|
| 24 | + * Create a new authentication controller instance. |
|
| 25 | + * |
|
| 26 | + * @param \Illuminate\Contracts\Auth\Guard $auth |
|
| 27 | + * @param \Illuminate\Contracts\Auth\Registrar $registrar |
|
| 28 | + * @return void |
|
| 29 | + */ |
|
| 30 | + public function __construct(Guard $auth, Registrar $registrar) |
|
| 31 | + { |
|
| 32 | + $this->auth = $auth; |
|
| 33 | + $this->registrar = $registrar; |
|
| 34 | 34 | |
| 35 | - $this->middleware('guest', ['except' => 'getLogout']); |
|
| 36 | - } |
|
| 35 | + $this->middleware('guest', ['except' => 'getLogout']); |
|
| 36 | + } |
|
| 37 | 37 | |
| 38 | 38 | } |
@@ -5,7 +5,8 @@ |
||
| 5 | 5 | use Illuminate\Contracts\Auth\Registrar; |
| 6 | 6 | use Illuminate\Foundation\Auth\AuthenticatesAndRegistersUsers; |
| 7 | 7 | |
| 8 | -class AuthController extends Controller { |
|
| 8 | +class AuthController extends Controller |
|
| 9 | +{ |
|
| 9 | 10 | |
| 10 | 11 | /* |
| 11 | 12 | |-------------------------------------------------------------------------- |
@@ -6,6 +6,6 @@ |
||
| 6 | 6 | |
| 7 | 7 | abstract class Controller extends BaseController { |
| 8 | 8 | |
| 9 | - use DispatchesCommands, ValidatesRequests; |
|
| 9 | + use DispatchesCommands, ValidatesRequests; |
|
| 10 | 10 | |
| 11 | 11 | } |
@@ -4,7 +4,8 @@ |
||
| 4 | 4 | use Illuminate\Routing\Controller as BaseController; |
| 5 | 5 | use Illuminate\Foundation\Validation\ValidatesRequests; |
| 6 | 6 | |
| 7 | -abstract class Controller extends BaseController { |
|
| 7 | +abstract class Controller extends BaseController |
|
| 8 | +{ |
|
| 8 | 9 | |
| 9 | 10 | use DispatchesCommands, ValidatesRequests; |
| 10 | 11 | |
@@ -33,8 +33,8 @@ discard block |
||
| 33 | 33 | * @return Response |
| 34 | 34 | * @throws \BB\Exceptions\AuthenticationException |
| 35 | 35 | */ |
| 36 | - public function index() |
|
| 37 | - { |
|
| 36 | + public function index() |
|
| 37 | + { |
|
| 38 | 38 | $userId = \Request::get('user_id', ''); |
| 39 | 39 | $sortBy = \Request::get('sortBy', 'created_at'); |
| 40 | 40 | $direction = \Request::get('direction', 'desc'); |
@@ -49,18 +49,18 @@ discard block |
||
| 49 | 49 | $expenses = $this->expenseRepository->getPaginated(compact('sortBy', 'direction')); |
| 50 | 50 | |
| 51 | 51 | return \View::make('expenses.index')->with('expenses', $expenses); |
| 52 | - } |
|
| 52 | + } |
|
| 53 | 53 | |
| 54 | 54 | |
| 55 | - /** |
|
| 56 | - * Show the form for creating a new resource. |
|
| 57 | - * |
|
| 58 | - * @return Response |
|
| 59 | - */ |
|
| 60 | - public function create() |
|
| 61 | - { |
|
| 62 | - // |
|
| 63 | - } |
|
| 55 | + /** |
|
| 56 | + * Show the form for creating a new resource. |
|
| 57 | + * |
|
| 58 | + * @return Response |
|
| 59 | + */ |
|
| 60 | + public function create() |
|
| 61 | + { |
|
| 62 | + // |
|
| 63 | + } |
|
| 64 | 64 | |
| 65 | 65 | |
| 66 | 66 | /** |
@@ -70,9 +70,9 @@ discard block |
||
| 70 | 70 | * @throws ImageFailedException |
| 71 | 71 | * @throws \BB\Exceptions\FormValidationException |
| 72 | 72 | */ |
| 73 | - public function store() |
|
| 74 | - { |
|
| 75 | - $data = \Request::only(['user_id', 'category', 'description', 'amount', 'expense_date', 'file']); |
|
| 73 | + public function store() |
|
| 74 | + { |
|
| 75 | + $data = \Request::only(['user_id', 'category', 'description', 'amount', 'expense_date', 'file']); |
|
| 76 | 76 | |
| 77 | 77 | $this->expenseValidator->validate($data); |
| 78 | 78 | |
@@ -107,31 +107,31 @@ discard block |
||
| 107 | 107 | event(new NewExpenseSubmitted($expense)); |
| 108 | 108 | |
| 109 | 109 | return \Response::json($expense, 201); |
| 110 | - } |
|
| 110 | + } |
|
| 111 | 111 | |
| 112 | 112 | |
| 113 | - /** |
|
| 114 | - * Display the specified resource. |
|
| 115 | - * |
|
| 116 | - * @param int $id |
|
| 117 | - * @return Response |
|
| 118 | - */ |
|
| 119 | - public function show($id) |
|
| 120 | - { |
|
| 121 | - return \BB\Entities\Expense::findOrFail($id); |
|
| 122 | - } |
|
| 113 | + /** |
|
| 114 | + * Display the specified resource. |
|
| 115 | + * |
|
| 116 | + * @param int $id |
|
| 117 | + * @return Response |
|
| 118 | + */ |
|
| 119 | + public function show($id) |
|
| 120 | + { |
|
| 121 | + return \BB\Entities\Expense::findOrFail($id); |
|
| 122 | + } |
|
| 123 | 123 | |
| 124 | 124 | |
| 125 | - /** |
|
| 126 | - * Show the form for editing the specified resource. |
|
| 127 | - * |
|
| 128 | - * @param int $id |
|
| 129 | - * @return Response |
|
| 130 | - */ |
|
| 131 | - public function edit($id) |
|
| 132 | - { |
|
| 133 | - // |
|
| 134 | - } |
|
| 125 | + /** |
|
| 126 | + * Show the form for editing the specified resource. |
|
| 127 | + * |
|
| 128 | + * @param int $id |
|
| 129 | + * @return Response |
|
| 130 | + */ |
|
| 131 | + public function edit($id) |
|
| 132 | + { |
|
| 133 | + // |
|
| 134 | + } |
|
| 135 | 135 | |
| 136 | 136 | |
| 137 | 137 | /** |
@@ -141,8 +141,8 @@ discard block |
||
| 141 | 141 | * @return Response |
| 142 | 142 | * @throws \BB\Exceptions\AuthenticationException |
| 143 | 143 | */ |
| 144 | - public function update($id) |
|
| 145 | - { |
|
| 144 | + public function update($id) |
|
| 145 | + { |
|
| 146 | 146 | /** |
| 147 | 147 | if (\Request::ajax()) { |
| 148 | 148 | $data = \Request::only(['category', 'description', 'amount', 'expense_date']); |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | |
| 153 | 153 | return $expense; |
| 154 | 154 | } |
| 155 | - */ |
|
| 155 | + */ |
|
| 156 | 156 | |
| 157 | 157 | if ( ! \Auth::user()->hasRole('admin')) { |
| 158 | 158 | throw new \BB\Exceptions\AuthenticationException(); |
@@ -167,20 +167,20 @@ discard block |
||
| 167 | 167 | } |
| 168 | 168 | |
| 169 | 169 | return \Redirect::route('expenses.index'); |
| 170 | - } |
|
| 170 | + } |
|
| 171 | 171 | |
| 172 | 172 | |
| 173 | - /** |
|
| 174 | - * Remove the specified resource from storage. |
|
| 175 | - * |
|
| 176 | - * @param int $id |
|
| 177 | - * @return Response |
|
| 178 | - */ |
|
| 179 | - public function destroy($id) |
|
| 180 | - { |
|
| 173 | + /** |
|
| 174 | + * Remove the specified resource from storage. |
|
| 175 | + * |
|
| 176 | + * @param int $id |
|
| 177 | + * @return Response |
|
| 178 | + */ |
|
| 179 | + public function destroy($id) |
|
| 180 | + { |
|
| 181 | 181 | //$expense = \BB\Entities\Expense::findOrFail($id); |
| 182 | 182 | //$expense->delete(); |
| 183 | - } |
|
| 183 | + } |
|
| 184 | 184 | |
| 185 | 185 | |
| 186 | 186 | } |
@@ -6,7 +6,8 @@ |
||
| 6 | 6 | use Illuminate\Support\Facades\Response; |
| 7 | 7 | use Illuminate\Support\Facades\Storage; |
| 8 | 8 | |
| 9 | -class ExpensesController extends Controller { |
|
| 9 | +class ExpensesController extends Controller |
|
| 10 | +{ |
|
| 10 | 11 | |
| 11 | 12 | /** |
| 12 | 13 | * @var \BB\Validators\ExpenseValidator |
@@ -9,16 +9,16 @@ discard block |
||
| 9 | 9 | class ReminderController extends Controller |
| 10 | 10 | { |
| 11 | 11 | |
| 12 | - /** |
|
| 13 | - * Display the password reminder view. |
|
| 14 | - * |
|
| 15 | - * @return Response |
|
| 16 | - */ |
|
| 17 | - public function create() |
|
| 18 | - { |
|
| 12 | + /** |
|
| 13 | + * Display the password reminder view. |
|
| 14 | + * |
|
| 15 | + * @return Response |
|
| 16 | + */ |
|
| 17 | + public function create() |
|
| 18 | + { |
|
| 19 | 19 | |
| 20 | 20 | return view('password.create'); |
| 21 | - } |
|
| 21 | + } |
|
| 22 | 22 | |
| 23 | 23 | /** |
| 24 | 24 | * Handle a POST request to remind a user of their password. |
@@ -26,8 +26,8 @@ discard block |
||
| 26 | 26 | * @param Request $request |
| 27 | 27 | * @return \Illuminate\Http\RedirectResponse|null |
| 28 | 28 | */ |
| 29 | - public function store(Request $request) |
|
| 30 | - { |
|
| 29 | + public function store(Request $request) |
|
| 30 | + { |
|
| 31 | 31 | $validator = app('Illuminate\Contracts\Validation\Factory')->make($request->all(), ['email' => 'required|email']); |
| 32 | 32 | if ($validator->fails()) { |
| 33 | 33 | throw new FormValidationException('Error', $validator->errors()); |
@@ -39,31 +39,31 @@ discard block |
||
| 39 | 39 | }); |
| 40 | 40 | |
| 41 | 41 | switch ($response) { |
| 42 | - case Password::INVALID_USER: |
|
| 42 | + case Password::INVALID_USER: |
|
| 43 | 43 | \Notification::error(trans($response)); |
| 44 | 44 | return redirect()->back(); |
| 45 | 45 | |
| 46 | - case Password::RESET_LINK_SENT: |
|
| 46 | + case Password::RESET_LINK_SENT: |
|
| 47 | 47 | \Notification::success(trans($response)); |
| 48 | 48 | return redirect()->back(); |
| 49 | - } |
|
| 50 | - } |
|
| 51 | - |
|
| 52 | - /** |
|
| 53 | - * Display the password reset view for the given token. |
|
| 54 | - * |
|
| 55 | - * @param string $token |
|
| 56 | - * @return Response |
|
| 57 | - */ |
|
| 58 | - public function getReset($token = null) |
|
| 59 | - { |
|
| 49 | + } |
|
| 50 | + } |
|
| 51 | + |
|
| 52 | + /** |
|
| 53 | + * Display the password reset view for the given token. |
|
| 54 | + * |
|
| 55 | + * @param string $token |
|
| 56 | + * @return Response |
|
| 57 | + */ |
|
| 58 | + public function getReset($token = null) |
|
| 59 | + { |
|
| 60 | 60 | if (is_null($token)) |
| 61 | 61 | { |
| 62 | 62 | throw new NotFoundHttpException; |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | return view('password.reset')->with('token', $token); |
| 66 | - } |
|
| 66 | + } |
|
| 67 | 67 | |
| 68 | 68 | /** |
| 69 | 69 | * Handle a POST request to reset a user's password. |
@@ -71,8 +71,8 @@ discard block |
||
| 71 | 71 | * @param Request $request |
| 72 | 72 | * @return \Illuminate\Http\RedirectResponse|null |
| 73 | 73 | */ |
| 74 | - public function postReset(Request $request) |
|
| 75 | - { |
|
| 74 | + public function postReset(Request $request) |
|
| 75 | + { |
|
| 76 | 76 | $credentials = $request->only( |
| 77 | 77 | 'email', 'password', 'password_confirmation', 'token' |
| 78 | 78 | ); |
@@ -33,8 +33,7 @@ discard block |
||
| 33 | 33 | throw new FormValidationException('Error', $validator->errors()); |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - $response = Password::sendResetLink($request->only('email'), function(Message $message) |
|
| 37 | - { |
|
| 36 | + $response = Password::sendResetLink($request->only('email'), function(Message $message) { |
|
| 38 | 37 | $message->subject('Reset your password'); |
| 39 | 38 | }); |
| 40 | 39 | |
@@ -57,8 +56,7 @@ discard block |
||
| 57 | 56 | */ |
| 58 | 57 | public function getReset($token = null) |
| 59 | 58 | { |
| 60 | - if (is_null($token)) |
|
| 61 | - { |
|
| 59 | + if (is_null($token)) { |
|
| 62 | 60 | throw new NotFoundHttpException; |
| 63 | 61 | } |
| 64 | 62 | |
@@ -16,27 +16,27 @@ discard block |
||
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | |
| 19 | - /** |
|
| 20 | - * Show the form for creating a new resource. |
|
| 21 | - * |
|
| 22 | - * @return Response |
|
| 23 | - */ |
|
| 24 | - public function create() |
|
| 25 | - { |
|
| 19 | + /** |
|
| 20 | + * Show the form for creating a new resource. |
|
| 21 | + * |
|
| 22 | + * @return Response |
|
| 23 | + */ |
|
| 24 | + public function create() |
|
| 25 | + { |
|
| 26 | 26 | if ( ! Auth::guest()) { |
| 27 | 27 | return redirect()->to('account/' . \Auth::id()); |
| 28 | 28 | } |
| 29 | 29 | return \View::make('session.create'); |
| 30 | - } |
|
| 30 | + } |
|
| 31 | 31 | |
| 32 | 32 | |
| 33 | - /** |
|
| 34 | - * Store a newly created resource in storage. |
|
| 35 | - * |
|
| 36 | - * @return \Illuminate\Http\RedirectResponse |
|
| 37 | - */ |
|
| 38 | - public function store() |
|
| 39 | - { |
|
| 33 | + /** |
|
| 34 | + * Store a newly created resource in storage. |
|
| 35 | + * |
|
| 36 | + * @return \Illuminate\Http\RedirectResponse |
|
| 37 | + */ |
|
| 38 | + public function store() |
|
| 39 | + { |
|
| 40 | 40 | $input = \Input::only('email', 'password'); |
| 41 | 41 | |
| 42 | 42 | $this->loginForm->validate($input); |
@@ -47,23 +47,23 @@ discard block |
||
| 47 | 47 | |
| 48 | 48 | \Notification::error("Invalid login details"); |
| 49 | 49 | return redirect()->back()->withInput(); |
| 50 | - } |
|
| 50 | + } |
|
| 51 | 51 | |
| 52 | 52 | |
| 53 | - /** |
|
| 54 | - * Remove the specified resource from storage. |
|
| 55 | - * |
|
| 56 | - * @param int $id |
|
| 57 | - * @return \Illuminate\Http\RedirectResponse |
|
| 58 | - */ |
|
| 59 | - public function destroy($id = null) |
|
| 60 | - { |
|
| 53 | + /** |
|
| 54 | + * Remove the specified resource from storage. |
|
| 55 | + * |
|
| 56 | + * @param int $id |
|
| 57 | + * @return \Illuminate\Http\RedirectResponse |
|
| 58 | + */ |
|
| 59 | + public function destroy($id = null) |
|
| 60 | + { |
|
| 61 | 61 | Auth::logout(); |
| 62 | 62 | |
| 63 | 63 | \Notification::success('Logged Out'); |
| 64 | 64 | |
| 65 | 65 | return redirect()->home(); |
| 66 | - } |
|
| 66 | + } |
|
| 67 | 67 | |
| 68 | 68 | /** |
| 69 | 69 | * @param Request $request |