├── .env.example ├── .gitattributes ├── .gitignore ├── .travis.yml ├── app ├── Category.php ├── Client.php ├── Console │ ├── Commands │ │ ├── CreateUser.php │ │ ├── Inspire.php │ │ └── SpawnOccurrences.php │ └── Kernel.php ├── Events │ ├── Event.php │ ├── ServiceWasCreated.php │ └── ServiceWasUpdated.php ├── Exceptions │ └── Handler.php ├── Http │ ├── Controllers │ │ ├── Api │ │ │ ├── CategoryController.php │ │ │ ├── ClientController.php │ │ │ └── OccurrenceController.php │ │ ├── Auth │ │ │ ├── AuthController.php │ │ │ └── PasswordController.php │ │ ├── CategoryController.php │ │ ├── ClientController.php │ │ ├── Controller.php │ │ ├── HomeController.php │ │ ├── ServiceController.php │ │ └── SettingsController.php │ ├── Kernel.php │ ├── Middleware │ │ ├── Authenticate.php │ │ ├── EncryptCookies.php │ │ ├── RedirectIfAuthenticated.php │ │ └── VerifyCsrfToken.php │ ├── Requests │ │ └── Request.php │ ├── api_routes.php │ └── routes.php ├── Jobs │ └── Job.php ├── Listeners │ ├── .gitkeep │ ├── CreateServiceOccurrence.php │ └── UpdateServiceOccurrences.php ├── Occurrence.php ├── Occurrences │ ├── OccurrenceCreator.php │ └── OccurrenceRepository.php ├── Policies │ └── .gitkeep ├── Providers │ ├── AppServiceProvider.php │ ├── AuthServiceProvider.php │ ├── EventServiceProvider.php │ └── RouteServiceProvider.php ├── Service.php ├── User.php └── helpers.php ├── artisan ├── bootstrap ├── app.php ├── autoload.php └── cache │ └── .gitignore ├── composer.json ├── composer.lock ├── config ├── app.php ├── auth.php ├── broadcasting.php ├── cache.php ├── compile.php ├── database.php ├── filesystems.php ├── mail.php ├── queue.php ├── services.php ├── session.php └── view.php ├── database ├── .gitignore ├── factories │ └── ModelFactory.php ├── migrations │ ├── .gitkeep │ ├── 2014_10_12_000000_create_users_table.php │ ├── 2014_10_12_100000_create_password_resets_table.php │ ├── 2016_07_14_092017_create_clients_table.php │ ├── 2016_07_14_092024_create_services_table.php │ ├── 2016_07_14_125816_create_occurrences_table.php │ ├── 2016_07_16_212605_create_categories_table.php │ ├── 2016_07_17_085858_add_preferred_currency_and_email_notifications_to_users_table.php │ ├── 2016_07_17_095203_create_cache_table.php │ ├── 2016_07_18_123554_drop_unique_index_for_tax_number_from_clients_table.php │ └── 2016_07_31_180730_fix_occurrences_occurs_at_column_by_dropping_table.php └── seeds │ ├── .gitkeep │ ├── DatabaseSeeder.php │ └── SampleDataSeeder.php ├── gulpfile.js ├── license.md ├── overview.png ├── package.json ├── phpunit.xml ├── public ├── .htaccess ├── build │ ├── css │ │ ├── app-13224de714.css │ │ └── app.css.map │ ├── fonts │ │ ├── FontAwesome.otf │ │ ├── fontawesome-webfont.eot │ │ ├── fontawesome-webfont.svg │ │ ├── fontawesome-webfont.ttf │ │ ├── fontawesome-webfont.woff │ │ ├── fontawesome-webfont.woff2 │ │ ├── glyphicons-halflings-regular.eot │ │ ├── glyphicons-halflings-regular.svg │ │ ├── glyphicons-halflings-regular.ttf │ │ ├── glyphicons-halflings-regular.woff │ │ └── glyphicons-halflings-regular.woff2 │ ├── js │ │ ├── all.js.map │ │ ├── app-832c11af61.js │ │ └── app.js.map │ └── rev-manifest.json ├── css │ ├── app.css │ └── app.css.map ├── favicon.ico ├── index.php ├── js │ ├── app.js │ └── app.js.map ├── robots.txt └── web.config ├── readme.md ├── resources ├── assets │ ├── js │ │ └── app.js │ └── less │ │ ├── app.less │ │ └── themes │ │ └── paper │ │ ├── bootswatch.less │ │ └── variables.less ├── lang │ └── en │ │ ├── auth.php │ │ ├── pagination.php │ │ ├── passwords.php │ │ └── validation.php └── views │ ├── auth │ ├── emails │ │ └── password.blade.php │ ├── login.blade.php │ ├── passwords │ │ ├── email.blade.php │ │ └── reset.blade.php │ └── register.blade.php │ ├── categories │ ├── create.blade.php │ ├── edit.blade.php │ └── index.blade.php │ ├── clients │ ├── create.blade.php │ ├── edit.blade.php │ └── index.blade.php │ ├── errors │ └── 503.blade.php │ ├── home.blade.php │ ├── layouts │ ├── app.blade.php │ └── partials │ │ ├── navbar.blade.php │ │ ├── page_header.blade.php │ │ └── validation.blade.php │ ├── partials │ └── _occurrences_table.blade.php │ ├── report.blade.php │ ├── services │ ├── create.blade.php │ ├── edit.blade.php │ └── index.blade.php │ ├── settings │ └── edit.blade.php │ └── vendor │ ├── .gitkeep │ └── flash │ ├── message.blade.php │ └── modal.blade.php ├── server.php ├── storage ├── app │ ├── .gitignore │ └── public │ │ └── .gitignore ├── framework │ ├── .gitignore │ ├── cache │ │ └── .gitignore │ ├── sessions │ │ └── .gitignore │ └── views │ │ └── .gitignore └── logs │ └── .gitignore └── tests ├── TestCase.php ├── functional ├── CategoryTest.php ├── ClientTest.php ├── OverviewTest.php ├── ReportTest.php ├── ServiceTest.php └── SettingsTest.php ├── models ├── OccurrenceTest.php └── ServiceTest.php └── unit └── OccurrenceCreatorTest.php /.env.example: -------------------------------------------------------------------------------- 1 | APP_ENV=local 2 | APP_KEY=SomeRandomString 3 | APP_DEBUG=true 4 | APP_LOG_LEVEL=debug 5 | APP_URL=http://localhost 6 | 7 | DB_CONNECTION=mysql 8 | DB_HOST=192.168.10.10 9 | DB_PORT=3306 10 | DB_DATABASE=kyle 11 | DB_USERNAME=homestead 12 | DB_PASSWORD=secret 13 | 14 | CACHE_DRIVER=file 15 | SESSION_DRIVER=file 16 | QUEUE_DRIVER=sync 17 | 18 | REDIS_HOST=127.0.0.1 19 | REDIS_PASSWORD=null 20 | REDIS_PORT=6379 21 | 22 | MAIL_DRIVER=smtp 23 | MAIL_HOST=mailtrap.io 24 | MAIL_PORT=2525 25 | MAIL_USERNAME=null 26 | MAIL_PASSWORD=null 27 | MAIL_ENCRYPTION=null 28 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | *.css linguist-vendored 3 | *.scss linguist-vendored 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /vendor 2 | /node_modules 3 | /public/storage 4 | Homestead.yaml 5 | Homestead.json 6 | .env 7 | .idea 8 | deploy/ -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: php 2 | 3 | php: 4 | - '7.0' 5 | 6 | services: 7 | - mysql 8 | 9 | install: 10 | - composer install --prefer-source --no-interaction 11 | 12 | before_script: 13 | - mysql -e 'create database kyle_test;' 14 | - php artisan migrate --force 15 | 16 | script: 17 | - vendor/bin/phpunit 18 | 19 | env: 20 | - DB_DATABASE=kyle_test DB_USERNAME=root APP_KEY="SdklvfdkJY46KvNmnihYLfspA4xOLeub" -------------------------------------------------------------------------------- /app/Category.php: -------------------------------------------------------------------------------- 1 | hasMany(Service::class); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/Client.php: -------------------------------------------------------------------------------- 1 | hasMany(Service::class); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/Console/Commands/CreateUser.php: -------------------------------------------------------------------------------- 1 | argument('name'); 45 | $email = $this->argument('email'); 46 | $password = $this->secret('User password:'); 47 | 48 | $data = compact('name', 'email', 'password'); 49 | $validator = Validator::make($data, [ 50 | 'name' => 'required|max:255', 51 | 'email' => 'required|email|max:255|unique:users', 52 | 'password' => 'required|min:6', 53 | ]); 54 | if($validator->fails()) { 55 | foreach($validator->errors()->all() as $error) { 56 | $this->error($error); 57 | return 0; 58 | } 59 | } 60 | 61 | User::create([ 62 | 'name' => $data['name'], 63 | 'email' => $data['email'], 64 | 'password' => bcrypt($data['password']), 65 | 'api_token' => bin2hex(openssl_random_pseudo_bytes(16)), 66 | 'email_notifications' => true, 67 | 'preferred_currency' => 'usd' 68 | ]); 69 | 70 | $this->info('User has been created.'); 71 | $this->comment('You can now login using the email and password entered here.'); 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /app/Console/Commands/Inspire.php: -------------------------------------------------------------------------------- 1 | comment(PHP_EOL.Inspiring::quote().PHP_EOL); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /app/Console/Commands/SpawnOccurrences.php: -------------------------------------------------------------------------------- 1 | occurrenceCreator = $occurrenceCreator; 40 | $this->services = $services; 41 | $this->carbon = $carbon; 42 | } 43 | 44 | /** 45 | * Execute the console command. 46 | * 47 | * @return mixed 48 | */ 49 | public function handle() 50 | { 51 | foreach($this->services->all() as $service) { 52 | $date = $this->carbon->createFromDate( 53 | date('Y'), 54 | $service->month, 55 | $service->day 56 | ); 57 | $this->occurrenceCreator->create($date, $service); 58 | } 59 | 60 | $this->info($this->services->count() . ' occurrences have been spawned'); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /app/Console/Kernel.php: -------------------------------------------------------------------------------- 1 | command('occurrences:spawn') 30 | // every year at january 1st 31 | ->yearly(); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /app/Events/Event.php: -------------------------------------------------------------------------------- 1 | service = $service; 23 | } 24 | 25 | /** 26 | * Get the channels the event should be broadcast on. 27 | * 28 | * @return array 29 | */ 30 | public function broadcastOn() 31 | { 32 | return []; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /app/Events/ServiceWasUpdated.php: -------------------------------------------------------------------------------- 1 | service = $service; 23 | } 24 | 25 | /** 26 | * Get the channels the event should be broadcast on. 27 | * 28 | * @return array 29 | */ 30 | public function broadcastOn() 31 | { 32 | return []; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /app/Exceptions/Handler.php: -------------------------------------------------------------------------------- 1 | validate($request, [ 16 | 'name' => 'required|string|max:255' 17 | ]); 18 | 19 | $category = Category::create([ 20 | 'name' => $request->get('name') 21 | ]); 22 | 23 | return $category->toArray(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /app/Http/Controllers/Api/ClientController.php: -------------------------------------------------------------------------------- 1 | validate($request, [ 16 | 'name' => 'required|string|max:255' 17 | ]); 18 | 19 | $client = Client::create([ 20 | 'name' => $request->get('name') 21 | ]); 22 | 23 | return $client->toArray(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /app/Http/Controllers/Api/OccurrenceController.php: -------------------------------------------------------------------------------- 1 | validate($request, [ 15 | 'state' => 'required|boolean' 16 | ]); 17 | 18 | $occurrence->offer_sent = $request->get('state'); 19 | $occurrence->save(); 20 | 21 | return $occurrence->offer_sent; 22 | } 23 | 24 | public function togglePayment(Occurrence $occurrence, Request $request) 25 | { 26 | $this->validate($request, [ 27 | 'state' => 'required|boolean' 28 | ]); 29 | 30 | var_dump($occurrence->occurs_at); 31 | 32 | $occurrence->payment_received = $request->get('state'); 33 | $occurrence->save(); 34 | 35 | var_dump($occurrence->occurs_at); 36 | 37 | return $occurrence->payment_received; 38 | } 39 | 40 | public function toggleReceipt(Occurrence $occurrence, Request $request) 41 | { 42 | $this->validate($request, [ 43 | 'state' => 'required|boolean' 44 | ]); 45 | 46 | $occurrence->receipt_sent = $request->get('state'); 47 | $occurrence->save(); 48 | 49 | return $occurrence->receipt_sent; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /app/Http/Controllers/Auth/AuthController.php: -------------------------------------------------------------------------------- 1 | middleware($this->guestMiddleware(), ['except' => 'logout']); 41 | } 42 | 43 | /** 44 | * Get a validator for an incoming registration request. 45 | * 46 | * @param array $data 47 | * @return \Illuminate\Contracts\Validation\Validator 48 | */ 49 | protected function validator(array $data) 50 | { 51 | return Validator::make($data, [ 52 | 'name' => 'required|max:255', 53 | 'email' => 'required|email|max:255|unique:users', 54 | 'password' => 'required|min:6|confirmed', 55 | ]); 56 | } 57 | 58 | /** 59 | * Create a new user instance after a valid registration. 60 | * 61 | * @param array $data 62 | * @return User 63 | */ 64 | protected function create(array $data) 65 | { 66 | return User::create([ 67 | 'name' => $data['name'], 68 | 'email' => $data['email'], 69 | 'password' => bcrypt($data['password']), 70 | 'api_token' => bin2hex(openssl_random_pseudo_bytes(16)) 71 | ]); 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /app/Http/Controllers/Auth/PasswordController.php: -------------------------------------------------------------------------------- 1 | middleware($this->guestMiddleware()); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /app/Http/Controllers/CategoryController.php: -------------------------------------------------------------------------------- 1 | with(['services']) 20 | ->get(); 21 | 22 | return view('categories.index')->with(compact('categories')); 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 | return view('categories.create'); 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 | $this->validate($request, [ 44 | 'name' => 'required|string|max:255', 45 | ]); 46 | 47 | $category = Category::create([ 48 | 'name' => $request->get('name'), 49 | ]); 50 | 51 | flash()->success('Category created!'); 52 | 53 | return redirect()->route('categories.index'); 54 | } 55 | 56 | /** 57 | * Show the form for editing the specified resource. 58 | * 59 | * @param int $id 60 | * @return \Illuminate\Http\Response 61 | */ 62 | public function edit($id) 63 | { 64 | $category = Category::findOrFail($id); 65 | 66 | return view('categories.edit')->with(compact('category')); 67 | } 68 | 69 | /** 70 | * Update the specified resource in storage. 71 | * 72 | * @param \Illuminate\Http\Request $request 73 | * @param int $id 74 | * @return \Illuminate\Http\Response 75 | */ 76 | public function update(Request $request, $id) 77 | { 78 | $category = Category::findOrFail($id); 79 | 80 | $this->validate($request, [ 81 | 'name' => 'required|string|max:255', 82 | ]); 83 | 84 | $category->update([ 85 | 'name' => $request->get('name'), 86 | ]); 87 | 88 | flash()->success('Category Updated!'); 89 | 90 | return redirect()->route('categories.edit', $category->id); 91 | } 92 | 93 | /** 94 | * Remove the specified resource from storage. 95 | * 96 | * @param int $id 97 | * @return \Illuminate\Http\Response 98 | */ 99 | public function destroy($id) 100 | { 101 | $category = Category::findOrFail($id); 102 | $category->delete(); 103 | 104 | flash()->success('Category Deleted!'); 105 | 106 | return redirect()->route('categories.index'); 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /app/Http/Controllers/ClientController.php: -------------------------------------------------------------------------------- 1 | get(); 19 | 20 | return view('clients.index')->with(compact('clients')); 21 | } 22 | 23 | /** 24 | * Show the form for creating a new resource. 25 | * 26 | * @return \Illuminate\Http\Response 27 | */ 28 | public function create() 29 | { 30 | return view('clients.create'); 31 | } 32 | 33 | /** 34 | * Store a newly created resource in storage. 35 | * 36 | * @param \Illuminate\Http\Request $request 37 | * @return \Illuminate\Http\Response 38 | */ 39 | public function store(Request $request) 40 | { 41 | $this->validate($request, [ 42 | 'name' => 'required|string|max:255', 43 | 'tax_number' => 'string|max:255|unique:clients', 44 | 'street' => 'string|max:255', 45 | 'city' => 'string|max:255', 46 | 'postal_code' => 'integer', 47 | ]); 48 | 49 | $client = Client::create([ 50 | 'name' => $request->get('name'), 51 | 'tax_number' => $request->get('tax_number'), 52 | 'street' => $request->get('street'), 53 | 'city' => $request->get('city'), 54 | 'postal_code' => $request->get('postal_code'), 55 | ]); 56 | 57 | flash()->success('Client created!'); 58 | 59 | return redirect()->route('clients.index'); 60 | } 61 | 62 | /** 63 | * Show the form for editing the specified resource. 64 | * 65 | * @param int $id 66 | * @return \Illuminate\Http\Response 67 | */ 68 | public function edit($id) 69 | { 70 | $client = Client::findOrFail($id); 71 | 72 | return view('clients.edit')->with(compact('client')); 73 | } 74 | 75 | /** 76 | * Update the specified resource in storage. 77 | * 78 | * @param \Illuminate\Http\Request $request 79 | * @param int $id 80 | * @return \Illuminate\Http\Response 81 | */ 82 | public function update(Request $request, $id) 83 | { 84 | $client = Client::findOrFail($id); 85 | 86 | $this->validate($request, [ 87 | 'name' => 'required|string|max:255', 88 | 'tax_number' => 'string|max:255|unique:clients,tax_number,' . $client->id, 89 | 'street' => 'string|max:255', 90 | 'city' => 'string|max:255', 91 | 'postal_code' => 'integer', 92 | ]); 93 | 94 | $client->update([ 95 | 'name' => $request->get('name'), 96 | 'tax_number' => $request->get('tax_number'), 97 | 'street' => $request->get('street'), 98 | 'city' => $request->get('city'), 99 | 'postal_code' => $request->get('postal_code'), 100 | ]); 101 | 102 | flash()->success('Client Updated!'); 103 | 104 | return redirect()->route('clients.edit', $client->id); 105 | } 106 | 107 | /** 108 | * Remove the specified resource from storage. 109 | * 110 | * @param int $id 111 | * @return \Illuminate\Http\Response 112 | */ 113 | public function destroy($id) 114 | { 115 | $client = Client::findOrFail($id); 116 | $client->delete(); 117 | 118 | flash()->success('Client Deleted!'); 119 | 120 | return redirect()->route('clients.index'); 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /app/Http/Controllers/Controller.php: -------------------------------------------------------------------------------- 1 | getOccurrencesForCurrentMonth(); 20 | $occurrencesNextMonth = $occurrenceRepository->getOccurrencesForNextMonth(); 21 | $previousUnpaidOccurrences = $occurrenceRepository->getPreviousUnpaidOccurrences(); 22 | 23 | return view('home')->with(compact( 24 | 'occurrencesThisMonth', 25 | 'occurrencesNextMonth', 26 | 'previousUnpaidOccurrences' 27 | )); 28 | } 29 | 30 | /** 31 | * Show the report for all things. 32 | * 33 | * @return [type] 34 | */ 35 | public function report() 36 | { 37 | $services = Service::orderBy('month') 38 | ->orderBy('day') 39 | ->where('active', 1) 40 | ->with(['client', 'category']) 41 | ->get(); 42 | 43 | $clients = Client::orderBy('name') 44 | ->whereHas('services', function ($query) { 45 | $query->where('active', 1); 46 | }) 47 | ->with(['services' => function ($query) { 48 | $query->where('active', 1); 49 | }]) 50 | ->get(); 51 | 52 | $categories = Category::orderBy('name') 53 | ->whereHas('services', function ($query) { 54 | $query->where('active', 1); 55 | }) 56 | ->with(['services' => function ($query) { 57 | $query->where('active', 1); 58 | }]) 59 | ->get(); 60 | 61 | return view('report')->with(compact('services', 'clients', 'categories')); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /app/Http/Controllers/ServiceController.php: -------------------------------------------------------------------------------- 1 | orderBy('day') 24 | ->with(['client', 'category']) 25 | ->get(); 26 | 27 | return view('services.index')->with(compact('services')); 28 | } 29 | 30 | /** 31 | * Show the form for creating a new resource. 32 | * 33 | * @return \Illuminate\Http\Response 34 | */ 35 | public function create() 36 | { 37 | $currencies = [ 38 | 'hrk' => 'HRK', 39 | 'usd' => 'USD', 40 | 'eur' => 'EUR', 41 | ]; 42 | $clients = Client::orderBy('name')->pluck('name', 'id')->toArray(); 43 | $categories = Category::orderBy('name')->pluck('name', 'id')->toArray(); 44 | 45 | return view('services.create')->with(compact('currencies', 'clients', 'categories')); 46 | } 47 | 48 | /** 49 | * Store a newly created resource in storage. 50 | * 51 | * @param \Illuminate\Http\Request $request 52 | * @return \Illuminate\Http\Response 53 | */ 54 | public function store(Request $request) 55 | { 56 | $this->validate($request, [ 57 | 'title' => 'required|max:255', 58 | 'note' => 'string', 59 | 'month' => 'required|integer|min:1|max:12', 60 | 'day' => 'required|integer|min:1|max:31', 61 | 'cost' => 'required|regex:/([0-9],)+[0-9]{2,}/|min:0', 62 | 'currency' => 'required|in:hrk,usd,eur', 63 | 'exchange_rate' => 'required|numeric|min:0', 64 | 'active' => 'boolean', 65 | 'client_id' => 'required|exists:clients,id', 66 | 'category_id' => 'required|exists:categories,id' 67 | ]); 68 | 69 | $client = Client::find($request->get('client_id')); 70 | $category = Category::find($request->get('category_id')); 71 | 72 | $service = new Service; 73 | $service->title = $request->get('title'); 74 | $service->note = $request->get('note'); 75 | $service->month = $request->get('month'); 76 | $service->day = $request->get('day'); 77 | $service->cost = convert_integer($request->get('cost')); 78 | $service->currency = $request->get('currency'); 79 | $service->exchange_rate = $request->get('exchange_rate'); 80 | $service->active = $request->get('active', false); 81 | $service->client()->associate($client); 82 | $service->category()->associate($category); 83 | $service->save(); 84 | 85 | event(new ServiceWasCreated($service)); 86 | 87 | flash()->success('Service created!'); 88 | 89 | return redirect()->route('services.index'); 90 | } 91 | 92 | /** 93 | * Show the form for editing the specified resource. 94 | * 95 | * @param int $id 96 | * @return \Illuminate\Http\Response 97 | */ 98 | public function edit($id) 99 | { 100 | $service = Service::findOrFail($id); 101 | $currencies = [ 102 | 'hrk' => 'HRK', 103 | 'usd' => 'USD', 104 | 'eur' => 'EUR', 105 | ]; 106 | $clients = Client::orderBy('name')->pluck('name', 'id')->toArray(); 107 | $categories = Category::orderBy('name')->pluck('name', 'id')->toArray(); 108 | 109 | return view('services.edit')->with(compact('service', 'currencies', 'clients', 'categories')); 110 | } 111 | 112 | /** 113 | * Update the specified resource in storage. 114 | * 115 | * @param \Illuminate\Http\Request $request 116 | * @param int $id 117 | * @return \Illuminate\Http\Response 118 | */ 119 | public function update(Request $request, $id) 120 | { 121 | $service = Service::findOrFail($id); 122 | 123 | $this->validate($request, [ 124 | 'title' => 'required|max:255', 125 | 'note' => 'string', 126 | 'month' => 'required|integer|min:1|max:12', 127 | 'day' => 'required|integer|min:1|max:31', 128 | 'cost' => 'required|regex:/([0-9],)+[0-9]{2,}/|min:0', 129 | 'currency' => 'required|in:hrk,usd,eur', 130 | 'exchange_rate' => 'required|numeric|min:0', 131 | 'active' => 'boolean', 132 | 'client_id' => 'required|exists:clients,id', 133 | 'category_id' => 'required|exists:categories,id' 134 | ]); 135 | 136 | $service->update([ 137 | 'title' => $request->get('title'), 138 | 'note' => $request->get('note'), 139 | 'month' => $request->get('month'), 140 | 'day' => $request->get('day'), 141 | 'cost' => convert_integer($request->get('cost')), 142 | 'currency' => $request->get('currency'), 143 | 'exchange_rate' => $request->get('exchange_rate'), 144 | 'active' => $request->get('active', false), 145 | ]); 146 | 147 | $client = Client::find($request->get('client_id')); 148 | $service->client()->associate($client); 149 | $category = Category::find($request->get('category_id')); 150 | $service->category()->associate($category); 151 | $service->save(); 152 | 153 | event(new ServiceWasUpdated($service)); 154 | 155 | flash()->success('Service Updated!'); 156 | 157 | return redirect()->route('services.edit', $service->id); 158 | } 159 | 160 | /** 161 | * Remove the specified resource from storage. 162 | * 163 | * @param int $id 164 | * @return \Illuminate\Http\Response 165 | */ 166 | public function destroy($id) 167 | { 168 | $service = Service::findOrFail($id); 169 | $service->delete(); 170 | 171 | flash()->success('Service Deleted!'); 172 | 173 | return redirect()->route('services.index'); 174 | } 175 | } 176 | -------------------------------------------------------------------------------- /app/Http/Controllers/SettingsController.php: -------------------------------------------------------------------------------- 1 | user(); 19 | $currencies = [ 20 | 'hrk' => 'HRK', 21 | 'usd' => 'USD', 22 | 'eur' => 'EUR' 23 | ]; 24 | 25 | return view('settings.edit')->with(compact('user', 'currencies')); 26 | } 27 | 28 | /** 29 | * Update the specified resource in storage. 30 | * 31 | * @param \Illuminate\Http\Request $request 32 | * @return \Illuminate\Http\Response 33 | */ 34 | public function update(Request $request) 35 | { 36 | $this->validate($request, [ 37 | 'name' => 'required|max:255', 38 | 'email' => 'required|email|max:255|unique:users,email,' . auth()->user()->id, 39 | 'password' => 'min:6|confirmed', 40 | 'preferred_currency' => 'required|in:hrk,usd,eur', 41 | 'email_notifications' => 'boolean' 42 | ]); 43 | 44 | auth()->user()->update([ 45 | 'name' => $request->get('name'), 46 | 'email' => $request->get('email'), 47 | 'preferred_currency' => $request->get('preferred_currency'), 48 | 'email_notifications' => $request->get('email_notifications', false) 49 | ]); 50 | 51 | if($request->get('password', "") != "") { 52 | auth()->user()->password = bcrypt($request->get('password')); 53 | auth()->user()->save(); 54 | } 55 | 56 | flash()->success('Settings updated!'); 57 | 58 | return redirect('/settings'); 59 | } 60 | 61 | /** 62 | * Remove the specified resource from storage. 63 | * 64 | * @param int $id 65 | * @return \Illuminate\Http\Response 66 | */ 67 | public function destroy($id) 68 | { 69 | // 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /app/Http/Kernel.php: -------------------------------------------------------------------------------- 1 | [ 27 | \App\Http\Middleware\EncryptCookies::class, 28 | \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, 29 | \Illuminate\Session\Middleware\StartSession::class, 30 | \Illuminate\View\Middleware\ShareErrorsFromSession::class, 31 | \App\Http\Middleware\VerifyCsrfToken::class, 32 | ], 33 | 34 | 'api' => [ 35 | 'throttle:60,1', 36 | ], 37 | ]; 38 | 39 | /** 40 | * The application's route middleware. 41 | * 42 | * These middleware may be assigned to groups or used individually. 43 | * 44 | * @var array 45 | */ 46 | protected $routeMiddleware = [ 47 | 'auth' => \App\Http\Middleware\Authenticate::class, 48 | 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class, 49 | 'can' => \Illuminate\Foundation\Http\Middleware\Authorize::class, 50 | 'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class, 51 | 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class, 52 | ]; 53 | } 54 | -------------------------------------------------------------------------------- /app/Http/Middleware/Authenticate.php: -------------------------------------------------------------------------------- 1 | guest()) { 21 | if ($request->ajax() || $request->wantsJson()) { 22 | return response('Unauthorized.', 401); 23 | } 24 | 25 | return redirect()->guest('login'); 26 | } 27 | 28 | return $next($request); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /app/Http/Middleware/EncryptCookies.php: -------------------------------------------------------------------------------- 1 | check()) { 21 | return redirect('/'); 22 | } 23 | 24 | return $next($request); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/Http/Middleware/VerifyCsrfToken.php: -------------------------------------------------------------------------------- 1 | 'api/v1', 'middleware' => 'auth:api'], function () { 4 | 5 | Route::post('categories', 'CategoryController@store'); 6 | 7 | Route::post('clients', 'ClientController@store'); 8 | 9 | Route::get('occurrences/{occurrence}/offer', 'OccurrenceController@toggleOffer'); 10 | Route::get('occurrences/{occurrence}/payment', 'OccurrenceController@togglePayment'); 11 | Route::get('occurrences/{occurrence}/receipt', 'OccurrenceController@toggleReceipt'); 12 | }); -------------------------------------------------------------------------------- /app/Http/routes.php: -------------------------------------------------------------------------------- 1 | 'auth'], function () { 15 | Route::get('/', 'HomeController@index'); 16 | 17 | Route::get('settings', 'SettingsController@edit'); 18 | Route::put('settings', 'SettingsController@update'); 19 | 20 | Route::get('report', 'HomeController@report'); 21 | 22 | Route::resource('clients', 'ClientController'); 23 | 24 | Route::resource('categories', 'CategoryController'); 25 | 26 | Route::resource('services', 'ServiceController'); 27 | }); 28 | 29 | // Authentication Routes... 30 | $this->get('login', 'Auth\AuthController@showLoginForm'); 31 | $this->post('login', 'Auth\AuthController@login'); 32 | $this->get('logout', 'Auth\AuthController@logout'); 33 | 34 | // Registration Routes... 35 | // $this->get('register', 'Auth\AuthController@showRegistrationForm'); 36 | // $this->post('register', 'Auth\AuthController@register'); 37 | 38 | // Password Reset Routes... 39 | $this->get('password/reset/{token?}', 'Auth\PasswordController@showResetForm'); 40 | $this->post('password/email', 'Auth\PasswordController@sendResetLinkEmail'); 41 | $this->post('password/reset', 'Auth\PasswordController@reset'); 42 | -------------------------------------------------------------------------------- /app/Jobs/Job.php: -------------------------------------------------------------------------------- 1 | occurrenceCreator = $occurrenceCreator; 23 | } 24 | 25 | /** 26 | * Handle the event. 27 | * 28 | * @param ServiceWasCreated $event 29 | * @return void 30 | */ 31 | public function handle(ServiceWasCreated $event) 32 | { 33 | $date = \Carbon\Carbon::createFromDate( 34 | date('Y'), 35 | $event->service->month, 36 | $event->service->day 37 | ); 38 | 39 | $this->occurrenceCreator->create($date, $event->service); 40 | 41 | /** 42 | * TODO: Maybe do a check here if the occurrence for this service 43 | * already exists ??? 44 | */ 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /app/Listeners/UpdateServiceOccurrences.php: -------------------------------------------------------------------------------- 1 | service->occurrences()->get() as $occurence) 30 | { 31 | $date = \Carbon\Carbon::createFromDate( 32 | $occurence->occurs_at->year, 33 | $event->service->month, 34 | $event->service->day 35 | ); 36 | 37 | $occurence->occurs_at = $date->timestamp; 38 | $occurence->save(); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /app/Occurrence.php: -------------------------------------------------------------------------------- 1 | belongsTo(Service::class); 32 | } 33 | 34 | /** 35 | * If the offer_sent is set to true, this 36 | * returns false. 37 | * 38 | * @return [type] 39 | */ 40 | public function getFutureOfferState() 41 | { 42 | return $this->offer_sent ? 0 : 1; 43 | } 44 | 45 | /** 46 | * If the payment_received is set to true 47 | * this returns false. 48 | * 49 | * @return [type] 50 | */ 51 | public function getFuturePaymentState() 52 | { 53 | return $this->payment_received ? 0 : 1; 54 | } 55 | 56 | /** 57 | * If the receipt_sent is set to true 58 | * this returns false. 59 | * 60 | * @return [type] 61 | */ 62 | public function getFutureReceiptState() 63 | { 64 | return $this->receipt_sent ? 0 : 1; 65 | } 66 | 67 | /** 68 | * Check if the occurrence is paid. 69 | * "Has the payment been received." 70 | * 71 | * @return boolean 72 | */ 73 | public function isPaid() 74 | { 75 | return (bool) $this->payment_received; 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /app/Occurrences/OccurrenceCreator.php: -------------------------------------------------------------------------------- 1 | occurs_at = $date->timestamp; 23 | $occurrence->offer_sent = false; 24 | $occurrence->payment_received = false; 25 | $occurrence->receipt_sent = false; 26 | $occurrence->service()->associate($service); 27 | $occurrence->save(); 28 | 29 | return $occurrence; 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /app/Occurrences/OccurrenceRepository.php: -------------------------------------------------------------------------------- 1 | occurrences = $occurrences; 21 | } 22 | 23 | /** 24 | * It gets occurrences for specified month in current year 25 | * but only occurrences that belong to a service that is 26 | * active and eager loads service.client nested relationship. 27 | * 28 | * @param int $month 29 | * @return [type] 30 | */ 31 | public function getOccurrencesForMonth(int $month) 32 | { 33 | // Change (int 9) to (string '09') 34 | if ($month < 10) { 35 | $month = '0' . $month; 36 | } 37 | 38 | $year = Carbon::now()->year; 39 | 40 | return $this->occurrences 41 | ->orderBy('occurs_at') 42 | ->where(function ($query) use ($month, $year) { 43 | // $date = 2016-07-% 44 | $date = $year . '-' . $month . '-%'; 45 | $query->where('occurs_at', 'like', $date); 46 | }) 47 | ->whereHas('service', function ($query) { 48 | $query->where('active', 1); 49 | }) 50 | ->with(['service.client']) 51 | ->get(); 52 | } 53 | 54 | /** 55 | * It gets active occurrences for current month. 56 | * 57 | * @return [type] 58 | */ 59 | public function getOccurrencesForCurrentMonth() 60 | { 61 | $month = Carbon::now()->month; 62 | 63 | return $this->getOccurrencesForMonth($month); 64 | } 65 | 66 | /** 67 | * It gets active occurrences for the upcoming month. 68 | * 69 | * @return [type] 70 | */ 71 | public function getOccurrencesForNextMonth() 72 | { 73 | $month = Carbon::now()->month; 74 | $occurrences = []; 75 | 76 | if (++$month <= 12) { 77 | $occurrences = $this->getOccurrencesForMonth($month); 78 | } 79 | 80 | return $occurrences; 81 | } 82 | 83 | /** 84 | * It gets all active occurrences that are not paid 85 | * for this year up to the current month. 86 | * 87 | * @return [type] 88 | */ 89 | public function getPreviousUnpaidOccurrences() 90 | { 91 | $date = Carbon::now(); 92 | $date->day = 1; 93 | $date->hour = 0; 94 | $date->minute = 0; 95 | $date->second = 0; 96 | 97 | return $this->occurrences 98 | ->orderBy('occurs_at') 99 | ->where(function ($query) use ($date) { 100 | $query->where('occurs_at', '<', $date); 101 | }) 102 | ->where('payment_received', 0) 103 | ->whereHas('service', function ($query) { 104 | $query->where('active', 1); 105 | }) 106 | ->with(['service.client']) 107 | ->get(); 108 | } 109 | 110 | } 111 | -------------------------------------------------------------------------------- /app/Policies/.gitkeep: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /app/Providers/AppServiceProvider.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 | -------------------------------------------------------------------------------- /app/Providers/EventServiceProvider.php: -------------------------------------------------------------------------------- 1 | [ 17 | 'App\Listeners\CreateServiceOccurrence', 18 | ], 19 | 'App\Events\ServiceWasUpdated' => [ 20 | 'App\Listeners\UpdateServiceOccurrences', 21 | ], 22 | ]; 23 | 24 | /** 25 | * Register any other events for your application. 26 | * 27 | * @param \Illuminate\Contracts\Events\Dispatcher $events 28 | * @return void 29 | */ 30 | public function boot(DispatcherContract $events) 31 | { 32 | parent::boot($events); 33 | 34 | // 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /app/Providers/RouteServiceProvider.php: -------------------------------------------------------------------------------- 1 | mapWebRoutes($router); 41 | 42 | // 43 | } 44 | 45 | /** 46 | * Define the "web" routes for the application. 47 | * 48 | * These routes all receive session state, CSRF protection, etc. 49 | * 50 | * @param \Illuminate\Routing\Router $router 51 | * @return void 52 | */ 53 | protected function mapWebRoutes(Router $router) 54 | { 55 | $router->group([ 56 | 'namespace' => $this->namespace, 'middleware' => 'web', 57 | ], function ($router) { 58 | require app_path('Http/routes.php'); 59 | }); 60 | 61 | $router->group([ 62 | 'namespace' => $this->namespace . '\Api', 'middleware' => 'api', 63 | ], function ($router) { 64 | require app_path('Http/api_routes.php'); 65 | }); 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /app/Service.php: -------------------------------------------------------------------------------- 1 | belongsTo(Client::class); 31 | } 32 | 33 | /** 34 | * To which category does this service belong. 35 | * 36 | * @return [type] 37 | */ 38 | public function category() 39 | { 40 | return $this->belongsTo(Category::class); 41 | } 42 | 43 | /** 44 | * One per year would be perfect. :) 45 | * 46 | * @return [type] 47 | */ 48 | public function occurrences() 49 | { 50 | return $this->hasMany(Occurrence::class); 51 | } 52 | 53 | /** 54 | * Converts 112345 to 1123,45. 55 | * For forms only. 56 | * 57 | * @return string 58 | */ 59 | public function formCostAttribute() 60 | { 61 | return number_format($this->cost / 100, 2, ',', ''); 62 | } 63 | 64 | /** 65 | * Returns formatted cost with currency. 66 | * Converts `112345 usd` to `1.123,45 USD`. 67 | * 68 | * @return string 69 | */ 70 | public function getFormattedCostAttribute() 71 | { 72 | return number_format($this->cost / 100, 2, ',', '.') . ' ' . strtoupper($this->currency); 73 | } 74 | 75 | /** 76 | * Gets the sum of all services, converted to user's 77 | * preferred currency with current exchange rate. 78 | * 79 | * It is possible to pass a collection of services to this method, 80 | * and it will return the sum of that collection. 81 | * 82 | * @param Collection|null $services 83 | * @return [type] 84 | */ 85 | public function getSum(Collection $services = null) 86 | { 87 | if(!($services instanceof Collection)) { 88 | $services = $this->all(); 89 | } 90 | 91 | $sum = 0; 92 | foreach($services as $service) { 93 | $currentCurrency = strtoupper($service->currency); 94 | $sum+= ($service->cost / 100); 95 | } 96 | 97 | return number_format($sum, 2, ',', '.') . ' ' . $currentCurrency; 98 | } 99 | 100 | /** 101 | * Gets the sum of all services, converted to user's 102 | * preferred currency with current exchange rate for the entered month. 103 | * 104 | * By default, all services are included (active and non active). 105 | * 106 | * @param $month 107 | * @param boolean $onlyActive 108 | * @return [type] 109 | */ 110 | public function getSumForMonth($month, $onlyActive = false) 111 | { 112 | $services = $this->where('month', $month); 113 | if($onlyActive) { 114 | $services->where('active', 1); 115 | } 116 | $services = $services->get(); 117 | 118 | return $this->getSum($services); 119 | } 120 | } 121 | -------------------------------------------------------------------------------- /app/User.php: -------------------------------------------------------------------------------- 1 | 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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /bootstrap/autoload.php: -------------------------------------------------------------------------------- 1 | =7.0.0", 19 | "laravel/framework": "5.2.*", 20 | "laravelcollective/html": "^5.2", 21 | "laravelista/ekko": "^1.2", 22 | "laracasts/flash": "^2.0", 23 | "doctrine/dbal": "^2.5" 24 | }, 25 | "require-dev": { 26 | "fzaninotto/faker": "~1.4", 27 | "mockery/mockery": "0.9.*", 28 | "phpunit/phpunit": "~4.0", 29 | "symfony/css-selector": "2.8.*|3.0.*", 30 | "symfony/dom-crawler": "2.8.*|3.0.*" 31 | }, 32 | "autoload": { 33 | "classmap": [ 34 | "database" 35 | ], 36 | "psr-4": { 37 | "App\\": "app/" 38 | }, 39 | "files": [ 40 | "app/helpers.php" 41 | ] 42 | }, 43 | "autoload-dev": { 44 | "classmap": [ 45 | "tests/TestCase.php" 46 | ] 47 | }, 48 | "scripts": { 49 | "post-root-package-install": [ 50 | "php -r \"copy('.env.example', '.env');\"" 51 | ], 52 | "post-create-project-cmd": [ 53 | "php artisan key:generate" 54 | ], 55 | "post-install-cmd": [ 56 | "Illuminate\\Foundation\\ComposerScripts::postInstall", 57 | "php artisan optimize" 58 | ], 59 | "post-update-cmd": [ 60 | "Illuminate\\Foundation\\ComposerScripts::postUpdate", 61 | "php artisan optimize" 62 | ] 63 | }, 64 | "config": { 65 | "preferred-install": "dist" 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /config/auth.php: -------------------------------------------------------------------------------- 1 | [ 17 | 'guard' => 'web', 18 | 'passwords' => 'users', 19 | ], 20 | 21 | /* 22 | |-------------------------------------------------------------------------- 23 | | Authentication Guards 24 | |-------------------------------------------------------------------------- 25 | | 26 | | Next, you may define every authentication guard for your application. 27 | | Of course, a great default configuration has been defined for you 28 | | here which uses session storage and the Eloquent user provider. 29 | | 30 | | All authentication drivers have a user provider. This defines how the 31 | | users are actually retrieved out of your database or other storage 32 | | mechanisms used by this application to persist your user's data. 33 | | 34 | | Supported: "session", "token" 35 | | 36 | */ 37 | 38 | 'guards' => [ 39 | 'web' => [ 40 | 'driver' => 'session', 41 | 'provider' => 'users', 42 | ], 43 | 44 | 'api' => [ 45 | 'driver' => 'token', 46 | 'provider' => 'users', 47 | ], 48 | ], 49 | 50 | /* 51 | |-------------------------------------------------------------------------- 52 | | User Providers 53 | |-------------------------------------------------------------------------- 54 | | 55 | | All authentication drivers have a user provider. This defines how the 56 | | users are actually retrieved out of your database or other storage 57 | | mechanisms used by this application to persist your user's data. 58 | | 59 | | If you have multiple user tables or models you may configure multiple 60 | | sources which represent each model / table. These sources may then 61 | | be assigned to any extra authentication guards you have defined. 62 | | 63 | | Supported: "database", "eloquent" 64 | | 65 | */ 66 | 67 | 'providers' => [ 68 | 'users' => [ 69 | 'driver' => 'eloquent', 70 | 'model' => App\User::class, 71 | ], 72 | 73 | // 'users' => [ 74 | // 'driver' => 'database', 75 | // 'table' => 'users', 76 | // ], 77 | ], 78 | 79 | /* 80 | |-------------------------------------------------------------------------- 81 | | Resetting Passwords 82 | |-------------------------------------------------------------------------- 83 | | 84 | | Here you may set the options for resetting passwords including the view 85 | | that is your password reset e-mail. You may also set the name of the 86 | | table that maintains all of the reset tokens for your application. 87 | | 88 | | You may specify multiple password reset configurations if you have more 89 | | than one user table or model in the application and you want to have 90 | | separate password reset settings based on the specific user types. 91 | | 92 | | The expire time is the number of minutes that the reset token should be 93 | | considered valid. This security feature keeps tokens short-lived so 94 | | they have less time to be guessed. You may change this as needed. 95 | | 96 | */ 97 | 98 | 'passwords' => [ 99 | 'users' => [ 100 | 'provider' => 'users', 101 | 'email' => 'auth.emails.password', 102 | 'table' => 'password_resets', 103 | 'expire' => 60, 104 | ], 105 | ], 106 | 107 | ]; 108 | -------------------------------------------------------------------------------- /config/broadcasting.php: -------------------------------------------------------------------------------- 1 | env('BROADCAST_DRIVER', 'pusher'), 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Broadcast Connections 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here you may define all of the broadcast connections that will be used 26 | | to broadcast events to other systems or over websockets. Samples of 27 | | each available type of connection are provided inside this array. 28 | | 29 | */ 30 | 31 | 'connections' => [ 32 | 33 | 'pusher' => [ 34 | 'driver' => 'pusher', 35 | 'key' => env('PUSHER_KEY'), 36 | 'secret' => env('PUSHER_SECRET'), 37 | 'app_id' => env('PUSHER_APP_ID'), 38 | 'options' => [ 39 | // 40 | ], 41 | ], 42 | 43 | 'redis' => [ 44 | 'driver' => 'redis', 45 | 'connection' => 'default', 46 | ], 47 | 48 | 'log' => [ 49 | 'driver' => 'log', 50 | ], 51 | 52 | ], 53 | 54 | ]; 55 | -------------------------------------------------------------------------------- /config/cache.php: -------------------------------------------------------------------------------- 1 | env('CACHE_DRIVER', 'file'), 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Cache Stores 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here you may define all of the cache "stores" for your application as 26 | | well as their drivers. You may even define multiple stores for the 27 | | same cache driver to group types of items stored in your caches. 28 | | 29 | */ 30 | 31 | 'stores' => [ 32 | 33 | 'apc' => [ 34 | 'driver' => 'apc', 35 | ], 36 | 37 | 'array' => [ 38 | 'driver' => 'array', 39 | ], 40 | 41 | 'database' => [ 42 | 'driver' => 'database', 43 | 'table' => 'cache', 44 | 'connection' => null, 45 | ], 46 | 47 | 'file' => [ 48 | 'driver' => 'file', 49 | 'path' => storage_path('framework/cache'), 50 | ], 51 | 52 | 'memcached' => [ 53 | 'driver' => 'memcached', 54 | 'servers' => [ 55 | [ 56 | 'host' => env('MEMCACHED_HOST', '127.0.0.1'), 57 | 'port' => env('MEMCACHED_PORT', 11211), 58 | 'weight' => 100, 59 | ], 60 | ], 61 | ], 62 | 63 | 'redis' => [ 64 | 'driver' => 'redis', 65 | 'connection' => 'default', 66 | ], 67 | 68 | ], 69 | 70 | /* 71 | |-------------------------------------------------------------------------- 72 | | Cache Key Prefix 73 | |-------------------------------------------------------------------------- 74 | | 75 | | When utilizing a RAM based store such as APC or Memcached, there might 76 | | be other applications utilizing the same cache. So, we'll specify a 77 | | value to get prefixed to all our keys so we can avoid collisions. 78 | | 79 | */ 80 | 81 | 'prefix' => 'kyle', 82 | 83 | ]; 84 | -------------------------------------------------------------------------------- /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/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' => env('DB_DATABASE', database_path('database.sqlite')), 52 | 'prefix' => '', 53 | ], 54 | 55 | 'mysql' => [ 56 | 'driver' => 'mysql', 57 | 'host' => env('DB_HOST', 'localhost'), 58 | 'port' => env('DB_PORT', '3306'), 59 | 'database' => env('DB_DATABASE', 'forge'), 60 | 'username' => env('DB_USERNAME', 'forge'), 61 | 'password' => env('DB_PASSWORD', ''), 62 | 'charset' => 'utf8', 63 | 'collation' => 'utf8_unicode_ci', 64 | 'prefix' => '', 65 | 'strict' => false, 66 | 'engine' => null, 67 | ], 68 | 69 | /** 70 | * Used for seeding the database for testing. 71 | */ 72 | 'mysql_testing' => [ 73 | 'driver' => 'mysql', 74 | 'host' => env('DB_HOST', 'localhost'), 75 | 'port' => env('DB_PORT', '3306'), 76 | 'database' => env('DB_TEST_DATABASE', 'kyle_testing'), 77 | 'username' => env('DB_USERNAME', 'forge'), 78 | 'password' => env('DB_PASSWORD', ''), 79 | 'charset' => 'utf8', 80 | 'collation' => 'utf8_unicode_ci', 81 | 'prefix' => '', 82 | 'strict' => false, 83 | 'engine' => null, 84 | ], 85 | 86 | 'pgsql' => [ 87 | 'driver' => 'pgsql', 88 | 'host' => env('DB_HOST', 'localhost'), 89 | 'port' => env('DB_PORT', '5432'), 90 | 'database' => env('DB_DATABASE', 'forge'), 91 | 'username' => env('DB_USERNAME', 'forge'), 92 | 'password' => env('DB_PASSWORD', ''), 93 | 'charset' => 'utf8', 94 | 'prefix' => '', 95 | 'schema' => 'public', 96 | ], 97 | 98 | ], 99 | 100 | /* 101 | |-------------------------------------------------------------------------- 102 | | Migration Repository Table 103 | |-------------------------------------------------------------------------- 104 | | 105 | | This table keeps track of all the migrations that have already run for 106 | | your application. Using this information, we can determine which of 107 | | the migrations on disk haven't actually been run in the database. 108 | | 109 | */ 110 | 111 | 'migrations' => 'migrations', 112 | 113 | /* 114 | |-------------------------------------------------------------------------- 115 | | Redis Databases 116 | |-------------------------------------------------------------------------- 117 | | 118 | | Redis is an open source, fast, and advanced key-value store that also 119 | | provides a richer set of commands than a typical key-value systems 120 | | such as APC or Memcached. Laravel makes it easy to dig right in. 121 | | 122 | */ 123 | 124 | 'redis' => [ 125 | 126 | 'cluster' => false, 127 | 128 | 'default' => [ 129 | 'host' => env('REDIS_HOST', 'localhost'), 130 | 'password' => env('REDIS_PASSWORD', null), 131 | 'port' => env('REDIS_PORT', 6379), 132 | 'database' => 0, 133 | ], 134 | 135 | ], 136 | 137 | ]; 138 | -------------------------------------------------------------------------------- /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 | 'public' => [ 52 | 'driver' => 'local', 53 | 'root' => storage_path('app/public'), 54 | 'visibility' => 'public', 55 | ], 56 | 57 | 's3' => [ 58 | 'driver' => 's3', 59 | 'key' => 'your-key', 60 | 'secret' => 'your-secret', 61 | 'region' => 'your-region', 62 | 'bucket' => 'your-bucket', 63 | ], 64 | 65 | ], 66 | 67 | ]; 68 | -------------------------------------------------------------------------------- /config/mail.php: -------------------------------------------------------------------------------- 1 | env('MAIL_DRIVER', 'smtp'), 20 | 21 | /* 22 | |-------------------------------------------------------------------------- 23 | | SMTP Host Address 24 | |-------------------------------------------------------------------------- 25 | | 26 | | Here you may provide the host address of the SMTP server used by your 27 | | applications. A default option is provided that is compatible with 28 | | the Mailgun mail service which will provide reliable deliveries. 29 | | 30 | */ 31 | 32 | 'host' => env('MAIL_HOST', 'smtp.mailgun.org'), 33 | 34 | /* 35 | |-------------------------------------------------------------------------- 36 | | SMTP Host Port 37 | |-------------------------------------------------------------------------- 38 | | 39 | | This is the SMTP port used by your application to deliver e-mails to 40 | | users of the application. Like the host we have set this value to 41 | | stay compatible with the Mailgun e-mail application by default. 42 | | 43 | */ 44 | 45 | 'port' => env('MAIL_PORT', 587), 46 | 47 | /* 48 | |-------------------------------------------------------------------------- 49 | | Global "From" Address 50 | |-------------------------------------------------------------------------- 51 | | 52 | | You may wish for all e-mails sent by your application to be sent from 53 | | the same address. Here, you may specify a name and address that is 54 | | used globally for all e-mails that are sent by your application. 55 | | 56 | */ 57 | 58 | 'from' => ['address' => null, 'name' => null], 59 | 60 | /* 61 | |-------------------------------------------------------------------------- 62 | | E-Mail Encryption Protocol 63 | |-------------------------------------------------------------------------- 64 | | 65 | | Here you may specify the encryption protocol that should be used when 66 | | the application send e-mail messages. A sensible default using the 67 | | transport layer security protocol should provide great security. 68 | | 69 | */ 70 | 71 | 'encryption' => env('MAIL_ENCRYPTION', 'tls'), 72 | 73 | /* 74 | |-------------------------------------------------------------------------- 75 | | SMTP Server Username 76 | |-------------------------------------------------------------------------- 77 | | 78 | | If your SMTP server requires a username for authentication, you should 79 | | set it here. This will get used to authenticate with your server on 80 | | connection. You may also set the "password" value below this one. 81 | | 82 | */ 83 | 84 | 'username' => env('MAIL_USERNAME'), 85 | 86 | /* 87 | |-------------------------------------------------------------------------- 88 | | SMTP Server Password 89 | |-------------------------------------------------------------------------- 90 | | 91 | | Here you may set the password required by your SMTP server to send out 92 | | messages from your application. This will be given to the server on 93 | | connection so that the application will be able to send messages. 94 | | 95 | */ 96 | 97 | 'password' => env('MAIL_PASSWORD'), 98 | 99 | /* 100 | |-------------------------------------------------------------------------- 101 | | Sendmail System Path 102 | |-------------------------------------------------------------------------- 103 | | 104 | | When using the "sendmail" driver to send e-mails, we will need to know 105 | | the path to where Sendmail lives on this server. A default path has 106 | | been provided here, which will work well on most of your systems. 107 | | 108 | */ 109 | 110 | 'sendmail' => '/usr/sbin/sendmail -bs', 111 | 112 | ]; 113 | -------------------------------------------------------------------------------- /config/queue.php: -------------------------------------------------------------------------------- 1 | env('QUEUE_DRIVER', 'sync'), 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Queue Connections 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here you may configure the connection information for each server that 26 | | is used by your application. A default configuration has been added 27 | | for each back-end shipped with Laravel. You are free to add more. 28 | | 29 | */ 30 | 31 | 'connections' => [ 32 | 33 | 'sync' => [ 34 | 'driver' => 'sync', 35 | ], 36 | 37 | 'database' => [ 38 | 'driver' => 'database', 39 | 'table' => 'jobs', 40 | 'queue' => 'default', 41 | 'expire' => 90, 42 | ], 43 | 44 | 'beanstalkd' => [ 45 | 'driver' => 'beanstalkd', 46 | 'host' => 'localhost', 47 | 'queue' => 'default', 48 | 'ttr' => 90, 49 | ], 50 | 51 | 'sqs' => [ 52 | 'driver' => 'sqs', 53 | 'key' => 'your-public-key', 54 | 'secret' => 'your-secret-key', 55 | 'prefix' => 'https://sqs.us-east-1.amazonaws.com/your-account-id', 56 | 'queue' => 'your-queue-name', 57 | 'region' => 'us-east-1', 58 | ], 59 | 60 | 'redis' => [ 61 | 'driver' => 'redis', 62 | 'connection' => 'default', 63 | 'queue' => 'default', 64 | 'expire' => 90, 65 | ], 66 | 67 | ], 68 | 69 | /* 70 | |-------------------------------------------------------------------------- 71 | | Failed Queue Jobs 72 | |-------------------------------------------------------------------------- 73 | | 74 | | These options configure the behavior of failed queue job logging so you 75 | | can control which database and table are used to store the jobs that 76 | | have failed. You may change them to any database / table you wish. 77 | | 78 | */ 79 | 80 | 'failed' => [ 81 | 'database' => env('DB_CONNECTION', 'mysql'), 82 | 'table' => 'failed_jobs', 83 | ], 84 | 85 | ]; 86 | -------------------------------------------------------------------------------- /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 | 'sparkpost' => [ 33 | 'secret' => env('SPARKPOST_SECRET'), 34 | ], 35 | 36 | 'stripe' => [ 37 | 'model' => App\User::class, 38 | 'key' => env('STRIPE_KEY'), 39 | 'secret' => env('STRIPE_SECRET'), 40 | ], 41 | 42 | ]; 43 | -------------------------------------------------------------------------------- /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' => 'kyle_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' => env('SESSION_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 | |-------------------------------------------------------------------------- 155 | | HTTP Access Only 156 | |-------------------------------------------------------------------------- 157 | | 158 | | Setting this value to true will prevent JavaScript from accessing the 159 | | value of the cookie and the cookie will only be accessible through 160 | | the HTTP protocol. You are free to modify this option if needed. 161 | | 162 | */ 163 | 164 | 'http_only' => true, 165 | 166 | ]; 167 | -------------------------------------------------------------------------------- /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/.gitignore: -------------------------------------------------------------------------------- 1 | *.sqlite 2 | -------------------------------------------------------------------------------- /database/factories/ModelFactory.php: -------------------------------------------------------------------------------- 1 | define(App\User::class, function (Faker\Generator $faker) { 15 | return [ 16 | 'name' => $faker->name, 17 | 'email' => $faker->safeEmail, 18 | 'password' => bcrypt(str_random(10)), 19 | 'remember_token' => str_random(10), 20 | 'api_token' => bin2hex(openssl_random_pseudo_bytes(16)), 21 | 'email_notifications' => false, //$faker->boolean 22 | 'preferred_currency' => $faker->randomElement(['hrk', 'usd', 'eur']) 23 | ]; 24 | }); 25 | 26 | $factory->define(App\Category::class, function (Faker\Generator $faker) { 27 | return [ 28 | 'name' => $faker->randomElement(['Hosting', 'Maintenance', 'Domain', 'SSL Certificate']), 29 | ]; 30 | }); 31 | 32 | $factory->define(App\Client::class, function (Faker\Generator $faker) { 33 | return [ 34 | 'name' => $faker->name, 35 | 'tax_number' => $faker->randomNumber, 36 | 'street' => $faker->streetAddress, 37 | 'city' => $faker->city, 38 | 'postal_code' => $faker->postcode 39 | ]; 40 | }); 41 | 42 | $factory->define(App\Service::class, function (Faker\Generator $faker) { 43 | return [ 44 | 'title' => $faker->sentence(3), 45 | 'note' => $faker->text(200), 46 | 'month' => (int) $faker->month, 47 | 'day' => (int) $faker->dayOfMonth, 48 | 'cost' => $faker->randomNumber(5), 49 | 'currency' => $faker->randomElement(['hrk', 'eur', 'usd']), 50 | 'active' => $faker->boolean, 51 | 'exchange_rate' => $faker->randomFloat(4, 1, 11), 52 | 'client_id' => factory(App\Client::class)->create()->id, 53 | 'category_id' => factory(App\Category::class)->create()->id, 54 | ]; 55 | }); 56 | 57 | $factory->define(App\Occurrence::class, function (Faker\Generator $faker) { 58 | return [ 59 | 'occurs_at' => $faker->dateTimeThisYear, 60 | 'offer_sent' => $faker->boolean, 61 | 'payment_received' => $faker->boolean, 62 | 'receipt_sent' => $faker->boolean, 63 | 'service_id' => factory(App\Service::class)->create()->id 64 | ]; 65 | }); 66 | -------------------------------------------------------------------------------- /database/migrations/.gitkeep: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /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('api_token', 60)->unique(); 20 | $table->string('password'); 21 | $table->rememberToken(); 22 | $table->timestamps(); 23 | }); 24 | } 25 | 26 | /** 27 | * Reverse the migrations. 28 | * 29 | * @return void 30 | */ 31 | public function down() 32 | { 33 | Schema::drop('users'); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /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')->nullable(); 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 | -------------------------------------------------------------------------------- /database/migrations/2016_07_14_092017_create_clients_table.php: -------------------------------------------------------------------------------- 1 | string('name'); 17 | $table->string('tax_number')->unique(); 18 | $table->string('street')->nullable(); 19 | $table->string('city')->nullable(); 20 | $table->string('postal_code')->nullable(); 21 | $table->increments('id'); 22 | $table->timestamps(); 23 | }); 24 | } 25 | 26 | /** 27 | * Reverse the migrations. 28 | * 29 | * @return void 30 | */ 31 | public function down() 32 | { 33 | Schema::drop('clients'); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /database/migrations/2016_07_14_092024_create_services_table.php: -------------------------------------------------------------------------------- 1 | string('title'); 17 | $table->text('note')->nullable(); 18 | $table->integer('month')->unsigned(); 19 | $table->integer('day')->unsigned(); 20 | $table->integer('cost')->unsigned(); 21 | $table->string('currency'); // HRK, USD, EUR 22 | $table->double('exchange_rate')->default(1); // Default to USD currency 23 | $table->boolean('active'); 24 | $table->integer('client_id')->unsigned(); 25 | $table->foreign('client_id')->references('id')->on('clients')->onDelete('cascade'); 26 | $table->increments('id'); 27 | $table->timestamps(); 28 | }); 29 | } 30 | 31 | /** 32 | * Reverse the migrations. 33 | * 34 | * @return void 35 | */ 36 | public function down() 37 | { 38 | Schema::drop('services'); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /database/migrations/2016_07_14_125816_create_occurrences_table.php: -------------------------------------------------------------------------------- 1 | timestamp('occurs_at'); 17 | $table->boolean('offer_sent')->nullable(); 18 | $table->boolean('payment_received')->nullable(); 19 | $table->boolean('receipt_sent')->nullable(); 20 | $table->integer('service_id')->unsigned(); 21 | $table->foreign('service_id')->references('id')->on('services')->onDelete('cascade'); 22 | $table->increments('id'); 23 | $table->timestamps(); 24 | }); 25 | } 26 | 27 | /** 28 | * Reverse the migrations. 29 | * 30 | * @return void 31 | */ 32 | public function down() 33 | { 34 | Schema::drop('occurrences'); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /database/migrations/2016_07_16_212605_create_categories_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 17 | $table->string('name'); 18 | $table->timestamps(); 19 | }); 20 | 21 | Schema::table('services', function(Blueprint $table) { 22 | $table->integer('category_id')->unsigned()->nullable(); 23 | $table->foreign('category_id')->references('id')->on('categories')->onDelete('cascade'); 24 | }); 25 | } 26 | 27 | /** 28 | * Reverse the migrations. 29 | * 30 | * @return void 31 | */ 32 | public function down() 33 | { 34 | Schema::table('services', function(Blueprint $table) { 35 | $table->dropForeign(['category_id']); 36 | $table->dropColumn('category_id'); 37 | }); 38 | 39 | Schema::drop('categories'); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /database/migrations/2016_07_17_085858_add_preferred_currency_and_email_notifications_to_users_table.php: -------------------------------------------------------------------------------- 1 | string('preferred_currency')->default('usd'); 17 | $table->boolean('email_notifications')->default(true); 18 | }); 19 | } 20 | 21 | /** 22 | * Reverse the migrations. 23 | * 24 | * @return void 25 | */ 26 | public function down() 27 | { 28 | Schema::table('users', function (Blueprint $table) { 29 | $table->dropColumn('preferred_currency'); 30 | $table->dropColumn('email_notifications'); 31 | }); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /database/migrations/2016_07_17_095203_create_cache_table.php: -------------------------------------------------------------------------------- 1 | string('key')->unique(); 17 | $table->text('value'); 18 | $table->integer('expiration'); 19 | }); 20 | } 21 | 22 | /** 23 | * Reverse the migrations. 24 | * 25 | * @return void 26 | */ 27 | public function down() 28 | { 29 | Schema::drop('cache'); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /database/migrations/2016_07_18_123554_drop_unique_index_for_tax_number_from_clients_table.php: -------------------------------------------------------------------------------- 1 | dropUnique(['tax_number']); 17 | $table->string('tax_number')->nullable()->change(); 18 | }); 19 | } 20 | 21 | /** 22 | * Reverse the migrations. 23 | * 24 | * @return void 25 | */ 26 | public function down() 27 | { 28 | Schema::table('clients', function (Blueprint $table) { 29 | // $table->unique('tax_number'); // can cause problems when refreshing db. 30 | }); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /database/migrations/2016_07_31_180730_fix_occurrences_occurs_at_column_by_dropping_table.php: -------------------------------------------------------------------------------- 1 | dateTime('occurs_at'); 19 | $table->boolean('offer_sent')->nullable(); 20 | $table->boolean('payment_received')->nullable(); 21 | $table->boolean('receipt_sent')->nullable(); 22 | $table->integer('service_id')->unsigned(); 23 | $table->foreign('service_id')->references('id')->on('services')->onDelete('cascade'); 24 | $table->increments('id'); 25 | $table->timestamps(); 26 | }); 27 | } 28 | 29 | /** 30 | * Reverse the migrations. 31 | * 32 | * @return void 33 | */ 34 | public function down() 35 | { 36 | Schema::drop('occurrences'); 37 | 38 | Schema::create('occurrences', function (Blueprint $table) { 39 | $table->timestamp('occurs_at'); 40 | $table->boolean('offer_sent')->nullable(); 41 | $table->boolean('payment_received')->nullable(); 42 | $table->boolean('receipt_sent')->nullable(); 43 | $table->integer('service_id')->unsigned(); 44 | $table->foreign('service_id')->references('id')->on('services')->onDelete('cascade'); 45 | $table->increments('id'); 46 | $table->timestamps(); 47 | }); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /database/seeds/.gitkeep: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /database/seeds/DatabaseSeeder.php: -------------------------------------------------------------------------------- 1 | call(SampleDataSeeder::class); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /database/seeds/SampleDataSeeder.php: -------------------------------------------------------------------------------- 1 | create([ 36 | 'name' => $category 37 | ]); 38 | }, $categories); 39 | 40 | $clients = factory(App\Client::class, 10)->create(); 41 | 42 | foreach($clients as $client) { 43 | $services = factory(App\Service::class, 10)->create([ 44 | 'client_id' => $client->id, 45 | 'category_id' => rand(1, count($categories)) 46 | ]); 47 | } 48 | 49 | /** 50 | * Sample User for testing purposes: 51 | * 52 | * email: sample.user@email.com 53 | * password: password 54 | * 55 | */ 56 | factory(App\User::class)->create([ 57 | 'name' => 'Sample User', 58 | 'email' => 'sample@user.dev', 59 | 'password' => bcrypt('password'), 60 | 'preferred_currency' => 'usd' 61 | ]); 62 | 63 | /** 64 | * Cleanup 65 | * 66 | * Because there is a long standing bug in Laravel 67 | * with model factories, I need to manually remove extra 68 | * records created. 69 | */ 70 | App\Category::has('services', '=', 0)->delete(); 71 | App\Client::has('services', '=', 0)->delete(); 72 | 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /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 | mix 16 | .copy('node_modules/bootstrap-less/fonts', 'public/build/fonts') 17 | .copy('node_modules/font-awesome/fonts', 'public/build/fonts') 18 | .less('app.less') 19 | .browserify('app.js') 20 | .version(['css/app.css', 'js/app.js']); 21 | }); 22 | -------------------------------------------------------------------------------- /license.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016-2017 Mario Bašić 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 10 | -------------------------------------------------------------------------------- /overview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/laravelista/kyle/ad08e66ed34218f03a776d211dadff94072a16cd/overview.png -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "scripts": { 4 | "prod": "gulp --production", 5 | "dev": "gulp watch" 6 | }, 7 | "devDependencies": { 8 | "gulp": "^3.9.1", 9 | "laravel-elixir": "^5.0.0", 10 | "bootbox": "^4.4.0", 11 | "bootstrap": "^3.3.6", 12 | "bootstrap-less": "^3.3.8", 13 | "font-awesome": "^4.6.3", 14 | "jquery": "^3.1.0", 15 | "selectize": "^0.12.2" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /phpunit.xml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 13 | ./tests 14 | 15 | 16 | 17 | 18 | ./app 19 | 20 | ./app/Http/routes.php 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /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 | # Handle Authorization Header 18 | RewriteCond %{HTTP:Authorization} . 19 | RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] 20 | 21 | -------------------------------------------------------------------------------- /public/build/fonts/FontAwesome.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/laravelista/kyle/ad08e66ed34218f03a776d211dadff94072a16cd/public/build/fonts/FontAwesome.otf -------------------------------------------------------------------------------- /public/build/fonts/fontawesome-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/laravelista/kyle/ad08e66ed34218f03a776d211dadff94072a16cd/public/build/fonts/fontawesome-webfont.eot -------------------------------------------------------------------------------- /public/build/fonts/fontawesome-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/laravelista/kyle/ad08e66ed34218f03a776d211dadff94072a16cd/public/build/fonts/fontawesome-webfont.ttf -------------------------------------------------------------------------------- /public/build/fonts/fontawesome-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/laravelista/kyle/ad08e66ed34218f03a776d211dadff94072a16cd/public/build/fonts/fontawesome-webfont.woff -------------------------------------------------------------------------------- /public/build/fonts/fontawesome-webfont.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/laravelista/kyle/ad08e66ed34218f03a776d211dadff94072a16cd/public/build/fonts/fontawesome-webfont.woff2 -------------------------------------------------------------------------------- /public/build/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/laravelista/kyle/ad08e66ed34218f03a776d211dadff94072a16cd/public/build/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /public/build/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/laravelista/kyle/ad08e66ed34218f03a776d211dadff94072a16cd/public/build/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /public/build/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/laravelista/kyle/ad08e66ed34218f03a776d211dadff94072a16cd/public/build/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /public/build/fonts/glyphicons-halflings-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/laravelista/kyle/ad08e66ed34218f03a776d211dadff94072a16cd/public/build/fonts/glyphicons-halflings-regular.woff2 -------------------------------------------------------------------------------- /public/build/js/all.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["app.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"all.js","sourcesContent":["/* This is a fix for Bootstrap requiring jQuery */\r\nglobal.jQuery = require('jquery');\r\nrequire('bootstrap');\r\n\r\nvar $ = require('jquery');\r\nvar bootbox = require('bootbox');\r\n\r\n$('.confirm').on(\"submit\", function(e) {\r\n var currentForm = this;\r\n e.preventDefault();\r\n bootbox.confirm('Are you sure?', function(result) {\r\n if(result === true) {\r\n currentForm.submit();\r\n }\r\n })\r\n});\r\n\r\n//var api_token = window.api_token || {};\r\n\r\n$('#currency').on('change', function() {\r\n\r\n var currency = $(this).val();\r\n\r\n $.ajax('/api/v1/quote', {\r\n data: {\r\n currency: currency,\r\n api_token: api_token\r\n },\r\n method: 'GET',\r\n success: function (data) {\r\n $('#exchange_rate').val(data);\r\n }\r\n });\r\n});"],"sourceRoot":"/source/"} -------------------------------------------------------------------------------- /public/build/rev-manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "css/app.css": "css/app-13224de714.css", 3 | "js/app.js": "js/app-832c11af61.js" 4 | } -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/laravelista/kyle/ad08e66ed34218f03a776d211dadff94072a16cd/public/favicon.ico -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | User-agent: * 2 | Disallow: 3 | -------------------------------------------------------------------------------- /public/web.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # Kyle 2 | 3 | 4 | [![Latest Stable Version](https://poser.pugx.org/laravelista/kyle/version)](https://packagist.org/packages/laravelista/kyle) 5 | [![Total Downloads](https://poser.pugx.org/laravelista/kyle/downloads)](https://packagist.org/packages/laravelista/kyle) 6 | [![Latest Unstable Version](https://poser.pugx.org/laravelista/kyle/v/unstable)](//packagist.org/packages/laravelista/kyle) 7 | [![License](https://poser.pugx.org/laravelista/kyle/license)](https://packagist.org/packages/laravelista/kyle) 8 | [![Build Status](https://travis-ci.org/laravelista/kyle.svg?branch=master)](https://travis-ci.org/laravelista/kyle) 9 | [![composer.lock available](https://poser.pugx.org/laravelista/kyle/composerlock)](https://packagist.org/packages/laravelista/kyle) 10 | 11 | Kyle is a web application built with Laravel for web developers and small companies to efficiently track and stay on top of yearly expenses related to services. We believe that having a calendar with reoccurring meetings or relying on email notifications from service providers is not a trustworthy source of information to bill clients for the services they use. 12 | 13 | Kyle attempts to provide you with a clear and simple way to see which client uses which services and when those service need to be billed. The idea behind Kyle is very simple "Never forget to bill a client for the services that he uses". 14 | 15 | ![Overview](overview.png) 16 | 17 | *Names and prices displayed in this image are all fictional and are provided here for demonstration purposes.* 18 | 19 | ## Features 20 | 21 | - Overview of services for current and upcoming month 22 | - Service breakdown by month 23 | - Keep track of services that a client uses 24 | - Group services by custom defined categories 25 | - Yearly report and statistics 26 | - Track is the offer sent, payment received and receipt sent 27 | - Email notifications (Planned) 28 | 29 | ## Installation 30 | 31 | Install by issuing the Composer `create-project` command in your terminal: 32 | 33 | ``` 34 | composer create-project --prefer-dist laravelista/kyle 35 | ``` 36 | 37 | Change values in `.env` file related to `DB_` and `APP_` keys. 38 | 39 | You need to set your database values including: 40 | 41 | - DB_HOST 42 | - DB_PORT 43 | - DB_DATABASE 44 | - DB_USERNAME 45 | - DB_PASSWORD 46 | 47 | Also you need to set application to production env and disable debugging if you are planning on running Kyle on a production server: 48 | 49 | - APP_ENV=production 50 | - APP_DEBUG=false 51 | 52 | ### Migrate database 53 | 54 | Run migrations with: 55 | 56 | ``` 57 | php artisan migrate 58 | ``` 59 | 60 | #### Sample data 61 | 62 | To populate Kyle with sample data and see how the Overview and Report pages look like, use this command: 63 | 64 | ``` 65 | php artisan db:seed 66 | ``` 67 | 68 | > Warning! This command will populate the database with a lot of sample data. Use only while testing or if you understand what will happen once this command has triggered. 69 | 70 | This will create a sample user with which you can login: 71 | 72 | | Email | Password | 73 | |-----------------------|----------| 74 | | sample@user.dev | password | 75 | 76 | ## Create new user 77 | 78 | To create a new user use this command: 79 | 80 | ``` 81 | php artisan user:create "John Doe" john@doe.com 82 | ``` 83 | 84 | You will be asked for the password. 85 | 86 | ## Info 87 | 88 | At the start of every year 1st of January a command `occurrences:spawn` is executed using the task scheduler. 89 | 90 | Be sure to add Cron entry to your server: 91 | 92 | ``` 93 | * * * * * php /path/to/artisan schedule:run >> /dev/null 2>&1 94 | ``` 95 | 96 | This command creates new occurrences for services that will occur in the new year. 97 | -------------------------------------------------------------------------------- /resources/assets/js/app.js: -------------------------------------------------------------------------------- 1 | /* This is a fix for Bootstrap requiring jQuery */ 2 | global.jQuery = require('jquery'); 3 | require('bootstrap'); 4 | 5 | var $ = require('jquery'); 6 | var bootbox = require('bootbox'); 7 | var selectize = require('selectize'); 8 | 9 | $('.confirm').on("submit", function(e) { 10 | var currentForm = this; 11 | e.preventDefault(); 12 | bootbox.confirm('Are you sure?', function(result) { 13 | if(result === true) { 14 | currentForm.submit(); 15 | } 16 | }) 17 | }); 18 | 19 | var falseTemplate = ''; 20 | var trueTemplate = ''; 21 | 22 | $('.kyle-change-boolean').each(function(index, value) { 23 | var state = $(this).data('state'); 24 | 25 | if(state == "1") { 26 | $(this).html(falseTemplate); 27 | $(this).addClass('text-danger'); 28 | } 29 | else { 30 | $(this).html(trueTemplate); 31 | $(this).addClass('text-success'); 32 | } 33 | }); 34 | 35 | $('.kyle-change-boolean').on('click', function(e) { 36 | var url = $(this).data('url'); 37 | var state = $(this).data('state'); 38 | 39 | var that = this; 40 | 41 | $.ajax(url, { 42 | data: { 43 | state: state, 44 | api_token: api_token 45 | }, 46 | method: 'GET', 47 | success: function (data) { 48 | if(data == 0) { 49 | var opposite = 1; 50 | $(that).html(falseTemplate); 51 | $(that).addClass('text-danger'); 52 | $(that).removeClass('text-success'); 53 | } 54 | else { 55 | var opposite = 0; 56 | $(that).html(trueTemplate); 57 | $(that).addClass('text-success'); 58 | $(that).removeClass('text-danger'); 59 | } 60 | $(that).data('state', opposite); 61 | } 62 | }); 63 | }); 64 | 65 | // Categories can be created on-the-fly 66 | $('#category_id').selectize({ 67 | persist: true, 68 | create: function (input, callback) { 69 | $.ajax('/api/v1/categories', { 70 | data: { 71 | name: input, 72 | api_token: api_token 73 | }, 74 | method: 'POST', 75 | success: function (data) { 76 | return callback({ 77 | value: data.id, 78 | text: data.name 79 | }); 80 | } 81 | }); 82 | } 83 | }); 84 | 85 | // Clients can be created on-the-fly 86 | $('#client_id').selectize({ 87 | persist: true, 88 | create: function (input, callback) { 89 | $.ajax('/api/v1/clients', { 90 | data: { 91 | name: input, 92 | api_token: api_token 93 | }, 94 | method: 'POST', 95 | success: function (data) { 96 | return callback({ 97 | value: data.id, 98 | text: data.name 99 | }); 100 | } 101 | }); 102 | } 103 | }); -------------------------------------------------------------------------------- /resources/assets/less/app.less: -------------------------------------------------------------------------------- 1 | @import "node_modules/font-awesome/less/font-awesome"; 2 | @import "node_modules/bootstrap-less/bootstrap/bootstrap"; 3 | @import "node_modules/selectize/dist/less/selectize.bootstrap3"; 4 | @import "./themes/paper/variables"; 5 | @import "./themes/paper/bootswatch"; 6 | 7 | .kyle-change-boolean { 8 | cursor: pointer; 9 | } -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /resources/lang/en/pagination.php: -------------------------------------------------------------------------------- 1 | '« Previous', 17 | 'next' => 'Next »', 18 | 19 | ]; 20 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | 'dimensions' => 'The :attribute has invalid image dimensions.', 38 | 'distinct' => 'The :attribute field has a duplicate value.', 39 | 'email' => 'The :attribute must be a valid email address.', 40 | 'exists' => 'The selected :attribute is invalid.', 41 | 'file' => 'The :attribute must be a file.', 42 | 'filled' => 'The :attribute field is required.', 43 | 'image' => 'The :attribute must be an image.', 44 | 'in' => 'The selected :attribute is invalid.', 45 | 'in_array' => 'The :attribute field does not exist in :other.', 46 | 'integer' => 'The :attribute must be an integer.', 47 | 'ip' => 'The :attribute must be a valid IP address.', 48 | 'json' => 'The :attribute must be a valid JSON string.', 49 | 'max' => [ 50 | 'numeric' => 'The :attribute may not be greater than :max.', 51 | 'file' => 'The :attribute may not be greater than :max kilobytes.', 52 | 'string' => 'The :attribute may not be greater than :max characters.', 53 | 'array' => 'The :attribute may not have more than :max items.', 54 | ], 55 | 'mimes' => 'The :attribute must be a file of type: :values.', 56 | 'min' => [ 57 | 'numeric' => 'The :attribute must be at least :min.', 58 | 'file' => 'The :attribute must be at least :min kilobytes.', 59 | 'string' => 'The :attribute must be at least :min characters.', 60 | 'array' => 'The :attribute must have at least :min items.', 61 | ], 62 | 'not_in' => 'The selected :attribute is invalid.', 63 | 'numeric' => 'The :attribute must be a number.', 64 | 'present' => 'The :attribute field must be present.', 65 | 'regex' => 'The :attribute format is invalid.', 66 | 'required' => 'The :attribute field is required.', 67 | 'required_if' => 'The :attribute field is required when :other is :value.', 68 | 'required_unless' => 'The :attribute field is required unless :other is in :values.', 69 | 'required_with' => 'The :attribute field is required when :values is present.', 70 | 'required_with_all' => 'The :attribute field is required when :values is present.', 71 | 'required_without' => 'The :attribute field is required when :values is not present.', 72 | 'required_without_all' => 'The :attribute field is required when none of :values are present.', 73 | 'same' => 'The :attribute and :other must match.', 74 | 'size' => [ 75 | 'numeric' => 'The :attribute must be :size.', 76 | 'file' => 'The :attribute must be :size kilobytes.', 77 | 'string' => 'The :attribute must be :size characters.', 78 | 'array' => 'The :attribute must contain :size items.', 79 | ], 80 | 'string' => 'The :attribute must be a string.', 81 | 'timezone' => 'The :attribute must be a valid zone.', 82 | 'unique' => 'The :attribute has already been taken.', 83 | 'url' => 'The :attribute format is invalid.', 84 | 85 | /* 86 | |-------------------------------------------------------------------------- 87 | | Custom Validation Language Lines 88 | |-------------------------------------------------------------------------- 89 | | 90 | | Here you may specify custom validation messages for attributes using the 91 | | convention "attribute.rule" to name the lines. This makes it quick to 92 | | specify a specific custom language line for a given attribute rule. 93 | | 94 | */ 95 | 96 | 'custom' => [ 97 | 'attribute-name' => [ 98 | 'rule-name' => 'custom-message', 99 | ], 100 | ], 101 | 102 | /* 103 | |-------------------------------------------------------------------------- 104 | | Custom Validation Attributes 105 | |-------------------------------------------------------------------------- 106 | | 107 | | The following language lines are used to swap attribute place-holders 108 | | with something more reader friendly such as E-Mail Address instead 109 | | of "email". This simply helps us make messages a little cleaner. 110 | | 111 | */ 112 | 113 | 'attributes' => [], 114 | 115 | ]; 116 | -------------------------------------------------------------------------------- /resources/views/auth/emails/password.blade.php: -------------------------------------------------------------------------------- 1 | Click here to reset your password: {{ $link }} 2 | -------------------------------------------------------------------------------- /resources/views/auth/login.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('meta_title', 'Login') 4 | 5 | @section('content') 6 |
7 |
8 |
9 |
10 |
Login
11 |
12 |
13 | {{ csrf_field() }} 14 | 15 |
16 | 17 | 18 |
19 | 20 | 21 | @if ($errors->has('email')) 22 | 23 | {{ $errors->first('email') }} 24 | 25 | @endif 26 |
27 |
28 | 29 |
30 | 31 | 32 |
33 | 34 | 35 | @if ($errors->has('password')) 36 | 37 | {{ $errors->first('password') }} 38 | 39 | @endif 40 |
41 |
42 | 43 |
44 |
45 |
46 | 49 |
50 |
51 |
52 | 53 |
54 |
55 | 58 | 59 | Forgot Your Password? 60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 | @endsection 69 | -------------------------------------------------------------------------------- /resources/views/auth/passwords/email.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('meta_title', 'Reset Password') 4 | 5 | 6 | @section('content') 7 |
8 |
9 |
10 |
11 |
Reset Password
12 |
13 | @if (session('status')) 14 |
15 | {{ session('status') }} 16 |
17 | @endif 18 | 19 |
20 | {{ csrf_field() }} 21 | 22 |
23 | 24 | 25 |
26 | 27 | 28 | @if ($errors->has('email')) 29 | 30 | {{ $errors->first('email') }} 31 | 32 | @endif 33 |
34 |
35 | 36 |
37 |
38 | 41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 | @endsection 50 | -------------------------------------------------------------------------------- /resources/views/auth/passwords/reset.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('meta_title', 'Reset Password') 4 | 5 | @section('content') 6 |
7 |
8 |
9 |
10 |
Reset Password
11 | 12 |
13 |
14 | {{ csrf_field() }} 15 | 16 | 17 | 18 |
19 | 20 | 21 |
22 | 23 | 24 | @if ($errors->has('email')) 25 | 26 | {{ $errors->first('email') }} 27 | 28 | @endif 29 |
30 |
31 | 32 |
33 | 34 | 35 |
36 | 37 | 38 | @if ($errors->has('password')) 39 | 40 | {{ $errors->first('password') }} 41 | 42 | @endif 43 |
44 |
45 | 46 |
47 | 48 |
49 | 50 | 51 | @if ($errors->has('password_confirmation')) 52 | 53 | {{ $errors->first('password_confirmation') }} 54 | 55 | @endif 56 |
57 |
58 | 59 |
60 |
61 | 64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 | @endsection 73 | -------------------------------------------------------------------------------- /resources/views/auth/register.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('meta_title', 'Register') 4 | 5 | @section('content') 6 |
7 |
8 |
9 |
10 |
Register
11 |
12 |
13 | {{ csrf_field() }} 14 | 15 |
16 | 17 | 18 |
19 | 20 | 21 | @if ($errors->has('name')) 22 | 23 | {{ $errors->first('name') }} 24 | 25 | @endif 26 |
27 |
28 | 29 |
30 | 31 | 32 |
33 | 34 | 35 | @if ($errors->has('email')) 36 | 37 | {{ $errors->first('email') }} 38 | 39 | @endif 40 |
41 |
42 | 43 |
44 | 45 | 46 |
47 | 48 | 49 | @if ($errors->has('password')) 50 | 51 | {{ $errors->first('password') }} 52 | 53 | @endif 54 |
55 |
56 | 57 |
58 | 59 | 60 |
61 | 62 | 63 | @if ($errors->has('password_confirmation')) 64 | 65 | {{ $errors->first('password_confirmation') }} 66 | 67 | @endif 68 |
69 |
70 | 71 |
72 |
73 | 76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 | @endsection 85 | -------------------------------------------------------------------------------- /resources/views/categories/create.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('meta_title', 'Categories - Create') 4 | 5 | @section('content') 6 |
7 |
8 |
9 | @include('layouts.partials.page_header', [ 10 | 'header' => 'Categories', 11 | 'subtext' => 'Create' 12 | ]) 13 |
14 |
15 |
16 |
17 | 18 | @include('layouts.partials.validation') 19 | 20 | {{ Form::open(['route' => 'categories.store']) }} 21 | 22 |
23 | {{ Form::label('name', 'Name') }} 24 | {{ Form::text('name', null, ['class' => 'form-control', 'placeholder' => 'Name']) }} 25 |
26 | 27 | 28 | 29 | {{ Form::close() }} 30 |
31 |
32 |
33 | @endsection 34 | -------------------------------------------------------------------------------- /resources/views/categories/edit.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('meta_title', 'Categories - Edit') 4 | 5 | @section('content') 6 |
7 |
8 |
9 | @include('layouts.partials.page_header', [ 10 | 'header' => 'Categories', 11 | 'subtext' => 'Edit' 12 | ]) 13 |
14 |
15 |
16 |
17 | @include('layouts.partials.validation') 18 | 19 | {{ Form::model($category, ['route' => ['categories.update', $category->id], 'method' => 'PUT']) }} 20 | 21 |
22 | {{ Form::label('name', 'Name') }} 23 | {{ Form::text('name', null, ['class' => 'form-control', 'placeholder' => 'Name']) }} 24 |
25 | 26 | 27 | 28 | {{ Form::close() }} 29 |
30 |
31 |
32 | @endsection 33 | -------------------------------------------------------------------------------- /resources/views/categories/index.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('meta_title', 'Categories - Index') 4 | 5 | @section('content') 6 |
7 |
8 |
9 | @include('layouts.partials.page_header', [ 10 | 'header' => 'Categories', 11 | 'subtext' => 'Index' 12 | ]) 13 |
14 |
15 |
16 |
17 | 18 |

