├── public ├── favicon.ico ├── robots.txt ├── .htaccess └── index.php ├── app ├── Listeners │ └── .gitkeep ├── Policies │ └── .gitkeep ├── Events │ └── Event.php ├── Http │ ├── Requests │ │ └── Request.php │ ├── Middleware │ │ ├── EncryptCookies.php │ │ ├── VerifyCsrfToken.php │ │ ├── RedirectIfAuthenticated.php │ │ └── Authenticate.php │ ├── Controllers │ │ ├── Controller.php │ │ ├── Auth │ │ │ ├── PasswordController.php │ │ │ └── AuthController.php │ │ ├── TaxesController.php │ │ ├── DashboardController.php │ │ ├── VendorsController.php │ │ ├── AccountsController.php │ │ ├── CategoriesController.php │ │ └── TransactionsController.php │ ├── routes.php │ └── Kernel.php ├── Vendor.php ├── Category.php ├── Account.php ├── Providers │ ├── AppServiceProvider.php │ ├── AuthServiceProvider.php │ ├── EventServiceProvider.php │ └── RouteServiceProvider.php ├── Transaction.php ├── Jobs │ └── Job.php ├── Console │ ├── Commands │ │ └── Inspire.php │ └── Kernel.php ├── User.php └── Exceptions │ └── Handler.php ├── database ├── seeds │ ├── .gitkeep │ └── DatabaseSeeder.php ├── migrations │ ├── .gitkeep │ ├── 2015_11_22_120935_add_accounts_relationship_column.php │ ├── 2014_10_12_100000_create_password_resets_table.php │ ├── 2015_11_22_120516_create_accounts_table.php │ ├── 2015_11_18_042110_create_categories_table.php │ ├── 2014_10_12_000000_create_users_table.php │ ├── 2015_11_18_042058_create_vendors_table.php │ └── 2015_11_16_051726_create_transactions_table.php ├── .gitignore └── factories │ └── ModelFactory.php ├── bootstrap ├── cache │ └── .gitkeep ├── autoload.php └── app.php ├── resources ├── assets │ └── sass │ │ ├── global.scss │ │ └── bootstrap.scss ├── views │ ├── partials │ │ ├── alerts.blade.php │ │ └── validationErrors.blade.php │ ├── taxes │ │ └── index.blade.php │ ├── dashboard │ │ └── index.blade.php │ ├── errors │ │ └── 503.blade.php │ ├── vendors │ │ ├── index.blade.php │ │ └── showOrUpdate.blade.php │ ├── accounts │ │ ├── index.blade.php │ │ └── showOrUpdate.blade.php │ ├── categories │ │ ├── index.blade.php │ │ └── showOrUpdate.blade.php │ ├── transactions │ │ ├── index.blade.php │ │ └── createOrShowOrUpdate.blade.php │ └── layouts │ │ └── master.blade.php └── lang │ └── en │ ├── pagination.php │ ├── auth.php │ ├── passwords.php │ └── validation.php ├── .gitattributes ├── phpspec.yml ├── package.json ├── .gitignore ├── .env.example ├── bower.json ├── tests ├── ExampleTest.php └── TestCase.php ├── README.md ├── server.php ├── phpunit.xml ├── gulpfile.js ├── config ├── compile.php ├── services.php ├── view.php ├── broadcasting.php ├── cache.php ├── auth.php ├── filesystems.php ├── queue.php ├── database.php ├── mail.php ├── session.php └── app.php ├── composer.json └── artisan /public/favicon.ico: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/Listeners/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/Policies/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /database/seeds/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /bootstrap/cache/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /database/migrations/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /database/.gitignore: -------------------------------------------------------------------------------- 1 | *.sqlite 2 | -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | User-agent: * 2 | Disallow: 3 | -------------------------------------------------------------------------------- /resources/assets/sass/global.scss: -------------------------------------------------------------------------------- 1 | body { 2 | padding-top: 50px; 3 | } -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | *.css linguist-vendored 3 | *.less linguist-vendored 4 | -------------------------------------------------------------------------------- /resources/assets/sass/bootstrap.scss: -------------------------------------------------------------------------------- 1 | @import "node_modules/bootstrap-sass/assets/stylesheets/bootstrap"; 2 | 3 | -------------------------------------------------------------------------------- /app/Events/Event.php: -------------------------------------------------------------------------------- 1 | 3 | {{ session('success') }} 4 | 5 | @endif -------------------------------------------------------------------------------- /app/Http/Requests/Request.php: -------------------------------------------------------------------------------- 1 | 0) 2 | 9 | @endif -------------------------------------------------------------------------------- /app/Vendor.php: -------------------------------------------------------------------------------- 1 | hasMany('App\Transaction'); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /app/Category.php: -------------------------------------------------------------------------------- 1 | hasMany('App\Transaction'); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /app/Account.php: -------------------------------------------------------------------------------- 1 | hasMany('App\Transaction'); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /.env.example: -------------------------------------------------------------------------------- 1 | APP_ENV=local 2 | APP_DEBUG=true 3 | APP_KEY=SomeRandomString 4 | 5 | DB_HOST=localhost 6 | DB_DATABASE=homestead 7 | DB_USERNAME=homestead 8 | DB_PASSWORD=secret 9 | 10 | CACHE_DRIVER=file 11 | SESSION_DRIVER=file 12 | QUEUE_DRIVER=sync 13 | 14 | MAIL_DRIVER=smtp 15 | MAIL_HOST=mailtrap.io 16 | MAIL_PORT=2525 17 | MAIL_USERNAME=null 18 | MAIL_PASSWORD=null 19 | MAIL_ENCRYPTION=null 20 | -------------------------------------------------------------------------------- /app/Http/Middleware/EncryptCookies.php: -------------------------------------------------------------------------------- 1 | " 7 | ], 8 | "license": "MIT", 9 | "moduleType": [], 10 | "homepage": "", 11 | "private": true, 12 | "ignore": [ 13 | "**/.*", 14 | "node_modules", 15 | "bower_components", 16 | "test", 17 | "tests" 18 | ], 19 | "dependencies": { 20 | "jquery": "~2.1.4" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /database/seeds/DatabaseSeeder.php: -------------------------------------------------------------------------------- 1 | call(UserTableSeeder::class); 18 | 19 | Model::reguard(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /public/.htaccess: -------------------------------------------------------------------------------- 1 | 2 | 3 | Options -MultiViews 4 | 5 | 6 | RewriteEngine On 7 | 8 | # Redirect Trailing Slashes If Not A Folder... 9 | RewriteCond %{REQUEST_FILENAME} !-d 10 | RewriteRule ^(.*)/$ /$1 [L,R=301] 11 | 12 | # Handle Front Controller... 13 | RewriteCond %{REQUEST_FILENAME} !-d 14 | RewriteCond %{REQUEST_FILENAME} !-f 15 | RewriteRule ^ index.php [L] 16 | 17 | -------------------------------------------------------------------------------- /tests/ExampleTest.php: -------------------------------------------------------------------------------- 1 | visit('/') 17 | ->see('Laravel 5'); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /app/Providers/AppServiceProvider.php: -------------------------------------------------------------------------------- 1 | belongsTo('App\Category'); 14 | } 15 | 16 | public function vendor() 17 | { 18 | return $this->belongsTo('App\Vendor'); 19 | } 20 | 21 | public function account() 22 | { 23 | return $this->belongsTo('App\Account'); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /app/Jobs/Job.php: -------------------------------------------------------------------------------- 1 | '« Previous', 17 | 'next' => 'Next »', 18 | 19 | ]; 20 | -------------------------------------------------------------------------------- /tests/TestCase.php: -------------------------------------------------------------------------------- 1 | make(Illuminate\Contracts\Console\Kernel::class)->bootstrap(); 22 | 23 | return $app; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /server.php: -------------------------------------------------------------------------------- 1 | 8 | */ 9 | 10 | $uri = urldecode( 11 | parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH) 12 | ); 13 | 14 | // This file allows us to emulate Apache's "mod_rewrite" functionality from the 15 | // built-in PHP web server. This provides a convenient way to test a Laravel 16 | // application without having installed a "real" web server software here. 17 | if ($uri !== '/' && file_exists(__DIR__.'/public'.$uri)) { 18 | return false; 19 | } 20 | 21 | require_once __DIR__.'/public/index.php'; 22 | -------------------------------------------------------------------------------- /resources/lang/en/auth.php: -------------------------------------------------------------------------------- 1 | 'These credentials do not match our records.', 17 | 'throttle' => 'Too many login attempts. Please try again in :seconds seconds.', 18 | 19 | ]; 20 | -------------------------------------------------------------------------------- /database/factories/ModelFactory.php: -------------------------------------------------------------------------------- 1 | define(App\User::class, function (Faker\Generator $faker) { 15 | return [ 16 | 'name' => $faker->name, 17 | 'email' => $faker->email, 18 | 'password' => bcrypt(str_random(10)), 19 | 'remember_token' => str_random(10), 20 | ]; 21 | }); 22 | -------------------------------------------------------------------------------- /app/Console/Commands/Inspire.php: -------------------------------------------------------------------------------- 1 | comment(PHP_EOL.Inspiring::quote().PHP_EOL); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /app/Console/Kernel.php: -------------------------------------------------------------------------------- 1 | command('inspire') 28 | ->hourly(); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /database/migrations/2015_11_22_120935_add_accounts_relationship_column.php: -------------------------------------------------------------------------------- 1 | integer('account_id')->after('id'); 17 | }); 18 | } 19 | 20 | /** 21 | * Reverse the migrations. 22 | * 23 | * @return void 24 | */ 25 | public function down() 26 | { 27 | Schema::table('transactions', function ($table) { 28 | $table->dropColumn('account_id'); 29 | }); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /app/Http/routes.php: -------------------------------------------------------------------------------- 1 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
Business Taxes
Total Revenue{{ $revenue }}
Washington B&O (1.5%){{ $revenue * 0.015 }}
FICA (7.5%){{ $revenue * 0.075 }}
TAX LIABILITY{{ ($revenue * 0.015) + ($revenue * 0.075) }}
19 | 20 | 21 | @endsection -------------------------------------------------------------------------------- /database/migrations/2014_10_12_100000_create_password_resets_table.php: -------------------------------------------------------------------------------- 1 | string('email')->index(); 17 | $table->string('token')->index(); 18 | $table->timestamp('created_at'); 19 | }); 20 | } 21 | 22 | /** 23 | * Reverse the migrations. 24 | * 25 | * @return void 26 | */ 27 | public function down() 28 | { 29 | Schema::drop('password_resets'); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /app/Providers/AuthServiceProvider.php: -------------------------------------------------------------------------------- 1 | 'App\Policies\ModelPolicy', 17 | ]; 18 | 19 | /** 20 | * Register any application authentication / authorization services. 21 | * 22 | * @param \Illuminate\Contracts\Auth\Access\Gate $gate 23 | * @return void 24 | */ 25 | public function boot(GateContract $gate) 26 | { 27 | $this->registerPolicies($gate); 28 | 29 | // 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /database/migrations/2015_11_22_120516_create_accounts_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 17 | $table->string('name'); 18 | $table->string('slug'); 19 | $table->boolean('business_account'); 20 | $table->timestamps(); 21 | }); 22 | } 23 | 24 | /** 25 | * Reverse the migrations. 26 | * 27 | * @return void 28 | */ 29 | public function down() 30 | { 31 | Schema::drop('accounts'); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /database/migrations/2015_11_18_042110_create_categories_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 17 | $table->integer('parent_category_id'); 18 | $table->string('name'); 19 | $table->string('slug'); 20 | $table->timestamps(); 21 | }); 22 | } 23 | 24 | /** 25 | * Reverse the migrations. 26 | * 27 | * @return void 28 | */ 29 | public function down() 30 | { 31 | Schema::drop('categories'); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /resources/lang/en/passwords.php: -------------------------------------------------------------------------------- 1 | 'Passwords must be at least six characters and match the confirmation.', 17 | 'reset' => 'Your password has been reset!', 18 | 'sent' => 'We have e-mailed your password reset link!', 19 | 'token' => 'This password reset token is invalid.', 20 | 'user' => "We can't find a user with that e-mail address.", 21 | 22 | ]; 23 | -------------------------------------------------------------------------------- /app/Providers/EventServiceProvider.php: -------------------------------------------------------------------------------- 1 | [ 17 | 'App\Listeners\EventListener', 18 | ], 19 | ]; 20 | 21 | /** 22 | * Register any other events for your application. 23 | * 24 | * @param \Illuminate\Contracts\Events\Dispatcher $events 25 | * @return void 26 | */ 27 | public function boot(DispatcherContract $events) 28 | { 29 | parent::boot($events); 30 | 31 | // 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /database/migrations/2014_10_12_000000_create_users_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 17 | $table->string('name'); 18 | $table->string('email')->unique(); 19 | $table->string('password', 60); 20 | $table->rememberToken(); 21 | $table->timestamps(); 22 | }); 23 | } 24 | 25 | /** 26 | * Reverse the migrations. 27 | * 28 | * @return void 29 | */ 30 | public function down() 31 | { 32 | Schema::drop('users'); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /phpunit.xml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 13 | ./tests/ 14 | 15 | 16 | 17 | 18 | app/ 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /app/Http/Controllers/Auth/PasswordController.php: -------------------------------------------------------------------------------- 1 | middleware('guest'); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /app/Http/Middleware/RedirectIfAuthenticated.php: -------------------------------------------------------------------------------- 1 | auth = $auth; 26 | } 27 | 28 | /** 29 | * Handle an incoming request. 30 | * 31 | * @param \Illuminate\Http\Request $request 32 | * @param \Closure $next 33 | * @return mixed 34 | */ 35 | public function handle($request, Closure $next) 36 | { 37 | if ($this->auth->check()) { 38 | return redirect('/home'); 39 | } 40 | 41 | return $next($request); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /resources/views/dashboard/index.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.master') 2 | 3 | @section('title', 'Categories') 4 | 5 | @section('content') 6 | 7 |
8 |

Account Balances

9 | 10 | 11 | 12 | 13 | 14 | @foreach ($accounts as $account) 15 | 16 | 17 | 18 | 19 | @endforeach 20 | 21 | 22 | 23 | 24 |
AccountBalance
{{ $account->name }}{{ money_format('%(!i', $account->balance) }}
NET WORTH{{ money_format('%(!i', array_sum($accounts->pluck('balance')->toArray())) }}
25 |
26 | 27 | @endsection -------------------------------------------------------------------------------- /gulpfile.js: -------------------------------------------------------------------------------- 1 | var elixir = require('laravel-elixir'); 2 | 3 | /* 4 | |-------------------------------------------------------------------------- 5 | | Elixir Asset Management 6 | |-------------------------------------------------------------------------- 7 | | 8 | | Elixir provides a clean, fluent API for defining some basic Gulp tasks 9 | | for your Laravel application. By default, we are compiling the Sass 10 | | file for our application, as well as publishing vendor resources. 11 | | 12 | */ 13 | 14 | elixir(function(mix) { 15 | var boostrapPath = 'node_modules/bootstrap-sass/assets'; 16 | mix.sass('bootstrap.scss') 17 | .copy(boostrapPath + '/fonts', 'public/fonts') 18 | .copy(boostrapPath + '/javascripts/bootstrap.min.js', 'public/js'); 19 | 20 | mix.sass('global.scss'); 21 | 22 | var jqueryPath = 'bower_components/jquery/dist'; 23 | mix.copy(jqueryPath + '/jquery.min.js', 'public/js'); 24 | mix.copy(jqueryPath + '/jquery.min.map', 'public/js'); 25 | }); 26 | -------------------------------------------------------------------------------- /database/migrations/2015_11_18_042058_create_vendors_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 17 | $table->integer('default_category_id')->nullable(); 18 | $table->string('name'); 19 | $table->string('slug'); 20 | $table->string('address'); 21 | $table->string('city'); 22 | $table->string('state'); 23 | $table->string('zip'); 24 | $table->string('phone'); 25 | $table->timestamps(); 26 | }); 27 | } 28 | 29 | /** 30 | * Reverse the migrations. 31 | * 32 | * @return void 33 | */ 34 | public function down() 35 | { 36 | Schema::drop('vendors'); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /app/Http/Middleware/Authenticate.php: -------------------------------------------------------------------------------- 1 | auth = $auth; 26 | } 27 | 28 | /** 29 | * Handle an incoming request. 30 | * 31 | * @param \Illuminate\Http\Request $request 32 | * @param \Closure $next 33 | * @return mixed 34 | */ 35 | public function handle($request, Closure $next) 36 | { 37 | if ($this->auth->guest()) { 38 | if ($request->ajax()) { 39 | return response('Unauthorized.', 401); 40 | } else { 41 | return redirect()->guest('auth/login'); 42 | } 43 | } 44 | 45 | return $next($request); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /app/Http/Kernel.php: -------------------------------------------------------------------------------- 1 | \App\Http\Middleware\Authenticate::class, 30 | 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class, 31 | 'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class, 32 | ]; 33 | } 34 | -------------------------------------------------------------------------------- /config/compile.php: -------------------------------------------------------------------------------- 1 | [ 17 | // 18 | ], 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Compiled File Providers 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here you may list service providers which define a "compiles" function 26 | | that returns additional files that should be compiled, providing an 27 | | easy way to get common files from any packages you are utilizing. 28 | | 29 | */ 30 | 31 | 'providers' => [ 32 | // 33 | ], 34 | 35 | ]; 36 | -------------------------------------------------------------------------------- /config/services.php: -------------------------------------------------------------------------------- 1 | [ 18 | 'domain' => env('MAILGUN_DOMAIN'), 19 | 'secret' => env('MAILGUN_SECRET'), 20 | ], 21 | 22 | 'mandrill' => [ 23 | 'secret' => env('MANDRILL_SECRET'), 24 | ], 25 | 26 | 'ses' => [ 27 | 'key' => env('SES_KEY'), 28 | 'secret' => env('SES_SECRET'), 29 | 'region' => 'us-east-1', 30 | ], 31 | 32 | 'stripe' => [ 33 | 'model' => App\User::class, 34 | 'key' => env('STRIPE_KEY'), 35 | 'secret' => env('STRIPE_SECRET'), 36 | ], 37 | 38 | ]; 39 | -------------------------------------------------------------------------------- /config/view.php: -------------------------------------------------------------------------------- 1 | [ 17 | realpath(base_path('resources/views')), 18 | ], 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Compiled View Path 23 | |-------------------------------------------------------------------------- 24 | | 25 | | This option determines where all the compiled Blade templates will be 26 | | stored for your application. Typically, this is within the storage 27 | | directory. However, as usual, you are free to change this value. 28 | | 29 | */ 30 | 31 | 'compiled' => realpath(storage_path('framework/views')), 32 | 33 | ]; 34 | -------------------------------------------------------------------------------- /database/migrations/2015_11_16_051726_create_transactions_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 17 | $table->integer('vendor_id')->nullable(); 18 | $table->integer('category_id')->nullable(); 19 | $table->boolean('business_expense')->default(false); 20 | $table->boolean('charitable_deduction')->default(false); 21 | $table->string('description')->nullable(); 22 | $table->double('amount', 8, 2); 23 | $table->dateTime('timestamp'); 24 | $table->timestamps(); 25 | }); 26 | } 27 | 28 | /** 29 | * Reverse the migrations. 30 | * 31 | * @return void 32 | */ 33 | public function down() 34 | { 35 | Schema::drop('transactions'); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /bootstrap/autoload.php: -------------------------------------------------------------------------------- 1 | group(['namespace' => $this->namespace], function ($router) { 41 | require app_path('Http/routes.php'); 42 | }); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /app/User.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Be right back. 5 | 6 | 7 | 8 | 39 | 40 | 41 |
42 |
43 |
Be right back.
44 |
45 |
46 | 47 | 48 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "laravel/laravel", 3 | "description": "The Laravel Framework.", 4 | "keywords": ["framework", "laravel"], 5 | "license": "MIT", 6 | "type": "project", 7 | "require": { 8 | "php": ">=5.5.9", 9 | "laravel/framework": "5.1.*", 10 | "barryvdh/laravel-debugbar": "^2.0" 11 | }, 12 | "require-dev": { 13 | "fzaninotto/faker": "~1.4", 14 | "mockery/mockery": "0.9.*", 15 | "phpunit/phpunit": "~4.0", 16 | "phpspec/phpspec": "~2.1" 17 | }, 18 | "autoload": { 19 | "classmap": [ 20 | "database" 21 | ], 22 | "psr-4": { 23 | "App\\": "app/" 24 | } 25 | }, 26 | "autoload-dev": { 27 | "classmap": [ 28 | "tests/TestCase.php" 29 | ] 30 | }, 31 | "scripts": { 32 | "post-install-cmd": [ 33 | "php artisan clear-compiled", 34 | "php artisan optimize" 35 | ], 36 | "pre-update-cmd": [ 37 | "php artisan clear-compiled" 38 | ], 39 | "post-update-cmd": [ 40 | "php artisan optimize" 41 | ], 42 | "post-root-package-install": [ 43 | "php -r \"copy('.env.example', '.env');\"" 44 | ], 45 | "post-create-project-cmd": [ 46 | "php artisan key:generate" 47 | ] 48 | }, 49 | "config": { 50 | "preferred-install": "dist" 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /app/Exceptions/Handler.php: -------------------------------------------------------------------------------- 1 | getMessage(), $e); 47 | } 48 | 49 | return parent::render($request, $e); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /resources/views/vendors/index.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.master') 2 | 3 | @section('title', 'Vendors') 4 | 5 | @section('content') 6 | 7 |
8 | {{ csrf_field() }} 9 |
10 | 11 | 12 |
13 |
14 | 15 | 16 |
17 | 18 |
19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | @foreach ($vendors as $vendor) 33 | 34 | 35 | 36 | 37 | 38 | 39 | @endforeach 40 | 41 |
NameSlugTransactionsLast Modified
{{ $vendor->name }}{{ $vendor->slug }}{{ $vendor->transactions->count() }}{{ date('j-M-y', strtotime($vendor->updated_at)) }}
42 | 43 | @endsection -------------------------------------------------------------------------------- /resources/views/accounts/index.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.master') 2 | 3 | @section('title', 'Accounts') 4 | 5 | @section('content') 6 | 7 |
8 | {{ csrf_field() }} 9 |
10 | 11 | 12 |
13 |
14 | 15 | 16 |
17 | 18 |
19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | @foreach ($accounts as $account) 33 | 34 | 35 | 36 | 37 | 38 | 39 | @endforeach 40 | 41 |
NameSlugTransactionsLast Modified
{{ $account->name }}{{ $account->slug }}{{ $account->transactions->count() }}{{ date('j-M-y', strtotime($account->updated_at)) }}
42 | 43 | @endsection -------------------------------------------------------------------------------- /config/broadcasting.php: -------------------------------------------------------------------------------- 1 | env('BROADCAST_DRIVER', 'pusher'), 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Broadcast Connections 21 | |-------------------------------------------------------------------------- 22 | | 23 | | Here you may define all of the broadcast connections that will be used 24 | | to broadcast events to other systems or over websockets. Samples of 25 | | each available type of connection are provided inside this array. 26 | | 27 | */ 28 | 29 | 'connections' => [ 30 | 31 | 'pusher' => [ 32 | 'driver' => 'pusher', 33 | 'key' => env('PUSHER_KEY'), 34 | 'secret' => env('PUSHER_SECRET'), 35 | 'app_id' => env('PUSHER_APP_ID'), 36 | 'options' => [ 37 | // 38 | ], 39 | ], 40 | 41 | 'redis' => [ 42 | 'driver' => 'redis', 43 | 'connection' => 'default', 44 | ], 45 | 46 | 'log' => [ 47 | 'driver' => 'log', 48 | ], 49 | 50 | ], 51 | 52 | ]; 53 | -------------------------------------------------------------------------------- /resources/views/categories/index.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.master') 2 | 3 | @section('title', 'Categories') 4 | 5 | @section('content') 6 | 7 |
8 | {{ csrf_field() }} 9 |
10 | 11 | 12 |
13 |
14 | 15 | 16 |
17 | 18 |
19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | @foreach ($categories as $category) 33 | 34 | 35 | 36 | 37 | 38 | 39 | @endforeach 40 | 41 |
NameSlugTransactionsLast Modified
{{ $category->name }}{{ $category->slug }}{{ $category->transactions->count() }}{{ date('j-M-y', strtotime($category->updated_at)) }}
42 | 43 | @endsection -------------------------------------------------------------------------------- /bootstrap/app.php: -------------------------------------------------------------------------------- 1 | singleton( 30 | Illuminate\Contracts\Http\Kernel::class, 31 | App\Http\Kernel::class 32 | ); 33 | 34 | $app->singleton( 35 | Illuminate\Contracts\Console\Kernel::class, 36 | App\Console\Kernel::class 37 | ); 38 | 39 | $app->singleton( 40 | Illuminate\Contracts\Debug\ExceptionHandler::class, 41 | App\Exceptions\Handler::class 42 | ); 43 | 44 | /* 45 | |-------------------------------------------------------------------------- 46 | | Return The Application 47 | |-------------------------------------------------------------------------- 48 | | 49 | | This script returns the application instance. The instance is given to 50 | | the calling script so we can separate the building of the instances 51 | | from the actual running of the application and sending responses. 52 | | 53 | */ 54 | 55 | return $app; 56 | -------------------------------------------------------------------------------- /artisan: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env php 2 | make(Illuminate\Contracts\Console\Kernel::class); 32 | 33 | $status = $kernel->handle( 34 | $input = new Symfony\Component\Console\Input\ArgvInput, 35 | new Symfony\Component\Console\Output\ConsoleOutput 36 | ); 37 | 38 | /* 39 | |-------------------------------------------------------------------------- 40 | | Shutdown The Application 41 | |-------------------------------------------------------------------------- 42 | | 43 | | Once Artisan has finished running. We will fire off the shutdown events 44 | | so that any final work may be done by the application before we shut 45 | | down the process. This is the last thing to happen to the request. 46 | | 47 | */ 48 | 49 | $kernel->terminate($input, $status); 50 | 51 | exit($status); 52 | -------------------------------------------------------------------------------- /public/index.php: -------------------------------------------------------------------------------- 1 | 8 | */ 9 | 10 | /* 11 | |-------------------------------------------------------------------------- 12 | | Register The Auto Loader 13 | |-------------------------------------------------------------------------- 14 | | 15 | | Composer provides a convenient, automatically generated class loader for 16 | | our application. We just need to utilize it! We'll simply require it 17 | | into the script here so that we don't have to worry about manual 18 | | loading any of our classes later on. It feels nice to relax. 19 | | 20 | */ 21 | 22 | require __DIR__.'/../bootstrap/autoload.php'; 23 | 24 | /* 25 | |-------------------------------------------------------------------------- 26 | | Turn On The Lights 27 | |-------------------------------------------------------------------------- 28 | | 29 | | We need to illuminate PHP development, so let us turn on the lights. 30 | | This bootstraps the framework and gets it ready for use, then it 31 | | will load up this application so that we can run it and send 32 | | the responses back to the browser and delight our users. 33 | | 34 | */ 35 | 36 | $app = require_once __DIR__.'/../bootstrap/app.php'; 37 | 38 | /* 39 | |-------------------------------------------------------------------------- 40 | | Run The Application 41 | |-------------------------------------------------------------------------- 42 | | 43 | | Once we have the application, we can handle the incoming request 44 | | through the kernel, and send the associated response back to 45 | | the client's browser allowing them to enjoy the creative 46 | | and wonderful application we have prepared for them. 47 | | 48 | */ 49 | 50 | $kernel = $app->make(Illuminate\Contracts\Http\Kernel::class); 51 | 52 | $response = $kernel->handle( 53 | $request = Illuminate\Http\Request::capture() 54 | ); 55 | 56 | $response->send(); 57 | 58 | $kernel->terminate($request, $response); 59 | -------------------------------------------------------------------------------- /app/Http/Controllers/Auth/AuthController.php: -------------------------------------------------------------------------------- 1 | middleware('guest', ['except' => 'getLogout']); 34 | } 35 | 36 | /** 37 | * Get a validator for an incoming registration request. 38 | * 39 | * @param array $data 40 | * @return \Illuminate\Contracts\Validation\Validator 41 | */ 42 | protected function validator(array $data) 43 | { 44 | return Validator::make($data, [ 45 | 'name' => 'required|max:255', 46 | 'email' => 'required|email|max:255|unique:users', 47 | 'password' => 'required|confirmed|min:6', 48 | ]); 49 | } 50 | 51 | /** 52 | * Create a new user instance after a valid registration. 53 | * 54 | * @param array $data 55 | * @return User 56 | */ 57 | protected function create(array $data) 58 | { 59 | return User::create([ 60 | 'name' => $data['name'], 61 | 'email' => $data['email'], 62 | 'password' => bcrypt($data['password']), 63 | ]); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /app/Http/Controllers/TaxesController.php: -------------------------------------------------------------------------------- 1 | where('business_expense', '=', 1)->where('amount', '>', 0)->where('category_id', '=', 14)->sum('amount'); 20 | return view('taxes.index', [ 21 | 'revenue' => $revenue 22 | ]); 23 | } 24 | 25 | /** 26 | * Show the form for creating a new resource. 27 | * 28 | * @return \Illuminate\Http\Response 29 | */ 30 | public function create() 31 | { 32 | // 33 | } 34 | 35 | /** 36 | * Store a newly created resource in storage. 37 | * 38 | * @param \Illuminate\Http\Request $request 39 | * @return \Illuminate\Http\Response 40 | */ 41 | public function store(Request $request) 42 | { 43 | // 44 | } 45 | 46 | /** 47 | * Display the specified resource. 48 | * 49 | * @param int $id 50 | * @return \Illuminate\Http\Response 51 | */ 52 | public function show($id) 53 | { 54 | // 55 | } 56 | 57 | /** 58 | * Show the form for editing the specified resource. 59 | * 60 | * @param int $id 61 | * @return \Illuminate\Http\Response 62 | */ 63 | public function edit($id) 64 | { 65 | // 66 | } 67 | 68 | /** 69 | * Update the specified resource in storage. 70 | * 71 | * @param \Illuminate\Http\Request $request 72 | * @param int $id 73 | * @return \Illuminate\Http\Response 74 | */ 75 | public function update(Request $request, $id) 76 | { 77 | // 78 | } 79 | 80 | /** 81 | * Remove the specified resource from storage. 82 | * 83 | * @param int $id 84 | * @return \Illuminate\Http\Response 85 | */ 86 | public function destroy($id) 87 | { 88 | // 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /app/Http/Controllers/DashboardController.php: -------------------------------------------------------------------------------- 1 | all(); 21 | $accounts->each(function($item, $key) { 22 | $item->balance = $item->transactions->sum('amount'); 23 | }); 24 | 25 | return view('dashboard.index')->with('accounts', $accounts); 26 | } 27 | 28 | /** 29 | * Show the form for creating a new resource. 30 | * 31 | * @return \Illuminate\Http\Response 32 | */ 33 | public function create() 34 | { 35 | // 36 | } 37 | 38 | /** 39 | * Store a newly created resource in storage. 40 | * 41 | * @param \Illuminate\Http\Request $request 42 | * @return \Illuminate\Http\Response 43 | */ 44 | public function store(Request $request) 45 | { 46 | // 47 | } 48 | 49 | /** 50 | * Display the specified resource. 51 | * 52 | * @param int $id 53 | * @return \Illuminate\Http\Response 54 | */ 55 | public function show($id) 56 | { 57 | // 58 | } 59 | 60 | /** 61 | * Show the form for editing the specified resource. 62 | * 63 | * @param int $id 64 | * @return \Illuminate\Http\Response 65 | */ 66 | public function edit($id) 67 | { 68 | // 69 | } 70 | 71 | /** 72 | * Update the specified resource in storage. 73 | * 74 | * @param \Illuminate\Http\Request $request 75 | * @param int $id 76 | * @return \Illuminate\Http\Response 77 | */ 78 | public function update(Request $request, $id) 79 | { 80 | // 81 | } 82 | 83 | /** 84 | * Remove the specified resource from storage. 85 | * 86 | * @param int $id 87 | * @return \Illuminate\Http\Response 88 | */ 89 | public function destroy($id) 90 | { 91 | // 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /config/cache.php: -------------------------------------------------------------------------------- 1 | env('CACHE_DRIVER', 'file'), 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Cache Stores 21 | |-------------------------------------------------------------------------- 22 | | 23 | | Here you may define all of the cache "stores" for your application as 24 | | well as their drivers. You may even define multiple stores for the 25 | | same cache driver to group types of items stored in your caches. 26 | | 27 | */ 28 | 29 | 'stores' => [ 30 | 31 | 'apc' => [ 32 | 'driver' => 'apc', 33 | ], 34 | 35 | 'array' => [ 36 | 'driver' => 'array', 37 | ], 38 | 39 | 'database' => [ 40 | 'driver' => 'database', 41 | 'table' => 'cache', 42 | 'connection' => null, 43 | ], 44 | 45 | 'file' => [ 46 | 'driver' => 'file', 47 | 'path' => storage_path('framework/cache'), 48 | ], 49 | 50 | 'memcached' => [ 51 | 'driver' => 'memcached', 52 | 'servers' => [ 53 | [ 54 | 'host' => '127.0.0.1', 'port' => 11211, 'weight' => 100, 55 | ], 56 | ], 57 | ], 58 | 59 | 'redis' => [ 60 | 'driver' => 'redis', 61 | 'connection' => 'default', 62 | ], 63 | 64 | ], 65 | 66 | /* 67 | |-------------------------------------------------------------------------- 68 | | Cache Key Prefix 69 | |-------------------------------------------------------------------------- 70 | | 71 | | When utilizing a RAM based store such as APC or Memcached, there might 72 | | be other applications utilizing the same cache. So, we'll specify a 73 | | value to get prefixed to all our keys so we can avoid collisions. 74 | | 75 | */ 76 | 77 | 'prefix' => 'laravel', 78 | 79 | ]; 80 | -------------------------------------------------------------------------------- /config/auth.php: -------------------------------------------------------------------------------- 1 | 'eloquent', 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Authentication Model 23 | |-------------------------------------------------------------------------- 24 | | 25 | | When using the "Eloquent" authentication driver, we need to know which 26 | | Eloquent model should be used to retrieve your users. Of course, it 27 | | is often just the "User" model but you may use whatever you like. 28 | | 29 | */ 30 | 31 | 'model' => App\User::class, 32 | 33 | /* 34 | |-------------------------------------------------------------------------- 35 | | Authentication Table 36 | |-------------------------------------------------------------------------- 37 | | 38 | | When using the "Database" authentication driver, we need to know which 39 | | table should be used to retrieve your users. We have chosen a basic 40 | | default value but you may easily change it to any table you like. 41 | | 42 | */ 43 | 44 | 'table' => 'users', 45 | 46 | /* 47 | |-------------------------------------------------------------------------- 48 | | Password Reset Settings 49 | |-------------------------------------------------------------------------- 50 | | 51 | | Here you may set the options for resetting passwords including the view 52 | | that is your password reset e-mail. You can also set the name of the 53 | | table that maintains all of the reset tokens for your application. 54 | | 55 | | The expire time is the number of minutes that the reset token should be 56 | | considered valid. This security feature keeps tokens short-lived so 57 | | they have less time to be guessed. You may change this as needed. 58 | | 59 | */ 60 | 61 | 'password' => [ 62 | 'email' => 'emails.password', 63 | 'table' => 'password_resets', 64 | 'expire' => 60, 65 | ], 66 | 67 | ]; 68 | -------------------------------------------------------------------------------- /config/filesystems.php: -------------------------------------------------------------------------------- 1 | 'local', 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Default Cloud Filesystem Disk 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Many applications store files both locally and in the cloud. For this 26 | | reason, you may specify a default "cloud" driver here. This driver 27 | | will be bound as the Cloud disk implementation in the container. 28 | | 29 | */ 30 | 31 | 'cloud' => 's3', 32 | 33 | /* 34 | |-------------------------------------------------------------------------- 35 | | Filesystem Disks 36 | |-------------------------------------------------------------------------- 37 | | 38 | | Here you may configure as many filesystem "disks" as you wish, and you 39 | | may even configure multiple disks of the same driver. Defaults have 40 | | been setup for each driver as an example of the required options. 41 | | 42 | */ 43 | 44 | 'disks' => [ 45 | 46 | 'local' => [ 47 | 'driver' => 'local', 48 | 'root' => storage_path('app'), 49 | ], 50 | 51 | 'ftp' => [ 52 | 'driver' => 'ftp', 53 | 'host' => 'ftp.example.com', 54 | 'username' => 'your-username', 55 | 'password' => 'your-password', 56 | 57 | // Optional FTP Settings... 58 | // 'port' => 21, 59 | // 'root' => '', 60 | // 'passive' => true, 61 | // 'ssl' => true, 62 | // 'timeout' => 30, 63 | ], 64 | 65 | 's3' => [ 66 | 'driver' => 's3', 67 | 'key' => 'your-key', 68 | 'secret' => 'your-secret', 69 | 'region' => 'your-region', 70 | 'bucket' => 'your-bucket', 71 | ], 72 | 73 | 'rackspace' => [ 74 | 'driver' => 'rackspace', 75 | 'username' => 'your-username', 76 | 'key' => 'your-key', 77 | 'container' => 'your-container', 78 | 'endpoint' => 'https://identity.api.rackspacecloud.com/v2.0/', 79 | 'region' => 'IAD', 80 | 'url_type' => 'publicURL', 81 | ], 82 | 83 | ], 84 | 85 | ]; 86 | -------------------------------------------------------------------------------- /config/queue.php: -------------------------------------------------------------------------------- 1 | env('QUEUE_DRIVER', 'sync'), 20 | 21 | /* 22 | |-------------------------------------------------------------------------- 23 | | Queue Connections 24 | |-------------------------------------------------------------------------- 25 | | 26 | | Here you may configure the connection information for each server that 27 | | is used by your application. A default configuration has been added 28 | | for each back-end shipped with Laravel. You are free to add more. 29 | | 30 | */ 31 | 32 | 'connections' => [ 33 | 34 | 'sync' => [ 35 | 'driver' => 'sync', 36 | ], 37 | 38 | 'database' => [ 39 | 'driver' => 'database', 40 | 'table' => 'jobs', 41 | 'queue' => 'default', 42 | 'expire' => 60, 43 | ], 44 | 45 | 'beanstalkd' => [ 46 | 'driver' => 'beanstalkd', 47 | 'host' => 'localhost', 48 | 'queue' => 'default', 49 | 'ttr' => 60, 50 | ], 51 | 52 | 'sqs' => [ 53 | 'driver' => 'sqs', 54 | 'key' => 'your-public-key', 55 | 'secret' => 'your-secret-key', 56 | 'queue' => 'your-queue-url', 57 | 'region' => 'us-east-1', 58 | ], 59 | 60 | 'iron' => [ 61 | 'driver' => 'iron', 62 | 'host' => 'mq-aws-us-east-1.iron.io', 63 | 'token' => 'your-token', 64 | 'project' => 'your-project-id', 65 | 'queue' => 'your-queue-name', 66 | 'encrypt' => true, 67 | ], 68 | 69 | 'redis' => [ 70 | 'driver' => 'redis', 71 | 'connection' => 'default', 72 | 'queue' => 'default', 73 | 'expire' => 60, 74 | ], 75 | 76 | ], 77 | 78 | /* 79 | |-------------------------------------------------------------------------- 80 | | Failed Queue Jobs 81 | |-------------------------------------------------------------------------- 82 | | 83 | | These options configure the behavior of failed queue job logging so you 84 | | can control which database and table are used to store the jobs that 85 | | have failed. You may change them to any database / table you wish. 86 | | 87 | */ 88 | 89 | 'failed' => [ 90 | 'database' => env('DB_CONNECTION', 'mysql'), 91 | 'table' => 'failed_jobs', 92 | ], 93 | 94 | ]; 95 | -------------------------------------------------------------------------------- /resources/views/vendors/showOrUpdate.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.master') 2 | 3 | @section('title', $vendor->name) 4 | 5 | @section('content') 6 | @include('partials.validationErrors') 7 | 8 |
9 |
10 | 11 | {{ csrf_field() }} 12 | 13 |
14 | 15 |
16 | 17 |
18 |
19 |
20 | 21 |
22 | 23 |
24 |
25 |
26 | 27 |
28 | 29 |
30 |
31 |
32 | 33 |
34 | 35 |
36 |
37 |
38 | 39 |
40 | 41 |
42 |
43 |
44 |
45 | 46 |
47 |
48 |
49 |
50 | 51 |
52 |

Transactions   {{ $vendor->transactions->count() }}

53 | @if ($vendor->transactions->count() == 0) 54 |
55 |
56 | 57 | {{ csrf_field() }} 58 | 62 |
63 | @endif 64 |
65 | 66 | @endsection -------------------------------------------------------------------------------- /resources/views/categories/showOrUpdate.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.master') 2 | 3 | @section('title', $category->name) 4 | 5 | @section('content') 6 | @include('partials.validationErrors') 7 | 8 |
9 |
10 | 11 | {{ csrf_field() }} 12 | 13 |
14 | 15 |
16 | 17 |
18 |
19 |
20 | 21 |
22 | 23 |
24 |
25 |
26 | 27 |
28 | 29 |
30 |
31 |
32 | 33 |
34 | 35 |
36 |
37 |
38 | 39 |
40 | 41 |
42 |
43 |
44 |
45 | 46 |
47 |
48 |
49 |
50 | 51 |
52 |

Transactions   {{ $category->transactions->count() }}

53 | @if ($category->transactions->count() == 0) 54 |
55 |
56 | 57 | {{ csrf_field() }} 58 | 62 |
63 | @endif 64 |
65 | 66 | @endsection -------------------------------------------------------------------------------- /app/Http/Controllers/VendorsController.php: -------------------------------------------------------------------------------- 1 | orderBy('name')->with('transactions')->get(); 21 | return view('vendors.index')->with('vendors', $vendors); 22 | } 23 | 24 | /** 25 | * Show the form for creating a new resource. 26 | * 27 | * @return \Illuminate\Http\Response 28 | */ 29 | public function create() 30 | { 31 | return redirect('vendors'); 32 | } 33 | 34 | /** 35 | * Store a newly created resource in storage. 36 | * 37 | * @param \Illuminate\Http\Request $request 38 | * @param Vendor $vendor 39 | * @return \Illuminate\Http\Response 40 | */ 41 | public function store(Request $request, Vendor $vendor) 42 | { 43 | $this->validate($request, [ 44 | 'name' => 'required|unique:categories', 45 | 'slug' => 'required|unique:categories', 46 | ]); 47 | 48 | $input = $request->except(['_token']); 49 | $vendor->fill($input)->save(); 50 | 51 | return redirect('vendors')->with('success', 'Vendor successfully added.'); 52 | } 53 | 54 | /** 55 | * Display the specified resource. 56 | * 57 | * @param $slug 58 | * @param Vendor $vendor 59 | * @return \Illuminate\Http\Response 60 | */ 61 | public function show($slug, Vendor $vendor) 62 | { 63 | $vendor = $vendor->where('slug', '=', $slug)->firstOrFail(); 64 | return view('vendors.showOrUpdate')->with('vendor', $vendor); 65 | } 66 | 67 | /** 68 | * Show the form for editing the specified resource. 69 | * 70 | * @param $slug 71 | * @return \Illuminate\Http\Response 72 | */ 73 | public function edit($slug) 74 | { 75 | return redirect('vendors/' . $slug); 76 | } 77 | 78 | /** 79 | * Update the specified resource in storage. 80 | * 81 | * @param \Illuminate\Http\Request $request 82 | * @param Vendor $vendor 83 | * @param $slug 84 | * @return \Illuminate\Http\Response 85 | */ 86 | public function update(Request $request, Vendor $vendor, $slug) 87 | { 88 | $this->validate($request, [ 89 | 'name' => 'required', 90 | 'slug' => 'required', 91 | ]); 92 | 93 | $input = $request->except(['_token', '_method']); 94 | $vendor = $vendor->where('slug', '=', $slug)->firstOrFail(); 95 | $vendor->fill($input)->save(); 96 | 97 | return redirect('vendors/' . $vendor->slug)->with('success', 'Vendor successfully updated.'); 98 | } 99 | 100 | /** 101 | * Remove the specified resource from storage. 102 | * 103 | * @param Vendor $vendor 104 | * @param $slug 105 | * @return \Illuminate\Http\Response 106 | */ 107 | public function destroy(Vendor $vendor, $slug) 108 | { 109 | $vendor = $vendor->where('slug', '=', $slug)->firstOrFail(); 110 | $vendorName = $vendor->name; 111 | $vendor->delete(); 112 | return redirect('vendors')->with('success', 'Successfully deleted "' . $vendorName . '" vendor.'); 113 | } 114 | } 115 | -------------------------------------------------------------------------------- /app/Http/Controllers/AccountsController.php: -------------------------------------------------------------------------------- 1 | orderBy('name')->with('transactions')->get(); 19 | return view('accounts.index')->with('accounts', $accounts); 20 | } 21 | 22 | /** 23 | * Show the form for creating a new resource. 24 | * 25 | * @return \Illuminate\Http\Response 26 | */ 27 | public function create() 28 | { 29 | return redirect('accounts'); 30 | } 31 | 32 | /** 33 | * Store a newly created resource in storage. 34 | * 35 | * @param \Illuminate\Http\Request $request 36 | * @param Account $account 37 | * @return \Illuminate\Http\Response 38 | */ 39 | public function store(Request $request, Account $account) 40 | { 41 | $this->validate($request, [ 42 | 'name' => 'required|unique:accounts', 43 | 'slug' => 'required|unique:accounts', 44 | ]); 45 | 46 | $input = $request->except(['_token']); 47 | $account->fill($input)->save(); 48 | 49 | return redirect('accounts')->with('success', $account->name . ' account successfully added.'); 50 | } 51 | 52 | /** 53 | * Display the specified resource. 54 | * 55 | * @param Account $account 56 | * @param string $slug 57 | * @return \Illuminate\Http\Response 58 | */ 59 | public function show(Account $account, $slug) 60 | { 61 | $account = $account->where('slug', '=', $slug)->firstOrFail(); 62 | return view('accounts.showOrUpdate')->with('account', $account); 63 | } 64 | 65 | /** 66 | * Show the form for editing the specified resource. 67 | * 68 | * @param string $slug 69 | * @return \Illuminate\Http\Response 70 | */ 71 | public function edit($slug) 72 | { 73 | return redirect('accounts/' . $slug); 74 | } 75 | 76 | /** 77 | * Update the specified resource in storage. 78 | * 79 | * @param \Illuminate\Http\Request $request 80 | * @param Account $account 81 | * @param string $slug 82 | * @return \Illuminate\Http\Response 83 | */ 84 | public function update(Request $request, Account $account, $slug) 85 | { 86 | $this->validate($request, [ 87 | 'name' => 'required', 88 | 'slug' => 'required' 89 | ]); 90 | 91 | $input = $request->except(['_token', '_method']); 92 | $account = $account->where('slug', '=', $slug)->firstOrFail(); 93 | $account->fill($input)->save(); 94 | 95 | return redirect('accounts/' . $account->slug)->with('success', 'Account successfully updated.'); 96 | } 97 | 98 | /** 99 | * Remove the specified resource from storage. 100 | * 101 | * @param Account $account 102 | * @param string $slug 103 | * @return \Illuminate\Http\Response 104 | */ 105 | public function destroy(Account $account, $slug) 106 | { 107 | $account = $account->where('slug', '=', $slug)->firstOrFail(); 108 | $accountName = $account->name; 109 | $account->delete(); 110 | return redirect('accounts')->with('success', 'Successfully deleted "' . $accountName . '" account.'); 111 | } 112 | } 113 | -------------------------------------------------------------------------------- /app/Http/Controllers/CategoriesController.php: -------------------------------------------------------------------------------- 1 | orderBy('name')->with('transactions')->get(); 21 | return view('categories.index')->with('categories', $categories); 22 | } 23 | 24 | /** 25 | * Show the form for creating a new resource. 26 | * 27 | * @return \Illuminate\Http\Response 28 | */ 29 | public function create() 30 | { 31 | return redirect('/categories'); 32 | } 33 | 34 | /** 35 | * Store a newly created resource in storage. 36 | * 37 | * @param \Illuminate\Http\Request $request 38 | * @param Category $category 39 | * @return \Illuminate\Http\Response 40 | */ 41 | public function store(Request $request, Category $category) 42 | { 43 | $this->validate($request, [ 44 | 'name' => 'required|unique:categories', 45 | 'slug' => 'required|unique:categories', 46 | ]); 47 | 48 | $input = $request->except(['_token']); 49 | $category->fill($input)->save(); 50 | 51 | return redirect('categories')->with('success', $category->name . ' category successfully added.'); 52 | } 53 | 54 | /** 55 | * Display the specified resource. 56 | * 57 | * @param $slug 58 | * @param Category $category 59 | * @return \Illuminate\Http\Response 60 | */ 61 | public function show($slug, Category $category) 62 | { 63 | $category = $category->where('slug', '=', $slug)->firstOrFail(); 64 | return view('categories.showOrUpdate')->with('category', $category); 65 | } 66 | 67 | /** 68 | * Show the form for editing the specified resource. 69 | * 70 | * @param $slug 71 | * @return \Illuminate\Http\Response 72 | */ 73 | public function edit($slug) 74 | { 75 | return redirect('categories/' . $slug); 76 | } 77 | 78 | /** 79 | * Update the specified resource in storage. 80 | * 81 | * @param \Illuminate\Http\Request $request 82 | * @param Category $category 83 | * @param $slug 84 | * @return \Illuminate\Http\Response 85 | */ 86 | public function update(Request $request, Category $category, $slug) 87 | { 88 | $this->validate($request, [ 89 | 'name' => 'required', 90 | 'slug' => 'required', 91 | ]); 92 | 93 | $input = $request->except(['_token', '_method']); 94 | $category = $category->where('slug', '=', $slug)->firstOrFail(); 95 | $category->fill($input)->save(); 96 | 97 | return redirect('categories/' . $category->slug)->with('success', 'Category successfully updated.'); 98 | } 99 | 100 | /** 101 | * Remove the specified resource from storage. 102 | * 103 | * @param Category $category 104 | * @param $slug 105 | * @return \Illuminate\Http\Response 106 | */ 107 | public function destroy(Category $category, $slug) 108 | { 109 | $category = $category->where('slug', '=', $slug)->firstOrFail(); 110 | $categoryName = $category->name; 111 | $category->delete(); 112 | return redirect('categories')->with('success', 'Successfully deleted "' . $categoryName . '" category.'); 113 | } 114 | } 115 | -------------------------------------------------------------------------------- /resources/views/accounts/showOrUpdate.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.master') 2 | 3 | @section('title', $account->name) 4 | 5 | @section('content') 6 | @include('partials.validationErrors') 7 | 8 |
9 |
10 | 11 | {{ csrf_field() }} 12 | 13 |
14 | 15 |
16 | 17 |
18 |
19 |
20 | 21 |
22 | 23 |
24 |
25 |
26 | 27 |
28 | 29 |
30 |
31 |
32 |
33 |
34 | 41 |
42 |
43 |
44 |
45 | 46 |
47 | 48 |
49 |
50 |
51 | 52 |
53 | 54 |
55 |
56 |
57 |
58 | 59 |
60 |
61 |
62 |
63 | 64 |
65 |

