| @@ -2,6 +2,6 @@ | ||
| 2 | 2 | |
| 3 | 3 |  abstract class Event { | 
| 4 | 4 | |
| 5 | - // | |
| 5 | + // | |
| 6 | 6 | |
| 7 | 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,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 | } | 
| @@ -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 | } | 
| @@ -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 | } | 
| @@ -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 | ); | 
| @@ -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 | 
| @@ -5,46 +5,46 @@ | ||
| 5 | 5 | |
| 6 | 6 |  class Authenticate { | 
| 7 | 7 | |
| 8 | - /** | |
| 9 | - * The Guard implementation. | |
| 10 | - * | |
| 11 | - * @var Guard | |
| 12 | - */ | |
| 13 | - protected $auth; | |
| 8 | + /** | |
| 9 | + * The Guard implementation. | |
| 10 | + * | |
| 11 | + * @var Guard | |
| 12 | + */ | |
| 13 | + protected $auth; | |
| 14 | 14 | |
| 15 | - /** | |
| 16 | - * Create a new filter instance. | |
| 17 | - * | |
| 18 | - * @param Guard $auth | |
| 19 | - * @return void | |
| 20 | - */ | |
| 21 | - public function __construct(Guard $auth) | |
| 22 | -	{ | |
| 23 | - $this->auth = $auth; | |
| 24 | - } | |
| 15 | + /** | |
| 16 | + * Create a new filter instance. | |
| 17 | + * | |
| 18 | + * @param Guard $auth | |
| 19 | + * @return void | |
| 20 | + */ | |
| 21 | + public function __construct(Guard $auth) | |
| 22 | +    { | |
| 23 | + $this->auth = $auth; | |
| 24 | + } | |
| 25 | 25 | |
| 26 | - /** | |
| 27 | - * Handle an incoming request. | |
| 28 | - * | |
| 29 | - * @param \Illuminate\Http\Request $request | |
| 30 | - * @param \Closure $next | |
| 31 | - * @return mixed | |
| 32 | - */ | |
| 33 | - public function handle($request, Closure $next) | |
| 34 | -	{ | |
| 35 | - if ($this->auth->guest()) | |
| 36 | -		{ | |
| 37 | - if ($request->ajax()) | |
| 38 | -			{ | |
| 39 | -				return response('Unauthorized.', 401); | |
| 40 | - } | |
| 41 | - else | |
| 42 | -			{ | |
| 43 | -				return redirect()->guest('auth/login'); | |
| 44 | - } | |
| 45 | - } | |
| 26 | + /** | |
| 27 | + * Handle an incoming request. | |
| 28 | + * | |
| 29 | + * @param \Illuminate\Http\Request $request | |
| 30 | + * @param \Closure $next | |
| 31 | + * @return mixed | |
| 32 | + */ | |
| 33 | + public function handle($request, Closure $next) | |
| 34 | +    { | |
| 35 | + if ($this->auth->guest()) | |
| 36 | +        { | |
| 37 | + if ($request->ajax()) | |
| 38 | +            { | |
| 39 | +                return response('Unauthorized.', 401); | |
| 40 | + } | |
| 41 | + else | |
| 42 | +            { | |
| 43 | +                return redirect()->guest('auth/login'); | |
| 44 | + } | |
| 45 | + } | |
| 46 | 46 | |
| 47 | - return $next($request); | |
| 48 | - } | |
| 47 | + return $next($request); | |
| 48 | + } | |
| 49 | 49 | |
| 50 | 50 | } | 
| @@ -4,21 +4,21 @@ | ||
| 4 | 4 | |
| 5 | 5 |  class BrandingHeaders { | 
| 6 | 6 | |
| 7 | - /** | |
| 8 | - * Handle an incoming request. | |
| 9 | - * | |
| 10 | - * @param \Illuminate\Http\Request $request | |
| 11 | - * @param \Closure $next | |
| 12 | - * @return mixed | |
| 13 | - */ | |
| 14 | - public function handle($request, Closure $next) | |
| 15 | -	{ | |
| 7 | + /** | |
| 8 | + * Handle an incoming request. | |
| 9 | + * | |
| 10 | + * @param \Illuminate\Http\Request $request | |
| 11 | + * @param \Closure $next | |
| 12 | + * @return mixed | |
| 13 | + */ | |
| 14 | + public function handle($request, Closure $next) | |
| 15 | +    { | |
| 16 | 16 | //Don't add the header to acs requests | 
| 17 | 17 |          if ((strpos($request->path(), 'access-control/') === 0) || ($request->path() === 'acs') || ($request->path() === 'acs/spark')) { | 
| 18 | 18 | return $next($request); | 
| 19 | 19 | } | 
| 20 | 20 | |
| 21 | -		return $next($request)->header('Built-By', 'arthurguy.co.uk'); | |
| 22 | - } | |
| 21 | +        return $next($request)->header('Built-By', 'arthurguy.co.uk'); | |
| 22 | + } | |
| 23 | 23 | |
| 24 | 24 | } |