19 | Add Category 20 |

21 |
22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | @foreach($categories as $category) 31 | 32 | 33 | 34 | 44 | 45 | @endforeach 46 |
NameServices
{{ $category->name }}{{ $category->services->count() }} 35 | {{ Form::open(['route' => ['categories.destroy', $category->id], 'method' => 'DELETE', 'class' => 'confirm']) }} 36 | 37 | Edit 38 | 39 | 42 | {{ Form::close() }} 43 |
47 |
48 |
49 |
50 |
51 | @endsection 52 | -------------------------------------------------------------------------------- /resources/views/clients/create.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('meta_title', 'Clients - Create') 4 | 5 | @section('content') 6 |
7 |
8 |
9 | @include('layouts.partials.page_header', [ 10 | 'header' => 'Clients', 11 | 'subtext' => 'Create' 12 | ]) 13 |
14 |
15 |
16 |
17 | 18 | @include('layouts.partials.validation') 19 | 20 | {{ Form::open(['route' => 'clients.store']) }} 21 | 22 |
23 | {{ Form::label('name', 'Name') }} 24 | {{ Form::text('name', null, ['class' => 'form-control', 'placeholder' => 'Name']) }} 25 |
26 | 27 |
28 | {{ Form::label('tax_number', 'Tax Number') }} 29 | {{ Form::text('tax_number', null, ['class' => 'form-control', 'placeholder' => 'Tax Number']) }} 30 |
31 | 32 |
33 | {{ Form::label('street', 'Street') }} 34 | {{ Form::text('street', null, ['class' => 'form-control', 'placeholder' => 'Street']) }} 35 |
36 | 37 |
38 | {{ Form::label('city', 'City') }} 39 | {{ Form::text('city', null, ['class' => 'form-control', 'placeholder' => 'City']) }} 40 |
41 | 42 |
43 | {{ Form::label('postal_code', 'Postal code') }} 44 | {{ Form::text('postal_code', null, ['class' => 'form-control', 'placeholder' => 'Postal code']) }} 45 |
46 | 47 | 48 | 49 | {{ Form::close() }} 50 |
51 |
52 |
53 | @endsection 54 | -------------------------------------------------------------------------------- /resources/views/clients/edit.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('meta_title', 'Clients - Edit') 4 | 5 | @section('content') 6 |
7 |
8 |
9 | @include('layouts.partials.page_header', [ 10 | 'header' => 'Clients', 11 | 'subtext' => 'Edit' 12 | ]) 13 |
14 |
15 |
16 |
17 | @include('layouts.partials.validation') 18 | 19 | {{ Form::model($client, ['route' => ['clients.update', $client->id], 'method' => 'PUT']) }} 20 | 21 |
22 | {{ Form::label('name', 'Name') }} 23 | {{ Form::text('name', null, ['class' => 'form-control', 'placeholder' => 'Name']) }} 24 |
25 | 26 |
27 | {{ Form::label('tax_number', 'Tax Number') }} 28 | {{ Form::text('tax_number', null, ['class' => 'form-control', 'placeholder' => 'Tax Number']) }} 29 |
30 | 31 |
32 | {{ Form::label('street', 'Street') }} 33 | {{ Form::text('street', null, ['class' => 'form-control', 'placeholder' => 'Street']) }} 34 |
35 | 36 |
37 | {{ Form::label('city', 'City') }} 38 | {{ Form::text('city', null, ['class' => 'form-control', 'placeholder' => 'City']) }} 39 |
40 | 41 |
42 | {{ Form::label('postal_code', 'Postal code') }} 43 | {{ Form::text('postal_code', null, ['class' => 'form-control', 'placeholder' => 'Postal code']) }} 44 |
45 | 46 | 47 | 48 | {{ Form::close() }} 49 |
50 |
51 |
52 | @endsection 53 | -------------------------------------------------------------------------------- /resources/views/clients/index.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('meta_title', 'Clients - Index') 4 | 5 | @section('content') 6 |
7 |
8 |
9 | @include('layouts.partials.page_header', [ 10 | 'header' => 'Clients', 11 | 'subtext' => 'Index' 12 | ]) 13 |
14 |
15 |
16 |
17 | 18 |