Transactions   {{ $account->transactions->count() }}

66 | @if ($account->transactions->count() == 0) 67 |
68 |
69 | 70 | {{ csrf_field() }} 71 | 75 |
76 | @endif 77 |
78 | 79 | @endsection -------------------------------------------------------------------------------- /resources/views/transactions/index.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.master') 2 | 3 | @section('title', 'Transactions$' . $balance . '') 4 | 5 | @section('content') 6 |
7 | New Expense 8 | New Transfer 9 | 10 |
11 | 12 |
13 | 14 | @if (count($filters) > 0) 15 | @foreach ($filters as $name => $value) 16 | {{ ucwords($name) }} {{ $value['name'] }} 17 | @endforeach 18 |
19 | @endif 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | @foreach ($rows as $row) 35 | 36 | 37 | 42 | 47 | 58 | 59 | 60 | @if ($row->id == $rows[0]->id) 61 | 64 | @else 65 | 68 | @endif 69 | 70 | @endforeach 71 | 72 |
AccountVendorCategoryDescriptionDateAmountBalance
{{ $row->account->name }} 38 | @if ($row->vendor) 39 | {{ $row->vendor->name }} 40 | @endif 41 | 43 | @if ($row->category) 44 | {{ $row->category->name }} 45 | @endif 46 | 48 | @if ($row->description) 49 | {{ $row->description }} 50 | @endif 51 | @if ($row->business_expense == true) 52 | B 53 | @endif 54 | @if ($row->charitable_deduction == true) 55 | C 56 | @endif 57 | {{ date('j-M-y', strtotime($row->timestamp)) }}{{ money_format('%(!i', $row->amount) }} 62 | {{ money_format('%(!i', $row->balance) }} 63 | 66 | {{ money_format('%(!i', $row->balance) }} 67 |
73 | @endsection -------------------------------------------------------------------------------- /resources/views/layouts/master.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Accounting - @yield('title') 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 22 | 23 | 24 | 25 | 63 | 64 |
65 | 68 | 69 | @include('partials.alerts') 70 | 71 | @yield('content') 72 |
73 | 74 | 75 | 76 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /config/database.php: -------------------------------------------------------------------------------- 1 | PDO::FETCH_CLASS, 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Default Database Connection Name 21 | |-------------------------------------------------------------------------- 22 | | 23 | | Here you may specify which of the database connections below you wish 24 | | to use as your default connection for all database work. Of course 25 | | you may use many connections at once using the Database library. 26 | | 27 | */ 28 | 29 | 'default' => env('DB_CONNECTION', 'mysql'), 30 | 31 | /* 32 | |-------------------------------------------------------------------------- 33 | | Database Connections 34 | |-------------------------------------------------------------------------- 35 | | 36 | | Here are each of the database connections setup for your application. 37 | | Of course, examples of configuring each database platform that is 38 | | supported by Laravel is shown below to make development simple. 39 | | 40 | | 41 | | All database work in Laravel is done through the PHP PDO facilities 42 | | so make sure you have the driver for your particular database of 43 | | choice installed on your machine before you begin development. 44 | | 45 | */ 46 | 47 | 'connections' => [ 48 | 49 | 'sqlite' => [ 50 | 'driver' => 'sqlite', 51 | 'database' => database_path('database.sqlite'), 52 | 'prefix' => '', 53 | ], 54 | 55 | 'mysql' => [ 56 | 'driver' => 'mysql', 57 | 'host' => env('DB_HOST', 'localhost'), 58 | 'database' => env('DB_DATABASE', 'accounting'), 59 | 'username' => env('DB_USERNAME', 'homestead'), 60 | 'password' => env('DB_PASSWORD', 'secret'), 61 | 'charset' => 'utf8', 62 | 'collation' => 'utf8_unicode_ci', 63 | 'prefix' => '', 64 | 'strict' => false, 65 | ], 66 | 67 | 'pgsql' => [ 68 | 'driver' => 'pgsql', 69 | 'host' => env('DB_HOST', 'localhost'), 70 | 'database' => env('DB_DATABASE', 'forge'), 71 | 'username' => env('DB_USERNAME', 'forge'), 72 | 'password' => env('DB_PASSWORD', ''), 73 | 'charset' => 'utf8', 74 | 'prefix' => '', 75 | 'schema' => 'public', 76 | ], 77 | 78 | 'sqlsrv' => [ 79 | 'driver' => 'sqlsrv', 80 | 'host' => env('DB_HOST', 'localhost'), 81 | 'database' => env('DB_DATABASE', 'forge'), 82 | 'username' => env('DB_USERNAME', 'forge'), 83 | 'password' => env('DB_PASSWORD', ''), 84 | 'charset' => 'utf8', 85 | 'prefix' => '', 86 | ], 87 | 88 | ], 89 | 90 | /* 91 | |-------------------------------------------------------------------------- 92 | | Migration Repository Table 93 | |-------------------------------------------------------------------------- 94 | | 95 | | This table keeps track of all the migrations that have already run for 96 | | your application. Using this information, we can determine which of 97 | | the migrations on disk haven't actually been run in the database. 98 | | 99 | */ 100 | 101 | 'migrations' => 'migrations', 102 | 103 | /* 104 | |-------------------------------------------------------------------------- 105 | | Redis Databases 106 | |-------------------------------------------------------------------------- 107 | | 108 | | Redis is an open source, fast, and advanced key-value store that also 109 | | provides a richer set of commands than a typical key-value systems 110 | | such as APC or Memcached. Laravel makes it easy to dig right in. 111 | | 112 | */ 113 | 114 | 'redis' => [ 115 | 116 | 'cluster' => false, 117 | 118 | 'default' => [ 119 | 'host' => '127.0.0.1', 120 | 'port' => 6379, 121 | 'database' => 0, 122 | ], 123 | 124 | ], 125 | 126 | ]; 127 | -------------------------------------------------------------------------------- /config/mail.php: -------------------------------------------------------------------------------- 1 | env('MAIL_DRIVER', 'smtp'), 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | SMTP Host Address 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here you may provide the host address of the SMTP server used by your 26 | | applications. A default option is provided that is compatible with 27 | | the Mailgun mail service which will provide reliable deliveries. 28 | | 29 | */ 30 | 31 | 'host' => env('MAIL_HOST', 'smtp.mailgun.org'), 32 | 33 | /* 34 | |-------------------------------------------------------------------------- 35 | | SMTP Host Port 36 | |-------------------------------------------------------------------------- 37 | | 38 | | This is the SMTP port used by your application to deliver e-mails to 39 | | users of the application. Like the host we have set this value to 40 | | stay compatible with the Mailgun e-mail application by default. 41 | | 42 | */ 43 | 44 | 'port' => env('MAIL_PORT', 587), 45 | 46 | /* 47 | |-------------------------------------------------------------------------- 48 | | Global "From" Address 49 | |-------------------------------------------------------------------------- 50 | | 51 | | You may wish for all e-mails sent by your application to be sent from 52 | | the same address. Here, you may specify a name and address that is 53 | | used globally for all e-mails that are sent by your application. 54 | | 55 | */ 56 | 57 | 'from' => ['address' => null, 'name' => null], 58 | 59 | /* 60 | |-------------------------------------------------------------------------- 61 | | E-Mail Encryption Protocol 62 | |-------------------------------------------------------------------------- 63 | | 64 | | Here you may specify the encryption protocol that should be used when 65 | | the application send e-mail messages. A sensible default using the 66 | | transport layer security protocol should provide great security. 67 | | 68 | */ 69 | 70 | 'encryption' => env('MAIL_ENCRYPTION', 'tls'), 71 | 72 | /* 73 | |-------------------------------------------------------------------------- 74 | | SMTP Server Username 75 | |-------------------------------------------------------------------------- 76 | | 77 | | If your SMTP server requires a username for authentication, you should 78 | | set it here. This will get used to authenticate with your server on 79 | | connection. You may also set the "password" value below this one. 80 | | 81 | */ 82 | 83 | 'username' => env('MAIL_USERNAME'), 84 | 85 | /* 86 | |-------------------------------------------------------------------------- 87 | | SMTP Server Password 88 | |-------------------------------------------------------------------------- 89 | | 90 | | Here you may set the password required by your SMTP server to send out 91 | | messages from your application. This will be given to the server on 92 | | connection so that the application will be able to send messages. 93 | | 94 | */ 95 | 96 | 'password' => env('MAIL_PASSWORD'), 97 | 98 | /* 99 | |-------------------------------------------------------------------------- 100 | | Sendmail System Path 101 | |-------------------------------------------------------------------------- 102 | | 103 | | When using the "sendmail" driver to send e-mails, we will need to know 104 | | the path to where Sendmail lives on this server. A default path has 105 | | been provided here, which will work well on most of your systems. 106 | | 107 | */ 108 | 109 | 'sendmail' => '/usr/sbin/sendmail -bs', 110 | 111 | /* 112 | |-------------------------------------------------------------------------- 113 | | Mail "Pretend" 114 | |-------------------------------------------------------------------------- 115 | | 116 | | When this option is enabled, e-mail will not actually be sent over the 117 | | web and will instead be written to your application's logs files so 118 | | you may inspect the message. This is great for local development. 119 | | 120 | */ 121 | 122 | 'pretend' => env('MAIL_PRETEND', false), 123 | 124 | ]; 125 | -------------------------------------------------------------------------------- /config/session.php: -------------------------------------------------------------------------------- 1 | env('SESSION_DRIVER', 'file'), 20 | 21 | /* 22 | |-------------------------------------------------------------------------- 23 | | Session Lifetime 24 | |-------------------------------------------------------------------------- 25 | | 26 | | Here you may specify the number of minutes that you wish the session 27 | | to be allowed to remain idle before it expires. If you want them 28 | | to immediately expire on the browser closing, set that option. 29 | | 30 | */ 31 | 32 | 'lifetime' => 120, 33 | 34 | 'expire_on_close' => false, 35 | 36 | /* 37 | |-------------------------------------------------------------------------- 38 | | Session Encryption 39 | |-------------------------------------------------------------------------- 40 | | 41 | | This option allows you to easily specify that all of your session data 42 | | should be encrypted before it is stored. All encryption will be run 43 | | automatically by Laravel and you can use the Session like normal. 44 | | 45 | */ 46 | 47 | 'encrypt' => false, 48 | 49 | /* 50 | |-------------------------------------------------------------------------- 51 | | Session File Location 52 | |-------------------------------------------------------------------------- 53 | | 54 | | When using the native session driver, we need a location where session 55 | | files may be stored. A default has been set for you but a different 56 | | location may be specified. This is only needed for file sessions. 57 | | 58 | */ 59 | 60 | 'files' => storage_path('framework/sessions'), 61 | 62 | /* 63 | |-------------------------------------------------------------------------- 64 | | Session Database Connection 65 | |-------------------------------------------------------------------------- 66 | | 67 | | When using the "database" or "redis" session drivers, you may specify a 68 | | connection that should be used to manage these sessions. This should 69 | | correspond to a connection in your database configuration options. 70 | | 71 | */ 72 | 73 | 'connection' => null, 74 | 75 | /* 76 | |-------------------------------------------------------------------------- 77 | | Session Database Table 78 | |-------------------------------------------------------------------------- 79 | | 80 | | When using the "database" session driver, you may specify the table we 81 | | should use to manage the sessions. Of course, a sensible default is 82 | | provided for you; however, you are free to change this as needed. 83 | | 84 | */ 85 | 86 | 'table' => 'sessions', 87 | 88 | /* 89 | |-------------------------------------------------------------------------- 90 | | Session Sweeping Lottery 91 | |-------------------------------------------------------------------------- 92 | | 93 | | Some session drivers must manually sweep their storage location to get 94 | | rid of old sessions from storage. Here are the chances that it will 95 | | happen on a given request. By default, the odds are 2 out of 100. 96 | | 97 | */ 98 | 99 | 'lottery' => [2, 100], 100 | 101 | /* 102 | |-------------------------------------------------------------------------- 103 | | Session Cookie Name 104 | |-------------------------------------------------------------------------- 105 | | 106 | | Here you may change the name of the cookie used to identify a session 107 | | instance by ID. The name specified here will get used every time a 108 | | new session cookie is created by the framework for every driver. 109 | | 110 | */ 111 | 112 | 'cookie' => 'laravel_session', 113 | 114 | /* 115 | |-------------------------------------------------------------------------- 116 | | Session Cookie Path 117 | |-------------------------------------------------------------------------- 118 | | 119 | | The session cookie path determines the path for which the cookie will 120 | | be regarded as available. Typically, this will be the root path of 121 | | your application but you are free to change this when necessary. 122 | | 123 | */ 124 | 125 | 'path' => '/', 126 | 127 | /* 128 | |-------------------------------------------------------------------------- 129 | | Session Cookie Domain 130 | |-------------------------------------------------------------------------- 131 | | 132 | | Here you may change the domain of the cookie used to identify a session 133 | | in your application. This will determine which domains the cookie is 134 | | available to in your application. A sensible default has been set. 135 | | 136 | */ 137 | 138 | 'domain' => null, 139 | 140 | /* 141 | |-------------------------------------------------------------------------- 142 | | HTTPS Only Cookies 143 | |-------------------------------------------------------------------------- 144 | | 145 | | By setting this option to true, session cookies will only be sent back 146 | | to the server if the browser has a HTTPS connection. This will keep 147 | | the cookie from being sent to you if it can not be done securely. 148 | | 149 | */ 150 | 151 | 'secure' => false, 152 | 153 | ]; 154 | -------------------------------------------------------------------------------- /resources/lang/en/validation.php: -------------------------------------------------------------------------------- 1 | 'The :attribute must be accepted.', 17 | 'active_url' => 'The :attribute is not a valid URL.', 18 | 'after' => 'The :attribute must be a date after :date.', 19 | 'alpha' => 'The :attribute may only contain letters.', 20 | 'alpha_dash' => 'The :attribute may only contain letters, numbers, and dashes.', 21 | 'alpha_num' => 'The :attribute may only contain letters and numbers.', 22 | 'array' => 'The :attribute must be an array.', 23 | 'before' => 'The :attribute must be a date before :date.', 24 | 'between' => [ 25 | 'numeric' => 'The :attribute must be between :min and :max.', 26 | 'file' => 'The :attribute must be between :min and :max kilobytes.', 27 | 'string' => 'The :attribute must be between :min and :max characters.', 28 | 'array' => 'The :attribute must have between :min and :max items.', 29 | ], 30 | 'boolean' => 'The :attribute field must be true or false.', 31 | 'confirmed' => 'The :attribute confirmation does not match.', 32 | 'date' => 'The :attribute is not a valid date.', 33 | 'date_format' => 'The :attribute does not match the format :format.', 34 | 'different' => 'The :attribute and :other must be different.', 35 | 'digits' => 'The :attribute must be :digits digits.', 36 | 'digits_between' => 'The :attribute must be between :min and :max digits.', 37 | 'email' => 'The :attribute must be a valid email address.', 38 | 'exists' => 'The selected :attribute is invalid.', 39 | 'filled' => 'The :attribute field is required.', 40 | 'image' => 'The :attribute must be an image.', 41 | 'in' => 'The selected :attribute is invalid.', 42 | 'integer' => 'The :attribute must be an integer.', 43 | 'ip' => 'The :attribute must be a valid IP address.', 44 | 'json' => 'The :attribute must be a valid JSON string.', 45 | 'max' => [ 46 | 'numeric' => 'The :attribute may not be greater than :max.', 47 | 'file' => 'The :attribute may not be greater than :max kilobytes.', 48 | 'string' => 'The :attribute may not be greater than :max characters.', 49 | 'array' => 'The :attribute may not have more than :max items.', 50 | ], 51 | 'mimes' => 'The :attribute must be a file of type: :values.', 52 | 'min' => [ 53 | 'numeric' => 'The :attribute must be at least :min.', 54 | 'file' => 'The :attribute must be at least :min kilobytes.', 55 | 'string' => 'The :attribute must be at least :min characters.', 56 | 'array' => 'The :attribute must have at least :min items.', 57 | ], 58 | 'not_in' => 'The selected :attribute is invalid.', 59 | 'numeric' => 'The :attribute must be a number.', 60 | 'regex' => 'The :attribute format is invalid.', 61 | 'required' => 'The :attribute field is required.', 62 | 'required_if' => 'The :attribute field is required when :other is :value.', 63 | 'required_unless' => 'The :attribute field is required unless :other is in :values.', 64 | 'required_with' => 'The :attribute field is required when :values is present.', 65 | 'required_with_all' => 'The :attribute field is required when :values is present.', 66 | 'required_without' => 'The :attribute field is required when :values is not present.', 67 | 'required_without_all' => 'The :attribute field is required when none of :values are present.', 68 | 'same' => 'The :attribute and :other must match.', 69 | 'size' => [ 70 | 'numeric' => 'The :attribute must be :size.', 71 | 'file' => 'The :attribute must be :size kilobytes.', 72 | 'string' => 'The :attribute must be :size characters.', 73 | 'array' => 'The :attribute must contain :size items.', 74 | ], 75 | 'string' => 'The :attribute must be a string.', 76 | 'timezone' => 'The :attribute must be a valid zone.', 77 | 'unique' => 'The :attribute has already been taken.', 78 | 'url' => 'The :attribute format is invalid.', 79 | 80 | /* 81 | |-------------------------------------------------------------------------- 82 | | Custom Validation Language Lines 83 | |-------------------------------------------------------------------------- 84 | | 85 | | Here you may specify custom validation messages for attributes using the 86 | | convention "attribute.rule" to name the lines. This makes it quick to 87 | | specify a specific custom language line for a given attribute rule. 88 | | 89 | */ 90 | 91 | 'custom' => [ 92 | 'attribute-name' => [ 93 | 'rule-name' => 'custom-message', 94 | ], 95 | ], 96 | 97 | /* 98 | |-------------------------------------------------------------------------- 99 | | Custom Validation Attributes 100 | |-------------------------------------------------------------------------- 101 | | 102 | | The following language lines are used to swap attribute place-holders 103 | | with something more reader friendly such as E-Mail Address instead 104 | | of "email". This simply helps us make messages a little cleaner. 105 | | 106 | */ 107 | 108 | 'attributes' => [], 109 | 110 | ]; 111 | -------------------------------------------------------------------------------- /config/app.php: -------------------------------------------------------------------------------- 1 | env('APP_DEBUG', true), 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Application URL 21 | |-------------------------------------------------------------------------- 22 | | 23 | | This URL is used by the console to properly generate URLs when using 24 | | the Artisan command line tool. You should set this to the root of 25 | | your application so that it is used when running Artisan tasks. 26 | | 27 | */ 28 | 29 | 'url' => 'http://localhost', 30 | 31 | /* 32 | |-------------------------------------------------------------------------- 33 | | Application Timezone 34 | |-------------------------------------------------------------------------- 35 | | 36 | | Here you may specify the default timezone for your application, which 37 | | will be used by the PHP date and date-time functions. We have gone 38 | | ahead and set this to a sensible default for you out of the box. 39 | | 40 | */ 41 | 42 | 'timezone' => 'America/Los_Angeles', 43 | 44 | /* 45 | |-------------------------------------------------------------------------- 46 | | Application Locale Configuration 47 | |-------------------------------------------------------------------------- 48 | | 49 | | The application locale determines the default locale that will be used 50 | | by the translation service provider. You are free to set this value 51 | | to any of the locales which will be supported by the application. 52 | | 53 | */ 54 | 55 | 'locale' => 'en', 56 | 57 | /* 58 | |-------------------------------------------------------------------------- 59 | | Application Fallback Locale 60 | |-------------------------------------------------------------------------- 61 | | 62 | | The fallback locale determines the locale to use when the current one 63 | | is not available. You may change the value to correspond to any of 64 | | the language folders that are provided through your application. 65 | | 66 | */ 67 | 68 | 'fallback_locale' => 'en', 69 | 70 | /* 71 | |-------------------------------------------------------------------------- 72 | | Encryption Key 73 | |-------------------------------------------------------------------------- 74 | | 75 | | This key is used by the Illuminate encrypter service and should be set 76 | | to a random, 32 character string, otherwise these encrypted strings 77 | | will not be safe. Please do this before deploying an application! 78 | | 79 | */ 80 | 81 | 'key' => env('APP_KEY', 'SomeRandomString'), 82 | 83 | 'cipher' => 'AES-256-CBC', 84 | 85 | /* 86 | |-------------------------------------------------------------------------- 87 | | Logging Configuration 88 | |-------------------------------------------------------------------------- 89 | | 90 | | Here you may configure the log settings for your application. Out of 91 | | the box, Laravel uses the Monolog PHP logging library. This gives 92 | | you a variety of powerful log handlers / formatters to utilize. 93 | | 94 | | Available Settings: "single", "daily", "syslog", "errorlog" 95 | | 96 | */ 97 | 98 | 'log' => env('APP_LOG', 'single'), 99 | 100 | /* 101 | |-------------------------------------------------------------------------- 102 | | Autoloaded Service Providers 103 | |-------------------------------------------------------------------------- 104 | | 105 | | The service providers listed here will be automatically loaded on the 106 | | request to your application. Feel free to add your own services to 107 | | this array to grant expanded functionality to your applications. 108 | | 109 | */ 110 | 111 | 'providers' => [ 112 | 113 | /* 114 | * Laravel Framework Service Providers... 115 | */ 116 | Illuminate\Foundation\Providers\ArtisanServiceProvider::class, 117 | Illuminate\Auth\AuthServiceProvider::class, 118 | Illuminate\Broadcasting\BroadcastServiceProvider::class, 119 | Illuminate\Bus\BusServiceProvider::class, 120 | Illuminate\Cache\CacheServiceProvider::class, 121 | Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class, 122 | Illuminate\Routing\ControllerServiceProvider::class, 123 | Illuminate\Cookie\CookieServiceProvider::class, 124 | Illuminate\Database\DatabaseServiceProvider::class, 125 | Illuminate\Encryption\EncryptionServiceProvider::class, 126 | Illuminate\Filesystem\FilesystemServiceProvider::class, 127 | Illuminate\Foundation\Providers\FoundationServiceProvider::class, 128 | Illuminate\Hashing\HashServiceProvider::class, 129 | Illuminate\Mail\MailServiceProvider::class, 130 | Illuminate\Pagination\PaginationServiceProvider::class, 131 | Illuminate\Pipeline\PipelineServiceProvider::class, 132 | Illuminate\Queue\QueueServiceProvider::class, 133 | Illuminate\Redis\RedisServiceProvider::class, 134 | Illuminate\Auth\Passwords\PasswordResetServiceProvider::class, 135 | Illuminate\Session\SessionServiceProvider::class, 136 | Illuminate\Translation\TranslationServiceProvider::class, 137 | Illuminate\Validation\ValidationServiceProvider::class, 138 | Illuminate\View\ViewServiceProvider::class, 139 | Barryvdh\Debugbar\ServiceProvider::class, 140 | 141 | /* 142 | * Application Service Providers... 143 | */ 144 | App\Providers\AppServiceProvider::class, 145 | App\Providers\AuthServiceProvider::class, 146 | App\Providers\EventServiceProvider::class, 147 | App\Providers\RouteServiceProvider::class, 148 | 149 | ], 150 | 151 | /* 152 | |-------------------------------------------------------------------------- 153 | | Class Aliases 154 | |-------------------------------------------------------------------------- 155 | | 156 | | This array of class aliases will be registered when this application 157 | | is started. However, feel free to register as many as you wish as 158 | | the aliases are "lazy" loaded so they don't hinder performance. 159 | | 160 | */ 161 | 162 | 'aliases' => [ 163 | 164 | 'App' => Illuminate\Support\Facades\App::class, 165 | 'Artisan' => Illuminate\Support\Facades\Artisan::class, 166 | 'Auth' => Illuminate\Support\Facades\Auth::class, 167 | 'Blade' => Illuminate\Support\Facades\Blade::class, 168 | 'Bus' => Illuminate\Support\Facades\Bus::class, 169 | 'Cache' => Illuminate\Support\Facades\Cache::class, 170 | 'Config' => Illuminate\Support\Facades\Config::class, 171 | 'Cookie' => Illuminate\Support\Facades\Cookie::class, 172 | 'Crypt' => Illuminate\Support\Facades\Crypt::class, 173 | 'DB' => Illuminate\Support\Facades\DB::class, 174 | 'Eloquent' => Illuminate\Database\Eloquent\Model::class, 175 | 'Event' => Illuminate\Support\Facades\Event::class, 176 | 'File' => Illuminate\Support\Facades\File::class, 177 | 'Gate' => Illuminate\Support\Facades\Gate::class, 178 | 'Hash' => Illuminate\Support\Facades\Hash::class, 179 | 'Input' => Illuminate\Support\Facades\Input::class, 180 | 'Inspiring' => Illuminate\Foundation\Inspiring::class, 181 | 'Lang' => Illuminate\Support\Facades\Lang::class, 182 | 'Log' => Illuminate\Support\Facades\Log::class, 183 | 'Mail' => Illuminate\Support\Facades\Mail::class, 184 | 'Password' => Illuminate\Support\Facades\Password::class, 185 | 'Queue' => Illuminate\Support\Facades\Queue::class, 186 | 'Redirect' => Illuminate\Support\Facades\Redirect::class, 187 | 'Redis' => Illuminate\Support\Facades\Redis::class, 188 | 'Request' => Illuminate\Support\Facades\Request::class, 189 | 'Response' => Illuminate\Support\Facades\Response::class, 190 | 'Route' => Illuminate\Support\Facades\Route::class, 191 | 'Schema' => Illuminate\Support\Facades\Schema::class, 192 | 'Session' => Illuminate\Support\Facades\Session::class, 193 | 'Storage' => Illuminate\Support\Facades\Storage::class, 194 | 'URL' => Illuminate\Support\Facades\URL::class, 195 | 'Validator' => Illuminate\Support\Facades\Validator::class, 196 | 'View' => Illuminate\Support\Facades\View::class, 197 | 198 | ], 199 | 200 | ]; 201 | -------------------------------------------------------------------------------- /app/Http/Controllers/TransactionsController.php: -------------------------------------------------------------------------------- 1 | orderBy('timestamp', 'ASC')->with('category', 'vendor'); 29 | 30 | $activeFilters = []; 31 | 32 | // Account filter 33 | if ($accountFilter = $request->input('account')) { 34 | $query->whereHas('account', function ($q) use ($accountFilter) { 35 | $q->where('slug', '=', $accountFilter); 36 | }); 37 | $activeFilters['account'] = [ 38 | 'name' => Account::where('slug', '=', $accountFilter)->first()->name, 39 | 'removedUri' => http_build_query($request->except('account')) 40 | ]; 41 | } 42 | 43 | // Vendor filter 44 | if ($vendorFilter = $request->input('vendor')) { 45 | $query->whereHas('vendor', function ($q) use ($vendorFilter) { 46 | $q->where('slug', '=', $vendorFilter); 47 | }); 48 | $activeFilters['vendor'] = [ 49 | 'name' => Vendor::where('slug', '=', $vendorFilter)->first()->name, 50 | 'removedUri' => http_build_query($request->except('vendor')) 51 | ]; 52 | } 53 | 54 | // Category filter 55 | if ($categoryFilter = $request->input('category')) { 56 | $query->whereHas('category', function ($q) use ($categoryFilter) { 57 | $q->where('slug', '=', $categoryFilter); 58 | }); 59 | $activeFilters['category'] = [ 60 | 'name' => Category::where('slug', '=', $categoryFilter)->first()->name, 61 | 'removedUri' => http_build_query($request->except('category')) 62 | ]; 63 | } 64 | 65 | // Business filter 66 | if (($businessFilter = $request->input('business')) === "") { 67 | $query->where('business_expense', '=', '1'); 68 | $activeFilters['business expense'] = [ 69 | 'name' => '', 70 | 'removedUri' => http_build_query($request->except('business')) 71 | ]; 72 | } 73 | 74 | // Charity filter 75 | if (($charityFilter = $request->input('charity')) === "") { 76 | $query->where('charitable_deduction', '=', '1'); 77 | $activeFilters['charitable deduction'] = [ 78 | 'name' => '', 79 | 'removedUri' => http_build_query($request->except('charity')) 80 | ]; 81 | } 82 | 83 | // Execute query 84 | $this->transactions = $query->get(); 85 | 86 | $this->calculateRowBalances(); 87 | $rows = $this->transactions->reverse(); 88 | return view('transactions.index', [ 89 | 'rows' => $rows, 90 | 'balance' => money_format('%(!i', @$rows[0]->balance), 91 | 'filters' => $activeFilters 92 | ])->withInput($request->all()); 93 | } 94 | 95 | /** 96 | * Calculate running balance of rows 97 | * 98 | * @return void 99 | */ 100 | public function calculateRowBalances() 101 | { 102 | $this->transactions->each(function($row, $key) { 103 | // Get previous row 104 | $previousRow = $this->transactions->get($key - 1); 105 | $previousRowBalance = 0; 106 | if ($previousRow instanceof Transaction) { 107 | $previousRowBalance = $previousRow->balance; 108 | } 109 | 110 | $row->balance = $row->amount + $previousRowBalance; 111 | }); 112 | } 113 | 114 | /** 115 | * Show the form for creating a new resource. 116 | * 117 | * @return \Illuminate\Http\Response 118 | */ 119 | public function create(Request $request, Account $accounts, Vendor $vendors, Category $categories) 120 | { 121 | $type = key(array_where($request->only(['transfer', 'income']), function ($key, $value) { 122 | return $value !== null; 123 | })); 124 | 125 | return view('transactions.createOrShowOrUpdate', [ 126 | 'vendors' => $vendors->orderBy('name')->get(), 127 | 'categories' => $categories->orderBy('name')->get(), 128 | 'type' => $type ?: 'expense', 129 | 'accounts' => $accounts->orderBy('name')->get() 130 | ]); 131 | } 132 | 133 | /** 134 | * Store a newly created resource in storage. 135 | * 136 | * @param \Illuminate\Http\Request $request 137 | * @param Transaction $transaction 138 | * @return \Illuminate\Http\Response 139 | */ 140 | public function store(Request $request, Transaction $transaction) 141 | { 142 | if ($request->input('type') == 'transfer') { 143 | return $this->storeTransfer($request); 144 | } 145 | $this->validate($request, [ 146 | 'type' => 'required|in:expense,transfer,income', 147 | 'account' => 'required:exists:accounts,id', 148 | 'vendor' => 'required|exists:vendors,id', 149 | 'category' => 'exists:categories,id', 150 | 'description' => 'max:255', 151 | 'timestamp' => 'required|date_format:Y-m-d\TH:i|before:' . date('Y-m-d\TH:i'), 152 | 'amount' => 'required|numeric' 153 | ]); 154 | 155 | $input = $request->except(['_token']); 156 | if ($input['type'] == 'expense' && $input['amount'] > 0) { 157 | $input['amount'] = $input['amount'] * -1; 158 | } 159 | $input['account_id'] = $input['account']; 160 | $input['vendor_id'] = $input['vendor']; 161 | $input['category_id'] = $input['category']; 162 | unset($input['type'], $input['account'], $input['vendor'], $input['category']); 163 | 164 | $transaction->fill($input)->save(); 165 | 166 | return redirect('transactions')->with('success', 'Transaction successfully added.'); 167 | } 168 | 169 | protected function storeTransfer(Request $request) 170 | { 171 | $this->validate($request, [ 172 | 'type' => 'required|in:expense,transfer,income', 173 | 'from_account' => 'required:exists:accounts,id', 174 | 'to_account' => 'required:exists:accounts,id', 175 | 'description' => 'max:255', 176 | 'timestamp' => 'required|date_format:Y-m-d\TH:i|before:' . date('Y-m-d\TH:i'), 177 | 'amount' => 'required|numeric' 178 | ]); 179 | 180 | $input = $request->except(['_token']); 181 | $originalAmount = $input['amount']; 182 | unset($input['type'], $input['vendor'], $input['category']); 183 | 184 | // Save the expense 185 | $input['account_id'] = $input['from_account']; 186 | if ($input['amount'] > 0) { 187 | $input['amount'] = $input['amount'] * -1; 188 | } 189 | (new Transaction)->fill($input)->save(); 190 | 191 | // Save the income 192 | $input['account_id'] = $input['to_account']; 193 | $input['amount'] = $originalAmount; 194 | (new Transaction)->fill($input)->save(); 195 | 196 | return redirect('transactions')->with('success', 'Transactions successfully added.'); 197 | } 198 | 199 | /** 200 | * Display the specified resource. 201 | * 202 | * @param Transaction $transaction 203 | * @param Account $accounts 204 | * @param Vendor $vendors 205 | * @param Category $categories 206 | * @param int $id 207 | * @return \Illuminate\Http\Response 208 | */ 209 | public function show(Transaction $transaction, Account $accounts, Vendor $vendors, Category $categories, $id) 210 | { 211 | $transaction = $transaction->with(['category', 'vendor'])->where('id', '=', $id)->firstOrFail(); 212 | $transaction->timestamp = str_replace(' ', 'T', $transaction->timestamp); 213 | if ($transaction->amount < 0) { 214 | $type = 'expense'; 215 | $transaction->amount = $transaction->amount * -1; 216 | } elseif ($transaction->amount > 0) { 217 | $type = 'income'; 218 | } 219 | return view('transactions.createOrShowOrUpdate', [ 220 | 'transaction' => $transaction, 221 | 'accounts' => $accounts->orderBy('name')->get(), 222 | 'vendors' => $vendors->orderBy('name')->get(), 223 | 'categories' => $categories->orderBy('name')->get(), 224 | 'type' => $type 225 | ]); 226 | } 227 | 228 | /** 229 | * Show the form for editing the specified resource. 230 | * 231 | * @param int $id 232 | * @return \Illuminate\Http\Response 233 | */ 234 | public function edit($id) 235 | { 236 | return redirect('transactions/' . $id); 237 | } 238 | 239 | /** 240 | * Update the specified resource in storage. 241 | * 242 | * @param \Illuminate\Http\Request $request 243 | * @param Transaction $transaction 244 | * @param int $id 245 | * @return \Illuminate\Http\Response 246 | */ 247 | public function update(Request $request, Transaction $transaction, $id) 248 | { 249 | $this->validate($request, [ 250 | 'type' => 'required|in:expense,transfer,income', 251 | 'account' => 'required:exists:accounts,id', 252 | 'vendor' => 'required|exists:vendors,id', 253 | 'category' => 'exists:categories,id', 254 | 'description' => 'required|max:255', 255 | 'timestamp' => 'required|date_format:Y-m-d\TH:i|before:' . date('Y-m-d\TH:i'), 256 | 'amount' => 'required|numeric' 257 | ]); 258 | 259 | $input = $request->except(['_token', '_method']); 260 | if ($input['type'] == 'expense' && $input['amount'] > 0) { 261 | $input['amount'] = $input['amount'] * -1; 262 | } 263 | $input['account_id'] = $input['account']; 264 | $input['vendor_id'] = $input['vendor']; 265 | $input['category_id'] = $input['category']; 266 | $input['timestamp'] = str_replace('T', ' ', $input['timestamp']); 267 | unset($input['type'], $input['account'], $input['vendor'], $input['category']); 268 | 269 | $transaction->where('id', '=', $id)->firstOrFail()->fill($input)->save(); 270 | 271 | return redirect('transactions')->with('success', 'Transaction successfully updated.'); 272 | } 273 | 274 | /** 275 | * Remove the specified resource from storage. 276 | * 277 | * @param Transaction $transaction 278 | * @param int $id 279 | * @return \Illuminate\Http\Response 280 | */ 281 | public function destroy(Transaction $transaction, $id) 282 | { 283 | $transaction->where('id', '=', $id)->firstOrFail()->delete(); 284 | return redirect('transactions')->with('success', 'Successfully deleted transaction.'); 285 | } 286 | } 287 | -------------------------------------------------------------------------------- /resources/views/transactions/createOrShowOrUpdate.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.master') 2 | 3 | @if (isset($transaction)) 4 | @section('title', 'Update ' . ucfirst($type)) 5 | @else 6 | @section('title', 'New ' . ucfirst($type)) 7 | @endif 8 | 9 | @section('content') 10 | @include('partials.validationErrors') 11 | 12 |
13 | @if (isset($transaction)) 14 |
15 | 16 | @else 17 | 18 | @endif 19 | {{ csrf_field() }} 20 | 21 | 22 | @if (isset($transaction)) 23 | 24 |
25 | 26 |
27 | 28 |
29 |
30 | @endif 31 | 32 | @if ($type == 'transfer') 33 | 34 |
35 | 36 |
37 | 46 |
47 |
48 | 49 | 50 |
51 | 52 |
53 | 62 |
63 |
64 | @else 65 | 66 |
67 | 68 |
69 | 78 |
79 |
80 | @endif 81 | 82 | @if ($type !== 'transfer') 83 | 84 |
85 | 86 |
87 | 96 |
97 |
98 | 99 | 100 |
101 | 102 |
103 | 113 |
114 |
115 | @endif 116 | 117 | 118 |
119 | 120 |
121 | 122 |
123 |
124 | 125 | 126 |
127 | 128 |
129 | 130 |
131 |
132 | 133 | 134 |
135 | 136 |
137 |
138 | $ 139 | 140 |
141 |
142 |
143 | 144 | 145 |
146 |
147 |
148 | 155 |
156 |
157 |
158 | 159 | 160 |
161 |
162 |
163 | 170 |
171 |
172 |
173 | 174 | @if (isset($transaction)) 175 | 176 |
177 | 178 |
179 | 180 |
181 |
182 | 183 | 184 |
185 | 186 |
187 | 188 |
189 |
190 | @endif 191 | 192 |
193 | 194 | 195 |
196 |
197 | 198 |
199 |
200 | 201 |
202 |
203 | 204 |
205 | @if (isset($transaction)) 206 |
207 | 208 | {{ csrf_field() }} 209 | 213 |
214 | @endif 215 |
216 | @endsection --------------------------------------------------------------------------------