19 | Add Client 20 |

21 |
22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | @foreach($clients as $client) 34 | 35 | 36 | 37 | 38 | 39 | 40 | 50 | 51 | @endforeach 52 |
NameTax NumberStreetCityPostal Code
{{ $client->name }}{{ $client->tax_number }}{{ $client->street }}{{ $client->city }}{{ $client->postal_code }} 41 | {{ Form::open(['route' => ['clients.destroy', $client->id], 'method' => 'DELETE', 'class' => 'confirm']) }} 42 | 43 | Edit 44 | 45 | 48 | {{ Form::close() }} 49 |
53 |
54 |
55 |
56 |
57 | @endsection 58 | -------------------------------------------------------------------------------- /resources/views/errors/503.blade.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 | -------------------------------------------------------------------------------- /resources/views/home.blade.php: -------------------------------------------------------------------------------- 1 | @inject('Service', 'App\Service') 2 | 3 | @extends('layouts.app') 4 | 5 | @section('meta_title', 'Overview') 6 | 7 | @section('content') 8 | 9 |
10 |
11 |
12 | @include('layouts.partials.page_header', [ 13 | 'header' => 'Overview', 14 | 'subtext' => 'These are the services that need to be billed.' 15 | ]) 16 |
17 |
18 | 19 | @include('partials._occurrences_table', [ 20 | 'title' => 'This Month', 21 | 'occurrences' => $occurrencesThisMonth, 22 | 'month' => date('n') 23 | ]) 24 | 25 | @include('partials._occurrences_table', [ 26 | 'title' => 'Upcoming Month', 27 | 'occurrences' => $occurrencesNextMonth, 28 | 'month' => date('n') + 1 29 | ]) 30 | 31 | @include('partials._occurrences_table', [ 32 | 'title' => 'Have not received payment for', 33 | 'occurrences' => $previousUnpaidOccurrences 34 | ]) 35 | 36 |
37 | @endsection 38 | -------------------------------------------------------------------------------- /resources/views/layouts/app.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | @yield('meta_title') | Kyle 9 | 10 | 11 | 12 | 13 | 14 | @include('layouts.partials.navbar') 15 | 16 | @include('flash::message') 17 | 18 | @yield('content') 19 | 20 | @if (Auth::check()) 21 | 24 | @endif 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /resources/views/layouts/partials/navbar.blade.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /resources/views/layouts/partials/page_header.blade.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /resources/views/layouts/partials/validation.blade.php: -------------------------------------------------------------------------------- 1 | @if (count($errors) > 0) 2 |
3 | 8 |
9 | @endif -------------------------------------------------------------------------------- /resources/views/partials/_occurrences_table.blade.php: -------------------------------------------------------------------------------- 1 | @if(count($occurrences) > 0) 2 |
3 |
4 |

5 | {{ $title }} 6 | 7 | @if(isset($month)) 8 | TOTAL {{ $Service->getSumForMonth($month, true) }} 9 | @endif 10 | 11 |

12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | @foreach($occurrences as $occurrence) 25 | 26 | 27 | 28 | 29 | 30 | 31 | 36 | 41 | 46 | 47 | @endforeach 48 |
DateServiceClientCategoryCostOffer sentPayment receivedReceipt sent
{{ $occurrence->occurs_at->format('d.m.Y') }}{{ $occurrence->service->title }}{{ $occurrence->service->client->name }}{{ $occurrence->service->category->name or 'n/a' }}{{ $occurrence->service->formatted_cost }} 34 | {{ $occurrence->offer_sent }} 35 | 39 | {{ $occurrence->payment_received }} 40 | 44 | {{ $occurrence->receipt_sent }} 45 |
49 |
50 |
51 |
52 | @endif -------------------------------------------------------------------------------- /resources/views/services/create.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('meta_title', 'Services - Create') 4 | 5 | @section('content') 6 |
7 |
8 |
9 | @include('layouts.partials.page_header', [ 10 | 'header' => 'Services', 11 | 'subtext' => 'Create' 12 | ]) 13 |
14 |
15 |
16 |
17 | 18 | @include('layouts.partials.validation') 19 | 20 | {{ Form::open(['route' => 'services.store']) }} 21 | 22 |
23 | {{ Form::label('title', 'Title') }} 24 | {{ Form::text('title', null, ['class' => 'form-control', 'placeholder' => 'Title']) }} 25 |
26 | 27 |
28 | {{ Form::label('category_id', 'Category') }} 29 | {{ Form::select('category_id', $categories, null, [ 30 | 'class' => 'form-control', 31 | 'placeholder' => 'Select a category' 32 | ]) }} 33 |
34 | 35 |
36 | 39 |
40 | 41 |
42 | {{ Form::label('note', 'Note') }} 43 | {{ Form::textarea('note', null, ['class' => 'form-control', 'placeholder' => 'Note']) }} 44 |
45 | 46 |
47 | {{ Form::label('month', 'Month') }} 48 | {{ Form::text('month', null, ['class' => 'form-control', 'placeholder' => 'Month']) }} 49 |

1 = January, 2 = February...

50 |
51 | 52 |
53 | {{ Form::label('day', 'Day') }} 54 | {{ Form::text('day', null, ['class' => 'form-control', 'placeholder' => 'Day']) }} 55 |

1, 2, 3...

56 |
57 | 58 |
59 | {{ Form::label('cost', 'Cost') }} 60 | {{ Form::text('cost', null, ['class' => 'form-control', 'placeholder' => 'Cost']) }} 61 |

Eg. 1050,00

62 |
63 | 64 |
65 | {{ Form::label('currency', 'Currency') }} 66 | {{ Form::select('currency', $currencies, null, [ 67 | 'class' => 'form-control', 68 | 'placeholder' => 'Select a currency' 69 | ]) }} 70 |
71 | 72 |
73 | {{ Form::label('exchange_rate', 'Exchange Rate') }} 74 | {{ Form::text('exchange_rate', null, ['class' => 'form-control']) }} 75 |

If the currency is USD leave this blank or set to "1".

76 |
77 | 78 |
79 | {{ Form::label('client_id', 'Client') }} 80 | {{ Form::select('client_id', $clients, null, [ 81 | 'class' => 'form-control', 82 | 'placeholder' => 'Select a client' 83 | ]) }} 84 |
85 | 86 | 87 | 88 | {{ Form::close() }} 89 |
90 |
91 |
92 | @endsection 93 | -------------------------------------------------------------------------------- /resources/views/services/edit.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('meta_title', 'Services - Edit') 4 | 5 | @section('content') 6 |
7 |
8 |
9 | @include('layouts.partials.page_header', [ 10 | 'header' => 'Services', 11 | 'subtext' => 'Edit' 12 | ]) 13 |
14 |
15 |
16 |
17 | 18 | @include('layouts.partials.validation') 19 | 20 | {{ Form::model($service, ['route' => ['services.update', $service->id], 'method' => 'PUT']) }} 21 | 22 |
23 | {{ Form::label('title', 'Title') }} 24 | {{ Form::text('title', null, ['class' => 'form-control', 'placeholder' => 'Title']) }} 25 |
26 | 27 |
28 | {{ Form::label('category_id', 'Category') }} 29 | {{ Form::select('category_id', $categories, null, [ 30 | 'class' => 'form-control', 31 | 'placeholder' => 'Select a category' 32 | ]) }} 33 |
34 | 35 |
36 | 39 |
40 | 41 |
42 | {{ Form::label('note', 'Note') }} 43 | {{ Form::textarea('note', null, ['class' => 'form-control', 'placeholder' => 'Note']) }} 44 |
45 | 46 |
47 | {{ Form::label('month', 'Month') }} 48 | {{ Form::text('month', null, ['class' => 'form-control', 'placeholder' => 'Month']) }} 49 |

1 = January, 2 = February...

50 |
51 | 52 |
53 | {{ Form::label('day', 'Day') }} 54 | {{ Form::text('day', null, ['class' => 'form-control', 'placeholder' => 'Day']) }} 55 |

1, 2, 3...

56 |
57 | 58 |
59 | {{ Form::label('cost', 'Cost') }} 60 | {{ Form::text('cost', null, ['class' => 'form-control', 'placeholder' => 'Cost']) }} 61 |

Eg. 1050,00

62 |
63 | 64 |
65 | {{ Form::label('currency', 'Currency') }} 66 | {{ Form::select('currency', $currencies, null, [ 67 | 'class' => 'form-control', 68 | 'placeholder' => 'Select a currency' 69 | ]) }} 70 |
71 | 72 |
73 | {{ Form::label('exchange_rate', 'Exchange Rate') }} 74 | {{ Form::text('exchange_rate', null, ['class' => 'form-control']) }} 75 |

If the currency is USD leave this blank or set to "1".

76 |
77 | 78 |
79 | {{ Form::label('client_id', 'Client') }} 80 | {{ Form::select('client_id', $clients, null, [ 81 | 'class' => 'form-control', 82 | 'placeholder' => 'Select a client' 83 | ]) }} 84 |
85 | 86 | 87 | 88 | {{ Form::close() }} 89 |
90 |
91 |
92 | @endsection 93 | -------------------------------------------------------------------------------- /resources/views/services/index.blade.php: -------------------------------------------------------------------------------- 1 | @inject('Service', 'App\Service') 2 | 3 | @extends('layouts.app') 4 | 5 | @section('meta_title', 'Services - Index') 6 | 7 | @section('content') 8 |
9 |
10 |
11 | @include('layouts.partials.page_header', [ 12 | 'header' => 'Services', 13 | 'subtext' => 'Index' 14 | ]) 15 |
16 |
17 |
18 |
19 |

20 | Add Service 21 |

22 |
23 | 24 | @for($i = 1; $i <= 12; $i++) 25 | @if($services->where('month', $i)->count() > 0) 26 | 27 |

28 | {{ date('F', mktime(0, 0, 0, $i)) }} 29 | {{ $i }} 30 | 31 | TOTAL {{ $Service->getSumForMonth($i) }} 32 | 33 |

34 | 35 |
36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | @foreach($services->where('month', $i) as $service) 48 | 49 | 50 | 51 | 52 | 53 | 60 | 61 | 71 | 72 | @endforeach 73 |
Repeats onTitleClientCategoryActiveCost
{{ $service->day }}.{{ $service->month }}{{ $service->title }}{{ $service->client->name }}{{ $service->category->name or 'n/a' }} 54 | @if($service->active) 55 | 56 | @else 57 | 58 | @endif 59 | {{ $service->formatted_cost }} 62 | {{ Form::open(['route' => ['services.destroy', $service->id], 'method' => 'DELETE', 'class' => 'confirm']) }} 63 | 64 | Edit 65 | 66 | 69 | {{ Form::close() }} 70 |
74 |
75 | @endif 76 | @endfor 77 |
78 |
79 |
80 | @endsection 81 | -------------------------------------------------------------------------------- /resources/views/settings/edit.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('meta_title', 'Settings') 4 | 5 | @section('content') 6 |
7 |
8 |
9 | @include('layouts.partials.page_header', [ 10 | 'header' => 'Settings', 11 | 'subtext' => 'Edit your settings here' 12 | ]) 13 |
14 |
15 |
16 |
17 | @include('layouts.partials.validation') 18 | 19 | {{ Form::model($user, ['url' => '/settings', 'method' => 'PUT']) }} 20 | 21 |
22 | {{ Form::label('name', 'Name') }} 23 | {{ Form::text('name', null, ['class' => 'form-control', 'placeholder' => 'Name']) }} 24 |
25 | 26 |
27 | {{ Form::label('email', 'Email') }} 28 | {{ Form::email('email', null, ['class' => 'form-control', 'placeholder' => 'Email']) }} 29 |
30 | 31 |
32 | {{ Form::label('password', 'Password') }} 33 | {{ Form::password('password', ['class' => 'form-control', 'placeholder' => 'Password']) }} 34 |
35 | 36 |
37 | {{ Form::label('password_confirmation', 'Password confirmation') }} 38 | {{ Form::password('password_confirmation', ['class' => 'form-control', 'placeholder' => 'Password confirmation']) }} 39 |
40 | 41 |
42 | {{ Form::label('preferred_currency', 'Preferred currency') }} 43 | {{ Form::select('preferred_currency', $currencies, null, [ 44 | 'class' => 'form-control', 45 | 'placeholder' => 'Select a preferred currency' 46 | ]) }} 47 |
48 | 49 |
50 | 53 |
54 | 55 | 56 | 57 | {{ Form::close() }} 58 |
59 |
60 |
61 | @endsection 62 | -------------------------------------------------------------------------------- /resources/views/vendor/.gitkeep: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /resources/views/vendor/flash/message.blade.php: -------------------------------------------------------------------------------- 1 | @if (session()->has('flash_notification.message')) 2 | @if (session()->has('flash_notification.overlay')) 3 | @include('flash::modal', [ 4 | 'modalClass' => 'flash-modal', 5 | 'title' => session('flash_notification.title'), 6 | 'body' => session('flash_notification.message') 7 | ]) 8 | @else 9 |
13 | @if(session()->has('flash_notification.important')) 14 | 19 | @endif 20 | 21 | {!! session('flash_notification.message') !!} 22 |
23 | @endif 24 | @endif 25 | -------------------------------------------------------------------------------- /resources/views/vendor/flash/modal.blade.php: -------------------------------------------------------------------------------- 1 | 20 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /storage/app/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !public/ 3 | !.gitignore 4 | -------------------------------------------------------------------------------- /storage/app/public/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/.gitignore: -------------------------------------------------------------------------------- 1 | config.php 2 | routes.php 3 | schedule-* 4 | compiled.php 5 | services.json 6 | events.scanned.php 7 | routes.scanned.php 8 | down 9 | -------------------------------------------------------------------------------- /storage/framework/cache/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/sessions/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/views/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/logs/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /tests/TestCase.php: -------------------------------------------------------------------------------- 1 | make(Illuminate\Contracts\Console\Kernel::class)->bootstrap(); 22 | 23 | return $app; 24 | } 25 | 26 | public function setUp() 27 | { 28 | parent::setUp(); 29 | 30 | // Avoid using external service to fetch quotes 31 | $rate = new \Swap\Model\Rate(1); 32 | \Swap::shouldReceive('quote')->andReturn($rate); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /tests/functional/CategoryTest.php: -------------------------------------------------------------------------------- 1 | create(); 15 | 16 | $user = factory(\App\User::class)->create(); 17 | 18 | $this->actingAs($user) 19 | ->visit('/categories') 20 | ->see('Categories Index'); 21 | } 22 | 23 | /** @test */ 24 | public function it_creates_a_new_category() 25 | { 26 | $user = factory(\App\User::class)->create(); 27 | 28 | $name = 'Hosting'; 29 | 30 | $this->actingAs($user) 31 | ->visit('/categories/create') 32 | ->see('Categories Create') 33 | ->type($name, 'name') 34 | ->press('Save') 35 | ->seePageIs('/categories') 36 | ->see('Category Created!') 37 | ->seeInDatabase('categories', [ 38 | 'name' => $name 39 | ]); 40 | } 41 | 42 | /** @test */ 43 | public function it_updates_an_existing_category() 44 | { 45 | $user = factory(\App\User::class)->create(); 46 | 47 | $category = factory(\App\Category::class)->create([ 48 | 'name' => 'Hostingg' 49 | ]); 50 | 51 | $name = 'Hosting'; 52 | 53 | $this->actingAs($user) 54 | ->visit('/categories/' . $category->id . '/edit') 55 | ->see('Categories Edit') 56 | ->type($name, 'name') 57 | ->press('Update') 58 | ->see('Category Updated!') 59 | ->seeInDatabase('categories', [ 60 | 'name' => $name 61 | ]); 62 | } 63 | 64 | /** @test */ 65 | public function it_deletes_a_category() 66 | { 67 | $category = factory(\App\Category::class)->create(); 68 | 69 | $user = factory(\App\User::class)->create(); 70 | 71 | $this->actingAs($user) 72 | ->visit('/categories') 73 | ->see('Categories Index') 74 | ->see($category->name) 75 | ->press('category_' . $category->id) 76 | ->see('Category Deleted!') 77 | ->dontSee($category->name); 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /tests/functional/ClientTest.php: -------------------------------------------------------------------------------- 1 | create(); 15 | 16 | $user = factory(\App\User::class)->create(); 17 | 18 | $this->actingAs($user) 19 | ->visit('/clients') 20 | ->see('Clients Index'); 21 | } 22 | 23 | /** @test */ 24 | public function it_creates_a_new_client() 25 | { 26 | $user = factory(\App\User::class)->create(); 27 | 28 | $name = 'Pastor'; 29 | $tax_number = '12345678963'; 30 | $street = 'Some random street 12'; 31 | $city = 'A random City'; 32 | $postal_code = '12345'; 33 | 34 | $this->actingAs($user) 35 | ->visit('/clients/create') 36 | ->see('Clients Create') 37 | ->type($name, 'name') 38 | ->type($tax_number, 'tax_number') 39 | ->type($street, 'street') 40 | ->type($city, 'city') 41 | ->type($postal_code, 'postal_code') 42 | ->press('Save') 43 | ->seePageIs('/clients') 44 | ->see('Client Created!') 45 | ->seeInDatabase('clients', [ 46 | 'name' => $name 47 | ]); 48 | } 49 | 50 | /** @test */ 51 | public function it_updates_an_existing_client() 52 | { 53 | $user = factory(\App\User::class)->create(); 54 | 55 | $client = factory(\App\Client::class)->create([ 56 | 'name' => 'Acme building' 57 | ]); 58 | 59 | $name = 'Acme Company'; 60 | $tax_number = '12345678963'; 61 | $street = 'Some random street 12'; 62 | $city = 'A random City'; 63 | $postal_code = '12345'; 64 | 65 | $this->actingAs($user) 66 | ->visit('/clients/' . $client->id . '/edit') 67 | ->see('Clients Edit') 68 | ->type($name, 'name') 69 | ->type($tax_number, 'tax_number') 70 | ->type($street, 'street') 71 | ->type($city, 'city') 72 | ->type($postal_code, 'postal_code') 73 | ->press('Update') 74 | ->see('Client Updated!') 75 | ->seeInDatabase('clients', [ 76 | 'name' => $name 77 | ]); 78 | } 79 | 80 | /** @test */ 81 | public function it_deletes_a_client() 82 | { 83 | $client = factory(\App\Client::class)->create(); 84 | 85 | $user = factory(\App\User::class)->create(); 86 | 87 | $this->actingAs($user) 88 | ->visit('/clients') 89 | ->see('Clients Index') 90 | ->see($client->name) 91 | ->press('client_' . $client->id) 92 | ->see('Client Deleted!') 93 | ->dontSee($client->name); 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /tests/functional/OverviewTest.php: -------------------------------------------------------------------------------- 1 | create(); 15 | 16 | $this->actingAs($user) 17 | ->visit('/') 18 | ->see('Overview'); 19 | } 20 | } -------------------------------------------------------------------------------- /tests/functional/ReportTest.php: -------------------------------------------------------------------------------- 1 | create(); 15 | 16 | $this->actingAs($user) 17 | ->visit('/report') 18 | ->see('Report'); 19 | } 20 | } -------------------------------------------------------------------------------- /tests/functional/ServiceTest.php: -------------------------------------------------------------------------------- 1 | create(); 15 | 16 | $user = factory(\App\User::class)->create(); 17 | 18 | $this->actingAs($user) 19 | ->visit('/services') 20 | ->see('Services Index'); 21 | } 22 | 23 | /** @test */ 24 | public function it_creates_a_new_service() 25 | { 26 | $user = factory(\App\User::class)->create(); 27 | 28 | $category = factory(\App\Category::class)->create(); 29 | $client = factory(\App\Client::class)->create(); 30 | 31 | $title = 'Basic hosting plan'; 32 | $category_id = $category->id; 33 | $note = 'Service provider is Some company bla bla.'; 34 | $month = 1; 35 | $day = 1; 36 | $cost = '100,00'; 37 | $currency = 'usd'; 38 | $exchange_rate = 1; 39 | $client_id = $client->id; 40 | 41 | $this->actingAs($user) 42 | ->visit('/services/create') 43 | ->see('Services Create') 44 | ->type($title, 'title') 45 | ->select($category_id, 'category_id') 46 | ->check('active') 47 | ->type($note, 'note') 48 | ->type($month, 'month') 49 | ->type($day, 'day') 50 | ->type($cost, 'cost') 51 | ->type($currency, 'currency') 52 | ->type($exchange_rate, 'exchange_rate') 53 | ->select($client_id, 'client_id') 54 | ->press('Save') 55 | ->seePageIs('/services') 56 | ->see('Service Created!') 57 | ->seeInDatabase('services', [ 58 | 'title' => $title 59 | ]); 60 | } 61 | 62 | /** @test */ 63 | public function it_updates_an_existing_service() 64 | { 65 | $user = factory(\App\User::class)->create(); 66 | 67 | $service = factory(\App\Service::class)->create([ 68 | 'title' => 'Some strange plan' 69 | ]); 70 | 71 | $category = factory(\App\Category::class)->create(); 72 | $client = factory(\App\Client::class)->create(); 73 | 74 | $title = 'Basic hosting plan'; 75 | $category_id = $category->id; 76 | $note = 'Service provider is Some company bla bla.'; 77 | $month = 1; 78 | $day = 1; 79 | $cost = '100,00'; 80 | $currency = 'usd'; 81 | $exchange_rate = 1; 82 | $client_id = $client->id; 83 | 84 | $this->actingAs($user) 85 | ->visit('/services/' . $service->id . '/edit') 86 | ->see('Services Edit') 87 | ->type($title, 'title') 88 | ->select($category_id, 'category_id') 89 | ->check('active') 90 | ->type($note, 'note') 91 | ->type($month, 'month') 92 | ->type($day, 'day') 93 | ->type($cost, 'cost') 94 | ->type($currency, 'currency') 95 | ->type($exchange_rate, 'exchange_rate') 96 | ->select($client_id, 'client_id') 97 | ->press('Update') 98 | ->see('Service Updated!') 99 | ->seeInDatabase('services', [ 100 | 'title' => $title 101 | ]); 102 | } 103 | 104 | /** @test */ 105 | public function it_deletes_a_service() 106 | { 107 | $service = factory(\App\Service::class)->create(); 108 | 109 | $user = factory(\App\User::class)->create(); 110 | 111 | $this->actingAs($user) 112 | ->visit('/services') 113 | ->see('Services Index') 114 | ->see($service->title) 115 | ->press('service_' . $service->id) 116 | ->see('Service Deleted!') 117 | ->dontSee($service->title); 118 | } 119 | } 120 | -------------------------------------------------------------------------------- /tests/functional/SettingsTest.php: -------------------------------------------------------------------------------- 1 | create([ 15 | 'name' => 'Test Dummy', 16 | 'email' => 'test@test.dummy', 17 | 'preferred_currency' => 'hrk', 18 | 'email_notifications' => false 19 | ]); 20 | 21 | $name = 'Not A Test Dummy'; 22 | $email = 'not.a.fake@email.address'; 23 | $preferred_currency = 'usd'; 24 | 25 | $this->actingAs($user) 26 | ->visit('/settings') 27 | ->see('Settings') 28 | ->type($name, 'name') 29 | ->type($email, 'email') 30 | ->select($preferred_currency, 'preferred_currency') 31 | ->check('email_notifications') 32 | ->press('Update') 33 | ->see('Settings updated!') 34 | ->seeInDatabase('users', [ 35 | 'name' => $name, 36 | 'email' => $email, 37 | 'preferred_currency' => $preferred_currency, 38 | 'email_notifications' => 1 39 | ]); 40 | } 41 | } -------------------------------------------------------------------------------- /tests/models/OccurrenceTest.php: -------------------------------------------------------------------------------- 1 | make([ 15 | 'offer_sent' => true 16 | ]); 17 | $this->assertEquals(0, $occurrence->getFutureOfferState()); 18 | 19 | $occurrence = factory(\App\Occurrence::class)->make([ 20 | 'offer_sent' => false 21 | ]); 22 | $this->assertEquals(1, $occurrence->getFutureOfferState()); 23 | } 24 | 25 | /** @test */ 26 | public function it_gets_future_payment_state() 27 | { 28 | $occurrence = factory(\App\Occurrence::class)->make([ 29 | 'payment_received' => true 30 | ]); 31 | $this->assertEquals(0, $occurrence->getFuturePaymentState()); 32 | 33 | $occurrence = factory(\App\Occurrence::class)->make([ 34 | 'payment_received' => false 35 | ]); 36 | $this->assertEquals(1, $occurrence->getFuturePaymentState()); 37 | } 38 | 39 | /** @test */ 40 | public function it_gets_future_receipt_state() 41 | { 42 | $occurrence = factory(\App\Occurrence::class)->make([ 43 | 'receipt_sent' => true 44 | ]); 45 | $this->assertEquals(0, $occurrence->getFutureReceiptState()); 46 | 47 | $occurrence = factory(\App\Occurrence::class)->make([ 48 | 'receipt_sent' => false 49 | ]); 50 | $this->assertEquals(1, $occurrence->getFutureReceiptState()); 51 | } 52 | } -------------------------------------------------------------------------------- /tests/models/ServiceTest.php: -------------------------------------------------------------------------------- 1 | make([ 15 | 'cost' => 100000 // 1.000,00 16 | ]); 17 | 18 | $this->assertEquals('1000,00', $service->formCostAttribute()); 19 | } 20 | 21 | /** @test */ 22 | public function it_gets_formatted_cost_attribute() 23 | { 24 | $service = factory(\App\Service::class)->make([ 25 | 'cost' => 100000, // 1.000,00 26 | 'currency' => 'hrk' 27 | ]); 28 | 29 | $this->assertEquals('1.000,00 HRK', $service->formatted_cost); 30 | } 31 | 32 | /** @test */ 33 | public function it_gets_sum() 34 | { 35 | $user = factory(\App\User::class)->create([ 36 | 'preferred_currency' => 'usd' 37 | ]); 38 | 39 | /** 40 | * 10 * 100,00 USD = 1.000,00 USD 41 | */ 42 | $services = factory(\App\Service::class, 10)->make([ 43 | 'cost' => 10000, // 100,00 44 | 'currency' => 'eur' 45 | ]); 46 | 47 | /** 48 | * This method only works if the user is authenticated. 49 | * Based on users `preferred_currency` this methods sums 50 | * all service costs, converts currency using exhange rate 51 | * to preffered currency and returns formatted string. 52 | */ 53 | 54 | $this->actingAs($user); 55 | $sum = (new \App\Service)->getSum($services); 56 | $this->assertEquals('1.000,00 USD', $sum); 57 | 58 | factory(\App\Service::class, 5)->create([ 59 | 'cost' => 10000, // 100,00 60 | 'currency' => 'eur' 61 | ]); 62 | 63 | $sum = (new \App\Service)->getSum(); 64 | $this->assertEquals('500,00 USD', $sum); 65 | } 66 | 67 | /** @test */ 68 | public function it_gets_sum_for_specific_month() 69 | { 70 | $user = factory(\App\User::class)->create([ 71 | 'preferred_currency' => 'USD' 72 | ]); 73 | $this->actingAs($user); 74 | 75 | factory(\App\Service::class, 5)->create([ 76 | 'cost' => 10000, // 100,00 77 | 'currency' => 'eur', 78 | 'month' => 7, 79 | 'active' => true 80 | ]); 81 | 82 | factory(\App\Service::class, 5)->create([ 83 | 'cost' => 10000, // 100,00 84 | 'currency' => 'eur', 85 | 'month' => 8, 86 | 'active' => true 87 | ]); 88 | 89 | $sum = (new \App\Service)->getSumForMonth(7); 90 | $this->assertEquals('500,00 USD', $sum); 91 | 92 | factory(\App\Service::class, 5)->create([ 93 | 'cost' => 10000, // 100,00 94 | 'currency' => 'eur', 95 | 'month' => 7, 96 | 'active' => false 97 | ]); 98 | 99 | $sum = (new \App\Service)->getSumForMonth(7, true); 100 | $this->assertEquals('500,00 USD', $sum); 101 | } 102 | } -------------------------------------------------------------------------------- /tests/unit/OccurrenceCreatorTest.php: -------------------------------------------------------------------------------- 1 | create(); 16 | 17 | $occurrenceCreator = new \App\Occurrences\OccurrenceCreator; 18 | $occurrence = $occurrenceCreator->create($date, $service); 19 | 20 | $this->assertInstanceOf(\App\Occurrence::class, $occurrence); 21 | 22 | $this->seeInDatabase('occurrences', [ 23 | 'id' => $occurrence->id, 24 | 'occurs_at' => '2016-07-22 00:00:00', 25 | 'offer_sent' => 0, 26 | 'payment_received' => 0, 27 | 'receipt_sent' => 0, 28 | 'service_id' => $service->id 29 | ]); 30 | } 31 | } --------------------------------------------------------------------------------