diff --git a/app/Console/Commands/GenerateRecurringInvoices.php b/app/Console/Commands/GenerateRecurringInvoices.php index aefc2873..be425efa 100644 --- a/app/Console/Commands/GenerateRecurringInvoices.php +++ b/app/Console/Commands/GenerateRecurringInvoices.php @@ -56,10 +56,12 @@ public function handle() $template = $invoiceRecurrence->template; $templateItems = $template->items; - $constraintTime = $now->{$this->getDateAdditionOperator($invoiceRecurrence->time_period)}($invoiceRecurrence->time_interval + 3); + $constraintTime = $now->{$this->getDateAdditionOperator($invoiceRecurrence->time_period)}( + $invoiceRecurrence->time_interval + 3, + ); $constraint = new BeforeConstraint($constraintTime); -// $rrule = Unicorn::generateRrule($invoiceRecurrence->created_at, $timezone, $invoiceRecurrence->time_interval, $invoiceRecurrence->time_period, $invoiceRecurrence->until_type, $invoiceRecurrence->until_meta, true); + // $rrule = Unicorn::generateRrule($invoiceRecurrence->created_at, $timezone, $invoiceRecurrence->time_interval, $invoiceRecurrence->time_period, $invoiceRecurrence->until_type, $invoiceRecurrence->until_meta, true); $rrule = Rule::createFromString($invoiceRecurrence->rule, $template->date); $transformer = new ArrayTransformer(); @@ -73,7 +75,7 @@ public function handle() break; } -// $template->date = $template->date->{$this->getDateAdditionOperator($invoiceRecurrence->time_period)}(($invoiceRecurrence->time_interval * ($key + 1) )); + // $template->date = $template->date->{$this->getDateAdditionOperator($invoiceRecurrence->time_period)}(($invoiceRecurrence->time_interval * ($key + 1) )); $generatedInvoice = new Invoice(); $generatedInvoice->fill($template->toArray()); @@ -86,7 +88,7 @@ public function handle() //Generate hash based on the serialized version of the invoice; //Only retrieve the invoice data without any relations - $hash = hash('sha512', serialize(json_encode($generatedInvoice->getAttributes()).$templateItems)); + $hash = hash('sha512', serialize(json_encode($generatedInvoice->getAttributes()) . $templateItems)); if (Invoice::where('hash', $hash)->count() == 1) { print_r("Invoice already generated\n"); diff --git a/app/Console/Commands/ProcessNotifiableInvoices.php b/app/Console/Commands/ProcessNotifiableInvoices.php index 48828e46..fbdd9cd2 100644 --- a/app/Console/Commands/ProcessNotifiableInvoices.php +++ b/app/Console/Commands/ProcessNotifiableInvoices.php @@ -42,7 +42,9 @@ public function handle() { $startDate = Carbon::now()->subDay(); $endDate = Carbon::now()->addDay(); - $invoices = Invoice::datebetween($startDate, $endDate)->notifiable()->get(); + $invoices = Invoice::datebetween($startDate, $endDate) + ->notifiable() + ->get(); foreach ($invoices as $invoice) { $company = $invoice->company; $localDate = Carbon::now($company->timezone); diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index 27c0ff58..6ad6eaea 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -36,7 +36,7 @@ protected function schedule(Schedule $schedule) */ protected function commands() { - $this->load(__DIR__.'/Commands'); + $this->load(__DIR__ . '/Commands'); require base_path('routes/console.php'); } diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index c6c1ca2a..645c4471 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -22,11 +22,7 @@ class Handler extends ExceptionHandler * * @var array */ - protected $dontFlash = [ - 'current_password', - 'password', - 'password_confirmation', - ]; + protected $dontFlash = ['current_password', 'password', 'password_confirmation']; /** * Register the exception handling callbacks for the application. @@ -57,8 +53,6 @@ public function register() */ protected function unauthenticated($request, AuthenticationException $exception) { - return $request->expectsJson() - ? response()->json(['message' => 'Unauthenticated.'], 401) - : redirect()->guest(route('auth.show')); + return $request->expectsJson() ? response()->json(['message' => 'Unauthenticated.'], 401) : redirect()->guest(route('auth.show')); } } diff --git a/app/Http/Controllers/AdhocInvoiceController.php b/app/Http/Controllers/AdhocInvoiceController.php index b0e195c8..6d4fa9d2 100644 --- a/app/Http/Controllers/AdhocInvoiceController.php +++ b/app/Http/Controllers/AdhocInvoiceController.php @@ -64,12 +64,12 @@ public function store(CreateAdhocInvoiceRequest $request, Company $company) $invoice->notify = $request->has('notify') ? 1 : 0; $client = [ - 'companyname' => $request->input('companyname'), + 'companyname' => $request->input('companyname'), 'country_code' => $request->input('country_code'), - 'block' => $request->input('block'), - 'street' => $request->input('street'), - 'unitnumber' => $request->input('unitnumber'), - 'postalcode' => $request->input('postalcode'), + 'block' => $request->input('block'), + 'street' => $request->input('street'), + 'unitnumber' => $request->input('unitnumber'), + 'postalcode' => $request->input('postalcode'), ]; $invoice->client_data = json_encode($client); @@ -78,7 +78,9 @@ public function store(CreateAdhocInvoiceRequest $request, Company $company) foreach ($request->input('item_name') as $key => $item) { $invoiceitem = new InvoiceItem(); $invoiceitem->name = $item; - $invoiceitem->description = (array_key_exists($key, $request->input('item_description'))) ? $request->input('item_description')[$key] : null; + $invoiceitem->description = array_key_exists($key, $request->input('item_description')) + ? $request->input('item_description')[$key] + : null; $invoiceitem->quantity = $request->input('item_quantity')[$key]; $invoiceitem->price = $request->input('item_price')[$key]; $invoiceitem->invoice_id = $invoice->id; @@ -154,7 +156,7 @@ public function update(UpdateAdhocInvoiceRequest $request, Company $company, Inv $request->input('item_name')[$key], $request->input('item_description')[$key], $request->input('item_quantity')[$key], - $request->input('item_price')[$key] + $request->input('item_price')[$key], ); if ($ismodified) { @@ -188,12 +190,12 @@ public function update(UpdateAdhocInvoiceRequest $request, Company $company, Inv } $client = [ - 'companyname' => $request->input('companyname'), + 'companyname' => $request->input('companyname'), 'country_code' => $request->input('country_code'), - 'block' => $request->input('block'), - 'street' => $request->input('street'), - 'unitnumber' => $request->input('unitnumber'), - 'postalcode' => $request->input('postalcode'), + 'block' => $request->input('block'), + 'street' => $request->input('street'), + 'unitnumber' => $request->input('unitnumber'), + 'postalcode' => $request->input('postalcode'), ]; $invoice->client_data = json_encode($client); @@ -211,7 +213,9 @@ public function update(UpdateAdhocInvoiceRequest $request, Company $company, Inv $invoiceitem = new InvoiceItem(); } $invoiceitem->name = $itemname; - $invoiceitem->description = (array_key_exists($key, $request->input('item_description'))) ? $request->input('item_description')[$key] : null; + $invoiceitem->description = array_key_exists($key, $request->input('item_description')) + ? $request->input('item_description')[$key] + : null; $invoiceitem->quantity = $request->input('item_quantity')[$key]; $invoiceitem->price = $request->input('item_price')[$key]; $invoiceitem->invoice_id = $invoice->id; diff --git a/app/Http/Controllers/AdhocQuoteController.php b/app/Http/Controllers/AdhocQuoteController.php index fc1aa758..3234dd90 100644 --- a/app/Http/Controllers/AdhocQuoteController.php +++ b/app/Http/Controllers/AdhocQuoteController.php @@ -61,12 +61,12 @@ public function store(CreateAdhocQuoteRequest $request, Company $company) $quote->company_id = $company->id; $client = [ - 'companyname' => $request->input('companyname'), + 'companyname' => $request->input('companyname'), 'country_code' => $request->input('country_code'), - 'block' => $request->input('block'), - 'street' => $request->input('street'), - 'unitnumber' => $request->input('unitnumber'), - 'postalcode' => $request->input('postalcode'), + 'block' => $request->input('block'), + 'street' => $request->input('street'), + 'unitnumber' => $request->input('unitnumber'), + 'postalcode' => $request->input('postalcode'), ]; $quote->client_data = json_encode($client); @@ -75,7 +75,9 @@ public function store(CreateAdhocQuoteRequest $request, Company $company) foreach ($request->input('item_name') as $key => $item) { $quoteitem = new QuoteItem(); $quoteitem->name = $item; - $quoteitem->description = (array_key_exists($key, $request->input('item_description'))) ? $request->input('item_description')[$key] : null; + $quoteitem->description = array_key_exists($key, $request->input('item_description')) + ? $request->input('item_description')[$key] + : null; $quoteitem->quantity = $request->input('item_quantity')[$key]; $quoteitem->price = $request->input('item_price')[$key]; $quoteitem->quote_id = $quote->id; @@ -131,12 +133,12 @@ public function update(UpdateAdhocQuoteRequest $request, Company $company, Quote $quote->fill($request->all()); $client = [ - 'companyname' => $request->input('companyname'), + 'companyname' => $request->input('companyname'), 'country_code' => $request->input('country_code'), - 'block' => $request->input('block'), - 'street' => $request->input('street'), - 'unitnumber' => $request->input('unitnumber'), - 'postalcode' => $request->input('postalcode'), + 'block' => $request->input('block'), + 'street' => $request->input('street'), + 'unitnumber' => $request->input('unitnumber'), + 'postalcode' => $request->input('postalcode'), ]; $quote->client_data = json_encode($client); @@ -153,7 +155,9 @@ public function update(UpdateAdhocQuoteRequest $request, Company $company, Quote $quoteitem = new QuoteItem(); } $quoteitem->name = $itemname; - $quoteitem->description = (array_key_exists($key, $request->input('item_description'))) ? $request->input('item_description')[$key] : null; + $quoteitem->description = array_key_exists($key, $request->input('item_description')) + ? $request->input('item_description')[$key] + : null; $quoteitem->quantity = $request->input('item_quantity')[$key]; $quoteitem->price = $request->input('item_price')[$key]; $quoteitem->quote_id = $quote->id; diff --git a/app/Http/Controllers/ClientController.php b/app/Http/Controllers/ClientController.php index 7ee15498..c45174e1 100644 --- a/app/Http/Controllers/ClientController.php +++ b/app/Http/Controllers/ClientController.php @@ -61,23 +61,28 @@ public function store(CreateClientRequest $request, Company $company) $client->company_id = $company->id; $client->save(); - $storedirectory = '/perm_store/company/'.$client->company_id.'/clients/'.$client->id.'/photos/'; + $storedirectory = '/perm_store/company/' . $client->company_id . '/clients/' . $client->id . '/photos/'; Storage::makeDirectory($storedirectory); if ($request->file('logo')) { $file = $request->file('logo'); $uuid = Str::random(25); - $filename = $uuid.'.png'; - - if (! Storage::exists($storedirectory.'logo_'.$filename)) { - $image = Image::make($file)->fit(500, 500, function ($constraint) { - $constraint->upsize(); - }, 'center'); - Storage::put($storedirectory.'logo_'.$filename, $image->stream('jpg')->detach()); + $filename = $uuid . '.png'; + + if (!Storage::exists($storedirectory . 'logo_' . $filename)) { + $image = Image::make($file)->fit( + 500, + 500, + function ($constraint) { + $constraint->upsize(); + }, + 'center', + ); + Storage::put($storedirectory . 'logo_' . $filename, $image->stream('jpg')->detach()); } - $filepath = $storedirectory.'logo_'.$filename; + $filepath = $storedirectory . 'logo_' . $filename; $client->logo = $filepath; } @@ -143,23 +148,28 @@ public function update(UpdateClientRequest $request, Company $company, Client $c $client->fill($request->all()); $client->save(); - $storedirectory = '/perm_store/company/'.$client->company_id.'/clients/'.$client->id.'/photos/'; + $storedirectory = '/perm_store/company/' . $client->company_id . '/clients/' . $client->id . '/photos/'; Storage::makeDirectory($storedirectory); if ($request->file('logo')) { $file = $request->file('logo'); $uuid = Str::random(25); - $filename = $uuid.'.png'; - - if (! Storage::exists($storedirectory.'logo_'.$filename)) { - $image = Image::make($file)->fit(500, 500, function ($constraint) { - $constraint->upsize(); - }, 'center'); - Storage::put($storedirectory.'logo_'.$filename, $image->stream('jpg')->detach()); + $filename = $uuid . '.png'; + + if (!Storage::exists($storedirectory . 'logo_' . $filename)) { + $image = Image::make($file)->fit( + 500, + 500, + function ($constraint) { + $constraint->upsize(); + }, + 'center', + ); + Storage::put($storedirectory . 'logo_' . $filename, $image->stream('jpg')->detach()); } - $filepath = $storedirectory.'logo_'.$filename; + $filepath = $storedirectory . 'logo_' . $filename; $client->logo = $filepath; } @@ -198,8 +208,10 @@ public function destroy(Company $company, Client $client) */ public function invoicecreate(Company $company, Client $client) { - return redirect()->route('invoice.create', ['company' => $company])->withInput([ - 'client_id' => $client->id, - ]); + return redirect() + ->route('invoice.create', ['company' => $company]) + ->withInput([ + 'client_id' => $client->id, + ]); } } diff --git a/app/Http/Controllers/CompanyAddressController.php b/app/Http/Controllers/CompanyAddressController.php index 2759c6af..df864e27 100644 --- a/app/Http/Controllers/CompanyAddressController.php +++ b/app/Http/Controllers/CompanyAddressController.php @@ -89,7 +89,7 @@ public function update(UpdateCompanyAddressRequest $request, Company $company) { $companyaddress = $company->address; - if (! $companyaddress) { + if (!$companyaddress) { $companyaddress = new CompanyAddress(); } diff --git a/app/Http/Controllers/CompanyController.php b/app/Http/Controllers/CompanyController.php index 2d720f8e..523cc800 100644 --- a/app/Http/Controllers/CompanyController.php +++ b/app/Http/Controllers/CompanyController.php @@ -72,9 +72,9 @@ public function store(CreateCompanyRequest $request, Company $company) if ($request->session()->has('user_id') || auth()->check()) { $company = new Company(); $company->fill($request->all()); - $company->user_id = ($request->session()->has('user_id')) ? $request->session()->pull('user_id') : auth()->user()->id; + $company->user_id = $request->session()->has('user_id') ? $request->session()->pull('user_id') : auth()->user()->id; - if (! is_null($request->input('country_code')) && is_null($request->input('timezone'))) { + if (!is_null($request->input('country_code')) && is_null($request->input('timezone'))) { $timezone = DateTimeZone::listIdentifiers(DateTimeZone::PER_COUNTRY, $request->input('country_code'))[0]; $company->timezone = $timezone; } elseif (is_null($company->timezone)) { @@ -82,23 +82,28 @@ public function store(CreateCompanyRequest $request, Company $company) } $company->save(); - $storedirectory = '/perm_store/company/'.$company->id.'/photos/'; + $storedirectory = '/perm_store/company/' . $company->id . '/photos/'; Storage::makeDirectory($storedirectory); if ($request->file('logo')) { $file = $request->file('logo'); $uuid = Str::random(25); - $filename = $uuid.'.png'; - - if (! Storage::exists($storedirectory.'logo_'.$filename)) { - $image = Image::make($file)->fit(420, 220, function ($constraint) { - $constraint->upsize(); - }, 'center'); - Storage::put($storedirectory.'logo_'.$filename, $image->stream('jpg')->detach()); + $filename = $uuid . '.png'; + + if (!Storage::exists($storedirectory . 'logo_' . $filename)) { + $image = Image::make($file)->fit( + 420, + 220, + function ($constraint) { + $constraint->upsize(); + }, + 'center', + ); + Storage::put($storedirectory . 'logo_' . $filename, $image->stream('jpg')->detach()); } - $filepath = $storedirectory.'logo_'.$filename; + $filepath = $storedirectory . 'logo_' . $filename; $company->logo = $filepath; } @@ -106,16 +111,21 @@ public function store(CreateCompanyRequest $request, Company $company) if ($request->file('smlogo')) { $file = $request->file('smlogo'); $uuid = Str::random(25); - $filename = $uuid.'.png'; - - if (! Storage::exists($storedirectory.'smlogo_'.$filename)) { - $image = Image::make($file)->fit(200, 200, function ($constraint) { - $constraint->upsize(); - }, 'center'); - Storage::put($storedirectory.'smlogo_'.$filename, $image->stream('jpg')->detach()); + $filename = $uuid . '.png'; + + if (!Storage::exists($storedirectory . 'smlogo_' . $filename)) { + $image = Image::make($file)->fit( + 200, + 200, + function ($constraint) { + $constraint->upsize(); + }, + 'center', + ); + Storage::put($storedirectory . 'smlogo_' . $filename, $image->stream('jpg')->detach()); } - $filepath = $storedirectory.'smlogo_'.$filename; + $filepath = $storedirectory . 'smlogo_' . $filename; $company->smlogo = $filepath; } @@ -171,7 +181,7 @@ public function edit(Company $company) public function update(UpdateCompanyRequest $request, Company $company) { $company->fill($request->all()); - if ($request->has('country_code') && ! is_null($request->input('country_code'))) { + if ($request->has('country_code') && !is_null($request->input('country_code'))) { if ($request->has('timezone') && is_null($request->input('timezone'))) { $timezone = DateTimeZone::listIdentifiers(DateTimeZone::PER_COUNTRY, $request->input('country_code'))[0]; $company->timezone = $timezone; @@ -187,24 +197,29 @@ public function update(UpdateCompanyRequest $request, Company $company) } } - $storedirectory = '/perm_store/company/'.$company->id.'/photos/'; + $storedirectory = '/perm_store/company/' . $company->id . '/photos/'; Storage::makeDirectory($storedirectory); if ($request->file('logo')) { $file = $request->file('logo'); $uuid = Str::random(25); - $filename = $uuid.'.png'; + $filename = $uuid . '.png'; - if (! Storage::exists($storedirectory.'logo_'.$filename)) { + if (!Storage::exists($storedirectory . 'logo_' . $filename)) { $image = Image::make($file) ->encode('png', 100) - ->fit(420, 220, function ($constraint) { - $constraint->upsize(); - }, 'center'); - Storage::put($storedirectory.'logo_'.$filename, $image->stream('jpg')->detach()); + ->fit( + 420, + 220, + function ($constraint) { + $constraint->upsize(); + }, + 'center', + ); + Storage::put($storedirectory . 'logo_' . $filename, $image->stream('jpg')->detach()); } - $filepath = $storedirectory.'logo_'.$filename; + $filepath = $storedirectory . 'logo_' . $filename; $company->logo = $filepath; } @@ -212,18 +227,23 @@ public function update(UpdateCompanyRequest $request, Company $company) if ($request->file('smlogo')) { $file = $request->file('smlogo'); $uuid = Str::random(25); - $filename = $uuid.'.png'; + $filename = $uuid . '.png'; - if (! Storage::exists($storedirectory.'smlogo_'.$filename)) { + if (!Storage::exists($storedirectory . 'smlogo_' . $filename)) { $image = Image::make($file) ->encode('png', 100) - ->fit(200, 200, function ($constraint) { - $constraint->upsize(); - }, 'center'); - Storage::put($storedirectory.'smlogo_'.$filename, $image->stream('jpg')->detach()); + ->fit( + 200, + 200, + function ($constraint) { + $constraint->upsize(); + }, + 'center', + ); + Storage::put($storedirectory . 'smlogo_' . $filename, $image->stream('jpg')->detach()); } - $filepath = $storedirectory.'smlogo_'.$filename; + $filepath = $storedirectory . 'smlogo_' . $filename; $company->smlogo = $filepath; } @@ -295,7 +315,7 @@ public function check(Request $request, Company $company) { $email = $request->input('email'); -// $domain = preg_filter("/([^@]+)/","", $email); + // $domain = preg_filter("/([^@]+)/","", $email); $explode = explode('@', $email); $domain = array_pop($explode); diff --git a/app/Http/Controllers/CompanyRoleController.php b/app/Http/Controllers/CompanyRoleController.php index 9bfcba23..8f312bea 100644 --- a/app/Http/Controllers/CompanyRoleController.php +++ b/app/Http/Controllers/CompanyRoleController.php @@ -15,11 +15,7 @@ class CompanyRoleController extends Controller public function __construct() { - $this->defaultRoles = [ - 'global-administrator', - 'administrator', - 'user', - ]; + $this->defaultRoles = ['global-administrator', 'administrator', 'user']; } /** @@ -67,8 +63,10 @@ public function store(CreateRoleRequest $request, Company $company) $role->name = Str::slug($title); $role->save(); - if (! empty($permissions)) { - $abilities = Bouncer::ability()->whereIn('name', $permissions)->pluck('id'); + if (!empty($permissions)) { + $abilities = Bouncer::ability() + ->whereIn('name', $permissions) + ->pluck('id'); $role->abilities()->sync($abilities); } @@ -99,7 +97,7 @@ public function show($id) */ public function edit(Company $company, Role $role) { - if (! in_array($role->name, $this->defaultRoles)) { + if (!in_array($role->name, $this->defaultRoles)) { $rolePermissions = $role->getAbilities(); $permissions = self::getFormattedPermissions(); @@ -120,15 +118,17 @@ public function edit(Company $company, Role $role) */ public function update(UpdateRoleRequest $request, Company $company, Role $role) { - if (! in_array($role->name, $this->defaultRoles)) { + if (!in_array($role->name, $this->defaultRoles)) { $title = $request->input('title'); $permissions = $request->input('permissions'); $role->title = $title; $role->name = Str::slug($title); $role->save(); - if (! empty($permissions)) { - $abilities = Bouncer::ability()->whereIn('name', $permissions)->pluck('id'); + if (!empty($permissions)) { + $abilities = Bouncer::ability() + ->whereIn('name', $permissions) + ->pluck('id'); $role->abilities()->sync($abilities); } @@ -152,7 +152,7 @@ public function update(UpdateRoleRequest $request, Company $company, Role $role) */ public function destroy(Company $company, Role $role) { - if (! in_array($role->name, $this->defaultRoles)) { + if (!in_array($role->name, $this->defaultRoles)) { $role->delete(); } flash('The Role has been deleted', 'success'); diff --git a/app/Http/Controllers/CompanySettingsController.php b/app/Http/Controllers/CompanySettingsController.php index c6bb5bf3..49e7f174 100644 --- a/app/Http/Controllers/CompanySettingsController.php +++ b/app/Http/Controllers/CompanySettingsController.php @@ -89,7 +89,7 @@ public function update(UpdateCompanySettingRequest $request, Company $company) { $companySetting = $company->settings; - if (! $companySetting) { + if (!$companySetting) { $companySetting = new CompanySetting(); } diff --git a/app/Http/Controllers/ConfirmUserController.php b/app/Http/Controllers/ConfirmUserController.php index fb703d1d..68861cd0 100644 --- a/app/Http/Controllers/ConfirmUserController.php +++ b/app/Http/Controllers/ConfirmUserController.php @@ -15,7 +15,7 @@ public function getConfirmEmail($token = null) public function postConfirmEmail(Request $request, $token = null) { - if (! $token) { + if (!$token) { $token = $request->input('confirmation_token'); } diff --git a/app/Http/Controllers/DataMigrationController.php b/app/Http/Controllers/DataMigrationController.php index cb58bd78..9f6777db 100644 --- a/app/Http/Controllers/DataMigrationController.php +++ b/app/Http/Controllers/DataMigrationController.php @@ -33,17 +33,17 @@ public function storecontact(Request $request, Company $company) foreach ($results as $row) { try { $client = Client::query(); - $companyname = (is_null($row->company_name) ? $row->display_name : $row->company_name); - if (! $client->duplicatecheck($companyname)->first()) { + $companyname = is_null($row->company_name) ? $row->display_name : $row->company_name; + if (!$client->duplicatecheck($companyname)->first()) { $client = new Client(); $client->companyname = $companyname; $client->phone = $row->phone; $client->website = $row->website; $client->nickname = $row->display_name; - $client->street = $row->billing_address.$row->billing_street2; + $client->street = $row->billing_address . $row->billing_street2; $client->postalcode = $row->billing_code; $client->country = $row->billing_country; - $client->crn = (is_null($row->customfield_value1) ? null : $row->customfield_value1); + $client->crn = is_null($row->customfield_value1) ? null : $row->customfield_value1; $client->contactsalutation = $row->salutation; $client->contactfirstname = $row->first_name; $client->contactlastname = $row->last_name; @@ -53,10 +53,10 @@ public function storecontact(Request $request, Company $company) $client->company_id = auth()->user()->company_id; $client->save(); } else { - $errorscollection->push($row->emailid.' could not be imported'); + $errorscollection->push($row->emailid . ' could not be imported'); } } catch (\Exception $e) { - $errorscollection->push($row->emailid.' could not be imported'); + $errorscollection->push($row->emailid . ' could not be imported'); continue; // All other exceptions Log::info('Caught Exception la'); @@ -64,7 +64,9 @@ public function storecontact(Request $request, Company $company) } }); - return redirect()->route('migration.create')->with(compact('errorscollection')); + return redirect() + ->route('migration.create') + ->with(compact('errorscollection')); } public function storeinvoice(Request $request, Company $company) @@ -87,12 +89,18 @@ public function storeinvoice(Request $request, Company $company) $auth_companyid = auth()->user()->company_id; - if ($invoice = Invoice::where('nice_invoice_id', $row->invoice_number)->where('company_id', $auth_companyid)->first()) { + if ( + $invoice = Invoice::where('nice_invoice_id', $row->invoice_number) + ->where('company_id', $auth_companyid) + ->first() + ) { self::createInvoiceItem($row->item_name, $row->item_desc, $row->item_price, $row->quantity, $invoice->id); } else { $companyname = $row->company_name; - $client = Client::where('companyname', 'LIKE', '%'.$companyname.'%')->where('company_id', $auth_companyid)->first(); + $client = Client::where('companyname', 'LIKE', '%' . $companyname . '%') + ->where('company_id', $auth_companyid) + ->first(); $invoice = new Invoice(); $invoice->nice_invoice_id = $row->invoice_number; @@ -130,7 +138,7 @@ public function storeinvoice(Request $request, Company $company) $invoice->setInvoiceTotal(); } catch (Exception $e) { - $errorscollection->push($row->invoice_number.' could not be imported'); + $errorscollection->push($row->invoice_number . ' could not be imported'); continue; // All other exceptions Log::info('Caught Exception la'); @@ -138,7 +146,9 @@ public function storeinvoice(Request $request, Company $company) } }); - return redirect()->route('migration.create')->with(compact('errorscollection')); + return redirect() + ->route('migration.create') + ->with(compact('errorscollection')); } public function createInvoiceItem($name, $description, $price, $quantity, $invoiceid) @@ -146,9 +156,9 @@ public function createInvoiceItem($name, $description, $price, $quantity, $invoi $invoiceitem = InvoiceItem::query(); $price = number_format($price, 3, '.', ''); $quantity = intval($quantity); - if (! $invoiceitem->duplicatecheck($price, $quantity, $invoiceid)->first()) { + if (!$invoiceitem->duplicatecheck($price, $quantity, $invoiceid)->first()) { $invitem = new InvoiceItem(); - $invitem->name = (is_null($name) ? 'Item' : $name); + $invitem->name = is_null($name) ? 'Item' : $name; $invitem->description = $description; $invitem->price = $price; $invitem->quantity = $quantity; @@ -175,27 +185,29 @@ public function storepayment(Request $request, Company $company) try { $auth_companyid = auth()->user()->company_id; - $invoice = Invoice::where('nice_invoice_id', $row->invoice_number)->where('company_id', $auth_companyid)->first(); + $invoice = Invoice::where('nice_invoice_id', $row->invoice_number) + ->where('company_id', $auth_companyid) + ->first(); $payment = Payment::query(); $amount = number_format($row->amount, 3, '.', ''); - if (! $payment->duplicatecheck($amount, $row->date, $invoice->id, $invoice->getClient()->id, $auth_companyid)->first()) { + if (!$payment->duplicatecheck($amount, $row->date, $invoice->id, $invoice->getClient()->id, $auth_companyid)->first()) { $payment = new Payment(); $payment->amount = $amount; $payment->receiveddate = $row->date; - $payment->notes = $row->description.' '.$row->reference_number; + $payment->notes = $row->description . ' ' . $row->reference_number; $payment->mode = $row->mode; $payment->invoice_id = $invoice->id; $payment->client_id = $invoice->getClient()->id; $payment->company_id = $auth_companyid; $payment->save(); } else { - $errorscollection->push($row->invoice_number.', '.$row->date.', $'.$row->amount.' could not be imported'); + $errorscollection->push($row->invoice_number . ', ' . $row->date . ', $' . $row->amount . ' could not be imported'); } } catch (\Exception $e) { - $errorscollection->push($row->invoice_number.', '.$row->date.', $'.$row->amount.' could not be imported'); + $errorscollection->push($row->invoice_number . ', ' . $row->date . ', $' . $row->amount . ' could not be imported'); continue; // All other exceptions Log::info('Caught Exception la'); @@ -203,6 +215,8 @@ public function storepayment(Request $request, Company $company) } }); - return redirect()->route('migration.create')->with(compact('errorscollection')); + return redirect() + ->route('migration.create') + ->with(compact('errorscollection')); } } diff --git a/app/Http/Controllers/InvoiceController.php b/app/Http/Controllers/InvoiceController.php index f5a1d6f8..db877abd 100644 --- a/app/Http/Controllers/InvoiceController.php +++ b/app/Http/Controllers/InvoiceController.php @@ -36,10 +36,30 @@ public function __construct() */ public function index(Company $company) { - $overdue = $company->invoices()->with(['client'])->overdue()->notarchived()->get(); - $pending = $company->invoices()->with(['client'])->pending()->notarchived()->get(); - $draft = $company->invoices()->with(['client'])->draft()->notarchived()->get(); - $paid = $company->invoices()->with(['client'])->paid()->notarchived()->get(); + $overdue = $company + ->invoices() + ->with(['client']) + ->overdue() + ->notarchived() + ->get(); + $pending = $company + ->invoices() + ->with(['client']) + ->pending() + ->notarchived() + ->get(); + $draft = $company + ->invoices() + ->with(['client']) + ->draft() + ->notarchived() + ->get(); + $paid = $company + ->invoices() + ->with(['client']) + ->paid() + ->notarchived() + ->get(); return view('pages.invoice.index', compact('overdue', 'pending', 'draft', 'paid')); } @@ -53,7 +73,11 @@ public function index(Company $company) */ public function index_archived(Company $company) { - $invoices = $company->invoices()->archived()->with(['client'])->get(); + $invoices = $company + ->invoices() + ->archived() + ->with(['client']) + ->get(); return view('pages.invoice.index_archived', compact('invoices')); } @@ -115,7 +139,7 @@ public function share(Company $company, Invoice $invoice) */ public function sendnotification(Company $company, Invoice $invoice) { - if (! is_null($invoice->client_id)) { + if (!is_null($invoice->client_id)) { $invoice->notify(new InvoiceNotification($invoice)); flash('An email notification has been sent to the client', 'success'); } @@ -137,7 +161,7 @@ public function showwithtoken(Request $request, Company $company) $pdf = $invoice->generatePDFView(); - return $pdf->inline(Str::slug($invoice->nice_invoice_id).'.pdf'); + return $pdf->inline(Str::slug($invoice->nice_invoice_id) . '.pdf'); } /** @@ -202,7 +226,9 @@ public function store(CreateInvoiceRequest $request, Company $company) foreach ($request->input('item_name') as $key => $item) { $invoiceitem = new InvoiceItem(); $invoiceitem->name = $item; - $invoiceitem->description = (array_key_exists($key, $request->input('item_description'))) ? $request->input('item_description')[$key] : null; + $invoiceitem->description = array_key_exists($key, $request->input('item_description')) + ? $request->input('item_description')[$key] + : null; $invoiceitem->quantity = $request->input('item_quantity')[$key]; $invoiceitem->price = $request->input('item_price')[$key]; $invoiceitem->invoice_id = $invoice->id; @@ -230,13 +256,22 @@ public function store(CreateInvoiceRequest $request, Company $company) $repeatUntilMeta = $numberOfOccurences; break; case 'date': - $repeatUntilMeta = Carbon::createFromFormat('j F, Y', $request->input('recurring-until-date-value'))->startOfDay()->toDateTimeString(); + $repeatUntilMeta = Carbon::createFromFormat('j F, Y', $request->input('recurring-until-date-value')) + ->startOfDay() + ->toDateTimeString(); break; } $startDate = $invoice->date; $timezone = config('app.timezone'); - $rruleString = Unicorn::generateRrule($startDate, $timezone, $repeatsEveryInterval, $repeatsEveryTimePeriod, $repeatUntilOption, $repeatUntilMeta); + $rruleString = Unicorn::generateRrule( + $startDate, + $timezone, + $repeatsEveryInterval, + $repeatsEveryTimePeriod, + $repeatUntilOption, + $repeatUntilMeta, + ); $invoiceRecurrence = new InvoiceRecurrence(); $invoiceRecurrence->time_interval = $repeatsEveryInterval; @@ -325,7 +360,10 @@ public function convertToQuote(Company $company, Invoice $invoice) public function show(Company $company, Invoice $invoice) { $client = $invoice->getClient(); - $histories = $invoice->history()->orderBy('updated_at', 'desc')->get(); + $histories = $invoice + ->history() + ->orderBy('updated_at', 'desc') + ->get(); $payments = $invoice->payments; $recurrence = $invoice->recurrence; $siblings = $invoice->siblings(); @@ -346,7 +384,7 @@ public function printview(Company $company, Invoice $invoice) { $pdf = $invoice->generatePDFView(); - return $pdf->inline(Str::slug($invoice->nice_invoice_id).'.pdf'); + return $pdf->inline(Str::slug($invoice->nice_invoice_id) . '.pdf'); } /** @@ -361,7 +399,7 @@ public function download(Company $company, Invoice $invoice) { $pdf = $invoice->generatePDFView(); - return $pdf->download(Str::slug($invoice->nice_invoice_id).'.pdf'); + return $pdf->download(Str::slug($invoice->nice_invoice_id) . '.pdf'); } /** @@ -386,7 +424,7 @@ public function edit(Company $company, Invoice $invoice) $clients = $company->clients; $itemtemplates = $company->itemtemplates; - $recurrence = ($invoice->recurrence) ? $invoice->recurrence : null; + $recurrence = $invoice->recurrence ? $invoice->recurrence : null; return view('pages.invoice.edit', compact('invoice', 'clients', 'recurrence', 'itemtemplates')); } @@ -422,7 +460,7 @@ public function update(UpdateInvoiceRequest $request, Company $company, Invoice $request->input('item_name')[$key], $request->input('item_description')[$key], $request->input('item_quantity')[$key], - $request->input('item_price')[$key] + $request->input('item_price')[$key], ); if ($ismodified) { @@ -468,7 +506,9 @@ public function update(UpdateInvoiceRequest $request, Company $company, Invoice $invoiceitem = new InvoiceItem(); } $invoiceitem->name = $itemname; - $invoiceitem->description = (array_key_exists($key, $request->input('item_description'))) ? $request->input('item_description')[$key] : null; + $invoiceitem->description = array_key_exists($key, $request->input('item_description')) + ? $request->input('item_description')[$key] + : null; $invoiceitem->quantity = $request->input('item_quantity')[$key]; $invoiceitem->price = $request->input('item_price')[$key]; $invoiceitem->invoice_id = $invoice->id; @@ -478,7 +518,7 @@ public function update(UpdateInvoiceRequest $request, Company $company, Invoice $invoice = $invoice->fresh(); $invoice->setInvoiceTotal(); - $recurrenceExists = ($invoice->recurrence) ? true : false; + $recurrenceExists = $invoice->recurrence ? true : false; if ($request->has('recurring-invoice-check')) { if ($request->input('recurring-invoice-check') === 'on' && $request->input('recurring-details') === 'standalone') { @@ -509,15 +549,24 @@ public function update(UpdateInvoiceRequest $request, Company $company, Invoice $repeatUntilMeta = $numberOfOccurences; break; case 'date': - $repeatUntilMeta = Carbon::createFromFormat('j F, Y', $request->input('recurring-until-date-value'))->startOfDay()->toDateTimeString(); + $repeatUntilMeta = Carbon::createFromFormat('j F, Y', $request->input('recurring-until-date-value')) + ->startOfDay() + ->toDateTimeString(); break; } $startDate = $invoice->date; $timezone = config('app.timezone'); - $rruleString = Unicorn::generateRrule($startDate, $timezone, $repeatsEveryInterval, $repeatsEveryTimePeriod, $repeatUntilOption, $repeatUntilMeta); - - $invoiceRecurrence = ($recurrenceExists) ? $invoice->recurrence : new InvoiceRecurrence(); + $rruleString = Unicorn::generateRrule( + $startDate, + $timezone, + $repeatsEveryInterval, + $repeatsEveryTimePeriod, + $repeatUntilOption, + $repeatUntilMeta, + ); + + $invoiceRecurrence = $recurrenceExists ? $invoice->recurrence : new InvoiceRecurrence(); $invoiceRecurrence->time_interval = $repeatsEveryInterval; $invoiceRecurrence->time_period = $repeatsEveryTimePeriod; $invoiceRecurrence->until_type = $repeatUntilOption; @@ -611,7 +660,10 @@ public function destroy(Company $company, Invoice $invoice) public function history(Company $company, Invoice $invoice) { $client = $invoice->getClient(); - $histories = $invoice->history()->orderBy('created_at', 'desc')->get(); + $histories = $invoice + ->history() + ->orderBy('created_at', 'desc') + ->get(); return view('pages.invoice.history', compact('invoice', 'client', 'histories')); } @@ -626,7 +678,7 @@ public function history(Company $company, Invoice $invoice) */ public function checkSiblings(Company $company, Invoice $invoice) { - $hasSiblings = ($invoice->siblings()) ? true : false; + $hasSiblings = $invoice->siblings() ? true : false; return response()->json(compact('hasSiblings')); } diff --git a/app/Http/Controllers/MainController.php b/app/Http/Controllers/MainController.php index ce0fb911..308cb542 100644 --- a/app/Http/Controllers/MainController.php +++ b/app/Http/Controllers/MainController.php @@ -60,11 +60,9 @@ public function contact() public function contactHandle(ContactRequest $request) { - Mail::to(env('MAIL_TO_ADDRESS', 'support@poowflabs.com'))->send(new ContactForm( - $request->input('name'), - $request->input('email'), - $request->input('message') - )); + Mail::to(env('MAIL_TO_ADDRESS', 'support@poowflabs.com'))->send( + new ContactForm($request->input('name'), $request->input('email'), $request->input('message')), + ); flash('Cool! We will get back to you soon.', 'success'); @@ -79,26 +77,39 @@ public function start() public function dashboard(Company $company) { $user = auth()->user(); -// $company = auth()->user()->company; + // $company = auth()->user()->company; if ($company) { - $overdueinvoices = $company->invoices()->overdue()->take(10)->get(); + $overdueinvoices = $company + ->invoices() + ->overdue() + ->take(10) + ->get(); } else { $overdueinvoices = null; } $activity = [ - 'dates' => [], + 'dates' => [], 'invoices' => [], - 'quotes' => [], + 'quotes' => [], 'payments' => [], ]; for ($i = 0; $i < 7; $i++) { $today = Carbon::now(); $current = $today->subDays($i); - $invoiceCount = $company->invoices()->whereDate('created_at', $current)->count(); - $quoteCount = $company->quotes()->whereDate('created_at', $current)->count(); - $paymentCount = $company->payments()->whereDate('created_at', $current)->count(); + $invoiceCount = $company + ->invoices() + ->whereDate('created_at', $current) + ->count(); + $quoteCount = $company + ->quotes() + ->whereDate('created_at', $current) + ->count(); + $paymentCount = $company + ->payments() + ->whereDate('created_at', $current) + ->count(); array_push($activity['dates'], $current->format('d/M/Y')); array_push($activity['invoices'], $invoiceCount); @@ -108,7 +119,7 @@ public function dashboard(Company $company) $total = [ 'invoices' => $company->invoices->count(), - 'quotes' => $company->quotes->count(), + 'quotes' => $company->quotes->count(), 'payments' => $company->payments->count(), ]; diff --git a/app/Http/Controllers/NotificationController.php b/app/Http/Controllers/NotificationController.php index 971fe976..1533c547 100644 --- a/app/Http/Controllers/NotificationController.php +++ b/app/Http/Controllers/NotificationController.php @@ -34,7 +34,6 @@ public function pixel($notificationId) // the GIF should not be POSTed to, so do nothing... echo ' '; } else { - // return 1x1 pixel transparent gif header('Content-type: image/gif'); // needed to avoid cache time on browser side @@ -44,7 +43,52 @@ public function pixel($notificationId) header('Last-Modified: Wed, 11 Jan 2006 12:59:00 GMT'); header('Pragma: no-cache'); - echo sprintf('%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%', 71, 73, 70, 56, 57, 97, 1, 0, 1, 0, 128, 255, 0, 192, 192, 192, 0, 0, 0, 33, 249, 4, 1, 0, 0, 0, 0, 44, 0, 0, 0, 0, 1, 0, 1, 0, 0, 2, 2, 68, 1, 0, 59); + echo sprintf( + '%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%', + 71, + 73, + 70, + 56, + 57, + 97, + 1, + 0, + 1, + 0, + 128, + 255, + 0, + 192, + 192, + 192, + 0, + 0, + 0, + 33, + 249, + 4, + 1, + 0, + 0, + 0, + 0, + 44, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 2, + 2, + 68, + 1, + 0, + 59, + ); } // flush all output buffers. No reason to make the user wait for OWA. @@ -54,7 +98,7 @@ public function pixel($notificationId) // Can retrieve more info from server parameter // Log::info($_SERVER); - if (! $notification->read_at && $_SERVER['REQUEST_METHOD'] !== 'POST') { + if (!$notification->read_at && $_SERVER['REQUEST_METHOD'] !== 'POST') { $notification->read_at = Carbon::now(); $notification->save(); } diff --git a/app/Http/Controllers/OldInvoiceController.php b/app/Http/Controllers/OldInvoiceController.php index 0764d894..d457c200 100644 --- a/app/Http/Controllers/OldInvoiceController.php +++ b/app/Http/Controllers/OldInvoiceController.php @@ -73,7 +73,7 @@ public function printview(Company $company, OldInvoice $invoice) { $pdf = $invoice->generatePDFView(); - return $pdf->inline(Str::slug($invoice->nice_invoice_id.' - '.$invoice->created_at).'.pdf'); + return $pdf->inline(Str::slug($invoice->nice_invoice_id . ' - ' . $invoice->created_at) . '.pdf'); } /** @@ -88,7 +88,7 @@ public function download(Company $company, OldInvoice $invoice) { $pdf = $invoice->generatePDFView(); - return $pdf->download(Str::slug($invoice->nice_invoice_id.' - '.$invoice->created_at).'.pdf'); + return $pdf->download(Str::slug($invoice->nice_invoice_id . ' - ' . $invoice->created_at) . '.pdf'); } /** diff --git a/app/Http/Controllers/PaymentController.php b/app/Http/Controllers/PaymentController.php index c0d538d4..87b9e976 100644 --- a/app/Http/Controllers/PaymentController.php +++ b/app/Http/Controllers/PaymentController.php @@ -21,7 +21,10 @@ class PaymentController extends Controller */ public function index(Company $company) { - $payments = $company->payments()->with(['invoice', 'client'])->get(); + $payments = $company + ->payments() + ->with(['invoice', 'client']) + ->get(); return view('pages.payment.index', compact('payments')); } diff --git a/app/Http/Controllers/QuoteController.php b/app/Http/Controllers/QuoteController.php index 8b2c4a18..3b77734e 100644 --- a/app/Http/Controllers/QuoteController.php +++ b/app/Http/Controllers/QuoteController.php @@ -26,7 +26,11 @@ class QuoteController extends Controller */ public function index(Company $company) { - $quotes = $company->quotes()->notarchived()->with(['client'])->get(); + $quotes = $company + ->quotes() + ->notarchived() + ->with(['client']) + ->get(); return view('pages.quote.index', compact('quotes')); } @@ -40,7 +44,11 @@ public function index(Company $company) */ public function index_archived(Company $company) { - $quotes = $company->quotes()->archived()->with(['client'])->get(); + $quotes = $company + ->quotes() + ->archived() + ->with(['client']) + ->get(); return view('pages.quote.index_archived', compact('quotes')); } @@ -93,7 +101,7 @@ public function showwithtoken(Request $request, Company $company) $pdf = $quote->generatePDFView(); - return $pdf->inline(Str::slug($quote->nice_quote_id).'.pdf'); + return $pdf->inline(Str::slug($quote->nice_quote_id) . '.pdf'); } /** @@ -154,7 +162,9 @@ public function store(CreateQuoteRequest $request, Company $company) foreach ($request->input('item_name') as $key => $item) { $quoteitem = new QuoteItem(); $quoteitem->name = $item; - $quoteitem->description = (array_key_exists($key, $request->input('item_description'))) ? $request->input('item_description')[$key] : null; + $quoteitem->description = array_key_exists($key, $request->input('item_description')) + ? $request->input('item_description')[$key] + : null; $quoteitem->quantity = $request->input('item_quantity')[$key]; $quoteitem->price = $request->input('item_price')[$key]; $quoteitem->quote_id = $quote->id; @@ -178,7 +188,9 @@ public function convertToInvoice(Company $company, Quote $quote) { $invoice = new Invoice(); $invoice->nice_invoice_id = $company->niceinvoiceid(); - $duedate = Carbon::now()->addDays($quote->netdays)->startOfDay(); + $duedate = Carbon::now() + ->addDays($quote->netdays) + ->startOfDay(); $invoice->date = Carbon::now()->startOfDay(); $invoice->netdays = $quote->netdays; $invoice->duedate = $duedate; @@ -239,7 +251,7 @@ public function printview(Company $company, Quote $quote) { $pdf = $quote->generatePDFView(); - return $pdf->inline(Str::slug($quote->nice_quote_id).'quote.pdf'); + return $pdf->inline(Str::slug($quote->nice_quote_id) . 'quote.pdf'); } /** @@ -254,7 +266,7 @@ public function download(Company $company, Quote $quote) { $pdf = $quote->generatePDFView(); - return $pdf->download(Str::slug($quote->nice_quote_id).'.pdf'); + return $pdf->download(Str::slug($quote->nice_quote_id) . '.pdf'); } /** @@ -300,7 +312,9 @@ public function update(UpdateQuoteRequest $request, Company $company, Quote $quo $quoteitem = new QuoteItem(); } $quoteitem->name = $itemname; - $quoteitem->description = (array_key_exists($key, $request->input('item_description'))) ? $request->input('item_description')[$key] : null; + $quoteitem->description = array_key_exists($key, $request->input('item_description')) + ? $request->input('item_description')[$key] + : null; $quoteitem->quantity = $request->input('item_quantity')[$key]; $quoteitem->price = $request->input('item_price')[$key]; $quoteitem->quote_id = $quote->id; diff --git a/app/Http/Controllers/ReceiptController.php b/app/Http/Controllers/ReceiptController.php index 8fdc7bbd..5877e016 100644 --- a/app/Http/Controllers/ReceiptController.php +++ b/app/Http/Controllers/ReceiptController.php @@ -106,7 +106,7 @@ public function destroy(Company $company, Receipt $receipt) public function generate(Company $company, Invoice $invoice) { - if (! $invoice->receipt) { + if (!$invoice->receipt) { $receipt = new Receipt(); $receipt->nice_receipt_id = $company->niceReceiptID(); $receipt->company_id = $company->id; @@ -130,7 +130,7 @@ public function printview(Company $company, Receipt $receipt) { $pdf = $receipt->generatePDFView(); - return $pdf->inline(Str::slug($receipt->nice_receipt_id).'.pdf'); + return $pdf->inline(Str::slug($receipt->nice_receipt_id) . '.pdf'); } /** @@ -145,6 +145,6 @@ public function download(Company $company, Receipt $receipt) { $pdf = $receipt->generatePDFView(); - return $pdf->download(Str::slug($receipt->nice_receipt_id).'.pdf'); + return $pdf->download(Str::slug($receipt->nice_receipt_id) . '.pdf'); } } diff --git a/app/Http/Controllers/ResetPasswordController.php b/app/Http/Controllers/ResetPasswordController.php index 9e6b66b2..a869c03d 100644 --- a/app/Http/Controllers/ResetPasswordController.php +++ b/app/Http/Controllers/ResetPasswordController.php @@ -14,9 +14,7 @@ class ResetPasswordController extends Controller public function show(Request $request, $token = null) { - return view('pages.reset')->with( - ['token' => $token, 'email' => $request->email] - ); + return view('pages.reset')->with(['token' => $token, 'email' => $request->email]); } protected function resetPassword($user, $password) diff --git a/app/Http/Controllers/SocialAuthController.php b/app/Http/Controllers/SocialAuthController.php index f80f3eed..42136c6d 100644 --- a/app/Http/Controllers/SocialAuthController.php +++ b/app/Http/Controllers/SocialAuthController.php @@ -28,9 +28,9 @@ public function handleProviderCallback($provider) $user = User::where('email', $socialuser->email)->first(); - if (! $user) { + if (!$user) { $user = new User(); - $user->username = preg_replace('/\s/', '', $socialuser->name).'_'.Str::random(5); + $user->username = preg_replace('/\s/', '', $socialuser->name) . '_' . Str::random(5); $user->email = $socialuser->email; $user->password = Str::random(10); $user->full_name = $socialuser->name; @@ -48,7 +48,6 @@ public function handleProviderCallback($provider) $smt->google_token = $socialuser->token; break; default: - } $smt->save(); diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php index 2974736f..9d1b8dba 100644 --- a/app/Http/Controllers/UserController.php +++ b/app/Http/Controllers/UserController.php @@ -82,7 +82,7 @@ public function store(CreateUserRequest $request) $user = new User(); $user->fill($request->all()); $user->password = $request->input('password'); - if ($request->has('country_code') && ! is_null($request->input('country_code'))) { + if ($request->has('country_code') && !is_null($request->input('country_code'))) { if ($request->has('timezone') && is_null($request->input('timezone'))) { $timezone = DateTimeZone::listIdentifiers(DateTimeZone::PER_COUNTRY, $request->input('country_code'))[0]; $user->timezone = $timezone; @@ -112,7 +112,7 @@ public function store(CreateUserRequest $request) flash('Sign in to accept the invite', 'success'); return redirect()->route('auth.show'); -// return redirect()->route('company.invite.show', [ 'companyinvite' => $request->input('companyinvite') ]); + // return redirect()->route('company.invite.show', [ 'companyinvite' => $request->input('companyinvite') ]); } $request->session()->put('user_id', $user->id); @@ -183,15 +183,13 @@ public function update(UpdateUserRequest $request) $user->email_verified_at = null; } - if ($request->has('country_code') && ! is_null($request->input('country_code'))) { + if ($request->has('country_code') && !is_null($request->input('country_code'))) { if ($request->has('timezone') && is_null($request->input('timezone'))) { $timezone = $this->countries ->where('iso_3166_1_alpha2', $request->input('country_code')) ->first() ->hydrate('timezones') - ->timezones - ->first() - ->zone_name; + ->timezones->first()->zone_name; $user->timezone = $timezone; } } @@ -201,7 +199,7 @@ public function update(UpdateUserRequest $request) $user->password = $newpass; } - if (! $user->save()) { + if (!$user->save()) { flash('Failed to Update Profile', 'error'); return redirect()->back(); @@ -254,11 +252,7 @@ public function multifactor_create(Company $company) return redirect()->route('user.security', ['company' => $company]); } - $twoFactorUrl = Google2FA::getQRCodeUrl( - config('app.name'), - $user->email, - $twofa_secret - ); + $twoFactorUrl = Google2FA::getQRCodeUrl(config('app.name'), $user->email, $twofa_secret); return view('pages.user.multifactor.create', compact('twoFactorUrl', 'twofa_secret')); } @@ -284,7 +278,9 @@ public function multifactor_store(Request $request, Company $company) flash('Multifactor Auth has been enabled for your account', 'success'); - return redirect()->route('user.security', ['company' => $company])->with(compact('codes')); + return redirect() + ->route('user.security', ['company' => $company]) + ->with(compact('codes')); } else { flash('Something went wrong, please try again', 'error'); @@ -326,7 +322,9 @@ public function multifactor_regenerate_codes(Request $request, Company $company) flash('Your backup codes have been regenerated', 'success'); - return redirect()->route('user.security', ['company' => $company])->with(compact('codes')); + return redirect() + ->route('user.security', ['company' => $company]) + ->with(compact('codes')); } public function multifactor_backup() @@ -351,8 +349,8 @@ public function multifactor_backup_validate(Request $request, Company $company) session()->put('multifactor_status', [ 'otp_timestamp' => true, - 'auth_passed' => true, - 'auth_time' => Carbon::now(), + 'auth_passed' => true, + 'auth_time' => Carbon::now(), ]); return redirect()->route('dashboard', ['company' => $company]); diff --git a/app/Http/Controllers/VerificationController.php b/app/Http/Controllers/VerificationController.php index d4e07ca8..7828fd6b 100644 --- a/app/Http/Controllers/VerificationController.php +++ b/app/Http/Controllers/VerificationController.php @@ -12,9 +12,7 @@ class VerificationController extends Controller public function show(Request $request) { - return $request->user()->hasVerifiedEmail() - ? redirect($this->redirectPath()) - : view('pages.verify'); + return $request->user()->hasVerifiedEmail() ? redirect($this->redirectPath()) : view('pages.verify'); } public function redirectTo() diff --git a/app/Http/Kernel.php b/app/Http/Kernel.php index 726461f9..cca104d0 100644 --- a/app/Http/Kernel.php +++ b/app/Http/Kernel.php @@ -55,18 +55,18 @@ class Kernel extends HttpKernel * @var array */ protected $routeMiddleware = [ - 'auth' => \App\Http\Middleware\Authenticate::class, - 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class, - 'hascompany' => \App\Http\Middleware\HasCompany::class, - 'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class, + 'auth' => \App\Http\Middleware\Authenticate::class, + 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class, + 'hascompany' => \App\Http\Middleware\HasCompany::class, + 'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class, 'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class, - 'can' => \Illuminate\Auth\Middleware\Authorize::class, - 'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class, + 'can' => \Illuminate\Auth\Middleware\Authorize::class, + 'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class, 'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class, - 'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class, - 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class, - 'verified' => \App\Http\Middleware\EnsureEmailIsVerified::class, - '2fa' => \PragmaRX\Google2FALaravel\Middleware::class, + 'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class, + 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class, + 'verified' => \App\Http\Middleware\EnsureEmailIsVerified::class, + '2fa' => \PragmaRX\Google2FALaravel\Middleware::class, ]; /** diff --git a/app/Http/Middleware/Authenticate.php b/app/Http/Middleware/Authenticate.php index 3761e36a..2641b568 100644 --- a/app/Http/Middleware/Authenticate.php +++ b/app/Http/Middleware/Authenticate.php @@ -15,7 +15,7 @@ class Authenticate extends Middleware */ protected function redirectTo($request) { - if (! $request->expectsJson()) { + if (!$request->expectsJson()) { return route('auth.show'); } } diff --git a/app/Http/Middleware/EnsureEmailIsVerified.php b/app/Http/Middleware/EnsureEmailIsVerified.php index 6dc4ecbb..2d54cade 100644 --- a/app/Http/Middleware/EnsureEmailIsVerified.php +++ b/app/Http/Middleware/EnsureEmailIsVerified.php @@ -17,20 +17,20 @@ class EnsureEmailIsVerified */ public function handle($request, Closure $next) { - if (! $request->user() || - ($request->user() instanceof MustVerifyEmail && - ! $request->user()->hasVerifiedEmail())) { - if (! $request->session()->has('notice')) { + if (!$request->user() || ($request->user() instanceof MustVerifyEmail && !$request->user()->hasVerifiedEmail())) { + if (!$request->session()->has('notice')) { $request->session()->put('notice', [ - 'message' => 'Verify your email address. Didn\'t receive a verification email? Click the Resend button to get a new one.', + 'message' => + 'Verify your email address. Didn\'t receive a verification email? Click the Resend button to get a new one.', 'link.text' => 'Resend Verification Email', - 'link' => route('verification.resend'), + 'link' => route('verification.resend'), ]); } elseif ($request->session()->get('notice')['link.text'] !== 'Resend Verification Email') { $request->session()->put('notice', [ - 'message' => 'Verify your email address. Didn\'t receive a verification email? Click the Resend button to get a new one.', + 'message' => + 'Verify your email address. Didn\'t receive a verification email? Click the Resend button to get a new one.', 'link.text' => 'Resend Verification Email', - 'link' => route('verification.resend'), + 'link' => route('verification.resend'), ]); } } elseif ($request->user()->hasVerifiedEmail() && $request->session()->has('notice')) { diff --git a/app/Http/Middleware/ScopeBouncer.php b/app/Http/Middleware/ScopeBouncer.php index 1f4f481f..ad91da2a 100644 --- a/app/Http/Middleware/ScopeBouncer.php +++ b/app/Http/Middleware/ScopeBouncer.php @@ -38,7 +38,7 @@ public function handle($request, Closure $next) // Here you may use whatever mechanism you use in your app // to determine the current tenant. To demonstrate, the // $tenantId is set here from the user's company_id. - $companyId = ($request->route('company')) ? $request->route('company')->id : null; + $companyId = $request->route('company') ? $request->route('company')->id : null; $this->bouncer->scope()->to($companyId); $this->bouncer->useRoleModel(Role::class); diff --git a/app/Http/Middleware/TrimStrings.php b/app/Http/Middleware/TrimStrings.php index a8a252df..9d14052d 100644 --- a/app/Http/Middleware/TrimStrings.php +++ b/app/Http/Middleware/TrimStrings.php @@ -11,9 +11,5 @@ class TrimStrings extends Middleware * * @var array */ - protected $except = [ - 'current_password', - 'password', - 'password_confirmation', - ]; + protected $except = ['current_password', 'password', 'password_confirmation']; } diff --git a/app/Http/Middleware/TrustHosts.php b/app/Http/Middleware/TrustHosts.php index b0550cfc..2f8b4d49 100644 --- a/app/Http/Middleware/TrustHosts.php +++ b/app/Http/Middleware/TrustHosts.php @@ -13,8 +13,6 @@ class TrustHosts extends Middleware */ public function hosts() { - return [ - $this->allSubdomainsOfApplicationUrl(), - ]; + return [$this->allSubdomainsOfApplicationUrl()]; } } diff --git a/app/Http/Requests/ContactRequest.php b/app/Http/Requests/ContactRequest.php index ade25663..eab16d17 100644 --- a/app/Http/Requests/ContactRequest.php +++ b/app/Http/Requests/ContactRequest.php @@ -26,7 +26,7 @@ public function messages() { return [ 'g-recaptcha-response.required' => 'Captcha verification is required', - 'g-recaptcha-response.captcha' => 'Captcha verification has failed', + 'g-recaptcha-response.captcha' => 'Captcha verification has failed', ]; } @@ -38,13 +38,10 @@ public function messages() public function rules() { return [ - 'name' => 'required', - 'email' => 'required|email', - 'message' => 'required', - 'g-recaptcha-response' => [ - 'required', - new CaptchaRule(), - ], + 'name' => 'required', + 'email' => 'required|email', + 'message' => 'required', + 'g-recaptcha-response' => ['required', new CaptchaRule()], ]; } } diff --git a/app/Http/Requests/CreateAdhocInvoiceRequest.php b/app/Http/Requests/CreateAdhocInvoiceRequest.php index 97b3bee7..33b04f3f 100644 --- a/app/Http/Requests/CreateAdhocInvoiceRequest.php +++ b/app/Http/Requests/CreateAdhocInvoiceRequest.php @@ -14,7 +14,9 @@ class CreateAdhocInvoiceRequest extends FormRequest */ public function authorize() { - return auth()->user()->can('create', Invoice::class); + return auth() + ->user() + ->can('create', Invoice::class); } /** @@ -25,12 +27,12 @@ public function authorize() public function rules() { return [ - 'date' => 'required|date_format:"j F, Y"', - 'netdays' => 'required|integer|min:0', - 'companyname' => 'required|string', - 'item_name.*' => 'required|string', - 'item_quantity.*' => 'required|integer|min:1', - 'item_price.*' => 'required|numeric', + 'date' => 'required|date_format:"j F, Y"', + 'netdays' => 'required|integer|min:0', + 'companyname' => 'required|string', + 'item_name.*' => 'required|string', + 'item_quantity.*' => 'required|integer|min:1', + 'item_price.*' => 'required|numeric', 'item_description.*' => 'nullable|string', ]; } diff --git a/app/Http/Requests/CreateAdhocQuoteRequest.php b/app/Http/Requests/CreateAdhocQuoteRequest.php index 7396efb5..9b42d926 100644 --- a/app/Http/Requests/CreateAdhocQuoteRequest.php +++ b/app/Http/Requests/CreateAdhocQuoteRequest.php @@ -14,7 +14,9 @@ class CreateAdhocQuoteRequest extends FormRequest */ public function authorize() { - return auth()->user()->can('create', Quote::class); + return auth() + ->user() + ->can('create', Quote::class); } /** @@ -25,12 +27,12 @@ public function authorize() public function rules() { return [ - 'date' => 'required|date_format:"j F, Y"', - 'netdays' => 'required|integer|min:0', - 'companyname' => 'required|string', - 'item_name.*' => 'required|string', - 'item_quantity.*' => 'required|integer|min:1', - 'item_price.*' => 'required|numeric', + 'date' => 'required|date_format:"j F, Y"', + 'netdays' => 'required|integer|min:0', + 'companyname' => 'required|string', + 'item_name.*' => 'required|string', + 'item_quantity.*' => 'required|integer|min:1', + 'item_price.*' => 'required|numeric', 'item_description.*' => 'nullable|string', ]; } diff --git a/app/Http/Requests/CreateClientRequest.php b/app/Http/Requests/CreateClientRequest.php index 562e18e7..ca495a96 100644 --- a/app/Http/Requests/CreateClientRequest.php +++ b/app/Http/Requests/CreateClientRequest.php @@ -14,7 +14,9 @@ class CreateClientRequest extends FormRequest */ public function authorize() { - return auth()->user()->can('create', Client::class); + return auth() + ->user() + ->can('create', Client::class); } /** @@ -25,22 +27,22 @@ public function authorize() public function rules() { return [ - 'companyname' => 'required|string', - 'phone' => '', - 'block' => '', - 'street' => '', - 'unitnumber' => '', - 'postalcode' => '', - 'country_code' => '', - 'nickname' => '', - 'crn' => '', - 'website' => '', + 'companyname' => 'required|string', + 'phone' => '', + 'block' => '', + 'street' => '', + 'unitnumber' => '', + 'postalcode' => '', + 'country_code' => '', + 'nickname' => '', + 'crn' => '', + 'website' => '', 'contactsalutation' => 'required|in:mr,mrs,mdm,miss,dr,prof,mx', - 'contactfirstname' => 'required|string', - 'contactlastname' => '', - 'contactgender' => '', - 'contactemail' => 'required|email', - 'contactphone' => '', + 'contactfirstname' => 'required|string', + 'contactlastname' => '', + 'contactgender' => '', + 'contactemail' => 'required|email', + 'contactphone' => '', ]; } } diff --git a/app/Http/Requests/CreateCompanyRequest.php b/app/Http/Requests/CreateCompanyRequest.php index 9b2397cb..444d48ac 100644 --- a/app/Http/Requests/CreateCompanyRequest.php +++ b/app/Http/Requests/CreateCompanyRequest.php @@ -25,13 +25,13 @@ public function authorize() public function rules() { return [ - 'name' => 'required|string', - 'crn' => 'required|string', - 'phone' => 'required', - 'email' => 'required|email', + 'name' => 'required|string', + 'crn' => 'required|string', + 'phone' => 'required', + 'email' => 'required|email', 'domain_name' => ['required', 'unique:companies', new Hostname()], - 'logo' => 'mimes:jpeg,bmp,png', - 'smlogo' => 'mimes:jpeg,bmp,png', + 'logo' => 'mimes:jpeg,bmp,png', + 'smlogo' => 'mimes:jpeg,bmp,png', ]; } } diff --git a/app/Http/Requests/CreateCompanyUserRequest.php b/app/Http/Requests/CreateCompanyUserRequest.php index 6aff86a4..0550fa25 100644 --- a/app/Http/Requests/CreateCompanyUserRequest.php +++ b/app/Http/Requests/CreateCompanyUserRequest.php @@ -24,11 +24,11 @@ public function authorize() public function rules() { return [ - 'username' => 'required|string|min:4|unique:users', - 'email' => 'required|email|unique:users', + 'username' => 'required|string|min:4|unique:users', + 'email' => 'required|email|unique:users', 'full_name' => 'required|string|min:4', - 'phone' => 'required|unique:users', - 'gender' => 'required|in:male,female', + 'phone' => 'required|unique:users', + 'gender' => 'required|in:male,female', ]; } } diff --git a/app/Http/Requests/CreateInvoiceRequest.php b/app/Http/Requests/CreateInvoiceRequest.php index 87034d88..ac64b9a1 100644 --- a/app/Http/Requests/CreateInvoiceRequest.php +++ b/app/Http/Requests/CreateInvoiceRequest.php @@ -14,7 +14,9 @@ class CreateInvoiceRequest extends FormRequest */ public function authorize() { - return auth()->user()->can('create', Invoice::class); + return auth() + ->user() + ->can('create', Invoice::class); } /** @@ -27,15 +29,15 @@ public function messages() $messages = []; foreach ($this->request->get('item_name') as $key => $value) { - $messages['item_name.'.$key.'.required'] = 'Item Name #'.$key.' is required'; + $messages['item_name.' . $key . '.required'] = 'Item Name #' . $key . ' is required'; } foreach ($this->request->get('item_quantity') as $key => $value) { - $messages['item_quantity.'.$key.'.required'] = 'Item Quantity #'.$key.' is required'; + $messages['item_quantity.' . $key . '.required'] = 'Item Quantity #' . $key . ' is required'; } foreach ($this->request->get('item_price') as $key => $value) { - $messages['item_price.'.$key.'.required'] = 'Item Price #'.$key.' is required'; + $messages['item_price.' . $key . '.required'] = 'Item Price #' . $key . ' is required'; } return $messages; @@ -49,22 +51,22 @@ public function messages() public function rules() { return [ - 'date' => 'required|date_format:"j F, Y"', - 'netdays' => 'required|integer|min:0', - 'client_id' => 'required', - 'item_name' => 'required|array', - 'item_name.*' => 'required|string', - 'item_quantity' => 'required|array', - 'item_quantity.*' => 'required|integer|min:1', - 'item_price' => 'required|array', - 'item_price.*' => 'required|numeric', - 'item_description' => 'nullable|array', - 'item_description.*' => 'nullable|string', - 'recurring-time-interval' => 'required_if:recurring-invoice-check,on|integer|min:1', - 'recurring-time-period' => 'required_if:recurring-invoice-check,on|in:day,week,month,year', - 'recurring-until' => 'required_if:recurring-invoice-check,on|in:never,occurence,date', + 'date' => 'required|date_format:"j F, Y"', + 'netdays' => 'required|integer|min:0', + 'client_id' => 'required', + 'item_name' => 'required|array', + 'item_name.*' => 'required|string', + 'item_quantity' => 'required|array', + 'item_quantity.*' => 'required|integer|min:1', + 'item_price' => 'required|array', + 'item_price.*' => 'required|numeric', + 'item_description' => 'nullable|array', + 'item_description.*' => 'nullable|string', + 'recurring-time-interval' => 'required_if:recurring-invoice-check,on|integer|min:1', + 'recurring-time-period' => 'required_if:recurring-invoice-check,on|in:day,week,month,year', + 'recurring-until' => 'required_if:recurring-invoice-check,on|in:never,occurence,date', 'recurring-until-occurence-number' => 'required_if:recurring-invoice-check,on|integer|min:1', - 'recurring-until-date-value' => 'required_if:recurring-invoice-check,on|date_format:"j F, Y"', + 'recurring-until-date-value' => 'required_if:recurring-invoice-check,on|date_format:"j F, Y"', ]; } } diff --git a/app/Http/Requests/CreateItemTemplateRequest.php b/app/Http/Requests/CreateItemTemplateRequest.php index c3e91006..d0503b97 100644 --- a/app/Http/Requests/CreateItemTemplateRequest.php +++ b/app/Http/Requests/CreateItemTemplateRequest.php @@ -14,7 +14,9 @@ class CreateItemTemplateRequest extends FormRequest */ public function authorize() { - return auth()->user()->can('create', ItemTemplate::class); + return auth() + ->user() + ->can('create', ItemTemplate::class); } /** @@ -25,9 +27,9 @@ public function authorize() public function rules() { return [ - 'name' => 'required|string', - 'quantity' => 'required|integer|min:1', - 'price' => 'required|numeric', + 'name' => 'required|string', + 'quantity' => 'required|integer|min:1', + 'price' => 'required|numeric', 'description' => 'string', ]; } diff --git a/app/Http/Requests/CreatePaymentRequest.php b/app/Http/Requests/CreatePaymentRequest.php index a2af9f44..ae5577ca 100644 --- a/app/Http/Requests/CreatePaymentRequest.php +++ b/app/Http/Requests/CreatePaymentRequest.php @@ -14,7 +14,9 @@ class CreatePaymentRequest extends FormRequest */ public function authorize() { - return auth()->user()->can('create', Payment::class); + return auth() + ->user() + ->can('create', Payment::class); } /** @@ -25,9 +27,9 @@ public function authorize() public function rules() { return [ - 'amount' => 'required|numeric', + 'amount' => 'required|numeric', 'receiveddate' => 'required|date_format:"j F, Y"', - 'mode' => 'required', + 'mode' => 'required', ]; } } diff --git a/app/Http/Requests/CreateQuoteRequest.php b/app/Http/Requests/CreateQuoteRequest.php index 1cd5c6b3..a39e00c5 100644 --- a/app/Http/Requests/CreateQuoteRequest.php +++ b/app/Http/Requests/CreateQuoteRequest.php @@ -14,7 +14,9 @@ class CreateQuoteRequest extends FormRequest */ public function authorize() { - return auth()->user()->can('create', Quote::class); + return auth() + ->user() + ->can('create', Quote::class); } /** @@ -25,12 +27,12 @@ public function authorize() public function rules() { return [ - 'date' => 'required|date_format:"j F, Y"', - 'netdays' => 'required|integer|min:0', - 'client_id' => 'required', - 'item_name.*' => 'required|string', - 'item_quantity.*' => 'required|integer|min:1', - 'item_price.*' => 'required|numeric', + 'date' => 'required|date_format:"j F, Y"', + 'netdays' => 'required|integer|min:0', + 'client_id' => 'required', + 'item_name.*' => 'required|string', + 'item_quantity.*' => 'required|integer|min:1', + 'item_price.*' => 'required|numeric', 'item_description.*' => 'nullable|string', ]; } diff --git a/app/Http/Requests/CreateRecipientRequest.php b/app/Http/Requests/CreateRecipientRequest.php index 8527e7e3..fa1c6f30 100644 --- a/app/Http/Requests/CreateRecipientRequest.php +++ b/app/Http/Requests/CreateRecipientRequest.php @@ -14,7 +14,9 @@ class CreateRecipientRequest extends FormRequest */ public function authorize() { - return auth()->user()->can('create', Client::class); + return auth() + ->user() + ->can('create', Client::class); } /** @@ -27,9 +29,9 @@ public function rules() return [ 'salutation' => 'required|in:mr,mrs,mdm,miss,dr,prof,mx', 'first_name' => 'required|string', - 'last_name' => '', - 'email' => 'required|email|unique:recipients', - 'phone' => '', + 'last_name' => '', + 'email' => 'required|email|unique:recipients', + 'phone' => '', ]; } } diff --git a/app/Http/Requests/CreateRoleRequest.php b/app/Http/Requests/CreateRoleRequest.php index 295e21ce..b995e6d3 100644 --- a/app/Http/Requests/CreateRoleRequest.php +++ b/app/Http/Requests/CreateRoleRequest.php @@ -14,7 +14,9 @@ class CreateRoleRequest extends FormRequest */ public function authorize() { - return auth()->user()->can('owner', app('request')->route('company')); + return auth() + ->user() + ->can('owner', app('request')->route('company')); } /** diff --git a/app/Http/Requests/CreateSoloPaymentRequest.php b/app/Http/Requests/CreateSoloPaymentRequest.php index eca441f3..a7e48ab5 100644 --- a/app/Http/Requests/CreateSoloPaymentRequest.php +++ b/app/Http/Requests/CreateSoloPaymentRequest.php @@ -14,7 +14,9 @@ class CreateSoloPaymentRequest extends FormRequest */ public function authorize() { - return auth()->user()->can('create', Payment::class); + return auth() + ->user() + ->can('create', Payment::class); } /** @@ -25,10 +27,10 @@ public function authorize() public function rules() { return [ - 'invoice_id' => 'required', - 'amount' => 'required|numeric', + 'invoice_id' => 'required', + 'amount' => 'required|numeric', 'receiveddate' => 'required|date_format:"j F, Y"', - 'mode' => 'required', + 'mode' => 'required', ]; } } diff --git a/app/Http/Requests/CreateUserRequest.php b/app/Http/Requests/CreateUserRequest.php index fef982fc..19d26c5c 100644 --- a/app/Http/Requests/CreateUserRequest.php +++ b/app/Http/Requests/CreateUserRequest.php @@ -24,12 +24,12 @@ public function authorize() public function rules() { return [ - 'username' => 'required|min:4|unique:users', - 'email' => 'required|email|unique:users', - 'password' => 'required|confirmed', + 'username' => 'required|min:4|unique:users', + 'email' => 'required|email|unique:users', + 'password' => 'required|confirmed', 'full_name' => 'required|min:4', - 'phone' => 'required|unique:users', - 'gender' => 'required|in:male,female', + 'phone' => 'required|unique:users', + 'gender' => 'required|in:male,female', ]; } } diff --git a/app/Http/Requests/UpdateAdhocInvoiceRequest.php b/app/Http/Requests/UpdateAdhocInvoiceRequest.php index 940aeab3..a5b5443e 100644 --- a/app/Http/Requests/UpdateAdhocInvoiceRequest.php +++ b/app/Http/Requests/UpdateAdhocInvoiceRequest.php @@ -13,7 +13,9 @@ class UpdateAdhocInvoiceRequest extends FormRequest */ public function authorize() { - return auth()->user()->can('update', $this->route('invoice')); + return auth() + ->user() + ->can('update', $this->route('invoice')); } /** @@ -24,12 +26,12 @@ public function authorize() public function rules() { return [ - 'date' => 'required|date_format:"j F, Y"', - 'netdays' => 'required|integer|min:0', - 'companyname' => 'required|string', - 'item_name.*' => 'required|string', - 'item_quantity.*' => 'required|integer|min:1', - 'item_price.*' => 'required|numeric', + 'date' => 'required|date_format:"j F, Y"', + 'netdays' => 'required|integer|min:0', + 'companyname' => 'required|string', + 'item_name.*' => 'required|string', + 'item_quantity.*' => 'required|integer|min:1', + 'item_price.*' => 'required|numeric', 'item_description.*' => 'nullable|string', ]; } diff --git a/app/Http/Requests/UpdateAdhocQuoteRequest.php b/app/Http/Requests/UpdateAdhocQuoteRequest.php index 5c8ed838..bd594668 100644 --- a/app/Http/Requests/UpdateAdhocQuoteRequest.php +++ b/app/Http/Requests/UpdateAdhocQuoteRequest.php @@ -13,7 +13,9 @@ class UpdateAdhocQuoteRequest extends FormRequest */ public function authorize() { - return auth()->user()->can('update', $this->route('quote')); + return auth() + ->user() + ->can('update', $this->route('quote')); } /** @@ -24,12 +26,12 @@ public function authorize() public function rules() { return [ - 'date' => 'required|date_format:"j F, Y"', - 'netdays' => 'required|integer|min:0', - 'companyname' => 'required|string', - 'item_name.*' => 'required|string', - 'item_quantity.*' => 'required|integer|min:1', - 'item_price.*' => 'required|numeric', + 'date' => 'required|date_format:"j F, Y"', + 'netdays' => 'required|integer|min:0', + 'companyname' => 'required|string', + 'item_name.*' => 'required|string', + 'item_quantity.*' => 'required|integer|min:1', + 'item_price.*' => 'required|numeric', 'item_description.*' => 'nullable|string', ]; } diff --git a/app/Http/Requests/UpdateClientRequest.php b/app/Http/Requests/UpdateClientRequest.php index 70b0742d..9ceea2dd 100644 --- a/app/Http/Requests/UpdateClientRequest.php +++ b/app/Http/Requests/UpdateClientRequest.php @@ -13,7 +13,9 @@ class UpdateClientRequest extends FormRequest */ public function authorize() { - return auth()->user()->can('update', $this->route('client')); + return auth() + ->user() + ->can('update', $this->route('client')); } /** @@ -24,22 +26,22 @@ public function authorize() public function rules() { return [ - 'companyname' => 'required|string', - 'phone' => '', - 'block' => '', - 'street' => '', - 'unitnumber' => '', - 'postalcode' => '', - 'country_code' => '', - 'nickname' => '', - 'crn' => '', - 'website' => '', + 'companyname' => 'required|string', + 'phone' => '', + 'block' => '', + 'street' => '', + 'unitnumber' => '', + 'postalcode' => '', + 'country_code' => '', + 'nickname' => '', + 'crn' => '', + 'website' => '', 'contactsalutation' => 'required|in:mr,mrs,mdm,miss,dr,prof,mx', - 'contactfirstname' => 'required|string', - 'contactlastname' => '', - 'contactgender' => '', - 'contactemail' => 'required|email', - 'contactphone' => '', + 'contactfirstname' => 'required|string', + 'contactlastname' => '', + 'contactgender' => '', + 'contactemail' => 'required|email', + 'contactphone' => '', ]; } } diff --git a/app/Http/Requests/UpdateCompanyAddressRequest.php b/app/Http/Requests/UpdateCompanyAddressRequest.php index 7ed98629..ebd6dd56 100644 --- a/app/Http/Requests/UpdateCompanyAddressRequest.php +++ b/app/Http/Requests/UpdateCompanyAddressRequest.php @@ -13,7 +13,9 @@ class UpdateCompanyAddressRequest extends FormRequest */ public function authorize() { - return auth()->user()->can('address', $this->route('company')); + return auth() + ->user() + ->can('address', $this->route('company')); } /** @@ -24,10 +26,10 @@ public function authorize() public function rules() { return [ - 'block' => 'required|string', - 'street' => 'required|string', - 'unitnumber' => 'required|string', - 'postalcode' => 'required|string', + 'block' => 'required|string', + 'street' => 'required|string', + 'unitnumber' => 'required|string', + 'postalcode' => 'required|string', 'buildingtype' => 'required|string', ]; } @@ -43,7 +45,7 @@ public function withValidator($validator) { $validator->after(function ($validator) { $company = $this->route('company'); - if (! $company) { + if (!$company) { $validator->errors()->add('Company', 'Please fill in your company information first'); } }); diff --git a/app/Http/Requests/UpdateCompanyOwnerRequest.php b/app/Http/Requests/UpdateCompanyOwnerRequest.php index 8444c73b..fe79e1c4 100644 --- a/app/Http/Requests/UpdateCompanyOwnerRequest.php +++ b/app/Http/Requests/UpdateCompanyOwnerRequest.php @@ -13,7 +13,9 @@ class UpdateCompanyOwnerRequest extends FormRequest */ public function authorize() { - return auth()->user()->can('owner', $this->route('company')); + return auth() + ->user() + ->can('owner', $this->route('company')); } /** diff --git a/app/Http/Requests/UpdateCompanyRequest.php b/app/Http/Requests/UpdateCompanyRequest.php index 8d128f08..53aa01e0 100644 --- a/app/Http/Requests/UpdateCompanyRequest.php +++ b/app/Http/Requests/UpdateCompanyRequest.php @@ -14,7 +14,9 @@ class UpdateCompanyRequest extends FormRequest */ public function authorize() { - return auth()->user()->can('owner', $this->route('company')); + return auth() + ->user() + ->can('owner', $this->route('company')); } /** @@ -25,13 +27,13 @@ public function authorize() public function rules() { return [ - 'name' => 'required|string', - 'crn' => 'required|string', - 'phone' => 'required|string', - 'email' => 'required|email', - 'domain_name' => ['required', 'unique:companies,domain_name,'.$this->route('company')->id, new Hostname()], - 'logo' => 'mimes:jpeg,bmp,png', - 'smlogo' => 'mimes:jpeg,bmp,png', + 'name' => 'required|string', + 'crn' => 'required|string', + 'phone' => 'required|string', + 'email' => 'required|email', + 'domain_name' => ['required', 'unique:companies,domain_name,' . $this->route('company')->id, new Hostname()], + 'logo' => 'mimes:jpeg,bmp,png', + 'smlogo' => 'mimes:jpeg,bmp,png', ]; } } diff --git a/app/Http/Requests/UpdateCompanySettingRequest.php b/app/Http/Requests/UpdateCompanySettingRequest.php index 8ab24dc4..b9b6ee20 100644 --- a/app/Http/Requests/UpdateCompanySettingRequest.php +++ b/app/Http/Requests/UpdateCompanySettingRequest.php @@ -13,7 +13,9 @@ class UpdateCompanySettingRequest extends FormRequest */ public function authorize() { - return auth()->user()->can('settings', $this->route('company')); + return auth() + ->user() + ->can('settings', $this->route('company')); } /** @@ -24,11 +26,11 @@ public function authorize() public function rules() { return [ - 'invoice_prefix' => 'required|string', - 'quote_prefix' => 'required|string', - 'receipt_prefix' => 'required|string', + 'invoice_prefix' => 'required|string', + 'quote_prefix' => 'required|string', + 'receipt_prefix' => 'required|string', 'invoice_conditions' => 'required|string', - 'quote_conditions' => 'required|string', + 'quote_conditions' => 'required|string', ]; } @@ -43,7 +45,7 @@ public function withValidator($validator) { $validator->after(function ($validator) { $company = $this->route('company'); - if (! $company) { + if (!$company) { $validator->errors()->add('Company', 'Please fill in your company information first'); } }); diff --git a/app/Http/Requests/UpdateCompanyUserRequest.php b/app/Http/Requests/UpdateCompanyUserRequest.php index e98af009..3b54459a 100644 --- a/app/Http/Requests/UpdateCompanyUserRequest.php +++ b/app/Http/Requests/UpdateCompanyUserRequest.php @@ -13,7 +13,9 @@ class UpdateCompanyUserRequest extends FormRequest */ public function authorize() { - return auth()->user()->can('owner', $this->route('company')); + return auth() + ->user() + ->can('owner', $this->route('company')); } /** diff --git a/app/Http/Requests/UpdateInvoiceRequest.php b/app/Http/Requests/UpdateInvoiceRequest.php index a4557137..944bb25a 100644 --- a/app/Http/Requests/UpdateInvoiceRequest.php +++ b/app/Http/Requests/UpdateInvoiceRequest.php @@ -13,7 +13,9 @@ class UpdateInvoiceRequest extends FormRequest */ public function authorize() { - return auth()->user()->can('update', $this->route('invoice')); + return auth() + ->user() + ->can('update', $this->route('invoice')); } /** @@ -26,15 +28,15 @@ public function messages() $messages = []; foreach ($this->request->get('item_name') as $key => $value) { - $messages['item_name.'.$key.'.required'] = 'Item Name #'.$key.' is required'; + $messages['item_name.' . $key . '.required'] = 'Item Name #' . $key . ' is required'; } foreach ($this->request->get('item_quantity') as $key => $value) { - $messages['item_quantity.'.$key.'.required'] = 'Item Quantity #'.$key.' is required'; + $messages['item_quantity.' . $key . '.required'] = 'Item Quantity #' . $key . ' is required'; } foreach ($this->request->get('item_price') as $key => $value) { - $messages['item_price.'.$key.'.required'] = 'Item Price #'.$key.' is required'; + $messages['item_price.' . $key . '.required'] = 'Item Price #' . $key . ' is required'; } return $messages; @@ -48,22 +50,22 @@ public function messages() public function rules() { return [ - 'date' => 'required|date_format:"j F, Y"', - 'netdays' => 'required|integer|min:0', - 'item_name' => 'required|array', - 'item_name.*' => 'required|string', - 'item_quantity' => 'required|array', - 'item_quantity.*' => 'required|integer|min:1', - 'item_price' => 'required|array', - 'item_price.*' => 'required|numeric', - 'item_description' => 'nullable|array', - 'item_description.*' => 'nullable|string', - 'recurring-details' => 'required|in:none,standalone,future', - 'recurring-time-interval' => 'required_if:recurring-invoice-check,on|integer', - 'recurring-time-period' => 'required_if:recurring-invoice-check,on|in:day,week,month,year', - 'recurring-until' => 'required_if:recurring-invoice-check,on|in:never,occurence,date', + 'date' => 'required|date_format:"j F, Y"', + 'netdays' => 'required|integer|min:0', + 'item_name' => 'required|array', + 'item_name.*' => 'required|string', + 'item_quantity' => 'required|array', + 'item_quantity.*' => 'required|integer|min:1', + 'item_price' => 'required|array', + 'item_price.*' => 'required|numeric', + 'item_description' => 'nullable|array', + 'item_description.*' => 'nullable|string', + 'recurring-details' => 'required|in:none,standalone,future', + 'recurring-time-interval' => 'required_if:recurring-invoice-check,on|integer', + 'recurring-time-period' => 'required_if:recurring-invoice-check,on|in:day,week,month,year', + 'recurring-until' => 'required_if:recurring-invoice-check,on|in:never,occurence,date', 'recurring-until-occurence-number' => 'required_if:recurring-invoice-check,on|integer', - 'recurring-until-date-value' => 'required_if:recurring-invoice-check,on|date_format:"j F, Y"', + 'recurring-until-date-value' => 'required_if:recurring-invoice-check,on|date_format:"j F, Y"', ]; } } diff --git a/app/Http/Requests/UpdateItemTemplateRequest.php b/app/Http/Requests/UpdateItemTemplateRequest.php index 7d17b38b..9f865be3 100644 --- a/app/Http/Requests/UpdateItemTemplateRequest.php +++ b/app/Http/Requests/UpdateItemTemplateRequest.php @@ -13,7 +13,9 @@ class UpdateItemTemplateRequest extends FormRequest */ public function authorize() { - return auth()->user()->can('update', $this->route('itemtemplate')); + return auth() + ->user() + ->can('update', $this->route('itemtemplate')); } /** @@ -24,9 +26,9 @@ public function authorize() public function rules() { return [ - 'name' => 'required|string', - 'quantity' => 'required|integer|min:1', - 'price' => 'required|numeric', + 'name' => 'required|string', + 'quantity' => 'required|integer|min:1', + 'price' => 'required|numeric', 'description' => 'string', ]; } diff --git a/app/Http/Requests/UpdatePaymentRequest.php b/app/Http/Requests/UpdatePaymentRequest.php index cb9e0b74..8aa2d0bc 100644 --- a/app/Http/Requests/UpdatePaymentRequest.php +++ b/app/Http/Requests/UpdatePaymentRequest.php @@ -13,7 +13,9 @@ class UpdatePaymentRequest extends FormRequest */ public function authorize() { - return auth()->user()->can('update', $this->route('payment')); + return auth() + ->user() + ->can('update', $this->route('payment')); } /** @@ -24,9 +26,9 @@ public function authorize() public function rules() { return [ - 'amount' => 'required|numeric', + 'amount' => 'required|numeric', 'receiveddate' => 'required|date_format:"j F, Y"', - 'mode' => 'required', + 'mode' => 'required', ]; } } diff --git a/app/Http/Requests/UpdateQuoteRequest.php b/app/Http/Requests/UpdateQuoteRequest.php index 1dd9864a..d2f8ee91 100644 --- a/app/Http/Requests/UpdateQuoteRequest.php +++ b/app/Http/Requests/UpdateQuoteRequest.php @@ -13,7 +13,9 @@ class UpdateQuoteRequest extends FormRequest */ public function authorize() { - return auth()->user()->can('update', $this->route('quote')); + return auth() + ->user() + ->can('update', $this->route('quote')); } /** @@ -24,11 +26,11 @@ public function authorize() public function rules() { return [ - 'date' => 'required|date_format:"j F, Y"', - 'netdays' => 'required|integer|min:0', - 'item_name.*' => 'required|string', - 'item_quantity.*' => 'required|integer|min:1', - 'item_price.*' => 'required|numeric', + 'date' => 'required|date_format:"j F, Y"', + 'netdays' => 'required|integer|min:0', + 'item_name.*' => 'required|string', + 'item_quantity.*' => 'required|integer|min:1', + 'item_price.*' => 'required|numeric', 'item_description.*' => 'nullable|string', ]; } diff --git a/app/Http/Requests/UpdateRecipientRequest.php b/app/Http/Requests/UpdateRecipientRequest.php index a14dcc59..81beed25 100644 --- a/app/Http/Requests/UpdateRecipientRequest.php +++ b/app/Http/Requests/UpdateRecipientRequest.php @@ -14,7 +14,9 @@ class UpdateRecipientRequest extends FormRequest */ public function authorize() { - return auth()->user()->can('create', Client::class); + return auth() + ->user() + ->can('create', Client::class); } /** @@ -27,9 +29,9 @@ public function rules() return [ 'salutation' => 'required|in:mr,mrs,mdm,miss,dr,prof,mx', 'first_name' => 'required|string', - 'last_name' => '', - 'email' => 'required|email|unique:recipients,email,'.$this->route('recipient')->id, - 'phone' => '', + 'last_name' => '', + 'email' => 'required|email|unique:recipients,email,' . $this->route('recipient')->id, + 'phone' => '', ]; } } diff --git a/app/Http/Requests/UpdateRoleRequest.php b/app/Http/Requests/UpdateRoleRequest.php index 4a0e3055..8b8abb83 100644 --- a/app/Http/Requests/UpdateRoleRequest.php +++ b/app/Http/Requests/UpdateRoleRequest.php @@ -14,7 +14,9 @@ class UpdateRoleRequest extends FormRequest */ public function authorize() { - return auth()->user()->can('owner', $this->route('company')); + return auth() + ->user() + ->can('owner', $this->route('company')); } /** @@ -27,8 +29,12 @@ public function rules() return [ 'title' => [ 'required', - Rule::unique('roles')->where('scope', $this->route('company')->id)->ignore($this->role->id), - Rule::unique('roles', 'name')->where('scope', $this->route('company')->id)->ignore($this->role->id), + Rule::unique('roles') + ->where('scope', $this->route('company')->id) + ->ignore($this->role->id), + Rule::unique('roles', 'name') + ->where('scope', $this->route('company')->id) + ->ignore($this->role->id), ], 'permissions' => 'required|array', ]; diff --git a/app/Http/Requests/UpdateUserRequest.php b/app/Http/Requests/UpdateUserRequest.php index 9828472a..21cfc520 100644 --- a/app/Http/Requests/UpdateUserRequest.php +++ b/app/Http/Requests/UpdateUserRequest.php @@ -24,12 +24,12 @@ public function authorize() public function rules() { return [ - 'username' => 'required|string|min:4|unique:users,username,'.auth()->user()->id, - 'email' => 'required|email|unique:users,email,'.auth()->user()->id, - 'password' => 'required', - 'phone' => 'required|unique:users,phone,'.auth()->user()->id, - 'gender' => 'required|in:male,female', - 'full_name' => 'required|string|min:4', + 'username' => 'required|string|min:4|unique:users,username,' . auth()->user()->id, + 'email' => 'required|email|unique:users,email,' . auth()->user()->id, + 'password' => 'required', + 'phone' => 'required|unique:users,phone,' . auth()->user()->id, + 'gender' => 'required|in:male,female', + 'full_name' => 'required|string|min:4', 'newpassword' => 'confirmed', ]; } diff --git a/app/Library/Poowf/Unicorn.php b/app/Library/Poowf/Unicorn.php index 4c3702ec..5b28e8bd 100644 --- a/app/Library/Poowf/Unicorn.php +++ b/app/Library/Poowf/Unicorn.php @@ -40,7 +40,7 @@ public static function getGithubReleases($filter = true) if (config('app.github_token')) { $response = $client->request('GET', 'repos/poowf/invoiceneko/releases', [ 'headers' => [ - 'Authorization' => 'token '.config('app.github_token'), + 'Authorization' => 'token ' . config('app.github_token'), ], ]); } else { @@ -62,7 +62,7 @@ public static function getGithubReleases($filter = true) $release->commit_data = self::getGithubCommitDataByTag($release->tag_name); $release->body_html = $Parsedown->text($release->body); $unstable = $release; - } elseif (is_null($stable) && ! $release->prerelease) { + } elseif (is_null($stable) && !$release->prerelease) { $release->commit_data = self::getGithubCommitDataByTag($release->tag_name); $release->body_html = $Parsedown->text($release->body); $stable = $release; @@ -86,13 +86,13 @@ public static function getGithubCommitDataByTag($tagname) { $client = new Client(['base_uri' => 'https://api.github.com/']); if (config('app.github_token')) { - $response = $client->request('GET', 'repos/poowf/invoiceneko/git/refs/tags/'.$tagname, [ + $response = $client->request('GET', 'repos/poowf/invoiceneko/git/refs/tags/' . $tagname, [ 'headers' => [ - 'Authorization' => 'token '.config('app.github_token'), + 'Authorization' => 'token ' . config('app.github_token'), ], ]); } else { - $response = $client->request('GET', 'repos/poowf/invoiceneko/git/refs/tags/'.$tagname); + $response = $client->request('GET', 'repos/poowf/invoiceneko/git/refs/tags/' . $tagname); } $body = json_decode($response->getBody()->getContents()); @@ -205,17 +205,17 @@ public static function createRoleAndPermissions($scopeId = null) Bouncer::useRoleModel(Role::class); $gadmin = Bouncer::role()->firstOrCreate([ - 'name' => Str::slug('Global Administrator'), + 'name' => Str::slug('Global Administrator'), 'title' => 'Global Administrator', ]); $admin = Bouncer::role()->firstOrCreate([ - 'name' => Str::slug('Administrator'), + 'name' => Str::slug('Administrator'), 'title' => 'Administrator', ]); $user = Bouncer::role()->firstOrCreate([ - 'name' => Str::slug('User'), + 'name' => Str::slug('User'), 'title' => 'User', ]); @@ -243,25 +243,33 @@ protected static function createCrudPermissions($scopeId, $model) Bouncer::scope()->to($scopeId); Bouncer::useRoleModel(Role::class); - Bouncer::ability()->makeForModel($model, [ - 'name' => 'view-'.Str::slug(strtolower(self::getModelNiceName($model))), - 'title' => 'View '.self::getModelNiceName($model), - ])->save(); - - Bouncer::ability()->makeForModel($model, [ - 'name' => 'create-'.Str::slug(strtolower(self::getModelNiceName($model))), - 'title' => 'Create '.self::getModelNiceName($model), - ])->save(); - - Bouncer::ability()->makeForModel($model, [ - 'name' => 'update-'.Str::slug(strtolower(self::getModelNiceName($model))), - 'title' => 'Update '.self::getModelNiceName($model), - ])->save(); - - Bouncer::ability()->makeForModel($model, [ - 'name' => 'delete-'.Str::slug(strtolower(self::getModelNiceName($model))), - 'title' => 'Delete '.self::getModelNiceName($model), - ])->save(); + Bouncer::ability() + ->makeForModel($model, [ + 'name' => 'view-' . Str::slug(strtolower(self::getModelNiceName($model))), + 'title' => 'View ' . self::getModelNiceName($model), + ]) + ->save(); + + Bouncer::ability() + ->makeForModel($model, [ + 'name' => 'create-' . Str::slug(strtolower(self::getModelNiceName($model))), + 'title' => 'Create ' . self::getModelNiceName($model), + ]) + ->save(); + + Bouncer::ability() + ->makeForModel($model, [ + 'name' => 'update-' . Str::slug(strtolower(self::getModelNiceName($model))), + 'title' => 'Update ' . self::getModelNiceName($model), + ]) + ->save(); + + Bouncer::ability() + ->makeForModel($model, [ + 'name' => 'delete-' . Str::slug(strtolower(self::getModelNiceName($model))), + 'title' => 'Delete ' . self::getModelNiceName($model), + ]) + ->save(); } /** @@ -307,10 +315,10 @@ protected static function assignPermissions($scopeId, $role, $methodName, $model if ($modelClass === 'all') { foreach (self::$modelClasses as $key => $model) { - Bouncer::allow($role)->to($methodName.'-'.Str::slug(strtolower(self::getModelNiceName($model))), $model); + Bouncer::allow($role)->to($methodName . '-' . Str::slug(strtolower(self::getModelNiceName($model))), $model); } } else { - Bouncer::allow($role)->to($methodName.'-'.Str::slug(strtolower(self::getModelNiceName($modelClass))), $modelClass); + Bouncer::allow($role)->to($methodName . '-' . Str::slug(strtolower(self::getModelNiceName($modelClass))), $modelClass); } } @@ -321,7 +329,9 @@ protected static function assignPermissions($scopeId, $role, $methodName, $model */ protected static function getModelNiceName($modelClass) { - $transformed = trim(preg_replace('/(?loadHTML($html_str, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD)) { foreach ($xml->getElementsByTagName('*') as $tag) { - if (! in_array($tag->tagName, $allowed_tags)) { + if (!in_array($tag->tagName, $allowed_tags)) { $tag->parentNode->removeChild($tag); } else { foreach ($tag->attributes as $attr) { - if (! in_array($attr->nodeName, $allowed_attrs)) { + if (!in_array($attr->nodeName, $allowed_attrs)) { $tag->removeAttribute($attr->nodeName); } } diff --git a/app/Listeners/EmailChangedListener.php b/app/Listeners/EmailChangedListener.php index 2cdb8aa6..30f3aaff 100644 --- a/app/Listeners/EmailChangedListener.php +++ b/app/Listeners/EmailChangedListener.php @@ -13,7 +13,7 @@ class EmailChangedListener */ public function process($event) { - if ($event->user instanceof MustVerifyEmail && ! $event->user->hasVerifiedEmail()) { + if ($event->user instanceof MustVerifyEmail && !$event->user->hasVerifiedEmail()) { $event->user->save(); $event->user->sendEmailVerificationNotification(); } @@ -26,14 +26,8 @@ public function process($event) */ public function subscribe($events) { - $events->listen( - 'Illuminate\Auth\Events\Registered', - 'App\Listeners\EmailChangedListener@process' - ); + $events->listen('Illuminate\Auth\Events\Registered', 'App\Listeners\EmailChangedListener@process'); - $events->listen( - 'App\Events\ChangedEmail', - 'App\Listeners\EmailChangedListener@process' - ); + $events->listen('App\Events\ChangedEmail', 'App\Listeners\EmailChangedListener@process'); } } diff --git a/app/Mail/ContactForm.php b/app/Mail/ContactForm.php index 211a7c64..f1ed41de 100644 --- a/app/Mail/ContactForm.php +++ b/app/Mail/ContactForm.php @@ -33,11 +33,10 @@ public function __construct($name, $email, $message) */ public function build() { - return $this->markdown('emails.contact') - ->with([ - 'name' => $this->name, - 'email' => $this->email, - 'message' => $this->message, - ]); + return $this->markdown('emails.contact')->with([ + 'name' => $this->name, + 'email' => $this->email, + 'message' => $this->message, + ]); } } diff --git a/app/Models/Client.php b/app/Models/Client.php index a364c762..ab6fbc8f 100644 --- a/app/Models/Client.php +++ b/app/Models/Client.php @@ -44,9 +44,7 @@ class Client extends Model implements Auditable 'contactphone', ]; - protected $cascadeDeletes = [ - 'invoices', - ]; + protected $cascadeDeletes = ['invoices']; public function getContactNameAttribute() { @@ -73,7 +71,6 @@ public function company() public function scopeDuplicateCheck($query, $companyname) { - return $query - ->where('companyname', $companyname); + return $query->where('companyname', $companyname); } } diff --git a/app/Models/Company.php b/app/Models/Company.php index 5688beb3..b2293de2 100644 --- a/app/Models/Company.php +++ b/app/Models/Company.php @@ -31,19 +31,11 @@ class Company extends Model implements Auditable * * @var array */ - protected $fillable = [ - 'name', - 'crn', - 'domain_name', - 'phone', - 'email', - 'country_code', - 'timezone', - ]; + protected $fillable = ['name', 'crn', 'domain_name', 'phone', 'email', 'country_code', 'timezone']; protected $attributes = [ 'invoice_index' => 1, - 'quote_index' => 1, + 'quote_index' => 1, 'receipt_index' => 1, ]; @@ -103,16 +95,16 @@ public function niceReceiptID() public function generateNiceID($model, $letter) { $companySetting = $this->settings; - if ($companySetting->{$model.'_prefix'}) { - $generatedPrefix = $companySetting->{$model.'_prefix'}.'-'; + if ($companySetting->{$model . '_prefix'}) { + $generatedPrefix = $companySetting->{$model . '_prefix'} . '-'; } else { - $generatedPrefix = $this->slug.$letter.'-'; + $generatedPrefix = $this->slug . $letter . '-'; } //Retrieve latest version of the company model otherwise it will use the old index value $this->refresh(); - return $generatedPrefix.sprintf('%06d', $this->{$model.'_index'}); + return $generatedPrefix . sprintf('%06d', $this->{$model . '_index'}); } public function isOwner($user) @@ -127,12 +119,18 @@ public function hasUser($user) public function lastinvoice() { - return $this->hasOne('App\Models\Invoice')->latest()->limit(1)->first(); + return $this->hasOne('App\Models\Invoice') + ->latest() + ->limit(1) + ->first(); } public function lastquote() { - return $this->hasOne('App\Models\Quote')->latest()->limit(1)->first(); + return $this->hasOne('App\Models\Quote') + ->latest() + ->limit(1) + ->first(); } public function users() diff --git a/app/Models/CompanyAddress.php b/app/Models/CompanyAddress.php index de2d35be..000c3bfb 100644 --- a/app/Models/CompanyAddress.php +++ b/app/Models/CompanyAddress.php @@ -22,13 +22,7 @@ class CompanyAddress extends Model implements Auditable public $timestamps = true; - protected $fillable = [ - 'block', - 'street', - 'unitnumber', - 'postalcode', - 'buildingtype', - ]; + protected $fillable = ['block', 'street', 'unitnumber', 'postalcode', 'buildingtype']; const BUILDINGTYPE_RESIDENTIAL = 1; const BUILDINGTYPE_BUSINESS = 2; diff --git a/app/Models/CompanyInvite.php b/app/Models/CompanyInvite.php index a456be5c..2b03cd8f 100644 --- a/app/Models/CompanyInvite.php +++ b/app/Models/CompanyInvite.php @@ -24,20 +24,14 @@ class CompanyInvite extends Model implements Auditable * * @var array */ - protected $fillable = [ - ]; + protected $fillable = []; /** * The attributes that should be mutated to dates. * * @var array */ - protected $dates = [ - 'expires_at', - 'created_at', - 'updated_at', - 'deleted_at', - ]; + protected $dates = ['expires_at', 'created_at', 'updated_at', 'deleted_at']; /** * Get the route key for the model. diff --git a/app/Models/CompanySetting.php b/app/Models/CompanySetting.php index 5eb46a7d..bb4bd3df 100644 --- a/app/Models/CompanySetting.php +++ b/app/Models/CompanySetting.php @@ -22,19 +22,12 @@ class CompanySetting extends Model implements Auditable */ protected $table = 'company_settings'; - protected $fillable = [ - 'invoice_prefix', - 'quote_prefix', - 'receipt_prefix', - 'invoice_conditions', - 'quote_conditions', - 'tax', - ]; + protected $fillable = ['invoice_prefix', 'quote_prefix', 'receipt_prefix', 'invoice_conditions', 'quote_conditions', 'tax']; protected $attributes = [ 'invoice_conditions' => 'Terms & Conditions for your Invoice', - 'quote_conditions' => 'Terms & Conditions for your Quote', - 'tax' => 0, + 'quote_conditions' => 'Terms & Conditions for your Quote', + 'tax' => 0, ]; public function setInvoiceConditionsAttribute($description) @@ -53,8 +46,8 @@ protected static function boot() static::creating(function ($companySettings) { $companySettings->invoice_prefix = Str::slug($companySettings->company->name); - $companySettings->quote_prefix = Str::slug($companySettings->company->name).'Q'; - $companySettings->receipt_prefix = Str::slug($companySettings->company->name).'R'; + $companySettings->quote_prefix = Str::slug($companySettings->company->name) . 'Q'; + $companySettings->receipt_prefix = Str::slug($companySettings->company->name) . 'R'; }); } diff --git a/app/Models/CompanyUserRequest.php b/app/Models/CompanyUserRequest.php index 5a8da755..48d15dd5 100644 --- a/app/Models/CompanyUserRequest.php +++ b/app/Models/CompanyUserRequest.php @@ -31,11 +31,7 @@ class CompanyUserRequest extends Model implements Auditable * * @var array */ - protected $fillable = [ - 'full_name', - 'email', - 'phone', - ]; + protected $fillable = ['full_name', 'email', 'phone']; protected $attributes = [ 'status' => self::STATUS_PENDING, diff --git a/app/Models/Invoice.php b/app/Models/Invoice.php index ec255d15..386a83d1 100644 --- a/app/Models/Invoice.php +++ b/app/Models/Invoice.php @@ -39,44 +39,34 @@ class Invoice extends Model implements Auditable * * @var array */ - protected $fillable = [ - 'date', - 'netdays', - ]; + protected $fillable = ['date', 'netdays']; /** * The attributes that should be mutated to dates. * * @var array */ - protected $dates = [ - 'date', - 'duedate', - 'payment_complete_date', - 'created_at', - 'updated_at', - 'deleted_at', - ]; + protected $dates = ['date', 'duedate', 'payment_complete_date', 'created_at', 'updated_at', 'deleted_at']; protected $attributes = [ 'status' => self::STATUS_OPEN, ]; - protected $cascadeDeletes = [ - 'items', - 'payments', - ]; + protected $cascadeDeletes = ['items', 'payments']; protected static function boot() { parent::boot(); static::saving(function ($invoice) { - if ($invoice->status == self::STATUS_DRAFT && ! $invoice->generated) { + if ($invoice->status == self::STATUS_DRAFT && !$invoice->generated) { $invoice->status = self::STATUS_OPEN; } $date = clone $invoice->date; - $invoice->duedate = $date->timezone(config('app.timezone'))->startOfDay()->addDays($invoice->netdays); + $invoice->duedate = $date + ->timezone(config('app.timezone')) + ->startOfDay() + ->addDays($invoice->netdays); }); //Auto Increment of invoice_index per Company; @@ -110,14 +100,14 @@ public function getCreatedAtAttribute($value) { $date = $this->asDateTime($value); - return (auth()->user()) ? $date->timezone(auth()->user()->timezone) : $date->timezone(config('app.timezone')); + return auth()->user() ? $date->timezone(auth()->user()->timezone) : $date->timezone(config('app.timezone')); } public function getUpdatedAtAttribute($value) { $date = $this->asDateTime($value); - return (auth()->user()) ? $date->timezone(auth()->user()->timezone) : $date->timezone(config('app.timezone')); + return auth()->user() ? $date->timezone(auth()->user()->timezone) : $date->timezone(config('app.timezone')); } public function getDateAttribute($value) @@ -136,7 +126,7 @@ public function getDuedateAttribute($value) public function getPaymentCompleteDateAttribute($value) { - if (! is_null($value)) { + if (!is_null($value)) { $date = $this->asDateTime($value); return $date->timezone($this->company->timezone); @@ -199,12 +189,12 @@ public function notifications() public function getClient() { - return ($this->client) ? $this->client : (object) json_decode($this->client_data); + return $this->client ? $this->client : (object) json_decode($this->client_data); } public function isLocked() { - if (! is_null($this->payment_complete_date)) { + if (!is_null($this->payment_complete_date)) { $now = Carbon::now(); if (date_diff($now, $this->payment_complete_date)->format('%a') >= '120') { return true; @@ -218,14 +208,14 @@ public function siblings() { if ($this->recurrence) { if ($this->recurrence->invoices) { - return ($this->recurrence->invoices->except($this->id)->isNotEmpty()) ? $this->recurrence->invoices->except($this->id) : null; + return $this->recurrence->invoices->except($this->id)->isNotEmpty() ? $this->recurrence->invoices->except($this->id) : null; } } } public function hash() { - $hash = hash('sha512', serialize($this.$this->items)); + $hash = hash('sha512', serialize($this . $this->items)); return $hash; } @@ -267,7 +257,7 @@ public function calculatetax($moneyformat = true) $subtotal = $this->calculatesubtotal(false); $subtotalWithTax = $subtotal * $tax; - $tax = ($subtotalWithTax != 0) ? $subtotalWithTax / 100 : 0; + $tax = $subtotalWithTax != 0 ? $subtotalWithTax / 100 : 0; if ($moneyformat) { $amount = new \NumberFormatter('en_US.UTF-8', \NumberFormatter::PATTERN_DECIMAL, '* #####.00 ;(* #####.00)'); @@ -290,7 +280,7 @@ public function calculatetotal($moneyformat = true) $subtotal = $this->calculatesubtotal(false); $totalWithTax = $subtotal * (100 + $tax); - $total = ($totalWithTax != 0) ? $totalWithTax / 100 : 0; + $total = $totalWithTax != 0 ? $totalWithTax / 100 : 0; if ($moneyformat) { $amount = new \NumberFormatter('en_US.UTF-8', \NumberFormatter::PATTERN_DECIMAL, '* #####.00 ;(* #####.00)'); @@ -349,7 +339,7 @@ public function statusText() public function duplicate($date = null) { - $date = ($date) ? $date : Carbon::now(); + $date = $date ? $date : Carbon::now(); $company = $this->company; $cloned = $this->replicate(); @@ -415,52 +405,43 @@ public function sendEmailNotification() public function scopeDateBetween($query, $startDate, $endDate) { - return $query - ->whereBetween('date', [$startDate, $endDate]); + return $query->whereBetween('date', [$startDate, $endDate]); } public function scopeNotifiable($query) { - return $query - ->where('notify', true); + return $query->where('notify', true); } public function scopeOverdue($query) { $now = Carbon::now(); - return $query - ->where('duedate', '<=', $now) - ->whereIn('status', [self::STATUS_OPEN, self::STATUS_OVERDUE]); + return $query->where('duedate', '<=', $now)->whereIn('status', [self::STATUS_OPEN, self::STATUS_OVERDUE]); } public function scopePending($query) { - return $query - ->where('status', self::STATUS_OPEN); + return $query->where('status', self::STATUS_OPEN); } public function scopeDraft($query) { - return $query - ->where('status', self::STATUS_DRAFT); + return $query->where('status', self::STATUS_DRAFT); } public function scopePaid($query) { - return $query - ->where('status', self::STATUS_CLOSED); + return $query->where('status', self::STATUS_CLOSED); } public function scopeArchived($query) { - return $query - ->where('archived', true); + return $query->where('archived', true); } public function scopeNotArchived($query) { - return $query - ->where('archived', false); + return $query->where('archived', false); } } diff --git a/app/Models/InvoiceItemTemplate.php b/app/Models/InvoiceItemTemplate.php index fcf98011..1d23f7a7 100644 --- a/app/Models/InvoiceItemTemplate.php +++ b/app/Models/InvoiceItemTemplate.php @@ -26,12 +26,7 @@ class InvoiceItemTemplate extends Model implements Auditable * * @var array */ - protected $fillable = [ - 'name', - 'quantity', - 'price', - 'description', - ]; + protected $fillable = ['name', 'quantity', 'price', 'description']; public function setDescriptionAttribute($description) { diff --git a/app/Models/InvoiceTemplate.php b/app/Models/InvoiceTemplate.php index eb2c06f5..d5e08d71 100644 --- a/app/Models/InvoiceTemplate.php +++ b/app/Models/InvoiceTemplate.php @@ -25,12 +25,7 @@ class InvoiceTemplate extends Model implements Auditable * * @var array */ - protected $fillable = [ - 'date', - 'netdays', - 'notify', - 'client_id', - ]; + protected $fillable = ['date', 'netdays', 'notify', 'client_id']; public function getDateAttribute($value) { diff --git a/app/Models/ItemTemplate.php b/app/Models/ItemTemplate.php index 4c1acea1..b8e72b20 100644 --- a/app/Models/ItemTemplate.php +++ b/app/Models/ItemTemplate.php @@ -21,12 +21,7 @@ class ItemTemplate extends Model implements Auditable * * @var array */ - protected $fillable = [ - 'name', - 'quantity', - 'price', - 'description', - ]; + protected $fillable = ['name', 'quantity', 'price', 'description']; public function setDescriptionAttribute($description) { diff --git a/app/Models/NekoNotification.php b/app/Models/NekoNotification.php index 3f82441f..6d0ecfaf 100644 --- a/app/Models/NekoNotification.php +++ b/app/Models/NekoNotification.php @@ -21,24 +21,21 @@ class NekoNotification extends DatabaseNotification * * @var array */ - protected $dates = [ - 'created_at', - 'read_at', - ]; + protected $dates = ['created_at', 'read_at']; public function getCreatedAtAttribute($value) { $date = $this->asDateTime($value); - return (auth()->user()) ? $date->timezone(auth()->user()->timezone) : $date->timezone(config('app.timezone')); + return auth()->user() ? $date->timezone(auth()->user()->timezone) : $date->timezone(config('app.timezone')); } public function getReadAtAttribute($value) { - $date = ($value) ? $this->asDateTime($value) : null; + $date = $value ? $this->asDateTime($value) : null; - $timezone = (Unicorn::getCompanyKey()) ? Company::where('domain_name', Unicorn::getCompanyKey())->firstOrFail()->timezone : 'UTC'; + $timezone = Unicorn::getCompanyKey() ? Company::where('domain_name', Unicorn::getCompanyKey())->firstOrFail()->timezone : 'UTC'; - return ($date) ? $date->timezone($timezone) : null; + return $date ? $date->timezone($timezone) : null; } } diff --git a/app/Models/OldInvoice.php b/app/Models/OldInvoice.php index 15ea0d75..1fd1d8bd 100644 --- a/app/Models/OldInvoice.php +++ b/app/Models/OldInvoice.php @@ -27,52 +27,40 @@ class OldInvoice extends Model * * @var array */ - protected $fillable = [ - 'nice_invoice_id', - 'date', - 'duedate', - 'total', - 'status', - 'netdays', - 'client_data', - 'client_id', - 'company_id', - ]; + protected $fillable = ['nice_invoice_id', 'date', 'duedate', 'total', 'status', 'netdays', 'client_data', 'client_id', 'company_id']; protected $attributes = [ 'status' => self::STATUS_OPEN, ]; - protected $cascadeDeletes = [ - 'olditems', - ]; + protected $cascadeDeletes = ['olditems']; public function getCreatedAtAttribute($value) { $date = $this->asDateTime($value); - return (auth()->user()) ? $date->timezone(auth()->user()->timezone) : $date->timezone(config('app.timezone')); + return auth()->user() ? $date->timezone(auth()->user()->timezone) : $date->timezone(config('app.timezone')); } public function getUpdatedAtAttribute($value) { $date = $this->asDateTime($value); - return (auth()->user()) ? $date->timezone(auth()->user()->timezone) : $date->timezone(config('app.timezone')); + return auth()->user() ? $date->timezone(auth()->user()->timezone) : $date->timezone(config('app.timezone')); } public function getDateAttribute($value) { $date = $this->asDateTime($value); - return (auth()->user()) ? $date->timezone(auth()->user()->timezone) : $date->timezone(config('app.timezone')); + return auth()->user() ? $date->timezone(auth()->user()->timezone) : $date->timezone(config('app.timezone')); } public function getDuedateAttribute($value) { $date = $this->asDateTime($value); - return (auth()->user()) ? $date->timezone(auth()->user()->timezone) : $date->timezone(config('app.timezone')); + return auth()->user() ? $date->timezone(auth()->user()->timezone) : $date->timezone(config('app.timezone')); } public function items() @@ -97,7 +85,7 @@ public function current_invoice() public function getClient() { - return ($this->client) ? $this->client : (object) json_decode($this->client_data); + return $this->client ? $this->client : (object) json_decode($this->client_data); } public function calculatesubtotal($moneyformat = true) @@ -132,7 +120,7 @@ public function calculatetax($moneyformat = true) $subtotal = $this->calculatesubtotal(false); $subtotalWithTax = $subtotal * $tax; - $tax = ($subtotalWithTax != 0) ? $subtotalWithTax / 100 : 0; + $tax = $subtotalWithTax != 0 ? $subtotalWithTax / 100 : 0; if ($moneyformat) { $amount = new \NumberFormatter('en_US.UTF-8', \NumberFormatter::PATTERN_DECIMAL, '* #####.00 ;(* #####.00)'); @@ -155,7 +143,7 @@ public function calculatetotal($moneyformat = true) $subtotal = $this->calculatesubtotal(false); $totalWithTax = $subtotal * (100 + $tax); - $total = ($totalWithTax != 0) ? $totalWithTax / 100 : 0; + $total = $totalWithTax != 0 ? $totalWithTax / 100 : 0; if ($moneyformat) { $amount = new \NumberFormatter('en_US.UTF-8', \NumberFormatter::PATTERN_DECIMAL, '* #####.00 ;(* #####.00)'); diff --git a/app/Models/OldInvoiceItem.php b/app/Models/OldInvoiceItem.php index 5de195f5..6a02c2f4 100644 --- a/app/Models/OldInvoiceItem.php +++ b/app/Models/OldInvoiceItem.php @@ -22,12 +22,7 @@ class OldInvoiceItem extends Model * * @var array */ - protected $fillable = [ - 'name', - 'description', - 'quantity', - 'price', - ]; + protected $fillable = ['name', 'description', 'quantity', 'price']; public function invoice() { diff --git a/app/Models/Payment.php b/app/Models/Payment.php index ec9dae3d..af67b2a2 100644 --- a/app/Models/Payment.php +++ b/app/Models/Payment.php @@ -25,23 +25,14 @@ class Payment extends Model implements Auditable * * @var array */ - protected $fillable = [ - 'amount', - 'mode', - 'notes', - ]; + protected $fillable = ['amount', 'mode', 'notes']; /** * The attributes that should be mutated to dates. * * @var array */ - protected $dates = [ - 'receiveddate', - 'created_at', - 'updated_at', - 'deleted_at', - ]; + protected $dates = ['receiveddate', 'created_at', 'updated_at', 'deleted_at']; /** * Get the price. @@ -63,7 +54,7 @@ public function getPercentageAttribute() if ($invoiceTotal == 0 && $this->amount == 0) { $percentage = 100; } else { - $percentage = ($invoiceTotal != 0) ? ($this->amount / $invoiceTotal) * 100 : 0; + $percentage = $invoiceTotal != 0 ? ($this->amount / $invoiceTotal) * 100 : 0; } return $amount->format($percentage); @@ -73,14 +64,14 @@ public function getCreatedAtAttribute($value) { $date = $this->asDateTime($value); - return (auth()->user()) ? $date->timezone(auth()->user()->timezone) : $date->timezone(config('app.timezone')); + return auth()->user() ? $date->timezone(auth()->user()->timezone) : $date->timezone(config('app.timezone')); } public function getUpdatedAtAttribute($value) { $date = $this->asDateTime($value); - return (auth()->user()) ? $date->timezone(auth()->user()->timezone) : $date->timezone(config('app.timezone')); + return auth()->user() ? $date->timezone(auth()->user()->timezone) : $date->timezone(config('app.timezone')); } public function getReceiveddateAttribute($value) @@ -92,7 +83,7 @@ public function getReceiveddateAttribute($value) public function getClient() { - return ($this->client) ? $this->client : (object) json_decode($this->invoice->client_data); + return $this->client ? $this->client : (object) json_decode($this->invoice->client_data); } public function invoice() diff --git a/app/Models/Quote.php b/app/Models/Quote.php index c5b904f9..924d9b0f 100644 --- a/app/Models/Quote.php +++ b/app/Models/Quote.php @@ -32,31 +32,20 @@ class Quote extends Model implements Auditable * * @var array */ - protected $fillable = [ - 'date', - 'netdays', - ]; + protected $fillable = ['date', 'netdays']; /** * The attributes that should be mutated to dates. * * @var array */ - protected $dates = [ - 'date', - 'duedate', - 'created_at', - 'updated_at', - 'deleted_at', - ]; + protected $dates = ['date', 'duedate', 'created_at', 'updated_at', 'deleted_at']; protected $attributes = [ 'status' => self::STATUS_OPEN, ]; - protected $cascadeDeletes = [ - 'items', - ]; + protected $cascadeDeletes = ['items']; protected static function boot() { @@ -67,7 +56,10 @@ protected static function boot() $quote->status = self::STATUS_OPEN; } $date = clone $quote->date; - $quote->duedate = $date->timezone(config('app.timezone'))->startOfDay()->addDays($quote->netdays); + $quote->duedate = $date + ->timezone(config('app.timezone')) + ->startOfDay() + ->addDays($quote->netdays); }); //Auto Increment of quote_index per Company; @@ -89,14 +81,14 @@ public function getCreatedAtAttribute($value) { $date = $this->asDateTime($value); - return (auth()->user()) ? $date->timezone(auth()->user()->timezone) : $date->timezone(config('app.timezone')); + return auth()->user() ? $date->timezone(auth()->user()->timezone) : $date->timezone(config('app.timezone')); } public function getUpdatedAtAttribute($value) { $date = $this->asDateTime($value); - return (auth()->user()) ? $date->timezone(auth()->user()->timezone) : $date->timezone(config('app.timezone')); + return auth()->user() ? $date->timezone(auth()->user()->timezone) : $date->timezone(config('app.timezone')); } public function getDateAttribute($value) @@ -139,7 +131,7 @@ public function items() public function getClient() { - return ($this->client) ? $this->client : (object) json_decode($this->client_data); + return $this->client ? $this->client : (object) json_decode($this->client_data); } public function owns($model) @@ -179,7 +171,7 @@ public function calculatetax($moneyformat = true) $subtotal = $this->calculatesubtotal(false); $subtotalWithTax = $subtotal * $tax; - $tax = ($subtotalWithTax != 0) ? $subtotalWithTax / 100 : 0; + $tax = $subtotalWithTax != 0 ? $subtotalWithTax / 100 : 0; if ($moneyformat) { $amount = new \NumberFormatter('en_US.UTF-8', \NumberFormatter::PATTERN_DECIMAL, '* #####.00 ;(* #####.00)'); @@ -202,7 +194,7 @@ public function calculatetotal($moneyformat = true) $subtotal = $this->calculatesubtotal(false); $totalWithTax = $subtotal * (100 + $tax); - $total = ($totalWithTax != 0) ? $totalWithTax / 100 : 0; + $total = $totalWithTax != 0 ? $totalWithTax / 100 : 0; if ($moneyformat) { $amount = new \NumberFormatter('en_US.UTF-8', \NumberFormatter::PATTERN_DECIMAL, '* #####.00 ;(* #####.00)'); @@ -250,7 +242,9 @@ public function duplicate() $cloned = $this->replicate(); $cloned->nice_quote_id = $company->nicequoteid(); $cloned->date = Carbon::now(); - $duedate = Carbon::now()->addDays($this->netdays)->toDateTimeString(); + $duedate = Carbon::now() + ->addDays($this->netdays) + ->toDateTimeString(); $cloned->duedate = $duedate; $cloned->status = self::STATUS_DRAFT; $cloned->save(); @@ -279,31 +273,26 @@ public function generatePDFView() public function scopeDraft($query) { - return $query - ->where('status', self::STATUS_DRAFT); + return $query->where('status', self::STATUS_DRAFT); } public function scopePending($query) { - return $query - ->where('status', self::STATUS_OPEN); + return $query->where('status', self::STATUS_OPEN); } public function scopeExpired($query) { - return $query - ->where('status', self::STATUS_EXPIRED); + return $query->where('status', self::STATUS_EXPIRED); } public function scopeArchived($query) { - return $query - ->where('archived', true); + return $query->where('archived', true); } public function scopeNotArchived($query) { - return $query - ->where('archived', false); + return $query->where('archived', false); } } diff --git a/app/Models/Receipt.php b/app/Models/Receipt.php index 2a69c257..bb61d2ae 100644 --- a/app/Models/Receipt.php +++ b/app/Models/Receipt.php @@ -24,14 +24,14 @@ public function getCreatedAtAttribute($value) { $date = $this->asDateTime($value); - return (auth()->user()) ? $date->timezone(auth()->user()->timezone) : $date->timezone(config('app.timezone')); + return auth()->user() ? $date->timezone(auth()->user()->timezone) : $date->timezone(config('app.timezone')); } public function getUpdatedAtAttribute($value) { $date = $this->asDateTime($value); - return (auth()->user()) ? $date->timezone(auth()->user()->timezone) : $date->timezone(config('app.timezone')); + return auth()->user() ? $date->timezone(auth()->user()->timezone) : $date->timezone(config('app.timezone')); } public function company() diff --git a/app/Models/Recipient.php b/app/Models/Recipient.php index fe36f920..69057b9c 100644 --- a/app/Models/Recipient.php +++ b/app/Models/Recipient.php @@ -24,13 +24,7 @@ class Recipient extends Model implements Auditable * * @var array */ - protected $fillable = [ - 'salutation', - 'first_name', - 'last_name', - 'email', - 'phone', - ]; + protected $fillable = ['salutation', 'first_name', 'last_name', 'email', 'phone']; public function getNameAttribute() { diff --git a/app/Models/Role.php b/app/Models/Role.php index 952097bb..6393acec 100644 --- a/app/Models/Role.php +++ b/app/Models/Role.php @@ -28,7 +28,9 @@ public function getRouteKeyName() */ public function resolveRouteBinding($value, $field = null) { - $role = $this->where($this->getRouteKeyName(), $value)->where('scope', app('request')->route('company')->id)->first(); + $role = $this->where($this->getRouteKeyName(), $value) + ->where('scope', app('request')->route('company')->id) + ->first(); return $role; } diff --git a/app/Models/User.php b/app/Models/User.php index d2f629cf..9e6661a0 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -35,27 +35,14 @@ class User extends Authenticatable implements MustVerifyEmail, Auditable * * @var string[] */ - protected $fillable = [ - 'full_name', - 'username', - 'email', - 'phone', - 'gender', - 'country_code', - 'timezone', - ]; + protected $fillable = ['full_name', 'username', 'email', 'phone', 'gender', 'country_code', 'timezone']; /** * The attributes that should be hidden for serialization. * * @var array */ - protected $hidden = [ - 'password', - 'remember_token', - 'twofa_secret', - 'twofa_timestamp', - ]; + protected $hidden = ['password', 'remember_token', 'twofa_secret', 'twofa_timestamp']; /** * The attributes that should be cast. @@ -64,7 +51,7 @@ class User extends Authenticatable implements MustVerifyEmail, Auditable */ protected $attributes = [ 'timezone' => 'UTC', - 'status' => self::STATUS_ACTIVE, + 'status' => self::STATUS_ACTIVE, ]; /** @@ -101,7 +88,7 @@ public function setPasswordAttribute($password) */ public function setTwofaSecretAttribute($value) { - $this->attributes['twofa_secret'] = ($value) ? encrypt($value) : null; + $this->attributes['twofa_secret'] = $value ? encrypt($value) : null; } /** @@ -113,7 +100,7 @@ public function setTwofaSecretAttribute($value) */ public function getTwofaSecretAttribute($value) { - return ($value) ? decrypt($value) : null; + return $value ? decrypt($value) : null; } /** @@ -125,7 +112,7 @@ public function getTwofaSecretAttribute($value) */ public function setTwofaBackupCodesAttribute($value) { - $this->attributes['twofa_backup_codes'] = ($value) ? encrypt($value) : null; + $this->attributes['twofa_backup_codes'] = $value ? encrypt($value) : null; } /** @@ -137,7 +124,7 @@ public function setTwofaBackupCodesAttribute($value) */ public function getTwofaBackupCodesAttribute($value) { - return ($value) ? decrypt($value) : null; + return $value ? decrypt($value) : null; } /** @@ -225,7 +212,7 @@ public function sendConfirmEmailNotification() public function getFirstCompanyKey() { - return (is_null($this->companies->first())) ? null : $this->companies->first()->{(new Company())->getRouteKeyName()}; + return is_null($this->companies->first()) ? null : $this->companies->first()->{(new Company())->getRouteKeyName()}; } public function sessions() diff --git a/app/Notifications/CompanyUserRequestApprovedNotification.php b/app/Notifications/CompanyUserRequestApprovedNotification.php index 975b4952..658ca971 100644 --- a/app/Notifications/CompanyUserRequestApprovedNotification.php +++ b/app/Notifications/CompanyUserRequestApprovedNotification.php @@ -46,8 +46,8 @@ public function toMail($notifiable) $url = route('user.create', ['token' => $this->token]); return (new MailMessage()) - ->subject('Your requested to be added to your company on '.config('app.name').' has been approved') - ->line('Please fill in the rest of your details on'.config('app.name')) + ->subject('Your requested to be added to your company on ' . config('app.name') . ' has been approved') + ->line('Please fill in the rest of your details on' . config('app.name')) ->action('Create Account', $url) ->line('Thank you for using our application!'); } @@ -62,7 +62,7 @@ public function toMail($notifiable) public function toArray($notifiable) { return [ - // - ]; + // + ]; } } diff --git a/app/Notifications/CompanyUserRequestRejectedNotification.php b/app/Notifications/CompanyUserRequestRejectedNotification.php index 6bff7d30..cf658a88 100644 --- a/app/Notifications/CompanyUserRequestRejectedNotification.php +++ b/app/Notifications/CompanyUserRequestRejectedNotification.php @@ -43,7 +43,7 @@ public function via($notifiable) public function toMail($notifiable) { return (new MailMessage()) - ->subject('Your requested to be added to your company on '.config('app.name').' has been rejected') + ->subject('Your requested to be added to your company on ' . config('app.name') . ' has been rejected') ->line('Please contact your company administrator for the reason') ->line('Thank you for using our application!'); } @@ -58,7 +58,7 @@ public function toMail($notifiable) public function toArray($notifiable) { return [ - // - ]; + // + ]; } } diff --git a/app/Notifications/ConfirmEmailNotification.php b/app/Notifications/ConfirmEmailNotification.php index 7ae5c731..3e55755f 100644 --- a/app/Notifications/ConfirmEmailNotification.php +++ b/app/Notifications/ConfirmEmailNotification.php @@ -43,7 +43,7 @@ public function via($notifiable) public function toMail($notifiable) { return (new MailMessage()) - ->line('Thanks for Signing up to '.config('app.name')) + ->line('Thanks for Signing up to ' . config('app.name')) ->line('Please confirm your email!') ->action('Confirm Email', route('confirm', ['token' => $this->token])) ->line('Thank you for using our application!'); @@ -59,7 +59,7 @@ public function toMail($notifiable) public function toArray($notifiable) { return [ - // - ]; + // + ]; } } diff --git a/app/Notifications/InviteUserNotification.php b/app/Notifications/InviteUserNotification.php index d3617a3b..fbc82e18 100644 --- a/app/Notifications/InviteUserNotification.php +++ b/app/Notifications/InviteUserNotification.php @@ -49,10 +49,10 @@ public function toMail($notifiable) $url = route('company.invite.show', ['companyinvite' => $companyInvite->token]); return (new MailMessage()) - ->subject('You have been invited to join '.$company->name.' on '.config('app.name')) - ->line('Join '.$company->name.' on '.config('app.name')) + ->subject('You have been invited to join ' . $company->name . ' on ' . config('app.name')) + ->line('Join ' . $company->name . ' on ' . config('app.name')) ->action('Accept Invite', $url) - ->line('Your invite code is : '.$companyInvite->token) + ->line('Your invite code is : ' . $companyInvite->token) ->line('This special invite link expires in 48 hours') ->line('Please contact the company owner for a new invite link if it has expired') ->line('Thank you for using our application!'); @@ -68,7 +68,7 @@ public function toMail($notifiable) public function toArray($notifiable) { return [ - // - ]; + // + ]; } } diff --git a/app/Notifications/InvoiceNotification.php b/app/Notifications/InvoiceNotification.php index 6c481eec..3935544e 100644 --- a/app/Notifications/InvoiceNotification.php +++ b/app/Notifications/InvoiceNotification.php @@ -53,16 +53,16 @@ public function toMail($notifiable) $token = (string) $invoice->generateShareToken(); $url = route('invoice.token', ['token' => $token]); $pixelRoute = route('notification.pixel', ['notification_id' => $this->id]); - $invoice_slug = Str::slug($invoice->nice_invoice_id).'.pdf'; + $invoice_slug = Str::slug($invoice->nice_invoice_id) . '.pdf'; return (new NekoMailMessage()) - ->subject("New Invoice #{$invoice->nice_invoice_id} from {$company->name}") - ->greeting("Hello {$client->companyname}!") - ->line("You have a new Invoice from {$company->name}") - ->action('View Invoice', $url) - ->line('Thank you for using our application!') - ->content('') - ->attachData($pdf->inline($invoice_slug), $invoice_slug); + ->subject("New Invoice #{$invoice->nice_invoice_id} from {$company->name}") + ->greeting("Hello {$client->companyname}!") + ->line("You have a new Invoice from {$company->name}") + ->action('View Invoice', $url) + ->line('Thank you for using our application!') + ->content('') + ->attachData($pdf->inline($invoice_slug), $invoice_slug); } /** @@ -75,11 +75,11 @@ public function toMail($notifiable) public function toArray($notifiable) { return [ - 'invoice_id' => $this->invoice->id, + 'invoice_id' => $this->invoice->id, 'nice_invoice_id' => $this->invoice->nice_invoice_id, - 'company_id' => $this->invoice->company_id, - 'clientname' => $this->invoice->client->companyname, - 'email' => $this->invoice->client->contactemail, + 'company_id' => $this->invoice->company_id, + 'clientname' => $this->invoice->client->companyname, + 'email' => $this->invoice->client->contactemail, ]; } } diff --git a/app/Notifications/NewCompanyUserNotification.php b/app/Notifications/NewCompanyUserNotification.php index f939d922..575ef7b4 100644 --- a/app/Notifications/NewCompanyUserNotification.php +++ b/app/Notifications/NewCompanyUserNotification.php @@ -49,9 +49,9 @@ public function toMail($notifiable) $url = route('auth.show'); return (new MailMessage()) - ->subject('You have been added to a company on '.config('app.name')) + ->subject('You have been added to a company on ' . config('app.name')) ->greeting("Hello {$user->full_name}!") - ->line('A new account has been created for you on '.config('app.name')) + ->line('A new account has been created for you on ' . config('app.name')) ->line('You account details are: ') ->line("Username: {$user->username}") ->line("Password: {$password}") @@ -69,7 +69,7 @@ public function toMail($notifiable) public function toArray($notifiable) { return [ - // - ]; + // + ]; } } diff --git a/app/Notifications/RequestCompanyAccessNotification.php b/app/Notifications/RequestCompanyAccessNotification.php index a8099735..ea2afbf2 100644 --- a/app/Notifications/RequestCompanyAccessNotification.php +++ b/app/Notifications/RequestCompanyAccessNotification.php @@ -49,8 +49,8 @@ public function toMail($notifiable) $url = route('company.requests.index', ['company' => $company]); return (new MailMessage()) - ->subject($companyUserRequest->full_name.' has requested to be added to your company on '.config('app.name')) - ->line('Please login to '.config('app.name').' to approve/reject the user') + ->subject($companyUserRequest->full_name . ' has requested to be added to your company on ' . config('app.name')) + ->line('Please login to ' . config('app.name') . ' to approve/reject the user') ->action('Sign In', $url) ->line('Thank you for using our application!'); } @@ -65,7 +65,7 @@ public function toMail($notifiable) public function toArray($notifiable) { return [ - // - ]; + // + ]; } } diff --git a/app/Notifications/ResetPasswordNotification.php b/app/Notifications/ResetPasswordNotification.php index 2094394c..8ed9261b 100644 --- a/app/Notifications/ResetPasswordNotification.php +++ b/app/Notifications/ResetPasswordNotification.php @@ -62,7 +62,7 @@ public function toMail($notifiable) public function toArray($notifiable) { return [ - // - ]; + // + ]; } } diff --git a/app/Notifications/VerifyEmail.php b/app/Notifications/VerifyEmail.php index a1f38aa0..b044a876 100644 --- a/app/Notifications/VerifyEmail.php +++ b/app/Notifications/VerifyEmail.php @@ -48,10 +48,7 @@ public function toMail($notifiable) return (new MailMessage()) ->subject(Lang::get('Verify Email Address')) ->line(Lang::get('Please click the button below to verify your email address.')) - ->action( - Lang::get('Verify Email Address'), - $this->verificationUrl($notifiable) - ) + ->action(Lang::get('Verify Email Address'), $this->verificationUrl($notifiable)) ->line(Lang::get('If you did not create an account, no further action is required.')); } @@ -64,9 +61,7 @@ public function toMail($notifiable) */ protected function verificationUrl($notifiable) { - return URL::temporarySignedRoute( - 'verification.verify', Carbon::now()->addMinutes(60), ['id' => $notifiable->getKey()] - ); + return URL::temporarySignedRoute('verification.verify', Carbon::now()->addMinutes(60), ['id' => $notifiable->getKey()]); } /** diff --git a/app/Otter/Client.php b/app/Otter/Client.php index 7e89ae4e..2307f5a5 100644 --- a/app/Otter/Client.php +++ b/app/Otter/Client.php @@ -28,14 +28,14 @@ class Client extends OtterResource public static function fields() { return [ - 'companyname' => 'text', - 'phone' => 'text', - 'crn' => 'text', + 'companyname' => 'text', + 'phone' => 'text', + 'crn' => 'text', 'contactsalutation' => 'text', - 'contactfirstname' => 'text', - 'contactlastname' => 'text', - 'contactemail' => 'text', - 'contactphone' => 'text', + 'contactfirstname' => 'text', + 'contactlastname' => 'text', + 'contactemail' => 'text', + 'contactphone' => 'text', ]; } @@ -46,7 +46,6 @@ public static function fields() */ public static function hidden() { - return [ - ]; + return []; } } diff --git a/app/Otter/Company.php b/app/Otter/Company.php index 057d258b..f9d5fcdd 100644 --- a/app/Otter/Company.php +++ b/app/Otter/Company.php @@ -28,13 +28,13 @@ class Company extends OtterResource public static function fields() { return [ - 'name' => 'text', - 'crn' => 'text', - 'domain_name' => 'text', - 'phone' => 'text', - 'email' => 'email', + 'name' => 'text', + 'crn' => 'text', + 'domain_name' => 'text', + 'phone' => 'text', + 'email' => 'email', 'country_code' => 'text', - 'timezone' => 'text', + 'timezone' => 'text', ]; } @@ -42,10 +42,10 @@ public static function relations() { return [ 'settings' => 'CompanySetting', - 'users' => 'User', + 'users' => 'User', 'invoices' => 'Invoice', 'receipts' => 'Receipt', - 'owner' => 'User', + 'owner' => 'User', ]; } } diff --git a/app/Otter/CompanyAddress.php b/app/Otter/CompanyAddress.php index 956c346c..d531c195 100644 --- a/app/Otter/CompanyAddress.php +++ b/app/Otter/CompanyAddress.php @@ -28,10 +28,10 @@ class CompanyAddress extends OtterResource public static function fields() { return [ - 'block' => 'text', - 'street' => 'text', - 'unitnumber' => 'text', - 'postalcode' => 'text', + 'block' => 'text', + 'street' => 'text', + 'unitnumber' => 'text', + 'postalcode' => 'text', 'buildingtype' => 'text', ]; } @@ -43,7 +43,6 @@ public static function fields() */ public static function hidden() { - return [ - ]; + return []; } } diff --git a/app/Otter/CompanySetting.php b/app/Otter/CompanySetting.php index 2d0d48fe..3b07b006 100644 --- a/app/Otter/CompanySetting.php +++ b/app/Otter/CompanySetting.php @@ -28,12 +28,12 @@ class CompanySetting extends OtterResource public static function fields() { return [ - 'invoice_prefix' => 'text', - 'quote_prefix' => 'text', - 'receipt_prefix' => 'text', + 'invoice_prefix' => 'text', + 'quote_prefix' => 'text', + 'receipt_prefix' => 'text', 'invoice_conditions' => 'text', - 'quote_conditions' => 'text', - 'tax' => 'text', + 'quote_conditions' => 'text', + 'tax' => 'text', ]; } @@ -44,7 +44,6 @@ public static function fields() */ public static function hidden() { - return [ - ]; + return []; } } diff --git a/app/Otter/Invoice.php b/app/Otter/Invoice.php index 1bd52129..81b91f18 100644 --- a/app/Otter/Invoice.php +++ b/app/Otter/Invoice.php @@ -29,10 +29,10 @@ public static function fields() { return [ 'nice_invoice_id' => 'text', - 'date' => 'text', - 'netdays' => 'text', - 'total' => 'text', - 'status' => 'text', + 'date' => 'text', + 'netdays' => 'text', + 'total' => 'text', + 'status' => 'text', ]; } @@ -44,10 +44,10 @@ public static function fields() public static function relations() { return [ - 'client' => ['Client', 'client_id'], - 'company' => 'Company', - 'items' => 'InvoiceItem', - 'receipt' => 'Receipt', + 'client' => ['Client', 'client_id'], + 'company' => 'Company', + 'items' => 'InvoiceItem', + 'receipt' => 'Receipt', ]; } diff --git a/app/Otter/InvoiceItem.php b/app/Otter/InvoiceItem.php index 7cda62d7..8150a204 100644 --- a/app/Otter/InvoiceItem.php +++ b/app/Otter/InvoiceItem.php @@ -28,9 +28,9 @@ class InvoiceItem extends OtterResource public static function fields() { return [ - 'name' => 'text', + 'name' => 'text', 'quantity' => 'text', - 'price' => 'text', + 'price' => 'text', ]; } @@ -41,7 +41,6 @@ public static function fields() */ public static function hidden() { - return [ - ]; + return []; } } diff --git a/app/Otter/InvoiceRecurrence.php b/app/Otter/InvoiceRecurrence.php index 28487d91..366d6238 100644 --- a/app/Otter/InvoiceRecurrence.php +++ b/app/Otter/InvoiceRecurrence.php @@ -29,10 +29,10 @@ public static function fields() { return [ 'time_interval' => 'text', - 'time_period' => 'text', - 'until_type' => 'text', - 'until_meta' => 'text', - 'rule' => 'text', + 'time_period' => 'text', + 'until_type' => 'text', + 'until_meta' => 'text', + 'rule' => 'text', ]; } @@ -43,8 +43,7 @@ public static function fields() */ public static function hidden() { - return [ - ]; + return []; } /** @@ -58,25 +57,25 @@ public static function validations() 'client' => [ 'create' => [ /* - * Client side create resource validation - */ + * Client side create resource validation + */ ], 'update' => [ /* - * Client side update resource validation - */ + * Client side update resource validation + */ ], ], 'server' => [ 'create' => [ /* - * Server side create resource validation - */ + * Server side create resource validation + */ ], 'update' => [ /* - * Server side update resource validation - */ + * Server side update resource validation + */ ], ], ]; diff --git a/app/Otter/ItemTemplate.php b/app/Otter/ItemTemplate.php index 905f75f7..8acc1554 100644 --- a/app/Otter/ItemTemplate.php +++ b/app/Otter/ItemTemplate.php @@ -28,9 +28,9 @@ class ItemTemplate extends OtterResource public static function fields() { return [ - 'name' => 'text', + 'name' => 'text', 'quantity' => 'text', - 'price' => 'text', + 'price' => 'text', ]; } @@ -41,8 +41,7 @@ public static function fields() */ public static function hidden() { - return [ - ]; + return []; } /** @@ -56,25 +55,25 @@ public static function validations() 'client' => [ 'create' => [ /* - * Client side create resource validation - */ + * Client side create resource validation + */ ], 'update' => [ /* - * Client side update resource validation - */ + * Client side update resource validation + */ ], ], 'server' => [ 'create' => [ /* - * Server side create resource validation - */ + * Server side create resource validation + */ ], 'update' => [ /* - * Server side update resource validation - */ + * Server side update resource validation + */ ], ], ]; diff --git a/app/Otter/Payment.php b/app/Otter/Payment.php index be532a93..f73da134 100644 --- a/app/Otter/Payment.php +++ b/app/Otter/Payment.php @@ -29,8 +29,8 @@ public static function fields() { return [ 'amount' => 'text', - 'mode' => 'text', - 'notes' => 'text', + 'mode' => 'text', + 'notes' => 'text', ]; } @@ -41,8 +41,7 @@ public static function fields() */ public static function hidden() { - return [ - ]; + return []; } /** @@ -69,25 +68,25 @@ public static function validations() 'client' => [ 'create' => [ /* - * Client side create resource validation - */ + * Client side create resource validation + */ ], 'update' => [ /* - * Client side update resource validation - */ + * Client side update resource validation + */ ], ], 'server' => [ 'create' => [ /* - * Server side create resource validation - */ + * Server side create resource validation + */ ], 'update' => [ /* - * Server side update resource validation - */ + * Server side update resource validation + */ ], ], ]; diff --git a/app/Otter/Quote.php b/app/Otter/Quote.php index 1c88e375..816bea22 100644 --- a/app/Otter/Quote.php +++ b/app/Otter/Quote.php @@ -29,10 +29,10 @@ public static function fields() { return [ 'nice_quote_id' => 'text', - 'date' => 'text', - 'netdays' => 'text', - 'total' => 'text', - 'status' => 'text', + 'date' => 'text', + 'netdays' => 'text', + 'total' => 'text', + 'status' => 'text', ]; } @@ -43,8 +43,7 @@ public static function fields() */ public static function hidden() { - return [ - ]; + return []; } public function toArray($request) diff --git a/app/Otter/Receipt.php b/app/Otter/Receipt.php index e869c6d1..776e3446 100644 --- a/app/Otter/Receipt.php +++ b/app/Otter/Receipt.php @@ -39,8 +39,7 @@ public static function fields() */ public static function hidden() { - return [ - ]; + return []; } /** @@ -54,25 +53,25 @@ public static function validations() 'client' => [ 'create' => [ /* - * Client side create resource validation - */ + * Client side create resource validation + */ ], 'update' => [ /* - * Client side update resource validation - */ + * Client side update resource validation + */ ], ], 'server' => [ 'create' => [ /* - * Server side create resource validation - */ + * Server side create resource validation + */ ], 'update' => [ /* - * Server side update resource validation - */ + * Server side update resource validation + */ ], ], ]; diff --git a/app/Otter/User.php b/app/Otter/User.php index d5f1e225..8015d835 100644 --- a/app/Otter/User.php +++ b/app/Otter/User.php @@ -29,11 +29,11 @@ public static function fields() { return [ 'full_name' => 'text', - 'username' => 'text', - 'password' => 'password', - 'email' => 'email', - 'phone' => 'text', - 'gender' => 'text', + 'username' => 'text', + 'password' => 'password', + 'email' => 'email', + 'phone' => 'text', + 'gender' => 'text', ]; } @@ -48,36 +48,36 @@ public static function validations() 'client' => [ 'create' => [ 'full_name' => 'required|min:4', - 'username' => 'required|min:4', - 'password' => 'required', - 'email' => 'required|email', - 'phone' => 'required', - 'gender' => 'required|included:male,female', + 'username' => 'required|min:4', + 'password' => 'required', + 'email' => 'required|email', + 'phone' => 'required', + 'gender' => 'required|included:male,female', ], 'update' => [ 'full_name' => 'required|min:4', - 'username' => 'required|min:4', - 'password' => '', - 'email' => 'required|email', - 'phone' => 'required', - 'gender' => 'required|included:male,female', + 'username' => 'required|min:4', + 'password' => '', + 'email' => 'required|email', + 'phone' => 'required', + 'gender' => 'required|included:male,female', ], ], 'server' => [ 'create' => [ 'full_name' => 'required|min:4', - 'username' => 'required|min:4|unique:users', - 'password' => 'required', - 'email' => 'required|email|unique:users', - 'phone' => 'required|unique:users', - 'gender' => 'required|in:male,female', + 'username' => 'required|min:4|unique:users', + 'password' => 'required', + 'email' => 'required|email|unique:users', + 'phone' => 'required|unique:users', + 'gender' => 'required|in:male,female', ], 'update' => [ 'full_name' => 'required|string|min:4', - 'username' => 'required|string|min:4|unique:users,username,'.auth()->user()->id, - 'email' => 'required|email|unique:users,email,'.auth()->user()->id, - 'phone' => 'required|unique:users,phone,'.auth()->user()->id, - 'gender' => 'required|in:male,female', + 'username' => 'required|string|min:4|unique:users,username,' . auth()->user()->id, + 'email' => 'required|email|unique:users,email,' . auth()->user()->id, + 'phone' => 'required|unique:users,phone,' . auth()->user()->id, + 'gender' => 'required|in:male,female', ], ], ]; @@ -90,9 +90,7 @@ public static function validations() */ public static function hidden() { - return [ - 'password', - ]; + return ['password']; } /** diff --git a/app/Policies/QuotePolicy.php b/app/Policies/QuotePolicy.php index 4f35a8cb..3b88868c 100644 --- a/app/Policies/QuotePolicy.php +++ b/app/Policies/QuotePolicy.php @@ -20,7 +20,7 @@ public function before($user, $ability) public function index(User $user) { -// dd($user->roles()->first()->getAbilities()); + // dd($user->roles()->first()->getAbilities()); return $user->can('view-quote', Quote::class); } diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 47188cb7..84a2c83a 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -29,13 +29,13 @@ public function register() if ($this->app->environment('local', 'testing', 'staging', 'dusk')) { $this->app->register(DuskServiceProvider::class); $this->app->register(DuskBrowserServiceProvider::class); -// $this->app->register(IdeHelperServiceProvider::class); + // $this->app->register(IdeHelperServiceProvider::class); } if ($this->app->environment('production', 'local', 'testing', 'staging')) { $this->app->register(HorizonServiceProvider::class); $this->app->register(TelescopeServiceProvider::class); -// $this->app->register(OtterServiceProvider::class); + // $this->app->register(OtterServiceProvider::class); } Bouncer::runAfterPolicies(); diff --git a/app/Providers/AuthServiceProvider.php b/app/Providers/AuthServiceProvider.php index c6273764..41117b2e 100644 --- a/app/Providers/AuthServiceProvider.php +++ b/app/Providers/AuthServiceProvider.php @@ -13,22 +13,22 @@ class AuthServiceProvider extends ServiceProvider * @var array */ protected $policies = [ - 'App\Models\Client' => 'App\Policies\ClientPolicy', - 'App\Models\Company' => 'App\Policies\CompanyPolicy', - 'App\Models\CompanyAddress' => 'App\Policies\CompanyAddressPolicy', - 'App\Models\CompanySetting' => 'App\Policies\CompanySettingPolicy', + 'App\Models\Client' => 'App\Policies\ClientPolicy', + 'App\Models\Company' => 'App\Policies\CompanyPolicy', + 'App\Models\CompanyAddress' => 'App\Policies\CompanyAddressPolicy', + 'App\Models\CompanySetting' => 'App\Policies\CompanySettingPolicy', 'App\Models\CompanyUserRequest' => 'App\Policies\CompanyUserRequestPolicy', - 'App\Models\Receipt' => 'App\Policies\ReceiptPolicy', - 'App\Models\InvoiceItem' => 'App\Policies\InvoiceItemPolicy', - 'App\Models\Invoice' => 'App\Policies\InvoicePolicy', - 'App\Models\OldInvoiceItem' => 'App\Policies\OldInvoiceItemPolicy', - 'App\Models\OldInvoice' => 'App\Policies\OldInvoicePolicy', - 'App\Models\ItemTemplate' => 'App\Policies\ItemTemplatePolicy', - 'App\Models\QuoteItem' => 'App\Policies\QuoteItemPolicy', - 'App\Models\Quote' => 'App\Policies\QuotePolicy', - 'App\Models\Payment' => 'App\Policies\PaymentPolicy', - 'App\Models\Role' => 'App\Policies\RolePolicy', - 'App\Models\User' => 'App\Policies\UserPolicy', + 'App\Models\Receipt' => 'App\Policies\ReceiptPolicy', + 'App\Models\InvoiceItem' => 'App\Policies\InvoiceItemPolicy', + 'App\Models\Invoice' => 'App\Policies\InvoicePolicy', + 'App\Models\OldInvoiceItem' => 'App\Policies\OldInvoiceItemPolicy', + 'App\Models\OldInvoice' => 'App\Policies\OldInvoicePolicy', + 'App\Models\ItemTemplate' => 'App\Policies\ItemTemplatePolicy', + 'App\Models\QuoteItem' => 'App\Policies\QuoteItemPolicy', + 'App\Models\Quote' => 'App\Policies\QuotePolicy', + 'App\Models\Payment' => 'App\Policies\PaymentPolicy', + 'App\Models\Role' => 'App\Policies\RolePolicy', + 'App\Models\User' => 'App\Policies\UserPolicy', ]; /** diff --git a/app/Providers/EventServiceProvider.php b/app/Providers/EventServiceProvider.php index 28b8e7ff..3bf284a7 100644 --- a/app/Providers/EventServiceProvider.php +++ b/app/Providers/EventServiceProvider.php @@ -12,17 +12,14 @@ class EventServiceProvider extends ServiceProvider * * @var array */ - protected $listen = [ - ]; + protected $listen = []; /** * The subscriber classes to register. * * @var array */ - protected $subscribe = [ - 'App\Listeners\EmailChangedListener', - ]; + protected $subscribe = ['App\Listeners\EmailChangedListener']; /** * Register any events for your application. diff --git a/app/Providers/HorizonServiceProvider.php b/app/Providers/HorizonServiceProvider.php index bb87df93..8bc38945 100644 --- a/app/Providers/HorizonServiceProvider.php +++ b/app/Providers/HorizonServiceProvider.php @@ -32,9 +32,7 @@ public function boot() protected function gate() { Gate::define('viewHorizon', function ($user) { - return in_array($user->email, [ - 'zane@poowf.com', - ]); + return in_array($user->email, ['zane@poowf.com']); }); } diff --git a/app/Providers/OtterServiceProvider.php b/app/Providers/OtterServiceProvider.php index 28e23f83..61b1a926 100644 --- a/app/Providers/OtterServiceProvider.php +++ b/app/Providers/OtterServiceProvider.php @@ -30,9 +30,7 @@ public function boot() protected function gate() { Gate::define('viewOtter', function ($user) { - return in_array($user->email, [ - 'zane@poowf.com', - ]); + return in_array($user->email, ['zane@poowf.com']); }); } diff --git a/app/Providers/TelescopeServiceProvider.php b/app/Providers/TelescopeServiceProvider.php index 60c1daa8..f494ed0c 100644 --- a/app/Providers/TelescopeServiceProvider.php +++ b/app/Providers/TelescopeServiceProvider.php @@ -25,10 +25,10 @@ public function register() return true; } -// return $entry->isReportableException() || -// $entry->isFailedJob() || -// $entry->isScheduledTask() || -// $entry->hasMonitoredTag(); + // return $entry->isReportableException() || + // $entry->isFailedJob() || + // $entry->isScheduledTask() || + // $entry->hasMonitoredTag(); return true; }); } @@ -46,11 +46,7 @@ protected function hideSensitiveRequestDetails() Telescope::hideRequestParameters(['_token']); - Telescope::hideRequestHeaders([ - 'cookie', - 'x-csrf-token', - 'x-xsrf-token', - ]); + Telescope::hideRequestHeaders(['cookie', 'x-csrf-token', 'x-xsrf-token']); } /** @@ -63,9 +59,7 @@ protected function hideSensitiveRequestDetails() protected function gate() { Gate::define('viewTelescope', function ($user) { - return in_array($user->email, [ - 'zane@poowf.com', - ]); + return in_array($user->email, ['zane@poowf.com']); }); } } diff --git a/app/Traits/UniqueSlug.php b/app/Traits/UniqueSlug.php index cbdf1748..ad4c159e 100644 --- a/app/Traits/UniqueSlug.php +++ b/app/Traits/UniqueSlug.php @@ -6,17 +6,17 @@ trait UniqueSlug { public static function generateSlug($model) { - $latestSlug = - $model::whereRaw("slug = '$model->slug' or slug LIKE '$model->slug-%'") - ->latest('id') - ->value('slug'); + $latestSlug = $model + ::whereRaw("slug = '$model->slug' or slug LIKE '$model->slug-%'") + ->latest('id') + ->value('slug'); if ($latestSlug) { $pieces = explode('-', $latestSlug); $number = intval(end($pieces)); - $model->slug .= '-'.($number + 1); + $model->slug .= '-' . ($number + 1); } } } diff --git a/bootstrap/app.php b/bootstrap/app.php index c65a8600..ad4b222f 100644 --- a/bootstrap/app.php +++ b/bootstrap/app.php @@ -11,9 +11,7 @@ | */ -$app = new Illuminate\Foundation\Application( - dirname(__DIR__) -); +$app = new Illuminate\Foundation\Application(dirname(__DIR__)); /* |-------------------------------------------------------------------------- @@ -26,20 +24,11 @@ | */ -$app->singleton( - Illuminate\Contracts\Http\Kernel::class, - App\Http\Kernel::class -); +$app->singleton(Illuminate\Contracts\Http\Kernel::class, App\Http\Kernel::class); -$app->singleton( - Illuminate\Contracts\Console\Kernel::class, - App\Console\Kernel::class -); +$app->singleton(Illuminate\Contracts\Console\Kernel::class, App\Console\Kernel::class); -$app->singleton( - Illuminate\Contracts\Debug\ExceptionHandler::class, - App\Exceptions\Handler::class -); +$app->singleton(Illuminate\Contracts\Debug\ExceptionHandler::class, App\Exceptions\Handler::class); /* |-------------------------------------------------------------------------- diff --git a/config/app.php b/config/app.php index b6196b34..cb567b51 100644 --- a/config/app.php +++ b/config/app.php @@ -1,7 +1,6 @@ env('ROLLBAR_TOKEN'), + 'rollbar_token' => env('ROLLBAR_TOKEN'), 'rollbar_post_client_token' => env('ROLLBAR_POST_CLIENT_TOKEN'), - 'rollbar_env' => env('ROLLBAR_ENV'), - 'sentry_laravel_dsn' => env('SENTRY_LARAVEL_DSN'), - 'tawkto_embed_key' => env('TAWKTO_EMBED_KEY'), - 'logrocket_token' => env('LOGROCKET_TOKEN'), - 'github_token' => env('GITHUB_TOKEN'), - 'googleua' => env('GOOGLE_UA'), + 'rollbar_env' => env('ROLLBAR_ENV'), + 'sentry_laravel_dsn' => env('SENTRY_LARAVEL_DSN'), + 'tawkto_embed_key' => env('TAWKTO_EMBED_KEY'), + 'logrocket_token' => env('LOGROCKET_TOKEN'), + 'github_token' => env('GITHUB_TOKEN'), + 'googleua' => env('GOOGLE_UA'), /* |-------------------------------------------------------------------------- @@ -152,7 +151,6 @@ */ 'providers' => [ - /* * Laravel Framework Service Providers... */ @@ -207,50 +205,48 @@ */ 'aliases' => [ - - 'App' => Illuminate\Support\Facades\App::class, - 'Arr' => Illuminate\Support\Arr::class, - 'Artisan' => Illuminate\Support\Facades\Artisan::class, - 'Auth' => Illuminate\Support\Facades\Auth::class, - 'Blade' => Illuminate\Support\Facades\Blade::class, - 'Broadcast' => Illuminate\Support\Facades\Broadcast::class, - 'Bus' => Illuminate\Support\Facades\Bus::class, - 'Cache' => Illuminate\Support\Facades\Cache::class, - 'Config' => Illuminate\Support\Facades\Config::class, - 'Cookie' => Illuminate\Support\Facades\Cookie::class, - 'Crypt' => Illuminate\Support\Facades\Crypt::class, + 'App' => Illuminate\Support\Facades\App::class, + 'Arr' => Illuminate\Support\Arr::class, + 'Artisan' => Illuminate\Support\Facades\Artisan::class, + 'Auth' => Illuminate\Support\Facades\Auth::class, + 'Blade' => Illuminate\Support\Facades\Blade::class, + 'Broadcast' => Illuminate\Support\Facades\Broadcast::class, + 'Bus' => Illuminate\Support\Facades\Bus::class, + 'Cache' => Illuminate\Support\Facades\Cache::class, + 'Config' => Illuminate\Support\Facades\Config::class, + 'Cookie' => Illuminate\Support\Facades\Cookie::class, + 'Crypt' => Illuminate\Support\Facades\Crypt::class, 'Date' => Illuminate\Support\Facades\Date::class, - 'DB' => Illuminate\Support\Facades\DB::class, - 'Eloquent' => Illuminate\Database\Eloquent\Model::class, - 'Event' => Illuminate\Support\Facades\Event::class, - 'File' => Illuminate\Support\Facades\File::class, - 'Gate' => Illuminate\Support\Facades\Gate::class, - 'Hash' => Illuminate\Support\Facades\Hash::class, + 'DB' => Illuminate\Support\Facades\DB::class, + 'Eloquent' => Illuminate\Database\Eloquent\Model::class, + 'Event' => Illuminate\Support\Facades\Event::class, + 'File' => Illuminate\Support\Facades\File::class, + 'Gate' => Illuminate\Support\Facades\Gate::class, + 'Hash' => Illuminate\Support\Facades\Hash::class, 'Http' => Illuminate\Support\Facades\Http::class, - 'Lang' => Illuminate\Support\Facades\Lang::class, - 'Log' => Illuminate\Support\Facades\Log::class, - 'Mail' => Illuminate\Support\Facades\Mail::class, + 'Lang' => Illuminate\Support\Facades\Lang::class, + 'Log' => Illuminate\Support\Facades\Log::class, + 'Mail' => Illuminate\Support\Facades\Mail::class, 'Notification' => Illuminate\Support\Facades\Notification::class, - 'Password' => Illuminate\Support\Facades\Password::class, - 'Queue' => Illuminate\Support\Facades\Queue::class, + 'Password' => Illuminate\Support\Facades\Password::class, + 'Queue' => Illuminate\Support\Facades\Queue::class, 'RateLimiter' => Illuminate\Support\Facades\RateLimiter::class, - 'Redirect' => Illuminate\Support\Facades\Redirect::class, + 'Redirect' => Illuminate\Support\Facades\Redirect::class, // 'Redis' => Illuminate\Support\Facades\Redis::class, - 'Request' => Illuminate\Support\Facades\Request::class, - 'Response' => Illuminate\Support\Facades\Response::class, - 'Route' => Illuminate\Support\Facades\Route::class, - 'Schema' => Illuminate\Support\Facades\Schema::class, - 'Session' => Illuminate\Support\Facades\Session::class, - 'Storage' => Illuminate\Support\Facades\Storage::class, - 'Str' => Illuminate\Support\Str::class, - 'URL' => Illuminate\Support\Facades\URL::class, - 'Validator' => Illuminate\Support\Facades\Validator::class, - 'View' => Illuminate\Support\Facades\View::class, + 'Request' => Illuminate\Support\Facades\Request::class, + 'Response' => Illuminate\Support\Facades\Response::class, + 'Route' => Illuminate\Support\Facades\Route::class, + 'Schema' => Illuminate\Support\Facades\Schema::class, + 'Session' => Illuminate\Support\Facades\Session::class, + 'Storage' => Illuminate\Support\Facades\Storage::class, + 'Str' => Illuminate\Support\Str::class, + 'URL' => Illuminate\Support\Facades\URL::class, + 'Validator' => Illuminate\Support\Facades\Validator::class, + 'View' => Illuminate\Support\Facades\View::class, //Added Facades - 'PDF' => Barryvdh\Snappy\Facades\SnappyPdf::class, + 'PDF' => Barryvdh\Snappy\Facades\SnappyPdf::class, 'SnappyImage' => Barryvdh\Snappy\Facades\SnappyImage::class, - 'Excel' => Maatwebsite\Excel\Facades\Excel::class, + 'Excel' => Maatwebsite\Excel\Facades\Excel::class, ], - ]; diff --git a/config/audit.php b/config/audit.php index 6a50a77d..908abc28 100644 --- a/config/audit.php +++ b/config/audit.php @@ -1,7 +1,6 @@ [ 'morph_prefix' => 'user', - 'guards' => [ - 'web', - 'sanctum', - ], + 'guards' => ['web', 'sanctum'], ], /* @@ -39,10 +35,10 @@ | */ 'resolver' => [ - 'user' => OwenIt\Auditing\Resolvers\UserResolver::class, + 'user' => OwenIt\Auditing\Resolvers\UserResolver::class, 'ip_address' => OwenIt\Auditing\Resolvers\IpAddressResolver::class, 'user_agent' => OwenIt\Auditing\Resolvers\UserAgentResolver::class, - 'url' => OwenIt\Auditing\Resolvers\UrlResolver::class, + 'url' => OwenIt\Auditing\Resolvers\UrlResolver::class, ], /* @@ -54,12 +50,7 @@ | */ - 'events' => [ - 'created', - 'updated', - 'deleted', - 'restored', - ], + 'events' => ['created', 'updated', 'deleted', 'restored'], /* |-------------------------------------------------------------------------- @@ -117,7 +108,7 @@ 'drivers' => [ 'database' => [ - 'table' => 'audits', + 'table' => 'audits', 'connection' => null, ], ], diff --git a/config/auth.php b/config/auth.php index 0dc88b39..c65fb73e 100644 --- a/config/auth.php +++ b/config/auth.php @@ -1,7 +1,6 @@ [ - 'guard' => 'web', + 'guard' => 'web', 'passwords' => 'users', ], @@ -37,7 +36,7 @@ 'guards' => [ 'web' => [ - 'driver' => 'session', + 'driver' => 'session', 'provider' => 'users', ], ], @@ -62,7 +61,7 @@ 'providers' => [ 'users' => [ 'driver' => 'eloquent', - 'model' => App\Models\User::class, + 'model' => App\Models\User::class, ], // 'users' => [ @@ -89,8 +88,8 @@ 'passwords' => [ 'users' => [ 'provider' => 'users', - 'table' => 'password_resets', - 'expire' => 60, + 'table' => 'password_resets', + 'expire' => 60, 'throttle' => 60, ], ], @@ -107,5 +106,4 @@ */ 'password_timeout' => 10800, - ]; diff --git a/config/broadcasting.php b/config/broadcasting.php index ee8dc041..cf0a4174 100644 --- a/config/broadcasting.php +++ b/config/broadcasting.php @@ -1,7 +1,6 @@ [ - 'pusher' => [ - 'driver' => 'pusher', - 'key' => env('PUSHER_APP_KEY'), - 'secret' => env('PUSHER_APP_SECRET'), - 'app_id' => env('PUSHER_APP_ID'), + 'driver' => 'pusher', + 'key' => env('PUSHER_APP_KEY'), + 'secret' => env('PUSHER_APP_SECRET'), + 'app_id' => env('PUSHER_APP_ID'), 'options' => [ 'cluster' => env('PUSHER_APP_CLUSTER'), 'useTLS' => true, @@ -47,7 +45,7 @@ ], 'redis' => [ - 'driver' => 'redis', + 'driver' => 'redis', 'connection' => 'default', ], @@ -58,7 +56,5 @@ 'null' => [ 'driver' => 'null', ], - ], - ]; diff --git a/config/cache.php b/config/cache.php index ff51df8d..b654e173 100644 --- a/config/cache.php +++ b/config/cache.php @@ -3,7 +3,6 @@ use Illuminate\Support\Str; return [ - /* |-------------------------------------------------------------------------- | Default Cache Store @@ -32,7 +31,6 @@ */ 'stores' => [ - 'apc' => [ 'driver' => 'apc', ], @@ -43,38 +41,35 @@ ], 'database' => [ - 'driver' => 'database', - 'table' => 'cache', + 'driver' => 'database', + 'table' => 'cache', 'connection' => null, 'lock_connection' => null, ], 'file' => [ 'driver' => 'file', - 'path' => storage_path('framework/cache/data'), + 'path' => storage_path('framework/cache/data'), ], 'memcached' => [ - 'driver' => 'memcached', + 'driver' => 'memcached', 'persistent_id' => env('MEMCACHED_PERSISTENT_ID'), - 'sasl' => [ - env('MEMCACHED_USERNAME'), - env('MEMCACHED_PASSWORD'), - ], + 'sasl' => [env('MEMCACHED_USERNAME'), env('MEMCACHED_PASSWORD')], 'options' => [ // Memcached::OPT_CONNECT_TIMEOUT => 2000, ], 'servers' => [ [ - 'host' => env('MEMCACHED_HOST', '127.0.0.1'), - 'port' => env('MEMCACHED_PORT', 11211), + 'host' => env('MEMCACHED_HOST', '127.0.0.1'), + 'port' => env('MEMCACHED_PORT', 11211), 'weight' => 100, ], ], ], 'redis' => [ - 'driver' => 'redis', + 'driver' => 'redis', 'connection' => 'cache', 'lock_connection' => 'default', ], @@ -91,7 +86,6 @@ 'octane' => [ 'driver' => 'octane', ], - ], /* @@ -105,6 +99,5 @@ | */ - 'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache'), - + 'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_') . '_cache'), ]; diff --git a/config/cors.php b/config/cors.php index 8a39e6da..9a2fcfb4 100644 --- a/config/cors.php +++ b/config/cors.php @@ -1,7 +1,6 @@ 0, 'supports_credentials' => false, - ]; diff --git a/config/database.php b/config/database.php index e337ad23..ed7682e1 100644 --- a/config/database.php +++ b/config/database.php @@ -3,7 +3,6 @@ use Illuminate\Support\Str; return [ - /* |-------------------------------------------------------------------------- | Default Database Connection Name @@ -34,7 +33,6 @@ */ 'connections' => [ - 'sqlite' => [ 'driver' => 'sqlite', 'url' => env('DATABASE_URL'), @@ -44,53 +42,54 @@ ], 'mysql' => [ - 'driver' => 'mysql', + 'driver' => 'mysql', 'url' => env('DATABASE_URL'), - 'host' => env('DB_HOST', '127.0.0.1'), - 'port' => env('DB_PORT', '3306'), - 'database' => env('DB_DATABASE', 'forge'), - 'username' => env('DB_USERNAME', 'forge'), - 'password' => env('DB_PASSWORD', ''), - 'unix_socket' => env('DB_SOCKET', ''), - 'charset' => 'utf8mb4', - 'collation' => 'utf8mb4_unicode_ci', - 'prefix' => '', + 'host' => env('DB_HOST', '127.0.0.1'), + 'port' => env('DB_PORT', '3306'), + 'database' => env('DB_DATABASE', 'forge'), + 'username' => env('DB_USERNAME', 'forge'), + 'password' => env('DB_PASSWORD', ''), + 'unix_socket' => env('DB_SOCKET', ''), + 'charset' => 'utf8mb4', + 'collation' => 'utf8mb4_unicode_ci', + 'prefix' => '', 'prefix_indexes' => true, - 'strict' => true, - 'engine' => null, - 'options' => extension_loaded('pdo_mysql') ? array_filter([ - PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'), - ]) : [], + 'strict' => true, + 'engine' => null, + 'options' => extension_loaded('pdo_mysql') + ? array_filter([ + PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'), + ]) + : [], ], 'pgsql' => [ - 'driver' => 'pgsql', + 'driver' => 'pgsql', 'url' => env('DATABASE_URL'), - 'host' => env('DB_HOST', '127.0.0.1'), - 'port' => env('DB_PORT', '5432'), - 'database' => env('DB_DATABASE', 'forge'), - 'username' => env('DB_USERNAME', 'forge'), - 'password' => env('DB_PASSWORD', ''), - 'charset' => 'utf8', - 'prefix' => '', + 'host' => env('DB_HOST', '127.0.0.1'), + 'port' => env('DB_PORT', '5432'), + 'database' => env('DB_DATABASE', 'forge'), + 'username' => env('DB_USERNAME', 'forge'), + 'password' => env('DB_PASSWORD', ''), + 'charset' => 'utf8', + 'prefix' => '', 'prefix_indexes' => true, - 'schema' => 'public', - 'sslmode' => 'prefer', + 'schema' => 'public', + 'sslmode' => 'prefer', ], 'sqlsrv' => [ - 'driver' => 'sqlsrv', + 'driver' => 'sqlsrv', 'url' => env('DATABASE_URL'), - 'host' => env('DB_HOST', 'localhost'), - 'port' => env('DB_PORT', '1433'), - 'database' => env('DB_DATABASE', 'forge'), - 'username' => env('DB_USERNAME', 'forge'), - 'password' => env('DB_PASSWORD', ''), - 'charset' => 'utf8', - 'prefix' => '', + 'host' => env('DB_HOST', 'localhost'), + 'port' => env('DB_PORT', '1433'), + 'database' => env('DB_DATABASE', 'forge'), + 'username' => env('DB_USERNAME', 'forge'), + 'password' => env('DB_PASSWORD', ''), + 'charset' => 'utf8', + 'prefix' => '', 'prefix_indexes' => true, ], - ], /* @@ -118,12 +117,11 @@ */ 'redis' => [ - 'client' => env('REDIS_CLIENT', 'phpredis'), 'options' => [ 'cluster' => env('REDIS_CLUSTER', 'redis'), - 'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'), + 'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_') . '_database_'), ], 'default' => [ @@ -141,7 +139,5 @@ 'port' => env('REDIS_PORT', '6379'), 'database' => env('REDIS_CACHE_DB', '1'), ], - ], - ]; diff --git a/config/debugbar.php b/config/debugbar.php index 5671d63e..97e14d80 100644 --- a/config/debugbar.php +++ b/config/debugbar.php @@ -1,7 +1,6 @@ [ - 'enabled' => true, - 'driver' => 'file', // redis, file, pdo, custom - 'path' => storage_path('debugbar'), // For file driver - 'connection' => null, // Leave null for default connection (Redis/PDO) - 'provider' => '', // Instance of StorageInterface for custom driver + 'enabled' => true, + 'driver' => 'file', // redis, file, pdo, custom + 'path' => storage_path('debugbar'), // For file driver + 'connection' => null, // Leave null for default connection (Redis/PDO) + 'provider' => '', // Instance of StorageInterface for custom driver ], /* @@ -61,7 +60,7 @@ | Optionally, you can also send ServerTiming headers on ajax requests for the Chrome DevTools. */ - 'capture_ajax' => true, + 'capture_ajax' => true, 'add_ajax_timing' => false, /* @@ -96,26 +95,26 @@ */ 'collectors' => [ - 'phpinfo' => true, // Php version - 'messages' => true, // Messages - 'time' => true, // Time Datalogger - 'memory' => true, // Memory usage - 'exceptions' => true, // Exception displayer - 'log' => true, // Logs from Monolog (merged in messages if enabled) - 'db' => true, // Show database (PDO) queries and bindings - 'views' => true, // Views with their data - 'route' => true, // Current route information - 'auth' => true, // Display Laravel authentication status - 'gate' => true, // Display Laravel Gate checks - 'session' => true, // Display session data - 'symfony_request' => true, // Only one can be enabled.. - 'mail' => true, // Catch mail messages - 'laravel' => false, // Laravel version and environment - 'events' => false, // All events fired + 'phpinfo' => true, // Php version + 'messages' => true, // Messages + 'time' => true, // Time Datalogger + 'memory' => true, // Memory usage + 'exceptions' => true, // Exception displayer + 'log' => true, // Logs from Monolog (merged in messages if enabled) + 'db' => true, // Show database (PDO) queries and bindings + 'views' => true, // Views with their data + 'route' => true, // Current route information + 'auth' => true, // Display Laravel authentication status + 'gate' => true, // Display Laravel Gate checks + 'session' => true, // Display session data + 'symfony_request' => true, // Only one can be enabled.. + 'mail' => true, // Catch mail messages + 'laravel' => false, // Laravel version and environment + 'events' => false, // All events fired 'default_request' => false, // Regular or special Symfony request logger - 'logs' => false, // Add the latest log messages - 'files' => false, // Show the included files - 'config' => false, // Display config settings + 'logs' => false, // Add the latest log messages + 'files' => false, // Show the included files + 'config' => false, // Display config settings ], /* @@ -129,26 +128,27 @@ 'options' => [ 'auth' => [ - 'show_name' => true, // Also show the users name/email in the debugbar + 'show_name' => true, // Also show the users name/email in the debugbar ], 'db' => [ - 'with_params' => true, // Render SQL with the parameters substituted - 'backtrace' => true, // Use a backtrace to find the origin of the query in your files. - 'timeline' => false, // Add the queries to the timeline - 'explain' => [ // Show EXPLAIN output on queries + 'with_params' => true, // Render SQL with the parameters substituted + 'backtrace' => true, // Use a backtrace to find the origin of the query in your files. + 'timeline' => false, // Add the queries to the timeline + 'explain' => [ + // Show EXPLAIN output on queries 'enabled' => false, - 'types' => ['SELECT'], // ['SELECT', 'INSERT', 'UPDATE', 'DELETE']; for MySQL 5.6.3+ + 'types' => ['SELECT'], // ['SELECT', 'INSERT', 'UPDATE', 'DELETE']; for MySQL 5.6.3+ ], - 'hints' => true, // Show hints for common mistakes + 'hints' => true, // Show hints for common mistakes ], 'mail' => [ 'full_log' => false, ], 'views' => [ - 'data' => false, //Note: Can slow down the application, because the data can be quite large.. + 'data' => false, //Note: Can slow down the application, because the data can be quite large.. ], 'route' => [ - 'label' => true, // show complete route on bar + 'label' => true, // show complete route on bar ], 'logs' => [ 'file' => null, diff --git a/config/filesystems.php b/config/filesystems.php index c8ef4298..590d2379 100644 --- a/config/filesystems.php +++ b/config/filesystems.php @@ -1,7 +1,6 @@ [ - 'local' => [ 'driver' => 'local', - 'root' => storage_path('app'), + 'root' => storage_path('app'), ], 'public' => [ - 'driver' => 'local', - 'root' => storage_path('app/public'), - 'url' => env('APP_URL').'/storage', + 'driver' => 'local', + 'root' => storage_path('app/public'), + 'url' => env('APP_URL') . '/storage', 'visibility' => 'public', ], 's3' => [ 'driver' => 's3', - 'key' => env('AWS_KEY'), + 'key' => env('AWS_KEY'), 'secret' => env('AWS_SECRET'), 'region' => env('AWS_REGION'), 'bucket' => env('AWS_BUCKET'), - 'url' => env('AWS_URL'), + 'url' => env('AWS_URL'), 'endpoint' => env('AWS_ENDPOINT'), 'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false), ], - ], /* @@ -69,5 +66,4 @@ 'links' => [ public_path('storage') => storage_path('app/public'), ], - ]; diff --git a/config/geoip.php b/config/geoip.php index 5f41256f..04d58a85 100644 --- a/config/geoip.php +++ b/config/geoip.php @@ -1,7 +1,6 @@ [ - 'maxmind_database' => [ - 'class' => \Torann\GeoIP\Services\MaxMindDatabase::class, + 'class' => \Torann\GeoIP\Services\MaxMindDatabase::class, 'database_path' => storage_path('app/geoip.mmdb'), - 'update_url' => 'https://geolite.maxmind.com/download/geoip/database/GeoLite2-City.mmdb.gz', - 'locales' => ['en'], + 'update_url' => 'https://geolite.maxmind.com/download/geoip/database/GeoLite2-City.mmdb.gz', + 'locales' => ['en'], ], 'maxmind_api' => [ - 'class' => \Torann\GeoIP\Services\MaxMindWebService::class, - 'user_id' => env('MAXMIND_USER_ID'), + 'class' => \Torann\GeoIP\Services\MaxMindWebService::class, + 'user_id' => env('MAXMIND_USER_ID'), 'license_key' => env('MAXMIND_LICENSE_KEY'), - 'locales' => ['en'], + 'locales' => ['en'], ], 'ipapi' => [ - 'class' => \Torann\GeoIP\Services\IPApi::class, - 'secure' => true, - 'key' => env('IPAPI_KEY'), + 'class' => \Torann\GeoIP\Services\IPApi::class, + 'secure' => true, + 'key' => env('IPAPI_KEY'), 'continent_path' => storage_path('app/continents.json'), - 'lang' => 'en', + 'lang' => 'en', ], 'ipgeolocation' => [ - 'class' => \Torann\GeoIP\Services\IPGeoLocation::class, - 'secure' => true, - 'key' => env('IPGEOLOCATION_KEY'), + 'class' => \Torann\GeoIP\Services\IPGeoLocation::class, + 'secure' => true, + 'key' => env('IPGEOLOCATION_KEY'), 'continent_path' => storage_path('app/continents.json'), - 'lang' => 'en', + 'lang' => 'en', ], 'ipdata' => [ - 'class' => \Torann\GeoIP\Services\IPData::class, - 'key' => env('IPDATA_API_KEY'), + 'class' => \Torann\GeoIP\Services\IPData::class, + 'key' => env('IPDATA_API_KEY'), 'secure' => true, ], - ], /* @@ -140,19 +137,18 @@ */ 'default_location' => [ - 'ip' => '127.0.0.0', - 'iso_code' => 'NekoC', - 'country' => 'NekoCountry', - 'city' => 'Invoice Neko', - 'state' => '', - 'state_name' => 'Poowf Labs', + 'ip' => '127.0.0.0', + 'iso_code' => 'NekoC', + 'country' => 'NekoCountry', + 'city' => 'Invoice Neko', + 'state' => '', + 'state_name' => 'Poowf Labs', 'postal_code' => 'Poowf', - 'lat' => 1.31, - 'lon' => 103.77, - 'timezone' => 'Asia/NekoCountry', - 'continent' => 'NA', - 'default' => true, - 'currency' => 'NekoCoin', + 'lat' => 1.31, + 'lon' => 103.77, + 'timezone' => 'Asia/NekoCountry', + 'continent' => 'NA', + 'default' => true, + 'currency' => 'NekoCoin', ], - ]; diff --git a/config/google2fa.php b/config/google2fa.php index f55efd65..8fb90abb 100644 --- a/config/google2fa.php +++ b/config/google2fa.php @@ -1,7 +1,6 @@ true, - ]; diff --git a/config/hashing.php b/config/hashing.php index 5b10c09d..a5ffb283 100644 --- a/config/hashing.php +++ b/config/hashing.php @@ -1,7 +1,6 @@ [ - 'memory' => 1024, + 'memory' => 1024, 'threads' => 2, - 'time' => 2, + 'time' => 2, ], - ]; diff --git a/config/horizon.php b/config/horizon.php index ec7b38d1..ffeeeca2 100644 --- a/config/horizon.php +++ b/config/horizon.php @@ -1,7 +1,6 @@ [ 'supervisor-1' => [ 'connection' => 'redis', - 'queue' => ['default'], - 'balance' => 'simple', - 'processes' => 10, - 'tries' => 3, + 'queue' => ['default'], + 'balance' => 'simple', + 'processes' => 10, + 'tries' => 3, ], ], 'local' => [ 'supervisor-1' => [ 'connection' => 'redis', - 'queue' => ['default'], - 'balance' => 'simple', - 'processes' => 3, - 'tries' => 3, + 'queue' => ['default'], + 'balance' => 'simple', + 'processes' => 3, + 'tries' => 3, ], ], ], diff --git a/config/image.php b/config/image.php index 67983819..7c2f5b5c 100644 --- a/config/image.php +++ b/config/image.php @@ -1,7 +1,6 @@ 'gd', - ]; diff --git a/config/larametrics.php b/config/larametrics.php index e825ce1c..565fc422 100644 --- a/config/larametrics.php +++ b/config/larametrics.php @@ -1,7 +1,6 @@ [ - 'App\Models\User', - ], + 'modelsWatched' => ['App\Models\User'], /* |-------------------------------------------------------------------------- @@ -147,5 +144,4 @@ 'email' => env('LARAMETRICS_NOTIFICATION_EMAIL', 'admin@localhost'), 'slack' => env('LARAMETRICS_NOTIFICATION_SLACK_WEBHOOK', ''), ], - ]; diff --git a/config/larecipe.php b/config/larecipe.php index 20c6803f..af9cf6f5 100644 --- a/config/larecipe.php +++ b/config/larecipe.php @@ -13,9 +13,9 @@ | */ - 'docs' => [ - 'route' => '/docs', - 'path' => '/resources/docs', + 'docs' => [ + 'route' => '/docs', + 'path' => '/resources/docs', 'landing' => 'requirements', ], @@ -31,11 +31,9 @@ | */ - 'versions' => [ - 'default' => '1.0', - 'published' => [ - '1.0', - ], + 'versions' => [ + 'default' => '1.0', + 'published' => ['1.0'], ], /* @@ -51,7 +49,7 @@ */ 'settings' => [ - 'auth' => false, + 'auth' => false, 'ga_id' => '', ], @@ -68,9 +66,9 @@ | */ - 'cache' => [ + 'cache' => [ 'enabled' => true, - 'period' => 360, + 'period' => 360, ], /* @@ -86,12 +84,12 @@ | */ - 'search' => [ - 'enabled' => false, - 'default' => 'algolia', - 'engines' => [ - 'algolia' => [ - 'key' => '', + 'search' => [ + 'enabled' => false, + 'default' => 'algolia', + 'engines' => [ + 'algolia' => [ + 'key' => '', 'index' => '', ], ], @@ -109,9 +107,9 @@ | */ - 'repository' => [ + 'repository' => [ 'provider' => 'github', - 'url' => 'https://github.com/poowf/invoiceneko', + 'url' => 'https://github.com/poowf/invoiceneko', ], /* @@ -127,23 +125,23 @@ | */ - 'ui' => [ - 'show_app_name' => true, - 'logo' => '/assets/img/logo.svg', // e.g.: /images/logo.svg - 'fav' => '/favicon.ico', // e.g.: /fav.png - 'theme' => 'dark', - 'code' => 'dark', - 'back_to_top' => true, - 'show_side_bar' => true, - 'colors' => [ - 'primary' => '#4da6a6', - 'secondary' => '#585454', - 'selection' => '#dce3e6', + 'ui' => [ + 'show_app_name' => true, + 'logo' => '/assets/img/logo.svg', // e.g.: /images/logo.svg + 'fav' => '/favicon.ico', // e.g.: /fav.png + 'theme' => 'dark', + 'code' => 'dark', + 'back_to_top' => true, + 'show_side_bar' => true, + 'colors' => [ + 'primary' => '#4da6a6', + 'secondary' => '#585454', + 'selection' => '#dce3e6', ], 'additional_css' => [ //'css/custom.css', ], - 'additional_js' => [ + 'additional_js' => [ //'js/custom.js', ], ], @@ -160,15 +158,15 @@ | */ - 'seo' => [ - 'author' => '', - 'description' => '', - 'keywords' => '', - 'og' => [ - 'title' => '', - 'type' => 'article', - 'url' => '', - 'image' => '', + 'seo' => [ + 'author' => '', + 'description' => '', + 'keywords' => '', + 'og' => [ + 'title' => '', + 'type' => 'article', + 'url' => '', + 'image' => '', 'description' => '', ], ], @@ -186,11 +184,11 @@ | */ - 'forum' => [ - 'enabled' => true, - 'default' => 'disqus', - 'services' => [ - 'disqus' => [ + 'forum' => [ + 'enabled' => true, + 'default' => 'disqus', + 'services' => [ + 'disqus' => [ 'site_name' => 'invoiceneko', // yoursite.disqus.com ], ], diff --git a/config/logging.php b/config/logging.php index 41bce5bb..fa2f3c92 100644 --- a/config/logging.php +++ b/config/logging.php @@ -5,7 +5,6 @@ use Monolog\Handler\SyslogUdpHandler; return [ - /* |-------------------------------------------------------------------------- | Default Log Channel @@ -36,44 +35,44 @@ 'channels' => [ 'stack' => [ - 'driver' => 'stack', + 'driver' => 'stack', 'channels' => ['rollbar', 'single'], 'ignore_exceptions' => false, ], 'single' => [ 'driver' => 'single', - 'path' => storage_path('logs/laravel.log'), + 'path' => storage_path('logs/laravel.log'), 'level' => env('LOG_LEVEL', 'debug'), ], 'daily' => [ 'driver' => 'daily', - 'path' => storage_path('logs/laravel.log'), + 'path' => storage_path('logs/laravel.log'), 'level' => env('LOG_LEVEL', 'debug'), - 'days' => 14, + 'days' => 14, ], 'rollbar' => [ - 'driver' => 'monolog', - 'handler' => \Rollbar\Laravel\MonologHandler::class, + 'driver' => 'monolog', + 'handler' => \Rollbar\Laravel\MonologHandler::class, 'access_token' => env('ROLLBAR_TOKEN'), - 'level' => env('LOG_LEVEL', 'debug'), - 'person_fn' => 'auth()->user()', + 'level' => env('LOG_LEVEL', 'debug'), + 'person_fn' => 'auth()->user()', ], 'slack' => [ - 'driver' => 'slack', - 'url' => env('LOG_SLACK_WEBHOOK_URL'), + 'driver' => 'slack', + 'url' => env('LOG_SLACK_WEBHOOK_URL'), 'username' => 'Laravel Log', - 'emoji' => ':boom:', - 'level' => env('LOG_LEVEL', 'critical'), + 'emoji' => ':boom:', + 'level' => env('LOG_LEVEL', 'critical'), ], 'papertrail' => [ - 'driver' => 'monolog', - 'level' => env('LOG_LEVEL', 'debug'), - 'handler' => SyslogUdpHandler::class, + 'driver' => 'monolog', + 'level' => env('LOG_LEVEL', 'debug'), + 'handler' => SyslogUdpHandler::class, 'handler_with' => [ 'host' => env('PAPERTRAIL_URL'), 'port' => env('PAPERTRAIL_PORT'), @@ -81,10 +80,10 @@ ], 'stderr' => [ - 'driver' => 'monolog', + 'driver' => 'monolog', 'level' => env('LOG_LEVEL', 'debug'), 'handler' => StreamHandler::class, - 'with' => [ + 'with' => [ 'stream' => 'php://stderr', ], ], @@ -108,5 +107,4 @@ 'path' => storage_path('logs/laravel.log'), ], ], - ]; diff --git a/config/mail.php b/config/mail.php index 10961e3a..d1915e8c 100644 --- a/config/mail.php +++ b/config/mail.php @@ -1,7 +1,6 @@ [ 'transport' => 'failover', - 'mailers' => [ - 'smtp', - 'log', - ], + 'mailers' => ['smtp', 'log'], ], ], @@ -93,7 +89,7 @@ 'from' => [ 'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'), - 'name' => env('MAIL_FROM_NAME', 'Example'), + 'name' => env('MAIL_FROM_NAME', 'Example'), ], /* @@ -110,9 +106,6 @@ 'markdown' => [ 'theme' => 'invoiceneko', - 'paths' => [ - resource_path('views/vendor/mail'), - ], + 'paths' => [resource_path('views/vendor/mail')], ], - ]; diff --git a/config/no-captcha.php b/config/no-captcha.php index 690e34b0..75ebe334 100644 --- a/config/no-captcha.php +++ b/config/no-captcha.php @@ -1,13 +1,12 @@ env('NOCAPTCHA_SECRET', 'no-captcha-secret'), + 'secret' => env('NOCAPTCHA_SECRET', 'no-captcha-secret'), 'sitekey' => env('NOCAPTCHA_SITEKEY', 'no-captcha-sitekey'), /* ----------------------------------------------------------------- @@ -24,8 +23,7 @@ 'attributes' => [ 'data-theme' => 'light', // 'light', 'dark' - 'data-type' => 'image', // 'image', 'audio' - 'data-size' => 'normal', // 'normal', 'compact' + 'data-type' => 'image', // 'image', 'audio' + 'data-size' => 'normal', // 'normal', 'compact' ], - ]; diff --git a/config/otter.php b/config/otter.php index b2e58bdb..10b82f79 100644 --- a/config/otter.php +++ b/config/otter.php @@ -1,7 +1,6 @@ [ - 'name' => 'full_name', + 'name' => 'full_name', 'email' => 'email', ], ]; diff --git a/config/queue.php b/config/queue.php index 98099c76..e0644aa1 100644 --- a/config/queue.php +++ b/config/queue.php @@ -1,7 +1,6 @@ [ - 'sync' => [ 'driver' => 'sync', ], 'database' => [ - 'driver' => 'database', - 'table' => 'jobs', - 'queue' => 'default', + 'driver' => 'database', + 'table' => 'jobs', + 'queue' => 'default', 'retry_after' => 90, 'after_commit' => false, ], 'beanstalkd' => [ - 'driver' => 'beanstalkd', - 'host' => 'localhost', - 'queue' => 'default', + 'driver' => 'beanstalkd', + 'host' => 'localhost', + 'queue' => 'default', 'retry_after' => 90, 'block_for' => 0, 'after_commit' => false, @@ -63,14 +61,13 @@ ], 'redis' => [ - 'driver' => 'redis', - 'connection' => 'default', - 'queue' => 'default', + 'driver' => 'redis', + 'connection' => 'default', + 'queue' => 'default', 'retry_after' => 90, - 'block_for' => null, + 'block_for' => null, 'after_commit' => false, ], - ], /* @@ -87,7 +84,6 @@ 'failed' => [ 'driver' => env('QUEUE_FAILED_DRIVER', 'database-uuids'), 'database' => env('DB_CONNECTION', 'mysql'), - 'table' => 'failed_jobs', + 'table' => 'failed_jobs', ], - ]; diff --git a/config/sanctum.php b/config/sanctum.php index 442726a7..47494cd6 100644 --- a/config/sanctum.php +++ b/config/sanctum.php @@ -1,7 +1,6 @@ explode(',', env('SANCTUM_STATEFUL_DOMAINS', sprintf( - '%s%s', - 'localhost,localhost:3000,127.0.0.1,127.0.0.1:8000,::1', - env('APP_URL') ? ','.parse_url(env('APP_URL'), PHP_URL_HOST) : '' - ))), + 'stateful' => explode( + ',', + env( + 'SANCTUM_STATEFUL_DOMAINS', + sprintf( + '%s%s', + 'localhost,localhost:3000,127.0.0.1,127.0.0.1:8000,::1', + env('APP_URL') ? ',' . parse_url(env('APP_URL'), PHP_URL_HOST) : '', + ), + ), + ), /* |-------------------------------------------------------------------------- @@ -47,5 +52,4 @@ 'verify_csrf_token' => App\Http\Middleware\VerifyCsrfToken::class, 'encrypt_cookies' => App\Http\Middleware\EncryptCookies::class, ], - ]; diff --git a/config/services.php b/config/services.php index 32ac7002..4b0eb934 100644 --- a/config/services.php +++ b/config/services.php @@ -1,7 +1,6 @@ [ - 'client_id' => env('SOCIALITE_FACEBOOK_CLIENTID'), + 'client_id' => env('SOCIALITE_FACEBOOK_CLIENTID'), 'client_secret' => env('SOCIALITE_FACEBOOK_SECRET'), - 'redirect' => env('SOCIALITE_FACEBOOK_REDIRECT'), + 'redirect' => env('SOCIALITE_FACEBOOK_REDIRECT'), ], 'google' => [ - 'client_id' => env('SOCIALITE_GOOGLE_CLIENTID'), + 'client_id' => env('SOCIALITE_GOOGLE_CLIENTID'), 'client_secret' => env('SOCIALITE_GOOGLE_SECRET'), - 'redirect' => env('SOCIALITE_GOOGLE_REDIRECT'), + 'redirect' => env('SOCIALITE_GOOGLE_REDIRECT'), ], - ]; diff --git a/config/session.php b/config/session.php index dd900e15..6bcdccc6 100644 --- a/config/session.php +++ b/config/session.php @@ -3,7 +3,6 @@ use Illuminate\Support\Str; return [ - /* |-------------------------------------------------------------------------- | Default Session Driver @@ -126,10 +125,7 @@ | */ - 'cookie' => env( - 'SESSION_COOKIE', - Str::slug(env('APP_NAME', 'laravel'), '_').'_session' - ), + 'cookie' => env('SESSION_COOKIE', Str::slug(env('APP_NAME', 'laravel'), '_') . '_session'), /* |-------------------------------------------------------------------------- @@ -197,5 +193,4 @@ */ 'same_site' => 'lax', - ]; diff --git a/config/snappy.php b/config/snappy.php index b0b54a3d..08d3ba21 100644 --- a/config/snappy.php +++ b/config/snappy.php @@ -1,26 +1,24 @@ [ 'enabled' => true, - 'binary' => '/usr/bin/xvfb-run -a /usr/bin/wkhtmltopdf', + 'binary' => '/usr/bin/xvfb-run -a /usr/bin/wkhtmltopdf', 'timeout' => false, 'options' => [ 'enable-local-file-access' => true, - 'encoding' => 'UTF-8', + 'encoding' => 'UTF-8', ], - 'env' => [], + 'env' => [], ], 'image' => [ 'enabled' => true, - 'binary' => '/usr/bin/xvfb-run -a /usr/bin/wkhtmltoimage', + 'binary' => '/usr/bin/xvfb-run -a /usr/bin/wkhtmltoimage', 'timeout' => false, 'options' => [ 'enable-local-file-access' => true, - 'encoding' => 'UTF-8', + 'encoding' => 'UTF-8', ], - 'env' => [], + 'env' => [], ], - ]; diff --git a/config/telescope.php b/config/telescope.php index d31c3739..c657b364 100644 --- a/config/telescope.php +++ b/config/telescope.php @@ -4,7 +4,6 @@ use Laravel\Telescope\Watchers; return [ - 'path' => 'telescope', /* @@ -50,10 +49,7 @@ | */ - 'middleware' => [ - 'web', - Authorize::class, - ], + 'middleware' => ['web', Authorize::class], /* |-------------------------------------------------------------------------- @@ -90,40 +86,40 @@ Watchers\CommandWatcher::class => [ 'enabled' => env('TELESCOPE_COMMAND_WATCHER', true), - 'ignore' => [], + 'ignore' => [], ], - Watchers\DumpWatcher::class => env('TELESCOPE_DUMP_WATCHER', true), - Watchers\EventWatcher::class => env('TELESCOPE_EVENT_WATCHER', true), + Watchers\DumpWatcher::class => env('TELESCOPE_DUMP_WATCHER', true), + Watchers\EventWatcher::class => env('TELESCOPE_EVENT_WATCHER', true), Watchers\ExceptionWatcher::class => env('TELESCOPE_EXCEPTION_WATCHER', true), - Watchers\JobWatcher::class => env('TELESCOPE_JOB_WATCHER', true), - Watchers\LogWatcher::class => env('TELESCOPE_LOG_WATCHER', true), - Watchers\MailWatcher::class => env('TELESCOPE_MAIL_WATCHER', true), + Watchers\JobWatcher::class => env('TELESCOPE_JOB_WATCHER', true), + Watchers\LogWatcher::class => env('TELESCOPE_LOG_WATCHER', true), + Watchers\MailWatcher::class => env('TELESCOPE_MAIL_WATCHER', true), Watchers\ModelWatcher::class => [ 'enabled' => env('TELESCOPE_MODEL_WATCHER', true), - 'events' => ['eloquent.*'], + 'events' => ['eloquent.*'], ], Watchers\NotificationWatcher::class => env('TELESCOPE_NOTIFICATION_WATCHER', true), Watchers\QueryWatcher::class => [ - 'enabled' => env('TELESCOPE_QUERY_WATCHER', true), + 'enabled' => env('TELESCOPE_QUERY_WATCHER', true), 'ignore_packages' => true, - 'slow' => 100, + 'slow' => 100, ], Watchers\RedisWatcher::class => env('TELESCOPE_REDIS_WATCHER', true), Watchers\RequestWatcher::class => [ - 'enabled' => env('TELESCOPE_REQUEST_WATCHER', true), + 'enabled' => env('TELESCOPE_REQUEST_WATCHER', true), 'size_limit' => env('TELESCOPE_RESPONSE_SIZE_LIMIT', 64), ], Watchers\GateWatcher::class => [ - 'enabled' => env('TELESCOPE_GATE_WATCHER', true), + 'enabled' => env('TELESCOPE_GATE_WATCHER', true), 'ignore_abilities' => [], - 'ignore_packages' => true, + 'ignore_packages' => true, ], Watchers\ScheduleWatcher::class => env('TELESCOPE_SCHEDULE_WATCHER', true), diff --git a/config/view.php b/config/view.php index 2acfd9cc..5420f125 100644 --- a/config/view.php +++ b/config/view.php @@ -1,7 +1,6 @@ [ - resource_path('views'), - ], + 'paths' => [resource_path('views')], /* |-------------------------------------------------------------------------- @@ -29,5 +26,4 @@ */ 'compiled' => realpath(storage_path('framework/views')), - ]; diff --git a/database/factories/ClientFactory.php b/database/factories/ClientFactory.php index 72c132b9..05b8a192 100644 --- a/database/factories/ClientFactory.php +++ b/database/factories/ClientFactory.php @@ -24,23 +24,23 @@ class ClientFactory extends Factory public function definition() { return [ - 'companyname' => $this->faker->company, - 'phone' => '+659'.$this->faker->numberBetween($min = 0, $max = 8).$this->faker->randomNumber(6, true), - 'block' => $this->faker->buildingNumber, - 'street' => $this->faker->streetName, - 'unitnumber' => $this->faker->buildingNumber, - 'postalcode' => $this->faker->postcode, - 'country_code' => $this->faker->countryCode, - 'nickname' => $this->faker->name, - 'crn' => $this->faker->ean8, - 'website' => $this->faker->url, + 'companyname' => $this->faker->company, + 'phone' => '+659' . $this->faker->numberBetween($min = 0, $max = 8) . $this->faker->randomNumber(6, true), + 'block' => $this->faker->buildingNumber, + 'street' => $this->faker->streetName, + 'unitnumber' => $this->faker->buildingNumber, + 'postalcode' => $this->faker->postcode, + 'country_code' => $this->faker->countryCode, + 'nickname' => $this->faker->name, + 'crn' => $this->faker->ean8, + 'website' => $this->faker->url, 'contactsalutation' => $this->faker->title, - 'contactfirstname' => $this->faker->firstName, - 'contactlastname' => $this->faker->lastName, - 'contactgender' => 'male', - 'contactemail' => $this->faker->unique()->companyEmail, - 'contactphone' => '+658'.$this->faker->numberBetween($min = 1, $max = 8).$this->faker->randomNumber(6, true), - 'company_id' => function () { + 'contactfirstname' => $this->faker->firstName, + 'contactlastname' => $this->faker->lastName, + 'contactgender' => 'male', + 'contactemail' => $this->faker->unique()->companyEmail, + 'contactphone' => '+658' . $this->faker->numberBetween($min = 1, $max = 8) . $this->faker->randomNumber(6, true), + 'company_id' => function () { return Company::factory()->create()->id; }, ]; @@ -54,8 +54,7 @@ public function definition() public function unverified() { return $this->state(function (array $attributes) { - return [ - ]; + return []; }); } } diff --git a/database/factories/CompanyAddressFactory.php b/database/factories/CompanyAddressFactory.php index 81b6f631..53634a11 100644 --- a/database/factories/CompanyAddressFactory.php +++ b/database/factories/CompanyAddressFactory.php @@ -24,12 +24,12 @@ class CompanyAddressFactory extends Factory public function definition() { return [ - 'block' => $this->faker->buildingNumber, - 'street' => $this->faker->streetName, - 'unitnumber' => $this->faker->buildingNumber, - 'postalcode' => $this->faker->postcode, + 'block' => $this->faker->buildingNumber, + 'street' => $this->faker->streetName, + 'unitnumber' => $this->faker->buildingNumber, + 'postalcode' => $this->faker->postcode, 'buildingtype' => $this->faker->numberBetween($min = 1, $max = 2), - 'company_id' => function () { + 'company_id' => function () { return Company::factory()->create()->id; }, ]; @@ -43,8 +43,7 @@ public function definition() public function unverified() { return $this->state(function (array $attributes) { - return [ - ]; + return []; }); } } diff --git a/database/factories/CompanyFactory.php b/database/factories/CompanyFactory.php index 2622c3a7..02eecd1a 100644 --- a/database/factories/CompanyFactory.php +++ b/database/factories/CompanyFactory.php @@ -24,17 +24,18 @@ class CompanyFactory extends Factory public function definition() { return [ - 'name' => $this->faker->company, + 'name' => $this->faker->company, 'invoice_index' => $this->faker->randomDigit, - 'quote_index' => $this->faker->randomDigit, - 'slug' => $this->faker->slug, - 'domain_name' => Str::random($this->faker->numberBetween($min = 1, $max = 63)).$this->faker->randomElement(['.com', '.net', '.org']), - 'crn' => $this->faker->ean8, - 'country_code' => $this->faker->countryCode, - 'timezone' => $this->faker->timezone, - 'phone' => '+659'.$this->faker->numberBetween($min = 0, $max = 8).$this->faker->randomNumber(6, true), - 'email' => $this->faker->unique()->companyEmail, - 'user_id' => function () { + 'quote_index' => $this->faker->randomDigit, + 'slug' => $this->faker->slug, + 'domain_name' => + Str::random($this->faker->numberBetween($min = 1, $max = 63)) . $this->faker->randomElement(['.com', '.net', '.org']), + 'crn' => $this->faker->ean8, + 'country_code' => $this->faker->countryCode, + 'timezone' => $this->faker->timezone, + 'phone' => '+659' . $this->faker->numberBetween($min = 0, $max = 8) . $this->faker->randomNumber(6, true), + 'email' => $this->faker->unique()->companyEmail, + 'user_id' => function () { return User::factory()->create()->id; }, ]; @@ -48,8 +49,7 @@ public function definition() public function unverified() { return $this->state(function (array $attributes) { - return [ - ]; + return []; }); } } diff --git a/database/factories/CompanySettingFactory.php b/database/factories/CompanySettingFactory.php index 28431a4c..374f2716 100644 --- a/database/factories/CompanySettingFactory.php +++ b/database/factories/CompanySettingFactory.php @@ -24,12 +24,12 @@ class CompanySettingFactory extends Factory public function definition() { return [ - 'invoice_prefix' => $this->faker->domainWord, - 'quote_prefix' => $this->faker->domainWord, + 'invoice_prefix' => $this->faker->domainWord, + 'quote_prefix' => $this->faker->domainWord, 'invoice_conditions' => $this->faker->realText($maxNbChars = 200, $indexSize = 2), - 'quote_conditions' => $this->faker->realText($maxNbChars = 200, $indexSize = 2), - 'tax' => $this->faker->numberBetween($min = 1, $max = 100), - 'company_id' => function () { + 'quote_conditions' => $this->faker->realText($maxNbChars = 200, $indexSize = 2), + 'tax' => $this->faker->numberBetween($min = 1, $max = 100), + 'company_id' => function () { return Company::factory()->create()->id; }, ]; @@ -43,8 +43,7 @@ public function definition() public function unverified() { return $this->state(function (array $attributes) { - return [ - ]; + return []; }); } } diff --git a/database/factories/CompanyUserRequestFactory.php b/database/factories/CompanyUserRequestFactory.php index 938cceaa..93fa65e0 100644 --- a/database/factories/CompanyUserRequestFactory.php +++ b/database/factories/CompanyUserRequestFactory.php @@ -24,11 +24,11 @@ class CompanyUserRequestFactory extends Factory public function definition() { return [ - 'full_name' => $this->faker->name, - 'email' => $this->faker->unique()->safeEmail, - 'phone' => '+658'.$this->faker->numberBetween($min = 1, $max = 8).$this->faker->randomNumber(6, true), - 'token' => Str::random(10), - 'status' => $this->faker->numberBetween($min = 1, $max = 3), + 'full_name' => $this->faker->name, + 'email' => $this->faker->unique()->safeEmail, + 'phone' => '+658' . $this->faker->numberBetween($min = 1, $max = 8) . $this->faker->randomNumber(6, true), + 'token' => Str::random(10), + 'status' => $this->faker->numberBetween($min = 1, $max = 3), 'company_id' => function () { return Company::factory()->create()->id; }, @@ -43,8 +43,7 @@ public function definition() public function unverified() { return $this->state(function (array $attributes) { - return [ - ]; + return []; }); } } diff --git a/database/factories/InvoiceFactory.php b/database/factories/InvoiceFactory.php index 034e83f0..b63fc644 100644 --- a/database/factories/InvoiceFactory.php +++ b/database/factories/InvoiceFactory.php @@ -25,16 +25,16 @@ class InvoiceFactory extends Factory public function definition() { return [ - 'nice_invoice_id' => substr($this->faker->slug, 0, 20).'sasdf', - 'date' => $this->faker->dateTime, - 'duedate' => $this->faker->dateTime, - 'netdays' => $this->faker->numberBetween($min = 1, $max = 60), - 'total' => $this->faker->randomFloat($nbMaxDecimals = 2, $min = 0, $max = 999999999999999.99), - 'share_token' => $this->faker->uuid, - 'status' => $this->faker->numberBetween($min = 1, $max = 7), - 'archived' => $this->faker->boolean, - 'notify' => $this->faker->boolean, - 'client_id' => function () { + 'nice_invoice_id' => substr($this->faker->slug, 0, 20) . 'sasdf', + 'date' => $this->faker->dateTime, + 'duedate' => $this->faker->dateTime, + 'netdays' => $this->faker->numberBetween($min = 1, $max = 60), + 'total' => $this->faker->randomFloat($nbMaxDecimals = 2, $min = 0, $max = 999999999999999.99), + 'share_token' => $this->faker->uuid, + 'status' => $this->faker->numberBetween($min = 1, $max = 7), + 'archived' => $this->faker->boolean, + 'notify' => $this->faker->boolean, + 'client_id' => function () { return Client::factory()->create()->id; }, 'company_id' => function () { @@ -51,8 +51,7 @@ public function definition() public function unverified() { return $this->state(function (array $attributes) { - return [ - ]; + return []; }); } } diff --git a/database/factories/InvoiceItemFactory.php b/database/factories/InvoiceItemFactory.php index 883f5815..9f5d20b0 100644 --- a/database/factories/InvoiceItemFactory.php +++ b/database/factories/InvoiceItemFactory.php @@ -24,11 +24,11 @@ class InvoiceItemFactory extends Factory public function definition() { return [ - 'name' => $this->faker->bs(), - 'quantity' => $this->faker->numberBetween($min = 1, $max = 999999999), - 'price' => $this->faker->randomFloat($nbMaxDecimals = 2, $min = 0, $max = 999999999999), + 'name' => $this->faker->bs(), + 'quantity' => $this->faker->numberBetween($min = 1, $max = 999999999), + 'price' => $this->faker->randomFloat($nbMaxDecimals = 2, $min = 0, $max = 999999999999), 'description' => $this->faker->text(200), - 'invoice_id' => function () { + 'invoice_id' => function () { return Invoice::factory()->create()->id; }, ]; @@ -42,8 +42,7 @@ public function definition() public function unverified() { return $this->state(function (array $attributes) { - return [ - ]; + return []; }); } } diff --git a/database/factories/InvoiceItemTemplateFactory.php b/database/factories/InvoiceItemTemplateFactory.php index 1519f8e9..9a9fd5ab 100644 --- a/database/factories/InvoiceItemTemplateFactory.php +++ b/database/factories/InvoiceItemTemplateFactory.php @@ -24,10 +24,10 @@ class InvoiceItemTemplateFactory extends Factory public function definition() { return [ - 'name' => $this->faker->bs(), - 'quantity' => $this->faker->numberBetween($min = 1, $max = 999999999), - 'price' => $this->faker->randomFloat($nbMaxDecimals = 2, $min = 0, $max = 999999999999), - 'description' => $this->faker->text(200), + 'name' => $this->faker->bs(), + 'quantity' => $this->faker->numberBetween($min = 1, $max = 999999999), + 'price' => $this->faker->randomFloat($nbMaxDecimals = 2, $min = 0, $max = 999999999999), + 'description' => $this->faker->text(200), 'invoice_template_id' => function () { return InvoiceTemplate::factory()->create()->id; }, @@ -42,8 +42,7 @@ public function definition() public function unverified() { return $this->state(function (array $attributes) { - return [ - ]; + return []; }); } } diff --git a/database/factories/InvoiceRecurrenceFactory.php b/database/factories/InvoiceRecurrenceFactory.php index 5ad90580..bd25b823 100644 --- a/database/factories/InvoiceRecurrenceFactory.php +++ b/database/factories/InvoiceRecurrenceFactory.php @@ -25,11 +25,11 @@ public function definition() { return [ 'time_interval' => '3', - 'time_period' => 'week', - 'until_type' => 'date', - 'until_meta' => '2020-10-31 00:00:00', - 'rule' => 'FREQ=WEEKLY;UNTIL=20201031T000000;INTERVAL=3', - 'company_id' => function () { + 'time_period' => 'week', + 'until_type' => 'date', + 'until_meta' => '2020-10-31 00:00:00', + 'rule' => 'FREQ=WEEKLY;UNTIL=20201031T000000;INTERVAL=3', + 'company_id' => function () { return Company::factory()->create()->id; }, ]; @@ -43,8 +43,7 @@ public function definition() public function unverified() { return $this->state(function (array $attributes) { - return [ - ]; + return []; }); } } diff --git a/database/factories/InvoiceTemplateFactory.php b/database/factories/InvoiceTemplateFactory.php index 6cd3509e..332c81db 100644 --- a/database/factories/InvoiceTemplateFactory.php +++ b/database/factories/InvoiceTemplateFactory.php @@ -25,9 +25,9 @@ class InvoiceTemplateFactory extends Factory public function definition() { return [ - 'date' => $this->faker->dateTime, - 'netdays' => $this->faker->numberBetween($min = 1, $max = 60), - 'notify' => $this->faker->boolean, + 'date' => $this->faker->dateTime, + 'netdays' => $this->faker->numberBetween($min = 1, $max = 60), + 'notify' => $this->faker->boolean, 'client_id' => function () { return Client::factory()->create()->id; }, @@ -45,8 +45,7 @@ public function definition() public function unverified() { return $this->state(function (array $attributes) { - return [ - ]; + return []; }); } } diff --git a/database/factories/ItemTemplateFactory.php b/database/factories/ItemTemplateFactory.php index ad984575..904efb5b 100644 --- a/database/factories/ItemTemplateFactory.php +++ b/database/factories/ItemTemplateFactory.php @@ -24,11 +24,11 @@ class ItemTemplateFactory extends Factory public function definition() { return [ - 'name' => $this->faker->bs(), - 'quantity' => $this->faker->numberBetween($min = 1, $max = 999999999), - 'price' => $this->faker->randomFloat($nbMaxDecimals = 2, $min = 0, $max = 999999999999), + 'name' => $this->faker->bs(), + 'quantity' => $this->faker->numberBetween($min = 1, $max = 999999999), + 'price' => $this->faker->randomFloat($nbMaxDecimals = 2, $min = 0, $max = 999999999999), 'description' => $this->faker->text(200), - 'company_id' => function () { + 'company_id' => function () { return Company::factory()->create()->id; }, ]; @@ -42,8 +42,7 @@ public function definition() public function unverified() { return $this->state(function (array $attributes) { - return [ - ]; + return []; }); } } diff --git a/database/factories/PaymentFactory.php b/database/factories/PaymentFactory.php index 198f412b..c5ae8836 100644 --- a/database/factories/PaymentFactory.php +++ b/database/factories/PaymentFactory.php @@ -26,11 +26,11 @@ class PaymentFactory extends Factory public function definition() { return [ - 'amount' => $this->faker->randomFloat($nbMaxDecimals = 2, $min = 0, $max = 999999999999), + 'amount' => $this->faker->randomFloat($nbMaxDecimals = 2, $min = 0, $max = 999999999999), 'receiveddate' => $this->faker->dateTime, - 'mode' => 'Cheque' | 'Bank Transfer', - 'notes' => $this->faker->realText(50, 2), - 'invoice_id' => function () { + 'mode' => 'Cheque' | 'Bank Transfer', + 'notes' => $this->faker->realText(50, 2), + 'invoice_id' => function () { return Invoice::factory()->create()->id; }, 'client_id' => function () { @@ -50,8 +50,7 @@ public function definition() public function unverified() { return $this->state(function (array $attributes) { - return [ - ]; + return []; }); } } diff --git a/database/factories/QuoteFactory.php b/database/factories/QuoteFactory.php index 77a850a9..12387eac 100644 --- a/database/factories/QuoteFactory.php +++ b/database/factories/QuoteFactory.php @@ -25,15 +25,15 @@ class QuoteFactory extends Factory public function definition() { return [ - 'nice_quote_id' => substr($this->faker->slug, 0, 20).'sasdf', - 'date' => $this->faker->dateTime, - 'duedate' => $this->faker->dateTime, - 'netdays' => $this->faker->numberBetween($min = 1, $max = 60), - 'total' => $this->faker->randomFloat($nbMaxDecimals = 2, $min = 0, $max = 999999999999999.99), - 'share_token' => $this->faker->uuid, - 'status' => $this->faker->numberBetween($min = 1, $max = 7), - 'archived' => $this->faker->boolean, - 'client_id' => function () { + 'nice_quote_id' => substr($this->faker->slug, 0, 20) . 'sasdf', + 'date' => $this->faker->dateTime, + 'duedate' => $this->faker->dateTime, + 'netdays' => $this->faker->numberBetween($min = 1, $max = 60), + 'total' => $this->faker->randomFloat($nbMaxDecimals = 2, $min = 0, $max = 999999999999999.99), + 'share_token' => $this->faker->uuid, + 'status' => $this->faker->numberBetween($min = 1, $max = 7), + 'archived' => $this->faker->boolean, + 'client_id' => function () { return Client::factory()->create()->id; }, 'company_id' => function () { @@ -50,8 +50,7 @@ public function definition() public function unverified() { return $this->state(function (array $attributes) { - return [ - ]; + return []; }); } } diff --git a/database/factories/QuoteItemFactory.php b/database/factories/QuoteItemFactory.php index 8e673471..91a1320c 100644 --- a/database/factories/QuoteItemFactory.php +++ b/database/factories/QuoteItemFactory.php @@ -24,11 +24,11 @@ class QuoteItemFactory extends Factory public function definition() { return [ - 'name' => $this->faker->bs(), - 'quantity' => $this->faker->numberBetween($min = 1, $max = 999999999), - 'price' => $this->faker->randomFloat($nbMaxDecimals = 2, $min = 0, $max = 999999999999), + 'name' => $this->faker->bs(), + 'quantity' => $this->faker->numberBetween($min = 1, $max = 999999999), + 'price' => $this->faker->randomFloat($nbMaxDecimals = 2, $min = 0, $max = 999999999999), 'description' => $this->faker->text(200), - 'quote_id' => function () { + 'quote_id' => function () { return Quote::factory()->create()->id; }, ]; @@ -42,8 +42,7 @@ public function definition() public function unverified() { return $this->state(function (array $attributes) { - return [ - ]; + return []; }); } } diff --git a/database/factories/UserFactory.php b/database/factories/UserFactory.php index fd9d1551..988153f8 100644 --- a/database/factories/UserFactory.php +++ b/database/factories/UserFactory.php @@ -23,16 +23,16 @@ class UserFactory extends Factory public function definition() { return [ - 'full_name' => $this->faker->name, - 'username' => $this->faker->userName, - 'email' => $this->faker->unique()->safeEmail, - 'country_code' => $this->faker->countryCode, - 'timezone' => $this->faker->timezone, - 'password' => 'secret', - 'phone' => '+658'.$this->faker->numberBetween($min = 1, $max = 8).$this->faker->randomNumber(6, true), - 'gender' => 'male' | 'female', - 'remember_token' => Str::random(10), - 'status' => $this->faker->numberBetween($min = 1, $max = 3), + 'full_name' => $this->faker->name, + 'username' => $this->faker->userName, + 'email' => $this->faker->unique()->safeEmail, + 'country_code' => $this->faker->countryCode, + 'timezone' => $this->faker->timezone, + 'password' => 'secret', + 'phone' => '+658' . $this->faker->numberBetween($min = 1, $max = 8) . $this->faker->randomNumber(6, true), + 'gender' => 'male' | 'female', + 'remember_token' => Str::random(10), + 'status' => $this->faker->numberBetween($min = 1, $max = 3), 'email_verified_at' => now(), ]; } diff --git a/database/migrations/2017_08_20_101229_create_invoices_table.php b/database/migrations/2017_08_20_101229_create_invoices_table.php index ca09081c..0b0cbf10 100644 --- a/database/migrations/2017_08_20_101229_create_invoices_table.php +++ b/database/migrations/2017_08_20_101229_create_invoices_table.php @@ -20,8 +20,10 @@ public function up() $table->integer('netdays'); $table->dateTime('duedate'); $table->integer('client_id')->unsigned(); - $table->foreign('client_id') - ->references('id')->on('clients') + $table + ->foreign('client_id') + ->references('id') + ->on('clients') ->onDelete('cascade'); $table->timestamps(); $table->softDeletes(); diff --git a/database/migrations/2017_08_20_101324_create_payments_table.php b/database/migrations/2017_08_20_101324_create_payments_table.php index da19b16d..71871eef 100644 --- a/database/migrations/2017_08_20_101324_create_payments_table.php +++ b/database/migrations/2017_08_20_101324_create_payments_table.php @@ -19,11 +19,15 @@ public function up() $table->dateTime('receiveddate'); $table->integer('invoice_id')->unsigned(); $table->integer('client_id')->unsigned(); - $table->foreign('invoice_id') - ->references('id')->on('invoices') + $table + ->foreign('invoice_id') + ->references('id') + ->on('invoices') ->onDelete('cascade'); - $table->foreign('client_id') - ->references('id')->on('clients') + $table + ->foreign('client_id') + ->references('id') + ->on('clients') ->onDelete('cascade'); $table->timestamps(); $table->softDeletes(); diff --git a/database/migrations/2017_08_20_102340_create_invoice_items_table.php b/database/migrations/2017_08_20_102340_create_invoice_items_table.php index 74b96669..b8257d8e 100644 --- a/database/migrations/2017_08_20_102340_create_invoice_items_table.php +++ b/database/migrations/2017_08_20_102340_create_invoice_items_table.php @@ -20,8 +20,10 @@ public function up() $table->integer('quantity'); $table->double('price', 15, 3); $table->integer('invoice_id')->unsigned(); - $table->foreign('invoice_id') - ->references('id')->on('invoices') + $table + ->foreign('invoice_id') + ->references('id') + ->on('invoices') ->onDelete('cascade'); $table->timestamps(); $table->softDeletes(); diff --git a/database/migrations/2017_09_10_182221_create_companies_table.php b/database/migrations/2017_09_10_182221_create_companies_table.php index 32bffbf7..7bfce73f 100644 --- a/database/migrations/2017_09_10_182221_create_companies_table.php +++ b/database/migrations/2017_09_10_182221_create_companies_table.php @@ -19,8 +19,10 @@ public function up() $table->string('slug'); $table->string('crn')->nullable(); $table->bigInteger('user_id')->unsigned(); - $table->foreign('user_id') - ->references('id')->on('users') + $table + ->foreign('user_id') + ->references('id') + ->on('users') ->onDelete('cascade'); $table->timestamps(); $table->softDeletes(); diff --git a/database/migrations/2017_09_10_182414_update_users_table.php b/database/migrations/2017_09_10_182414_update_users_table.php index 03fb46d2..193fa42a 100644 --- a/database/migrations/2017_09_10_182414_update_users_table.php +++ b/database/migrations/2017_09_10_182414_update_users_table.php @@ -14,9 +14,15 @@ class UpdateUsersTable extends Migration public function up() { Schema::table('users', function (Blueprint $table) { - $table->integer('company_id')->unsigned()->nullable()->after('remember_token'); - $table->foreign('company_id') - ->references('id')->on('companies') + $table + ->integer('company_id') + ->unsigned() + ->nullable() + ->after('remember_token'); + $table + ->foreign('company_id') + ->references('id') + ->on('companies') ->onDelete('cascade'); }); } diff --git a/database/migrations/2017_09_10_192238_update_invoices_table.php b/database/migrations/2017_09_10_192238_update_invoices_table.php index 736ec31b..e497c366 100644 --- a/database/migrations/2017_09_10_192238_update_invoices_table.php +++ b/database/migrations/2017_09_10_192238_update_invoices_table.php @@ -14,9 +14,15 @@ class UpdateInvoicesTable extends Migration public function up() { Schema::table('invoices', function (Blueprint $table) { - $table->integer('company_id')->unsigned()->nullable()->after('client_id'); - $table->foreign('company_id') - ->references('id')->on('companies') + $table + ->integer('company_id') + ->unsigned() + ->nullable() + ->after('client_id'); + $table + ->foreign('company_id') + ->references('id') + ->on('companies') ->onDelete('cascade'); }); } diff --git a/database/migrations/2017_09_10_200046_update_clients_table.php b/database/migrations/2017_09_10_200046_update_clients_table.php index a81a7571..ef1a722a 100644 --- a/database/migrations/2017_09_10_200046_update_clients_table.php +++ b/database/migrations/2017_09_10_200046_update_clients_table.php @@ -14,9 +14,15 @@ class UpdateClientsTable extends Migration public function up() { Schema::table('clients', function (Blueprint $table) { - $table->integer('company_id')->unsigned()->nullable()->after('contactphone'); - $table->foreign('company_id') - ->references('id')->on('companies') + $table + ->integer('company_id') + ->unsigned() + ->nullable() + ->after('contactphone'); + $table + ->foreign('company_id') + ->references('id') + ->on('companies') ->onDelete('cascade'); }); } diff --git a/database/migrations/2017_09_11_220542_add_logo_companies_table.php b/database/migrations/2017_09_11_220542_add_logo_companies_table.php index 38ab18f9..ddc29ee0 100644 --- a/database/migrations/2017_09_11_220542_add_logo_companies_table.php +++ b/database/migrations/2017_09_11_220542_add_logo_companies_table.php @@ -14,8 +14,14 @@ class AddLogoCompaniesTable extends Migration public function up() { Schema::table('companies', function (Blueprint $table) { - $table->string('logo')->nullable()->after('crn'); - $table->string('smlogo')->nullable()->after('crn'); + $table + ->string('logo') + ->nullable() + ->after('crn'); + $table + ->string('smlogo') + ->nullable() + ->after('crn'); }); } diff --git a/database/migrations/2017_09_12_072112_update_payments_table.php b/database/migrations/2017_09_12_072112_update_payments_table.php index b13b0553..c20257d1 100644 --- a/database/migrations/2017_09_12_072112_update_payments_table.php +++ b/database/migrations/2017_09_12_072112_update_payments_table.php @@ -14,8 +14,14 @@ class UpdatePaymentsTable extends Migration public function up() { Schema::table('payments', function (Blueprint $table) { - $table->text('notes')->nullable()->after('receiveddate'); - $table->string('mode')->nullable()->after('receiveddate'); + $table + ->text('notes') + ->nullable() + ->after('receiveddate'); + $table + ->string('mode') + ->nullable() + ->after('receiveddate'); }); } diff --git a/database/migrations/2017_09_13_021332_add_company_id_payments_table.php b/database/migrations/2017_09_13_021332_add_company_id_payments_table.php index a3f3952f..ad0b6263 100644 --- a/database/migrations/2017_09_13_021332_add_company_id_payments_table.php +++ b/database/migrations/2017_09_13_021332_add_company_id_payments_table.php @@ -14,9 +14,15 @@ class AddCompanyIdPaymentsTable extends Migration public function up() { Schema::table('payments', function (Blueprint $table) { - $table->integer('company_id')->unsigned()->nullable()->after('client_id'); - $table->foreign('company_id') - ->references('id')->on('companies') + $table + ->integer('company_id') + ->unsigned() + ->nullable() + ->after('client_id'); + $table + ->foreign('company_id') + ->references('id') + ->on('companies') ->onDelete('cascade'); }); } diff --git a/database/migrations/2017_09_17_004125_address_fields_clients_table.php b/database/migrations/2017_09_17_004125_address_fields_clients_table.php index f1696208..65224c82 100644 --- a/database/migrations/2017_09_17_004125_address_fields_clients_table.php +++ b/database/migrations/2017_09_17_004125_address_fields_clients_table.php @@ -14,17 +14,50 @@ class AddressFieldsClientsTable extends Migration public function up() { Schema::table('clients', function (Blueprint $table) { - $table->string('country')->nullable()->after('address'); - $table->string('zipcode')->nullable()->after('address'); - $table->string('address_second')->nullable()->after('address'); - $table->string('phone')->nullable()->after('companyname'); - $table->string('website')->nullable()->after('crn'); - $table->string('contactsalutation')->nullable()->after('photo'); - $table->string('contactlastname')->nullable()->after('contactsalutation'); - $table->string('contactfirstname')->nullable()->after('contactsalutation'); - $table->string('address')->nullable()->change(); - $table->string('contactemail')->nullable()->change(); - $table->string('contactphone')->nullable()->change(); + $table + ->string('country') + ->nullable() + ->after('address'); + $table + ->string('zipcode') + ->nullable() + ->after('address'); + $table + ->string('address_second') + ->nullable() + ->after('address'); + $table + ->string('phone') + ->nullable() + ->after('companyname'); + $table + ->string('website') + ->nullable() + ->after('crn'); + $table + ->string('contactsalutation') + ->nullable() + ->after('photo'); + $table + ->string('contactlastname') + ->nullable() + ->after('contactsalutation'); + $table + ->string('contactfirstname') + ->nullable() + ->after('contactsalutation'); + $table + ->string('address') + ->nullable() + ->change(); + $table + ->string('contactemail') + ->nullable() + ->change(); + $table + ->string('contactphone') + ->nullable() + ->change(); $table->dropColumn('contactname'); }); } @@ -46,9 +79,18 @@ public function down() $table->dropColumn('contactfirstname'); $table->dropColumn('contactlastname'); $table->string('contactname')->after('photo'); - $table->string('address')->nullable(false)->change(); - $table->string('contactemail')->nullable(false)->change(); - $table->string('contactphone')->nullable(false)->change(); + $table + ->string('address') + ->nullable(false) + ->change(); + $table + ->string('contactemail') + ->nullable(false) + ->change(); + $table + ->string('contactphone') + ->nullable(false) + ->change(); }); } } diff --git a/database/migrations/2017_09_18_061811_create_old_invoices_table.php b/database/migrations/2017_09_18_061811_create_old_invoices_table.php index f1c7e975..e31753e9 100644 --- a/database/migrations/2017_09_18_061811_create_old_invoices_table.php +++ b/database/migrations/2017_09_18_061811_create_old_invoices_table.php @@ -22,11 +22,15 @@ public function up() $table->integer('status'); $table->integer('client_id')->unsigned(); $table->integer('company_id')->unsigned(); - $table->foreign('client_id') - ->references('id')->on('clients') + $table + ->foreign('client_id') + ->references('id') + ->on('clients') ->onDelete('cascade'); - $table->foreign('company_id') - ->references('id')->on('companies') + $table + ->foreign('company_id') + ->references('id') + ->on('companies') ->onDelete('cascade'); $table->timestamps(); $table->softDeletes(); diff --git a/database/migrations/2017_09_18_061822_create_old_invoice_items_table.php b/database/migrations/2017_09_18_061822_create_old_invoice_items_table.php index 1807c4bd..57b38e9d 100644 --- a/database/migrations/2017_09_18_061822_create_old_invoice_items_table.php +++ b/database/migrations/2017_09_18_061822_create_old_invoice_items_table.php @@ -20,8 +20,10 @@ public function up() $table->integer('quantity'); $table->double('price', 15, 3); $table->integer('old_invoice_id')->unsigned(); - $table->foreign('old_invoice_id') - ->references('id')->on('old_invoices') + $table + ->foreign('old_invoice_id') + ->references('id') + ->on('old_invoices') ->onDelete('cascade'); $table->timestamps(); $table->softDeletes(); diff --git a/database/migrations/2017_09_18_061836_create_invoice_histories_table.php b/database/migrations/2017_09_18_061836_create_invoice_histories_table.php index df4570c9..e5c83b28 100644 --- a/database/migrations/2017_09_18_061836_create_invoice_histories_table.php +++ b/database/migrations/2017_09_18_061836_create_invoice_histories_table.php @@ -17,11 +17,15 @@ public function up() $table->increments('id'); $table->integer('invoice_id')->unsigned(); $table->integer('oldinvoice_id')->unsigned(); - $table->foreign('invoice_id') - ->references('id')->on('invoices') + $table + ->foreign('invoice_id') + ->references('id') + ->on('invoices') ->onDelete('cascade'); - $table->foreign('oldinvoice_id') - ->references('id')->on('old_invoices') + $table + ->foreign('oldinvoice_id') + ->references('id') + ->on('old_invoices') ->onDelete('cascade'); $table->timestamps(); $table->softDeletes(); diff --git a/database/migrations/2017_10_24_070453_create_role_user_table.php b/database/migrations/2017_10_24_070453_create_role_user_table.php index 77482eda..93c01d19 100644 --- a/database/migrations/2017_10_24_070453_create_role_user_table.php +++ b/database/migrations/2017_10_24_070453_create_role_user_table.php @@ -17,8 +17,16 @@ public function up() $table->increments('id'); $table->bigInteger('user_id')->unsigned(); $table->integer('role_id')->unsigned(); - $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); - $table->foreign('role_id')->references('id')->on('roles')->onDelete('cascade'); + $table + ->foreign('user_id') + ->references('id') + ->on('users') + ->onDelete('cascade'); + $table + ->foreign('role_id') + ->references('id') + ->on('roles') + ->onDelete('cascade'); $table->timestamps(); $table->softDeletes(); }); diff --git a/database/migrations/2017_10_24_070504_create_permission_role_table.php b/database/migrations/2017_10_24_070504_create_permission_role_table.php index 67515cbb..2da47772 100644 --- a/database/migrations/2017_10_24_070504_create_permission_role_table.php +++ b/database/migrations/2017_10_24_070504_create_permission_role_table.php @@ -17,8 +17,16 @@ public function up() $table->increments('id'); $table->integer('role_id')->unsigned(); $table->integer('permission_id')->unsigned(); - $table->foreign('role_id')->references('id')->on('roles')->onDelete('cascade'); - $table->foreign('permission_id')->references('id')->on('permissions')->onDelete('cascade'); + $table + ->foreign('role_id') + ->references('id') + ->on('roles') + ->onDelete('cascade'); + $table + ->foreign('permission_id') + ->references('id') + ->on('permissions') + ->onDelete('cascade'); $table->timestamps(); $table->softDeletes(); }); diff --git a/database/migrations/2017_10_24_073940_create_invoice_oldinvoice_table.php b/database/migrations/2017_10_24_073940_create_invoice_oldinvoice_table.php index abfab21a..6a19fde7 100644 --- a/database/migrations/2017_10_24_073940_create_invoice_oldinvoice_table.php +++ b/database/migrations/2017_10_24_073940_create_invoice_oldinvoice_table.php @@ -17,8 +17,16 @@ public function up() $table->increments('id'); $table->integer('invoice_id')->unsigned(); $table->integer('old_invoice_id')->unsigned(); - $table->foreign('invoice_id')->references('id')->on('invoices')->onDelete('cascade'); - $table->foreign('old_invoice_id')->references('id')->on('old_invoices')->onDelete('cascade'); + $table + ->foreign('invoice_id') + ->references('id') + ->on('invoices') + ->onDelete('cascade'); + $table + ->foreign('old_invoice_id') + ->references('id') + ->on('old_invoices') + ->onDelete('cascade'); $table->timestamps(); $table->softDeletes(); }); diff --git a/database/migrations/2017_10_24_074747_drop_invoice_histories_table.php b/database/migrations/2017_10_24_074747_drop_invoice_histories_table.php index 358d8978..9eb724ce 100644 --- a/database/migrations/2017_10_24_074747_drop_invoice_histories_table.php +++ b/database/migrations/2017_10_24_074747_drop_invoice_histories_table.php @@ -27,11 +27,15 @@ public function down() $table->increments('id'); $table->integer('invoice_id')->unsigned(); $table->integer('oldinvoice_id')->unsigned(); - $table->foreign('invoice_id') - ->references('id')->on('invoices') + $table + ->foreign('invoice_id') + ->references('id') + ->on('invoices') ->onDelete('cascade'); - $table->foreign('oldinvoice_id') - ->references('id')->on('old_invoices') + $table + ->foreign('oldinvoice_id') + ->references('id') + ->on('old_invoices') ->onDelete('cascade'); $table->timestamps(); $table->softDeletes(); diff --git a/database/migrations/2017_10_24_080949_drop_invoice_old_invoice_table.php b/database/migrations/2017_10_24_080949_drop_invoice_old_invoice_table.php index cfec2e30..a7afa6e4 100644 --- a/database/migrations/2017_10_24_080949_drop_invoice_old_invoice_table.php +++ b/database/migrations/2017_10_24_080949_drop_invoice_old_invoice_table.php @@ -27,8 +27,16 @@ public function down() $table->increments('id'); $table->integer('invoice_id')->unsigned(); $table->integer('old_invoice_id')->unsigned(); - $table->foreign('invoice_id')->references('id')->on('invoices')->onDelete('cascade'); - $table->foreign('old_invoice_id')->references('id')->on('old_invoices')->onDelete('cascade'); + $table + ->foreign('invoice_id') + ->references('id') + ->on('invoices') + ->onDelete('cascade'); + $table + ->foreign('old_invoice_id') + ->references('id') + ->on('old_invoices') + ->onDelete('cascade'); $table->timestamps(); $table->softDeletes(); }); diff --git a/database/migrations/2017_10_24_081008_add_original_invoice_id_to_old_invoices_table.php b/database/migrations/2017_10_24_081008_add_original_invoice_id_to_old_invoices_table.php index 540b929f..b5ae4b8a 100644 --- a/database/migrations/2017_10_24_081008_add_original_invoice_id_to_old_invoices_table.php +++ b/database/migrations/2017_10_24_081008_add_original_invoice_id_to_old_invoices_table.php @@ -15,8 +15,15 @@ public function up() { Schema::table('old_invoices', function (Blueprint $table) { $table->renameColumn('invoiceid', 'nice_invoice_id'); - $table->integer('invoice_id')->unsigned()->after('company_id'); - $table->foreign('invoice_id')->references('id')->on('invoices')->onDelete('cascade'); + $table + ->integer('invoice_id') + ->unsigned() + ->after('company_id'); + $table + ->foreign('invoice_id') + ->references('id') + ->on('invoices') + ->onDelete('cascade'); }); } diff --git a/database/migrations/2017_10_31_114111_create_company_addresses_table.php b/database/migrations/2017_10_31_114111_create_company_addresses_table.php index ed495800..8ef82b3b 100644 --- a/database/migrations/2017_10_31_114111_create_company_addresses_table.php +++ b/database/migrations/2017_10_31_114111_create_company_addresses_table.php @@ -20,8 +20,14 @@ public function up() $table->string('unitnumber')->nullable(); $table->string('postalcode'); $table->integer('buildingtype'); - $table->integer('company_id')->unsigned()->nullable(); - $table->foreign('company_id')->references('id')->on('companies'); + $table + ->integer('company_id') + ->unsigned() + ->nullable(); + $table + ->foreign('company_id') + ->references('id') + ->on('companies'); $table->timestamps(); $table->softDeletes(); }); diff --git a/database/migrations/2017_10_31_131224_change_client_address_structure.php b/database/migrations/2017_10_31_131224_change_client_address_structure.php index bc30323f..ef742837 100644 --- a/database/migrations/2017_10_31_131224_change_client_address_structure.php +++ b/database/migrations/2017_10_31_131224_change_client_address_structure.php @@ -17,7 +17,10 @@ public function up() $table->renameColumn('address', 'block'); $table->renameColumn('address_second', 'street'); $table->renameColumn('zipcode', 'postalcode'); - $table->string('unitnumber')->nullable()->after('address_second'); + $table + ->string('unitnumber') + ->nullable() + ->after('address_second'); }); } diff --git a/database/migrations/2017_11_02_173356_add_in_total_amount_to_invoice_table.php b/database/migrations/2017_11_02_173356_add_in_total_amount_to_invoice_table.php index 8ccf09fb..a0f3664d 100644 --- a/database/migrations/2017_11_02_173356_add_in_total_amount_to_invoice_table.php +++ b/database/migrations/2017_11_02_173356_add_in_total_amount_to_invoice_table.php @@ -14,11 +14,17 @@ class AddInTotalAmountToInvoiceTable extends Migration public function up() { Schema::table('invoices', function (Blueprint $table) { - $table->double('total')->nullable()->after('duedate'); + $table + ->double('total') + ->nullable() + ->after('duedate'); }); Schema::table('old_invoices', function (Blueprint $table) { - $table->double('total')->nullable()->after('duedate'); + $table + ->double('total') + ->nullable() + ->after('duedate'); }); } diff --git a/database/migrations/2017_11_10_013534_create_company_settings_table.php b/database/migrations/2017_11_10_013534_create_company_settings_table.php index 9902b5da..e237c8db 100644 --- a/database/migrations/2017_11_10_013534_create_company_settings_table.php +++ b/database/migrations/2017_11_10_013534_create_company_settings_table.php @@ -18,8 +18,10 @@ public function up() $table->string('invoice_prefix')->nullable(); $table->text('invoice_conditions')->nullable(); $table->integer('company_id')->unsigned(); - $table->foreign('company_id') - ->references('id')->on('companies') + $table + ->foreign('company_id') + ->references('id') + ->on('companies') ->onDelete('cascade'); $table->timestamps(); $table->softDeletes(); diff --git a/database/migrations/2018_09_30_191708_add_unique_token_to_invoices_table.php b/database/migrations/2018_09_30_191708_add_unique_token_to_invoices_table.php index 194ed0d8..2f2c2db6 100644 --- a/database/migrations/2018_09_30_191708_add_unique_token_to_invoices_table.php +++ b/database/migrations/2018_09_30_191708_add_unique_token_to_invoices_table.php @@ -14,7 +14,10 @@ class AddUniqueTokenToInvoicesTable extends Migration public function up() { Schema::table('invoices', function (Blueprint $table) { - $table->string('share_token')->after('total')->nullable(); + $table + ->string('share_token') + ->after('total') + ->nullable(); }); } diff --git a/database/migrations/2018_10_07_144027_create_quotes_table.php b/database/migrations/2018_10_07_144027_create_quotes_table.php index d5898e53..23fa798e 100644 --- a/database/migrations/2018_10_07_144027_create_quotes_table.php +++ b/database/migrations/2018_10_07_144027_create_quotes_table.php @@ -23,12 +23,16 @@ public function up() $table->integer('status'); $table->string('share_token')->nullable(); $table->integer('client_id')->unsigned(); - $table->foreign('client_id') - ->references('id')->on('clients') + $table + ->foreign('client_id') + ->references('id') + ->on('clients') ->onDelete('cascade'); $table->integer('company_id')->unsigned(); - $table->foreign('company_id') - ->references('id')->on('companies') + $table + ->foreign('company_id') + ->references('id') + ->on('companies') ->onDelete('cascade'); $table->timestamps(); $table->softDeletes(); diff --git a/database/migrations/2018_10_07_144035_create_quote_items_table.php b/database/migrations/2018_10_07_144035_create_quote_items_table.php index 5e00e925..a0ab14b8 100644 --- a/database/migrations/2018_10_07_144035_create_quote_items_table.php +++ b/database/migrations/2018_10_07_144035_create_quote_items_table.php @@ -20,8 +20,10 @@ public function up() $table->integer('quantity'); $table->double('price', 15, 3); $table->integer('quote_id')->unsigned(); - $table->foreign('quote_id') - ->references('id')->on('quotes') + $table + ->foreign('quote_id') + ->references('id') + ->on('quotes') ->onDelete('cascade'); $table->timestamps(); $table->softDeletes(); diff --git a/database/migrations/2018_10_18_224114_add_invoice_index_to_companies_table.php b/database/migrations/2018_10_18_224114_add_invoice_index_to_companies_table.php index ff3c94ad..c6afbe1d 100644 --- a/database/migrations/2018_10_18_224114_add_invoice_index_to_companies_table.php +++ b/database/migrations/2018_10_18_224114_add_invoice_index_to_companies_table.php @@ -14,7 +14,10 @@ class AddInvoiceIndexToCompaniesTable extends Migration public function up() { Schema::table('companies', function (Blueprint $table) { - $table->integer('invoice_index')->after('name')->nullable(); + $table + ->integer('invoice_index') + ->after('name') + ->nullable(); }); } diff --git a/database/migrations/2018_10_18_230330_add_quote_index_to_companies_table.php b/database/migrations/2018_10_18_230330_add_quote_index_to_companies_table.php index 833a9e38..14f257ea 100644 --- a/database/migrations/2018_10_18_230330_add_quote_index_to_companies_table.php +++ b/database/migrations/2018_10_18_230330_add_quote_index_to_companies_table.php @@ -14,7 +14,10 @@ class AddQuoteIndexToCompaniesTable extends Migration public function up() { Schema::table('companies', function (Blueprint $table) { - $table->integer('quote_index')->after('invoice_index')->nullable(); + $table + ->integer('quote_index') + ->after('invoice_index') + ->nullable(); }); } diff --git a/database/migrations/2018_10_18_231356_add_quote_prefix_to_company_settings_table.php b/database/migrations/2018_10_18_231356_add_quote_prefix_to_company_settings_table.php index b0235152..f40ccb13 100644 --- a/database/migrations/2018_10_18_231356_add_quote_prefix_to_company_settings_table.php +++ b/database/migrations/2018_10_18_231356_add_quote_prefix_to_company_settings_table.php @@ -14,7 +14,10 @@ class AddQuotePrefixToCompanySettingsTable extends Migration public function up() { Schema::table('company_settings', function (Blueprint $table) { - $table->string('quote_prefix')->after('invoice_prefix')->nullable(); + $table + ->string('quote_prefix') + ->after('invoice_prefix') + ->nullable(); }); } diff --git a/database/migrations/2018_10_18_231705_add_quote_conditions_to_company_settings_table.php b/database/migrations/2018_10_18_231705_add_quote_conditions_to_company_settings_table.php index 55238c9f..6dda5e45 100644 --- a/database/migrations/2018_10_18_231705_add_quote_conditions_to_company_settings_table.php +++ b/database/migrations/2018_10_18_231705_add_quote_conditions_to_company_settings_table.php @@ -14,7 +14,10 @@ class AddQuoteConditionsToCompanySettingsTable extends Migration public function up() { Schema::table('company_settings', function (Blueprint $table) { - $table->text('quote_conditions')->after('invoice_conditions')->nullable(); + $table + ->text('quote_conditions') + ->after('invoice_conditions') + ->nullable(); }); } diff --git a/database/migrations/2018_10_18_231832_create_item_templates_table.php b/database/migrations/2018_10_18_231832_create_item_templates_table.php index ca008796..a528f2fc 100644 --- a/database/migrations/2018_10_18_231832_create_item_templates_table.php +++ b/database/migrations/2018_10_18_231832_create_item_templates_table.php @@ -20,8 +20,10 @@ public function up() $table->integer('quantity'); $table->double('price', 15, 3); $table->integer('company_id')->unsigned(); - $table->foreign('company_id') - ->references('id')->on('companies') + $table + ->foreign('company_id') + ->references('id') + ->on('companies') ->onDelete('cascade'); $table->timestamps(); $table->softDeletes(); diff --git a/database/migrations/2018_10_28_014756_add_tax_to_company_settings_table.php b/database/migrations/2018_10_28_014756_add_tax_to_company_settings_table.php index 7b877a19..57323f7f 100644 --- a/database/migrations/2018_10_28_014756_add_tax_to_company_settings_table.php +++ b/database/migrations/2018_10_28_014756_add_tax_to_company_settings_table.php @@ -14,7 +14,10 @@ class AddTaxToCompanySettingsTable extends Migration public function up() { Schema::table('company_settings', function (Blueprint $table) { - $table->integer('tax')->after('quote_conditions')->nullable(); + $table + ->integer('tax') + ->after('quote_conditions') + ->nullable(); }); } diff --git a/database/migrations/2018_10_31_015426_update_crn_not_nullable_to_companies_table.php b/database/migrations/2018_10_31_015426_update_crn_not_nullable_to_companies_table.php index 547b2d4c..230b9110 100644 --- a/database/migrations/2018_10_31_015426_update_crn_not_nullable_to_companies_table.php +++ b/database/migrations/2018_10_31_015426_update_crn_not_nullable_to_companies_table.php @@ -14,7 +14,10 @@ class UpdateCrnNotNullableToCompaniesTable extends Migration public function up() { Schema::table('companies', function (Blueprint $table) { - $table->string('crn')->nullable(false)->change(); + $table + ->string('crn') + ->nullable(false) + ->change(); }); } @@ -26,7 +29,10 @@ public function up() public function down() { Schema::table('companies', function (Blueprint $table) { - $table->string('crn')->nullable()->change(); + $table + ->string('crn') + ->nullable() + ->change(); }); } } diff --git a/database/migrations/2018_10_31_170650_change_domain_name_nullable_to_companies_table.php b/database/migrations/2018_10_31_170650_change_domain_name_nullable_to_companies_table.php index 89298ac6..fda6572a 100644 --- a/database/migrations/2018_10_31_170650_change_domain_name_nullable_to_companies_table.php +++ b/database/migrations/2018_10_31_170650_change_domain_name_nullable_to_companies_table.php @@ -14,7 +14,10 @@ class ChangeDomainNameNullableToCompaniesTable extends Migration public function up() { Schema::table('companies', function (Blueprint $table) { - $table->string('domain_name')->nullable()->change(); + $table + ->string('domain_name') + ->nullable() + ->change(); }); } @@ -26,7 +29,10 @@ public function up() public function down() { Schema::table('companies', function (Blueprint $table) { - $table->string('domain_name')->nullable(false)->change(); + $table + ->string('domain_name') + ->nullable(false) + ->change(); }); } } diff --git a/database/migrations/2018_10_31_221557_create_company_user_requests_table.php b/database/migrations/2018_10_31_221557_create_company_user_requests_table.php index 4fce430e..4a8d95da 100644 --- a/database/migrations/2018_10_31_221557_create_company_user_requests_table.php +++ b/database/migrations/2018_10_31_221557_create_company_user_requests_table.php @@ -21,8 +21,10 @@ public function up() $table->string('token'); $table->integer('status'); $table->integer('company_id')->unsigned(); - $table->foreign('company_id') - ->references('id')->on('companies') + $table + ->foreign('company_id') + ->references('id') + ->on('companies') ->onDelete('cascade'); $table->timestamps(); $table->softDeletes(); diff --git a/database/migrations/2018_10_31_221953_change_domain_name_unique_to_companies_table.php b/database/migrations/2018_10_31_221953_change_domain_name_unique_to_companies_table.php index 8cd0c793..8bed810d 100644 --- a/database/migrations/2018_10_31_221953_change_domain_name_unique_to_companies_table.php +++ b/database/migrations/2018_10_31_221953_change_domain_name_unique_to_companies_table.php @@ -14,7 +14,10 @@ class ChangeDomainNameUniqueToCompaniesTable extends Migration public function up() { Schema::table('companies', function (Blueprint $table) { - $table->string('domain_name')->unique()->change(); + $table + ->string('domain_name') + ->unique() + ->change(); }); } diff --git a/database/migrations/2018_11_01_150744_add_twofa_secret_to_users_table.php b/database/migrations/2018_11_01_150744_add_twofa_secret_to_users_table.php index c248b157..456a07fb 100644 --- a/database/migrations/2018_11_01_150744_add_twofa_secret_to_users_table.php +++ b/database/migrations/2018_11_01_150744_add_twofa_secret_to_users_table.php @@ -14,7 +14,10 @@ class AddTwofaSecretToUsersTable extends Migration public function up() { Schema::table('users', function (Blueprint $table) { - $table->string('twofa_secret')->nullable()->after('status'); + $table + ->string('twofa_secret') + ->nullable() + ->after('status'); }); } diff --git a/database/migrations/2018_11_01_160806_add_twofa_timestamp_to_users_table.php b/database/migrations/2018_11_01_160806_add_twofa_timestamp_to_users_table.php index 62d45650..8184f131 100644 --- a/database/migrations/2018_11_01_160806_add_twofa_timestamp_to_users_table.php +++ b/database/migrations/2018_11_01_160806_add_twofa_timestamp_to_users_table.php @@ -14,7 +14,10 @@ class AddTwofaTimestampToUsersTable extends Migration public function up() { Schema::table('users', function (Blueprint $table) { - $table->string('twofa_timestamp')->nullable()->after('twofa_secret'); + $table + ->string('twofa_timestamp') + ->nullable() + ->after('twofa_secret'); }); } diff --git a/database/migrations/2018_11_01_223608_add_backup_codes_to_users_table.php b/database/migrations/2018_11_01_223608_add_backup_codes_to_users_table.php index fbc1ee16..20d92183 100644 --- a/database/migrations/2018_11_01_223608_add_backup_codes_to_users_table.php +++ b/database/migrations/2018_11_01_223608_add_backup_codes_to_users_table.php @@ -14,7 +14,10 @@ class AddBackupCodesToUsersTable extends Migration public function up() { Schema::table('users', function (Blueprint $table) { - $table->string('twofa_backup_codes', 800)->nullable()->after('twofa_timestamp'); + $table + ->string('twofa_backup_codes', 800) + ->nullable() + ->after('twofa_timestamp'); }); } diff --git a/database/migrations/2018_11_02_002815_add_default_value_for_archived_to_quotes_and_invoices_table.php b/database/migrations/2018_11_02_002815_add_default_value_for_archived_to_quotes_and_invoices_table.php index d4d05258..eb6dc58e 100644 --- a/database/migrations/2018_11_02_002815_add_default_value_for_archived_to_quotes_and_invoices_table.php +++ b/database/migrations/2018_11_02_002815_add_default_value_for_archived_to_quotes_and_invoices_table.php @@ -14,11 +14,17 @@ class AddDefaultValueForArchivedToQuotesAndInvoicesTable extends Migration public function up() { Schema::table('invoices', function (Blueprint $table) { - $table->boolean('archived')->default(0)->change(); + $table + ->boolean('archived') + ->default(0) + ->change(); }); Schema::table('quotes', function (Blueprint $table) { - $table->boolean('archived')->default(0)->change(); + $table + ->boolean('archived') + ->default(0) + ->change(); }); } @@ -30,11 +36,17 @@ public function up() public function down() { Schema::table('invoices', function (Blueprint $table) { - $table->boolean('archived')->default(null)->change(); + $table + ->boolean('archived') + ->default(null) + ->change(); }); Schema::table('quotes', function (Blueprint $table) { - $table->boolean('archived')->default(null)->change(); + $table + ->boolean('archived') + ->default(null) + ->change(); }); } } diff --git a/database/migrations/2018_11_02_145656_create_invoice_events_table.php b/database/migrations/2018_11_02_145656_create_invoice_events_table.php index 2edd7b3d..3e56561e 100644 --- a/database/migrations/2018_11_02_145656_create_invoice_events_table.php +++ b/database/migrations/2018_11_02_145656_create_invoice_events_table.php @@ -21,8 +21,10 @@ public function up() $table->string('until_meta')->nullable(); $table->string('rule'); $table->integer('company_id')->unsigned(); - $table->foreign('company_id') - ->references('id')->on('companies') + $table + ->foreign('company_id') + ->references('id') + ->on('companies') ->onDelete('cascade'); $table->timestamps(); $table->softDeletes(); diff --git a/database/migrations/2018_11_02_193140_add_extra_fields_to_companies_table.php b/database/migrations/2018_11_02_193140_add_extra_fields_to_companies_table.php index 9eb9200e..22bbbb02 100644 --- a/database/migrations/2018_11_02_193140_add_extra_fields_to_companies_table.php +++ b/database/migrations/2018_11_02_193140_add_extra_fields_to_companies_table.php @@ -14,8 +14,14 @@ class AddExtraFieldsToCompaniesTable extends Migration public function up() { Schema::table('companies', function (Blueprint $table) { - $table->string('timezone')->default('UTC')->after('logo'); - $table->string('country')->nullable()->after('logo'); + $table + ->string('timezone') + ->default('UTC') + ->after('logo'); + $table + ->string('country') + ->nullable() + ->after('logo'); }); } diff --git a/database/migrations/2018_11_02_193212_add_extra_fields_to_users_table.php b/database/migrations/2018_11_02_193212_add_extra_fields_to_users_table.php index 4f13edbc..e0997eb7 100644 --- a/database/migrations/2018_11_02_193212_add_extra_fields_to_users_table.php +++ b/database/migrations/2018_11_02_193212_add_extra_fields_to_users_table.php @@ -14,8 +14,14 @@ class AddExtraFieldsToUsersTable extends Migration public function up() { Schema::table('users', function (Blueprint $table) { - $table->string('timezone')->nullable()->after('gender'); - $table->string('country')->nullable()->after('gender'); + $table + ->string('timezone') + ->nullable() + ->after('gender'); + $table + ->string('country') + ->nullable() + ->after('gender'); }); } diff --git a/database/migrations/2018_11_03_103839_add_invoice_events_foreign_key_on_invoices_table.php b/database/migrations/2018_11_03_103839_add_invoice_events_foreign_key_on_invoices_table.php index 462d3aea..671d0061 100644 --- a/database/migrations/2018_11_03_103839_add_invoice_events_foreign_key_on_invoices_table.php +++ b/database/migrations/2018_11_03_103839_add_invoice_events_foreign_key_on_invoices_table.php @@ -14,9 +14,15 @@ class AddInvoiceEventsForeignKeyOnInvoicesTable extends Migration public function up() { Schema::table('invoices', function (Blueprint $table) { - $table->integer('invoice_event_id')->nullable()->unsigned()->after('company_id'); - $table->foreign('invoice_event_id') - ->references('id')->on('invoice_events') + $table + ->integer('invoice_event_id') + ->nullable() + ->unsigned() + ->after('company_id'); + $table + ->foreign('invoice_event_id') + ->references('id') + ->on('invoice_events') ->onDelete('cascade'); }); } diff --git a/database/migrations/2018_11_03_103937_create_invoice_templates_table.php b/database/migrations/2018_11_03_103937_create_invoice_templates_table.php index 7a0d0b08..7c61b139 100644 --- a/database/migrations/2018_11_03_103937_create_invoice_templates_table.php +++ b/database/migrations/2018_11_03_103937_create_invoice_templates_table.php @@ -18,12 +18,16 @@ public function up() $table->dateTime('date'); $table->integer('netdays'); $table->integer('client_id')->unsigned(); - $table->foreign('client_id') - ->references('id')->on('clients') + $table + ->foreign('client_id') + ->references('id') + ->on('clients') ->onDelete('cascade'); $table->integer('invoice_event_id')->unsigned(); - $table->foreign('invoice_event_id') - ->references('id')->on('invoice_events') + $table + ->foreign('invoice_event_id') + ->references('id') + ->on('invoice_events') ->onDelete('cascade'); $table->timestamps(); $table->softDeletes(); diff --git a/database/migrations/2018_11_03_104012_create_invoice_item_templates_table.php b/database/migrations/2018_11_03_104012_create_invoice_item_templates_table.php index f9ba0055..8e7d5625 100644 --- a/database/migrations/2018_11_03_104012_create_invoice_item_templates_table.php +++ b/database/migrations/2018_11_03_104012_create_invoice_item_templates_table.php @@ -20,8 +20,10 @@ public function up() $table->integer('quantity'); $table->double('price', 15, 3); $table->integer('invoice_template_id')->unsigned(); - $table->foreign('invoice_template_id') - ->references('id')->on('invoice_templates') + $table + ->foreign('invoice_template_id') + ->references('id') + ->on('invoice_templates') ->onDelete('cascade'); $table->timestamps(); $table->softDeletes(); diff --git a/database/migrations/2018_11_09_012741_add_hash_to_invoices_table.php b/database/migrations/2018_11_09_012741_add_hash_to_invoices_table.php index 6a7ee528..767af227 100644 --- a/database/migrations/2018_11_09_012741_add_hash_to_invoices_table.php +++ b/database/migrations/2018_11_09_012741_add_hash_to_invoices_table.php @@ -14,7 +14,10 @@ class AddHashToInvoicesTable extends Migration public function up() { Schema::table('invoices', function (Blueprint $table) { - $table->string('hash')->nullable()->after('archived'); + $table + ->string('hash') + ->nullable() + ->after('archived'); }); } diff --git a/database/migrations/2018_11_10_094808_remove_default_value_from_timezone_on_companies_table.php b/database/migrations/2018_11_10_094808_remove_default_value_from_timezone_on_companies_table.php index 9df6c0c9..bae23141 100644 --- a/database/migrations/2018_11_10_094808_remove_default_value_from_timezone_on_companies_table.php +++ b/database/migrations/2018_11_10_094808_remove_default_value_from_timezone_on_companies_table.php @@ -14,7 +14,10 @@ class RemoveDefaultValueFromTimezoneOnCompaniesTable extends Migration public function up() { Schema::table('companies', function (Blueprint $table) { - $table->string('timezone')->default(null)->change(); + $table + ->string('timezone') + ->default(null) + ->change(); }); } @@ -26,7 +29,10 @@ public function up() public function down() { Schema::table('companies', function (Blueprint $table) { - $table->string('timezone')->default('UTC')->change(); + $table + ->string('timezone') + ->default('UTC') + ->change(); }); } } diff --git a/database/migrations/2018_11_11_150258_add_payment_complete_date_to_invoices_table.php b/database/migrations/2018_11_11_150258_add_payment_complete_date_to_invoices_table.php index e8a70d03..0e223430 100644 --- a/database/migrations/2018_11_11_150258_add_payment_complete_date_to_invoices_table.php +++ b/database/migrations/2018_11_11_150258_add_payment_complete_date_to_invoices_table.php @@ -14,7 +14,10 @@ class AddPaymentCompleteDateToInvoicesTable extends Migration public function up() { Schema::table('invoices', function (Blueprint $table) { - $table->datetime('payment_complete_date')->nullable()->after('total'); + $table + ->datetime('payment_complete_date') + ->nullable() + ->after('total'); }); } diff --git a/database/migrations/2018_11_16_080639_drop_old_permissions_tables.php b/database/migrations/2018_11_16_080639_drop_old_permissions_tables.php index 8b663ad7..b387e571 100644 --- a/database/migrations/2018_11_16_080639_drop_old_permissions_tables.php +++ b/database/migrations/2018_11_16_080639_drop_old_permissions_tables.php @@ -46,8 +46,16 @@ public function down() $table->increments('id'); $table->bigInteger('user_id')->unsigned(); $table->integer('role_id')->unsigned(); - $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); - $table->foreign('role_id')->references('id')->on('roles')->onDelete('cascade'); + $table + ->foreign('user_id') + ->references('id') + ->on('users') + ->onDelete('cascade'); + $table + ->foreign('role_id') + ->references('id') + ->on('roles') + ->onDelete('cascade'); $table->timestamps(); $table->softDeletes(); }); @@ -56,8 +64,16 @@ public function down() $table->increments('id'); $table->integer('role_id')->unsigned(); $table->integer('permission_id')->unsigned(); - $table->foreign('role_id')->references('id')->on('roles')->onDelete('cascade'); - $table->foreign('permission_id')->references('id')->on('permissions')->onDelete('cascade'); + $table + ->foreign('role_id') + ->references('id') + ->on('roles') + ->onDelete('cascade'); + $table + ->foreign('permission_id') + ->references('id') + ->on('permissions') + ->onDelete('cascade'); $table->timestamps(); $table->softDeletes(); }); diff --git a/database/migrations/2018_11_16_092914_create_bouncer_tables.php b/database/migrations/2018_11_16_092914_create_bouncer_tables.php index ec8e0dd7..94d4dfd7 100644 --- a/database/migrations/2018_11_16_092914_create_bouncer_tables.php +++ b/database/migrations/2018_11_16_092914_create_bouncer_tables.php @@ -18,11 +18,17 @@ public function up() $table->increments('id'); $table->string('name'); $table->string('title')->nullable(); - $table->integer('entity_id')->unsigned()->nullable(); + $table + ->integer('entity_id') + ->unsigned() + ->nullable(); $table->string('entity_type')->nullable(); $table->boolean('only_owned')->default(false); $table->json('options')->nullable(); - $table->integer('scope')->nullable()->index(); + $table + ->integer('scope') + ->nullable() + ->index(); $table->timestamps(); }); @@ -30,49 +36,67 @@ public function up() $table->increments('id'); $table->string('name'); $table->string('title')->nullable(); - $table->integer('level')->unsigned()->nullable(); - $table->integer('scope')->nullable()->index(); + $table + ->integer('level') + ->unsigned() + ->nullable(); + $table + ->integer('scope') + ->nullable() + ->index(); $table->timestamps(); - $table->unique( - ['name', 'scope'], - 'roles_name_unique' - ); + $table->unique(['name', 'scope'], 'roles_name_unique'); }); Schema::create(Models::table('assigned_roles'), function (Blueprint $table) { - $table->integer('role_id')->unsigned()->index(); + $table + ->integer('role_id') + ->unsigned() + ->index(); $table->integer('entity_id')->unsigned(); $table->string('entity_type'); - $table->integer('restricted_to_id')->unsigned()->nullable(); + $table + ->integer('restricted_to_id') + ->unsigned() + ->nullable(); $table->string('restricted_to_type')->nullable(); - $table->integer('scope')->nullable()->index(); + $table + ->integer('scope') + ->nullable() + ->index(); - $table->index( - ['entity_id', 'entity_type', 'scope'], - 'assigned_roles_entity_index' - ); + $table->index(['entity_id', 'entity_type', 'scope'], 'assigned_roles_entity_index'); - $table->foreign('role_id') - ->references('id')->on(Models::table('roles')) - ->onUpdate('cascade')->onDelete('cascade'); + $table + ->foreign('role_id') + ->references('id') + ->on(Models::table('roles')) + ->onUpdate('cascade') + ->onDelete('cascade'); }); Schema::create(Models::table('permissions'), function (Blueprint $table) { - $table->integer('ability_id')->unsigned()->index(); + $table + ->integer('ability_id') + ->unsigned() + ->index(); $table->integer('entity_id')->unsigned(); $table->string('entity_type'); $table->boolean('forbidden')->default(false); - $table->integer('scope')->nullable()->index(); + $table + ->integer('scope') + ->nullable() + ->index(); - $table->index( - ['entity_id', 'entity_type', 'scope'], - 'permissions_entity_index' - ); + $table->index(['entity_id', 'entity_type', 'scope'], 'permissions_entity_index'); - $table->foreign('ability_id') - ->references('id')->on(Models::table('abilities')) - ->onUpdate('cascade')->onDelete('cascade'); + $table + ->foreign('ability_id') + ->references('id') + ->on(Models::table('abilities')) + ->onUpdate('cascade') + ->onDelete('cascade'); }); } diff --git a/database/migrations/2018_11_20_100901_create_company_user_table.php b/database/migrations/2018_11_20_100901_create_company_user_table.php index e28ec619..540fa72a 100644 --- a/database/migrations/2018_11_20_100901_create_company_user_table.php +++ b/database/migrations/2018_11_20_100901_create_company_user_table.php @@ -17,8 +17,16 @@ public function up() $table->increments('id'); $table->integer('company_id')->unsigned(); $table->bigInteger('user_id')->unsigned(); - $table->foreign('company_id')->references('id')->on('companies')->onDelete('cascade'); - $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); + $table + ->foreign('company_id') + ->references('id') + ->on('companies') + ->onDelete('cascade'); + $table + ->foreign('user_id') + ->references('id') + ->on('users') + ->onDelete('cascade'); $table->unique(['company_id', 'user_id']); $table->timestamps(); }); diff --git a/database/migrations/2018_11_20_101044_remove_company_id_from_users_table.php b/database/migrations/2018_11_20_101044_remove_company_id_from_users_table.php index 8904433e..f65e2eda 100644 --- a/database/migrations/2018_11_20_101044_remove_company_id_from_users_table.php +++ b/database/migrations/2018_11_20_101044_remove_company_id_from_users_table.php @@ -27,9 +27,15 @@ public function up() public function down() { Schema::table('users', function (Blueprint $table) { - $table->integer('company_id')->unsigned()->nullable()->after('remember_token'); - $table->foreign('company_id') - ->references('id')->on('companies') + $table + ->integer('company_id') + ->unsigned() + ->nullable() + ->after('remember_token'); + $table + ->foreign('company_id') + ->references('id') + ->on('companies') ->onDelete('cascade'); }); } diff --git a/database/migrations/2018_11_21_172841_create_company_invites_table.php b/database/migrations/2018_11_21_172841_create_company_invites_table.php index 08d29b60..e6e367ed 100644 --- a/database/migrations/2018_11_21_172841_create_company_invites_table.php +++ b/database/migrations/2018_11_21_172841_create_company_invites_table.php @@ -19,8 +19,10 @@ public function up() $table->string('token'); $table->json('roles'); $table->integer('company_id')->unsigned(); - $table->foreign('company_id') - ->references('id')->on('companies') + $table + ->foreign('company_id') + ->references('id') + ->on('companies') ->onDelete('cascade'); $table->dateTime('expires_at'); $table->timestamps(); diff --git a/database/migrations/2018_11_23_144104_create_receipts_table.php b/database/migrations/2018_11_23_144104_create_receipts_table.php index 401583f5..84382bea 100644 --- a/database/migrations/2018_11_23_144104_create_receipts_table.php +++ b/database/migrations/2018_11_23_144104_create_receipts_table.php @@ -16,13 +16,20 @@ public function up() Schema::create('receipts', function (Blueprint $table) { $table->increments('id'); $table->string('nice_receipt_id'); - $table->integer('invoice_id')->unique()->unsigned(); - $table->foreign('invoice_id') - ->references('id')->on('invoices') + $table + ->integer('invoice_id') + ->unique() + ->unsigned(); + $table + ->foreign('invoice_id') + ->references('id') + ->on('invoices') ->onDelete('cascade'); $table->integer('company_id')->unsigned(); - $table->foreign('company_id') - ->references('id')->on('companies') + $table + ->foreign('company_id') + ->references('id') + ->on('companies') ->onDelete('cascade'); $table->timestamps(); $table->softDeletes(); diff --git a/database/migrations/2018_11_23_150543_add_receipt_prefix_to_company_settings_table.php b/database/migrations/2018_11_23_150543_add_receipt_prefix_to_company_settings_table.php index 3bf0793e..0a9ee532 100644 --- a/database/migrations/2018_11_23_150543_add_receipt_prefix_to_company_settings_table.php +++ b/database/migrations/2018_11_23_150543_add_receipt_prefix_to_company_settings_table.php @@ -14,7 +14,10 @@ class AddReceiptPrefixToCompanySettingsTable extends Migration public function up() { Schema::table('company_settings', function (Blueprint $table) { - $table->string('receipt_prefix')->after('quote_prefix')->nullable(); + $table + ->string('receipt_prefix') + ->after('quote_prefix') + ->nullable(); }); } diff --git a/database/migrations/2018_11_23_150732_add_receipt_index_to_companies_table.php b/database/migrations/2018_11_23_150732_add_receipt_index_to_companies_table.php index bfea9b0c..a2c99d0c 100644 --- a/database/migrations/2018_11_23_150732_add_receipt_index_to_companies_table.php +++ b/database/migrations/2018_11_23_150732_add_receipt_index_to_companies_table.php @@ -14,7 +14,10 @@ class AddReceiptIndexToCompaniesTable extends Migration public function up() { Schema::table('companies', function (Blueprint $table) { - $table->integer('receipt_index')->after('quote_index')->nullable(); + $table + ->integer('receipt_index') + ->after('quote_index') + ->nullable(); }); } diff --git a/database/migrations/2018_11_24_145424_add_client_data_field_and_make_client_id_nullable_to_invoices_table.php b/database/migrations/2018_11_24_145424_add_client_data_field_and_make_client_id_nullable_to_invoices_table.php index a3784406..694b877f 100644 --- a/database/migrations/2018_11_24_145424_add_client_data_field_and_make_client_id_nullable_to_invoices_table.php +++ b/database/migrations/2018_11_24_145424_add_client_data_field_and_make_client_id_nullable_to_invoices_table.php @@ -14,8 +14,15 @@ class AddClientDataFieldAndMakeClientIdNullableToInvoicesTable extends Migration public function up() { Schema::table('invoices', function (Blueprint $table) { - $table->json('client_data')->nullable()->after('hash'); - $table->integer('client_id')->unsigned()->nullable()->change(); + $table + ->json('client_data') + ->nullable() + ->after('hash'); + $table + ->integer('client_id') + ->unsigned() + ->nullable() + ->change(); }); } @@ -28,7 +35,11 @@ public function down() { Schema::table('invoices', function (Blueprint $table) { $table->dropColumn('client_data'); - $table->integer('client_id')->unsigned()->nullable(false)->change(); + $table + ->integer('client_id') + ->unsigned() + ->nullable(false) + ->change(); }); } } diff --git a/database/migrations/2018_11_24_154814_add_client_data_field_and_make_client_id_nullable_to_old_invoices_table.php b/database/migrations/2018_11_24_154814_add_client_data_field_and_make_client_id_nullable_to_old_invoices_table.php index 3e5f7ea4..2fe8c216 100644 --- a/database/migrations/2018_11_24_154814_add_client_data_field_and_make_client_id_nullable_to_old_invoices_table.php +++ b/database/migrations/2018_11_24_154814_add_client_data_field_and_make_client_id_nullable_to_old_invoices_table.php @@ -14,8 +14,15 @@ class AddClientDataFieldAndMakeClientIdNullableToOldInvoicesTable extends Migrat public function up() { Schema::table('old_invoices', function (Blueprint $table) { - $table->json('client_data')->nullable()->after('status'); - $table->integer('client_id')->unsigned()->nullable()->change(); + $table + ->json('client_data') + ->nullable() + ->after('status'); + $table + ->integer('client_id') + ->unsigned() + ->nullable() + ->change(); }); } @@ -28,7 +35,11 @@ public function down() { Schema::table('old_invoices', function (Blueprint $table) { $table->dropColumn('client_data'); - $table->integer('client_id')->unsigned()->nullable(false)->change(); + $table + ->integer('client_id') + ->unsigned() + ->nullable(false) + ->change(); }); } } diff --git a/database/migrations/2018_11_24_161414_rename_invoice_events_to_invoice_recurrences.php b/database/migrations/2018_11_24_161414_rename_invoice_events_to_invoice_recurrences.php index f82cdfa8..231128f4 100644 --- a/database/migrations/2018_11_24_161414_rename_invoice_events_to_invoice_recurrences.php +++ b/database/migrations/2018_11_24_161414_rename_invoice_events_to_invoice_recurrences.php @@ -28,22 +28,28 @@ public function up() Schema::rename('invoice_events', 'invoice_recurrences'); Schema::table('invoice_recurrences', function (Blueprint $table) { - $table->foreign('company_id') - ->references('id')->on('companies') + $table + ->foreign('company_id') + ->references('id') + ->on('companies') ->onDelete('cascade'); }); Schema::table('invoices', function (Blueprint $table) { $table->renameColumn('invoice_event_id', 'invoice_recurrence_id'); - $table->foreign('invoice_recurrence_id') - ->references('id')->on('invoice_recurrences') + $table + ->foreign('invoice_recurrence_id') + ->references('id') + ->on('invoice_recurrences') ->onDelete('cascade'); }); Schema::table('invoice_templates', function (Blueprint $table) { $table->renameColumn('invoice_event_id', 'invoice_recurrence_id'); - $table->foreign('invoice_recurrence_id') - ->references('id')->on('invoice_recurrences') + $table + ->foreign('invoice_recurrence_id') + ->references('id') + ->on('invoice_recurrences') ->onDelete('cascade'); }); } @@ -72,20 +78,26 @@ public function down() Schema::rename('invoice_recurrences', 'invoice_events'); Schema::table('invoice_events', function (Blueprint $table) { - $table->foreign('company_id') - ->references('id')->on('companies') + $table + ->foreign('company_id') + ->references('id') + ->on('companies') ->onDelete('cascade'); }); Schema::table('invoices', function (Blueprint $table) { - $table->foreign('invoice_event_id') - ->references('id')->on('invoice_events') + $table + ->foreign('invoice_event_id') + ->references('id') + ->on('invoice_events') ->onDelete('cascade'); }); Schema::table('invoice_templates', function (Blueprint $table) { - $table->foreign('invoice_event_id') - ->references('id')->on('invoice_events') + $table + ->foreign('invoice_event_id') + ->references('id') + ->on('invoice_events') ->onDelete('cascade'); }); } diff --git a/database/migrations/2018_11_25_200612_add_email_verified_at_to_users_table.php b/database/migrations/2018_11_25_200612_add_email_verified_at_to_users_table.php index 69d05c49..e681a3e2 100644 --- a/database/migrations/2018_11_25_200612_add_email_verified_at_to_users_table.php +++ b/database/migrations/2018_11_25_200612_add_email_verified_at_to_users_table.php @@ -14,7 +14,10 @@ class AddEmailVerifiedAtToUsersTable extends Migration public function up() { Schema::table('users', function (Blueprint $table) { - $table->timestamp('email_verified_at')->nullable()->after('status'); + $table + ->timestamp('email_verified_at') + ->nullable() + ->after('status'); }); } diff --git a/database/migrations/2018_12_06_153303_add_client_data_field_and_make_client_id_nullable_to_quotes_table.php b/database/migrations/2018_12_06_153303_add_client_data_field_and_make_client_id_nullable_to_quotes_table.php index b2a1ba48..5c95e2dc 100644 --- a/database/migrations/2018_12_06_153303_add_client_data_field_and_make_client_id_nullable_to_quotes_table.php +++ b/database/migrations/2018_12_06_153303_add_client_data_field_and_make_client_id_nullable_to_quotes_table.php @@ -14,8 +14,15 @@ class AddClientDataFieldAndMakeClientIdNullableToQuotesTable extends Migration public function up() { Schema::table('quotes', function (Blueprint $table) { - $table->json('client_data')->nullable()->after('share_token'); - $table->integer('client_id')->unsigned()->nullable()->change(); + $table + ->json('client_data') + ->nullable() + ->after('share_token'); + $table + ->integer('client_id') + ->unsigned() + ->nullable() + ->change(); }); } @@ -28,7 +35,11 @@ public function down() { Schema::table('quotes', function (Blueprint $table) { $table->dropColumn('client_data'); - $table->integer('client_id')->unsigned()->nullable(false)->change(); + $table + ->integer('client_id') + ->unsigned() + ->nullable(false) + ->change(); }); } } diff --git a/database/migrations/2018_12_06_162017_create_recipients_table.php b/database/migrations/2018_12_06_162017_create_recipients_table.php index 639f4b38..73f04423 100644 --- a/database/migrations/2018_12_06_162017_create_recipients_table.php +++ b/database/migrations/2018_12_06_162017_create_recipients_table.php @@ -24,7 +24,11 @@ public function up() $table->string('recipientable_type'); $table->unique(['email', 'recipientable_id', 'recipientable_type'], 'recipients_unique'); $table->unsignedInteger('company_id'); - $table->foreign('company_id')->references('id')->on('companies')->onDelete('cascade'); + $table + ->foreign('company_id') + ->references('id') + ->on('companies') + ->onDelete('cascade'); $table->timestamps(); $table->softDeletes(); }); diff --git a/database/migrations/2019_01_15_162105_make_client_id_nullable_on_payments_table.php b/database/migrations/2019_01_15_162105_make_client_id_nullable_on_payments_table.php index 5203f7bb..2ee7a121 100644 --- a/database/migrations/2019_01_15_162105_make_client_id_nullable_on_payments_table.php +++ b/database/migrations/2019_01_15_162105_make_client_id_nullable_on_payments_table.php @@ -14,7 +14,11 @@ class MakeClientIdNullableOnPaymentsTable extends Migration public function up() { Schema::table('payments', function (Blueprint $table) { - $table->integer('client_id')->unsigned()->nullable()->change(); + $table + ->integer('client_id') + ->unsigned() + ->nullable() + ->change(); }); } @@ -26,7 +30,11 @@ public function up() public function down() { Schema::table('payments', function (Blueprint $table) { - $table->integer('client_id')->unsigned()->nullable(false)->change(); + $table + ->integer('client_id') + ->unsigned() + ->nullable(false) + ->change(); }); } } diff --git a/public/index.php b/public/index.php index 66ea93cd..2db99a58 100644 --- a/public/index.php +++ b/public/index.php @@ -16,8 +16,8 @@ | */ -if (file_exists(__DIR__.'/../storage/framework/maintenance.php')) { - require __DIR__.'/../storage/framework/maintenance.php'; +if (file_exists(__DIR__ . '/../storage/framework/maintenance.php')) { + require __DIR__ . '/../storage/framework/maintenance.php'; } /* @@ -31,7 +31,7 @@ | */ -require __DIR__.'/../vendor/autoload.php'; +require __DIR__ . '/../vendor/autoload.php'; /* |-------------------------------------------------------------------------- @@ -44,12 +44,10 @@ | */ -$app = require_once __DIR__.'/../bootstrap/app.php'; +$app = require_once __DIR__ . '/../bootstrap/app.php'; $kernel = $app->make(Kernel::class); -$response = tap($kernel->handle( - $request = Request::capture() -))->send(); +$response = tap($kernel->handle($request = Request::capture()))->send(); $kernel->terminate($request, $response); diff --git a/resources/assets/js/app.js b/resources/assets/js/app.js index d8aee6ef..7b6e7cfc 100644 --- a/resources/assets/js/app.js +++ b/resources/assets/js/app.js @@ -54,4 +54,4 @@ require('parsleyjs'); require('slick-carousel'); require('trumbowyg'); require('prismjs'); -require('chartist-plugin-legend'); \ No newline at end of file +require('chartist-plugin-legend'); diff --git a/resources/assets/js/core.js b/resources/assets/js/core.js index 8a187e1e..b774ef4f 100644 --- a/resources/assets/js/core.js +++ b/resources/assets/js/core.js @@ -1,19 +1,15 @@ -"use strict"; +'use strict'; -window.Parsley - .addValidator('phoneFormat', { - requirementType: 'string', - validateString: function(value, elementid) { - if($(elementid).intlTelInput("isValidNumber")) - { - return true; - } - else - { - return false; - } - }, - messages: { - en: 'This is an invalid phone number format' - } - }); \ No newline at end of file +window.Parsley.addValidator('phoneFormat', { + requirementType: 'string', + validateString: function (value, elementid) { + if ($(elementid).intlTelInput('isValidNumber')) { + return true; + } else { + return false; + } + }, + messages: { + en: 'This is an invalid phone number format' + } +}); diff --git a/resources/assets/js/unicorn.js b/resources/assets/js/unicorn.js index eb3375d0..42b08832 100644 --- a/resources/assets/js/unicorn.js +++ b/resources/assets/js/unicorn.js @@ -1,274 +1,355 @@ class Unicorn { - constructor(enforcer) { - throw new Error('Cannot construct singleton'); - } + constructor(enforcer) { + throw new Error('Cannot construct singleton'); + } - static initPhoneInput(selector, initialCountry = "sg") - { - $(selector).intlTelInput({ - initialCountry: initialCountry, - utilsScript: "/assets/js/utils.js" - }); + static initPhoneInput(selector, initialCountry = 'sg') { + $(selector).intlTelInput({ + initialCountry: initialCountry, + utilsScript: '/assets/js/utils.js' + }); - $(selector).focusin(function() { - $(this).parent().siblings('.label-validation').addClass('theme-text'); - }); + $(selector).focusin(function () { + $(this).parent().siblings('.label-validation').addClass('theme-text'); + }); - $(selector).focusout(function() { - $(this).parent().siblings('.label-validation').removeClass('theme-text'); - }); - } + $(selector).focusout(function () { + $(this).parent().siblings('.label-validation').removeClass('theme-text'); + }); + } - static initSelectize(selector, allowCreation = false) - { - $(selector).selectize({ - create: allowCreation, - onChange: function(value, isOnInitialize) { - this.$input.parsley().validate(); - } - }); - } + static initSelectize(selector, allowCreation = false) { + $(selector).selectize({ + create: allowCreation, + onChange: function (value, isOnInitialize) { + this.$input.parsley().validate(); + } + }); + } - static initDatepicker(selector, yearRangeStart, yearRangeEnd, defaultDate) - { - $(selector).datepicker({ - autoClose: 'false', - format: 'd mmmm, yyyy', - yearRange: [yearRangeStart, yearRangeEnd], - defaultDate: defaultDate, - setDefaultDate: true, - onSelect: function() { - // let date = $(this)[0].formats.yyyy() + '-' + $(this)[0].formats.mm() + '-' + $(this)[0].formats.dd() - // $('#receiveddate').val(date); - } - }); - } + static initDatepicker(selector, yearRangeStart, yearRangeEnd, defaultDate) { + $(selector).datepicker({ + autoClose: 'false', + format: 'd mmmm, yyyy', + yearRange: [yearRangeStart, yearRangeEnd], + defaultDate: defaultDate, + setDefaultDate: true, + onSelect: function () { + // let date = $(this)[0].formats.yyyy() + '-' + $(this)[0].formats.mm() + '-' + $(this)[0].formats.dd() + // $('#receiveddate').val(date); + } + }); + } - static initTrumbowyg(selector) - { - $(selector).trumbowyg({ - svgPath: '/assets/fonts/trumbowygicons.svg', - removeformatPasted: true, - resetCss: true, - autogrow: true, - }); - } + static initTrumbowyg(selector) { + $(selector).trumbowyg({ + svgPath: '/assets/fonts/trumbowygicons.svg', + removeformatPasted: true, + resetCss: true, + autogrow: true + }); + } - static initNewItem(count, elementContainer, modelType, itemOptions) { - let item = '
'; - $('#' + elementContainer).append(item); - this.initItemElement(itemOptions); - $('html, body').animate({ - scrollTop: $("#" + modelType + "_item_" + count).offset().top - }, 500, 'linear'); - } + static initNewItem(count, elementContainer, modelType, itemOptions) { + let item = + '
'; + $('#' + elementContainer).append(item); + this.initItemElement(itemOptions); + $('html, body').animate( + { + scrollTop: $('#' + modelType + '_item_' + count).offset().top + }, + 500, + 'linear' + ); + } - static initListener(parent_selector, selector, trigger = 'click', callback = null) - { - $(parent_selector).on(trigger, selector, function (event) { - typeof callback === 'function' && callback(event, $(this)); - }); - } + static initListener(parent_selector, selector, trigger = 'click', callback = null) { + $(parent_selector).on(trigger, selector, function (event) { + typeof callback === 'function' && callback(event, $(this)); + }); + } - static initItemConfirmationTrigger(parent_selector, selector, modal_selector, buttonSelector, trigger = 'click') - { - this.initListener(parent_selector, selector, trigger, function (event, element) { - event.preventDefault(); - $(modal_selector).modal('open'); + static initItemConfirmationTrigger( + parent_selector, + selector, + modal_selector, + buttonSelector, + trigger = 'click' + ) { + this.initListener(parent_selector, selector, trigger, function (event, element) { + event.preventDefault(); + $(modal_selector).modal('open'); - let itemid = element.attr('data-id'); - let count = element.attr('data-count'); + let itemid = element.attr('data-id'); + let count = element.attr('data-count'); - $(modal_selector).children().children(buttonSelector).attr('data-id', itemid); - $(modal_selector).children().children(buttonSelector).attr('data-count', count); - }); - } + $(modal_selector).children().children(buttonSelector).attr('data-id', itemid); + $(modal_selector).children().children(buttonSelector).attr('data-count', count); + }); + } - static executeItemDeleteTrigger(parent_selector, selector, modelType, trigger = 'click') - { - this.initListener(parent_selector, selector, trigger, function (event, element) { - event.preventDefault(); + static executeItemDeleteTrigger(parent_selector, selector, modelType, trigger = 'click') { + this.initListener(parent_selector, selector, trigger, function (event, element) { + event.preventDefault(); - let itemid = element.attr('data-id'); - let count = element.attr('data-count'); + let itemid = element.attr('data-id'); + let count = element.attr('data-count'); - if (itemid == "false") { - $('#' + modelType + '_item_' + count).remove(); - $(parent_selector).modal('close'); - } - }); - } + if (itemid == 'false') { + $('#' + modelType + '_item_' + count).remove(); + $(parent_selector).modal('close'); + } + }); + } - static initConfirmationTrigger(parent_selector, selector, fqdn, model, model_action, modal_selector, modal_form_selector, trigger = 'click') - { - this.initListener(parent_selector, selector, trigger, function (event, element) { - event.preventDefault(); - let dataid = element.attr('data-id'); - $(modal_form_selector).attr('action', '/' + fqdn + '/' + model + '/' + dataid + '/' + model_action); - $(modal_selector).modal('open'); - }); - } + static initConfirmationTrigger( + parent_selector, + selector, + fqdn, + model, + model_action, + modal_selector, + modal_form_selector, + trigger = 'click' + ) { + this.initListener(parent_selector, selector, trigger, function (event, element) { + event.preventDefault(); + let dataid = element.attr('data-id'); + $(modal_form_selector).attr( + 'action', + '/' + fqdn + '/' + model + '/' + dataid + '/' + model_action + ); + $(modal_selector).modal('open'); + }); + } - static initPageSearch(selector, selector_context) - { - let inputBox = $(selector); - let instance = $(selector_context); - // let context = document.querySelector(selector_context); - // let instance = new Mark(context); + static initPageSearch(selector, selector_context) { + let inputBox = $(selector); + let instance = $(selector_context); + // let context = document.querySelector(selector_context); + // let instance = new Mark(context); - inputBox.on("input", function() { - let term = $(this).val(); - instance.unmark().show(); - if (term != "") { - instance.mark(term, { - done: function() { - instance.not(":has(mark)").hide(); - } - }); - } + inputBox.on('input', function () { + let term = $(this).val(); + instance.unmark().show(); + if (term != '') { + instance.mark(term, { + done: function () { + instance.not(':has(mark)').hide(); + } }); - } + } + }); + } - static initImageUpload(selector, upload_selector, display_selector) - { - $(upload_selector).click(function(){ - $(selector).click(); - }); + static initImageUpload(selector, upload_selector, display_selector) { + $(upload_selector).click(function () { + $(selector).click(); + }); - $(selector).on("change", function() - { - let files = !!this.files ? this.files : []; - if (!files.length || !window.FileReader) return; // no file selected, or no FileReader support + $(selector).on('change', function () { + let files = !!this.files ? this.files : []; + if (!files.length || !window.FileReader) return; // no file selected, or no FileReader support - if (/^image/.test( files[0].type)){ // only image file - let reader = new FileReader(); // instance of the FileReader - reader.readAsDataURL(files[0]); // read the local file + if (/^image/.test(files[0].type)) { + // only image file + let reader = new FileReader(); // instance of the FileReader + reader.readAsDataURL(files[0]); // read the local file - reader.onloadend = function(){ // set image data as background of div - $(display_selector).attr("src", this.result); - } - } - }); - } + reader.onloadend = function () { + // set image data as background of div + $(display_selector).attr('src', this.result); + }; + } + }); + } - static initParsleyValidation(selector, callback = null) - { - $(selector).parsley({ - successClass: 'valid', - errorClass: 'invalid', - errorsContainer: function (velem) { - let $errelem = velem.$element.siblings('span.helper-text'); - $errelem.attr('data-error', window.Parsley.getErrorMessage(velem.validationResult[0].assert)); - return true; - }, - errorsWrapper: '', - errorTemplate: '' - }) - .on('field:validated', function(velem) { - }) - .on('field:success', function(velem) { - if (velem.$element.is(':radio')) - { - velem.$element.parentsUntil('.row').find('span.helper-text').removeClass('invalid').addClass('valid'); - } - else if (velem.$element.is('select')) { - velem.$element.siblings('.selectize-control').removeClass('invalid').addClass('valid'); - } - else if (velem.$element.is('.trumbowyg-textarea')) - { - velem.$element.parentsUntil('.row').find('.trumbowyg-box').removeClass('invalid').addClass('valid'); - velem.$element.parentsUntil('.row').find('span.helper-text').removeClass('invalid').addClass('valid'); - } - else if (velem.$element.is('.phone-input')) - { - velem.$element.parent('').siblings('span.helper-text').removeClass('invalid').addClass('valid'); - velem.$element.val(velem.$element.intlTelInput("getNumber")); - } - }) - .on('field:error', function(velem) { - if (velem.$element.is(':radio')) - { - velem.$element.parentsUntil('.row').find('span.helper-text').removeClass('valid').addClass('invalid'); - velem.$element.parentsUntil('.row').find('span.helper-text').attr('data-error', window.Parsley.getErrorMessage(velem.validationResult[0].assert)); - } - else if (velem.$element.is('select')) { - velem.$element.siblings('.selectize-control').removeClass('valid').addClass('invalid'); - } - else if(velem.$element.is('.trumbowyg-textarea')) { - velem.$element.parentsUntil('.row').find('.trumbowyg-box').removeClass('valid').addClass('invalid'); - velem.$element.parentsUntil('.row').find('span.helper-text').removeClass('valid').addClass('invalid'); - velem.$element.parentsUntil('.row').find('span.helper-text').attr('data-error', window.Parsley.getErrorMessage(velem.validationResult[0].assert)); - } - else if (velem.$element.is('.phone-input')) - { - velem.$element.parent('').siblings('span.helper-text').removeClass('valid').addClass('invalid'); - velem.$element.parent('').siblings('span.helper-text').attr('data-error', window.Parsley.getErrorMessage(velem.validationResult[0].assert)); - } - }) - .on('form:submit', function(velem) { - typeof callback === 'function' && callback(); - }); - } + static initParsleyValidation(selector, callback = null) { + $(selector) + .parsley({ + successClass: 'valid', + errorClass: 'invalid', + errorsContainer: function (velem) { + let $errelem = velem.$element.siblings('span.helper-text'); + $errelem.attr( + 'data-error', + window.Parsley.getErrorMessage(velem.validationResult[0].assert) + ); + return true; + }, + errorsWrapper: '', + errorTemplate: '' + }) + .on('field:validated', function (velem) {}) + .on('field:success', function (velem) { + if (velem.$element.is(':radio')) { + velem.$element + .parentsUntil('.row') + .find('span.helper-text') + .removeClass('invalid') + .addClass('valid'); + } else if (velem.$element.is('select')) { + velem.$element.siblings('.selectize-control').removeClass('invalid').addClass('valid'); + } else if (velem.$element.is('.trumbowyg-textarea')) { + velem.$element + .parentsUntil('.row') + .find('.trumbowyg-box') + .removeClass('invalid') + .addClass('valid'); + velem.$element + .parentsUntil('.row') + .find('span.helper-text') + .removeClass('invalid') + .addClass('valid'); + } else if (velem.$element.is('.phone-input')) { + velem.$element + .parent('') + .siblings('span.helper-text') + .removeClass('invalid') + .addClass('valid'); + velem.$element.val(velem.$element.intlTelInput('getNumber')); + } + }) + .on('field:error', function (velem) { + if (velem.$element.is(':radio')) { + velem.$element + .parentsUntil('.row') + .find('span.helper-text') + .removeClass('valid') + .addClass('invalid'); + velem.$element + .parentsUntil('.row') + .find('span.helper-text') + .attr('data-error', window.Parsley.getErrorMessage(velem.validationResult[0].assert)); + } else if (velem.$element.is('select')) { + velem.$element.siblings('.selectize-control').removeClass('valid').addClass('invalid'); + } else if (velem.$element.is('.trumbowyg-textarea')) { + velem.$element + .parentsUntil('.row') + .find('.trumbowyg-box') + .removeClass('valid') + .addClass('invalid'); + velem.$element + .parentsUntil('.row') + .find('span.helper-text') + .removeClass('valid') + .addClass('invalid'); + velem.$element + .parentsUntil('.row') + .find('span.helper-text') + .attr('data-error', window.Parsley.getErrorMessage(velem.validationResult[0].assert)); + } else if (velem.$element.is('.phone-input')) { + velem.$element + .parent('') + .siblings('span.helper-text') + .removeClass('valid') + .addClass('invalid'); + velem.$element + .parent('') + .siblings('span.helper-text') + .attr('data-error', window.Parsley.getErrorMessage(velem.validationResult[0].assert)); + } + }) + .on('form:submit', function (velem) { + typeof callback === 'function' && callback(); + }); + } - static retrieveItemTemplate(baseEndpoint, itemTemplateId, element, callback) { - if (typeof itemTemplateId !== typeof undefined && itemTemplateId !== false && itemTemplateId !== 'undefined') { - $.ajax({ - type: "GET", - url: baseEndpoint + "/itemtemplate/" + itemTemplateId + "/retrieve", - headers: { - 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') - } - }) - .done(function(data) { - callback(element, data); - }) - .fail(function(jqXHR, textStatus) { - console.log(jqXHR); - console.log(textStatus); - }) - .always(function() { - console.log("finish"); - }); + static retrieveItemTemplate(baseEndpoint, itemTemplateId, element, callback) { + if ( + typeof itemTemplateId !== typeof undefined && + itemTemplateId !== false && + itemTemplateId !== 'undefined' + ) { + $.ajax({ + type: 'GET', + url: baseEndpoint + '/itemtemplate/' + itemTemplateId + '/retrieve', + headers: { + 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') } + }) + .done(function (data) { + callback(element, data); + }) + .fail(function (jqXHR, textStatus) { + console.log(jqXHR); + console.log(textStatus); + }) + .always(function () { + console.log('finish'); + }); } + } - static setItemTemplate(element, itemtemplate) { - element.val(itemtemplate.name); - let quantityElement = element.parentsUntil(".card-panel").find('.item-quantity-input'); - let priceElement = element.parentsUntil(".card-panel").find('.item-price-input'); - let descriptionElement = element.parentsUntil(".card-panel").find('.item-description-textarea'); + static setItemTemplate(element, itemtemplate) { + element.val(itemtemplate.name); + let quantityElement = element.parentsUntil('.card-panel').find('.item-quantity-input'); + let priceElement = element.parentsUntil('.card-panel').find('.item-price-input'); + let descriptionElement = element.parentsUntil('.card-panel').find('.item-description-textarea'); - quantityElement.val(itemtemplate.quantity); - priceElement.val(itemtemplate.price); - descriptionElement.trumbowyg('html', itemtemplate.description); - } + quantityElement.val(itemtemplate.quantity); + priceElement.val(itemtemplate.price); + descriptionElement.trumbowyg('html', itemtemplate.description); + } - static initItemElement(options) - { - $('.trumbowyg-textarea').trumbowyg({ - svgPath: '/assets/fonts/trumbowygicons.svg', - removeformatPasted: true, - resetCss: true, - autogrow: true, - }); + static initItemElement(options) { + $('.trumbowyg-textarea').trumbowyg({ + svgPath: '/assets/fonts/trumbowygicons.svg', + removeformatPasted: true, + resetCss: true, + autogrow: true + }); - //Explicit selection otherwise will change the select into a multiple select if only selecting by css class - $('select.item-list-selector').selectize({ - create: true, - valueField: 'name', - labelField: 'name', - searchField: ['name'], - onChange: function(value, isOnInitialize) { - this.$input.parsley().validate(); - }, - options: options, - render: { - option: function(data) { - return '
' + data.name +'
'; - } - } - }); - } + //Explicit selection otherwise will change the select into a multiple select if only selecting by css class + $('select.item-list-selector').selectize({ + create: true, + valueField: 'name', + labelField: 'name', + searchField: ['name'], + onChange: function (value, isOnInitialize) { + this.$input.parsley().validate(); + }, + options: options, + render: { + option: function (data) { + return ( + '
' + + data.name + + '
' + ); + } + } + }); + } } Unicorn.type = 'Unicorn'; @@ -276,4 +357,4 @@ Unicorn.type = 'Unicorn'; // If exporting with export default Unicorn, the class needs to be accessed via : Unicorn.default.donkey() // export default Unicorn; -module.exports = Unicorn; \ No newline at end of file +module.exports = Unicorn; diff --git a/resources/lang/en/auth.php b/resources/lang/en/auth.php index 24e063b5..37e3e604 100644 --- a/resources/lang/en/auth.php +++ b/resources/lang/en/auth.php @@ -1,7 +1,6 @@ 'These credentials do not match our records.', + 'failed' => 'These credentials do not match our records.', 'password' => 'The provided password is incorrect.', 'throttle' => 'Too many login attempts. Please try again in :seconds seconds.', - ]; diff --git a/resources/lang/en/pagination.php b/resources/lang/en/pagination.php index fcab34b2..ecac3aa3 100644 --- a/resources/lang/en/pagination.php +++ b/resources/lang/en/pagination.php @@ -1,7 +1,6 @@ '« Previous', - 'next' => 'Next »', - + 'next' => 'Next »', ]; diff --git a/resources/lang/en/passwords.php b/resources/lang/en/passwords.php index 2345a56b..b56e2067 100644 --- a/resources/lang/en/passwords.php +++ b/resources/lang/en/passwords.php @@ -1,7 +1,6 @@ 'Please wait before retrying.', 'token' => 'This password reset token is invalid.', 'user' => "We can't find a user with that email address.", - ]; diff --git a/resources/lang/en/validation.php b/resources/lang/en/validation.php index 21791139..f9df1e30 100644 --- a/resources/lang/en/validation.php +++ b/resources/lang/en/validation.php @@ -1,7 +1,6 @@ [], - ]; diff --git a/resources/views/vendor/notifications/email.blade.php b/resources/views/vendor/notifications/email.blade.php index 53ee0af4..6669b4b1 100644 --- a/resources/views/vendor/notifications/email.blade.php +++ b/resources/views/vendor/notifications/email.blade.php @@ -18,16 +18,14 @@ {{-- Action Button --}} @isset($actionText) - + @component('mail::button', ['url' => $actionUrl, 'color' => $color]) {{ $actionText }} @endcomponent diff --git a/routes/web.php b/routes/web.php index b6a42fac..13f6e737 100644 --- a/routes/web.php +++ b/routes/web.php @@ -83,50 +83,102 @@ Route::post('/user/multifactor/start', 'UserController@multifactor_start')->name('user.multifactor.start'); Route::get('/user/multifactor/create', 'UserController@multifactor_create')->name('user.multifactor.create'); Route::post('/user/multifactor/create', 'UserController@multifactor_store')->name('user.multifactor.store'); - Route::post('/user/multifactor/regenerate_codes', 'UserController@multifactor_regenerate_codes')->name('user.multifactor.regenerate_codes'); + Route::post('/user/multifactor/regenerate_codes', 'UserController@multifactor_regenerate_codes')->name( + 'user.multifactor.regenerate_codes', + ); Route::delete('/user/multifactor/destroy', 'UserController@multifactor_destroy')->name('user.multifactor.destroy'); Route::delete('/user/session/{sessionId}/destroy', 'UserController@session_destroy')->name('user.security.session.destroy'); /* Company */ - Route::get('/company/show', 'CompanyController@show')->name('company.show')->middleware('can:member,company'); - Route::get('/company/edit', 'CompanyController@edit')->name('company.edit')->middleware('can:owner,company'); - Route::patch('/company/edit', 'CompanyController@update')->name('company.update')->middleware('can:owner,company'); + Route::get('/company/show', 'CompanyController@show') + ->name('company.show') + ->middleware('can:member,company'); + Route::get('/company/edit', 'CompanyController@edit') + ->name('company.edit') + ->middleware('can:owner,company'); + Route::patch('/company/edit', 'CompanyController@update') + ->name('company.update') + ->middleware('can:owner,company'); Route::group(['middleware' => ['hascompany']], function () { Route::get('/dashboard', 'MainController@dashboard')->name('dashboard'); - Route::get('/user/{user}/retrieve', 'UserController@retrieve')->name('user.retrieve')->middleware('can:owner,company'); + Route::get('/user/{user}/retrieve', 'UserController@retrieve') + ->name('user.retrieve') + ->middleware('can:owner,company'); /* Company */ - Route::get('/company/owner/edit', 'CompanyController@edit_owner')->name('company.owner.edit')->middleware('can:owner,company'); - Route::patch('/company/owner/edit', 'CompanyController@update_owner')->name('company.owner.update')->middleware('can:owner,company'); - Route::get('/company/users', 'CompanyUserController@index')->name('company.users.index')->middleware('can:owner,company'); - Route::get('/company/users/{user}/edit', 'CompanyUserController@edit')->name('company.users.edit')->middleware('can:owner,company'); - Route::patch('/company/users/{user}/edit', 'CompanyUserController@update')->name('company.users.update')->middleware('can:owner,company'); - - Route::get('/company/invite', 'CompanyInviteController@create')->name('company.invite.create')->middleware('can:owner,company'); - Route::post('/company/invite', 'CompanyInviteController@store')->name('company.invite.store')->middleware('can:owner,company'); - Route::delete('/company/access/{user}/revoke', 'CompanyInviteController@revoke')->name('company.access.revoke')->middleware('can:owner,company'); + Route::get('/company/owner/edit', 'CompanyController@edit_owner') + ->name('company.owner.edit') + ->middleware('can:owner,company'); + Route::patch('/company/owner/edit', 'CompanyController@update_owner') + ->name('company.owner.update') + ->middleware('can:owner,company'); + Route::get('/company/users', 'CompanyUserController@index') + ->name('company.users.index') + ->middleware('can:owner,company'); + Route::get('/company/users/{user}/edit', 'CompanyUserController@edit') + ->name('company.users.edit') + ->middleware('can:owner,company'); + Route::patch('/company/users/{user}/edit', 'CompanyUserController@update') + ->name('company.users.update') + ->middleware('can:owner,company'); + + Route::get('/company/invite', 'CompanyInviteController@create') + ->name('company.invite.create') + ->middleware('can:owner,company'); + Route::post('/company/invite', 'CompanyInviteController@store') + ->name('company.invite.store') + ->middleware('can:owner,company'); + Route::delete('/company/access/{user}/revoke', 'CompanyInviteController@revoke') + ->name('company.access.revoke') + ->middleware('can:owner,company'); /* CompanyAddress */ - Route::get('/company/address/edit', 'CompanyAddressController@edit')->name('company.address.edit')->middleware('can:address,company'); - Route::patch('/company/address/edit', 'CompanyAddressController@update')->name('company.address.update')->middleware('can:address,company'); + Route::get('/company/address/edit', 'CompanyAddressController@edit') + ->name('company.address.edit') + ->middleware('can:address,company'); + Route::patch('/company/address/edit', 'CompanyAddressController@update') + ->name('company.address.update') + ->middleware('can:address,company'); /* CompanySettings */ - Route::get('/company/settings/edit', 'CompanySettingsController@edit')->name('company.settings.edit')->middleware('can:settings,company'); - Route::patch('/company/settings/edit', 'CompanySettingsController@update')->name('company.settings.update')->middleware('can:settings,company'); + Route::get('/company/settings/edit', 'CompanySettingsController@edit') + ->name('company.settings.edit') + ->middleware('can:settings,company'); + Route::patch('/company/settings/edit', 'CompanySettingsController@update') + ->name('company.settings.update') + ->middleware('can:settings,company'); /* CompanyUserRequest */ - Route::get('/company/requests', 'CompanyUserRequestController@index')->name('company.requests.index')->middleware('can:index, App\Models\CompanyUserRequest'); - Route::post('/company/requests/{companyuserrequest}/approve', 'CompanyUserRequestController@approve')->name('company.requests.approve')->middleware('can:update,companyuserrequest'); - Route::post('/company/requests/{companyuserrequest}/reject', 'CompanyUserRequestController@reject')->name('company.requests.reject')->middleware('can:update,companyuserrequest'); + Route::get('/company/requests', 'CompanyUserRequestController@index') + ->name('company.requests.index') + ->middleware('can:index, App\Models\CompanyUserRequest'); + Route::post('/company/requests/{companyuserrequest}/approve', 'CompanyUserRequestController@approve') + ->name('company.requests.approve') + ->middleware('can:update,companyuserrequest'); + Route::post('/company/requests/{companyuserrequest}/reject', 'CompanyUserRequestController@reject') + ->name('company.requests.reject') + ->middleware('can:update,companyuserrequest'); /* Roles */ - Route::get('/company/roles', 'CompanyRoleController@index')->name('company.roles.index')->middleware('can:owner,company'); - Route::get('/company/roles/create', 'CompanyRoleController@create')->name('company.roles.create')->middleware('can:owner,company'); - Route::post('/company/roles/create', 'CompanyRoleController@store')->name('company.roles.store')->middleware('can:owner,company'); - Route::get('/company/roles/{role}/edit', 'CompanyRoleController@edit')->name('company.roles.edit')->middleware('can:owner,company'); - Route::patch('/company/roles/{role}/edit', 'CompanyRoleController@update')->name('company.roles.update')->middleware('can:owner,company'); - Route::delete('/company/roles/{role}/destroy', 'CompanyRoleController@destroy')->name('company.roles.destroy')->middleware('can:owner,company'); + Route::get('/company/roles', 'CompanyRoleController@index') + ->name('company.roles.index') + ->middleware('can:owner,company'); + Route::get('/company/roles/create', 'CompanyRoleController@create') + ->name('company.roles.create') + ->middleware('can:owner,company'); + Route::post('/company/roles/create', 'CompanyRoleController@store') + ->name('company.roles.store') + ->middleware('can:owner,company'); + Route::get('/company/roles/{role}/edit', 'CompanyRoleController@edit') + ->name('company.roles.edit') + ->middleware('can:owner,company'); + Route::patch('/company/roles/{role}/edit', 'CompanyRoleController@update') + ->name('company.roles.update') + ->middleware('can:owner,company'); + Route::delete('/company/roles/{role}/destroy', 'CompanyRoleController@destroy') + ->name('company.roles.destroy') + ->middleware('can:owner,company'); /* Migration */ Route::get('/migration/', 'DataMigrationController@create')->name('migration.create'); @@ -135,104 +187,264 @@ Route::post('/migration/import/payment', 'DataMigrationController@storepayment')->name('migration.import.payment'); /* Client Recipients */ - Route::get('/client/{client}/recipients/create', 'RecipientController@create')->name('client.recipient.create')->middleware('can:create, App\Models\Client'); - Route::post('/client/{client}/recipients/create', 'RecipientController@store')->name('client.recipient.store')->middleware('can:create, App\Models\Client'); - Route::get('/client/{client}/recipients/{recipient}/edit', 'RecipientController@edit')->name('client.recipient.edit')->middleware('can:update,recipient'); - Route::patch('/client/{client}/recipients/{recipient}/edit', 'RecipientController@update')->name('client.recipient.update')->middleware('can:update,recipient'); + Route::get('/client/{client}/recipients/create', 'RecipientController@create') + ->name('client.recipient.create') + ->middleware('can:create, App\Models\Client'); + Route::post('/client/{client}/recipients/create', 'RecipientController@store') + ->name('client.recipient.store') + ->middleware('can:create, App\Models\Client'); + Route::get('/client/{client}/recipients/{recipient}/edit', 'RecipientController@edit') + ->name('client.recipient.edit') + ->middleware('can:update,recipient'); + Route::patch('/client/{client}/recipients/{recipient}/edit', 'RecipientController@update') + ->name('client.recipient.update') + ->middleware('can:update,recipient'); /* Clients */ - Route::get('/clients', 'ClientController@index')->name('client.index')->middleware('can:index, App\Models\Client'); - Route::get('/client/create', 'ClientController@create')->name('client.create')->middleware('can:create, App\Models\Client'); - Route::post('/client/create', 'ClientController@store')->name('client.store')->middleware('can:create, App\Models\Client'); - Route::get('/client/{client}/invoicecreate', 'ClientController@invoicecreate')->name('client.invoice.create')->middleware('can:create,App\Models\Invoice'); - Route::get('/client/{client}', 'ClientController@show')->name('client.show')->middleware('can:view,client'); - Route::get('/client/{client}/edit', 'ClientController@edit')->name('client.edit')->middleware('can:update,client'); - Route::patch('/client/{client}/edit', 'ClientController@update')->name('client.update')->middleware('can:update,client'); - Route::delete('/client/{client}/destroy', 'ClientController@destroy')->name('client.destroy')->middleware('can:delete,client'); + Route::get('/clients', 'ClientController@index') + ->name('client.index') + ->middleware('can:index, App\Models\Client'); + Route::get('/client/create', 'ClientController@create') + ->name('client.create') + ->middleware('can:create, App\Models\Client'); + Route::post('/client/create', 'ClientController@store') + ->name('client.store') + ->middleware('can:create, App\Models\Client'); + Route::get('/client/{client}/invoicecreate', 'ClientController@invoicecreate') + ->name('client.invoice.create') + ->middleware('can:create,App\Models\Invoice'); + Route::get('/client/{client}', 'ClientController@show') + ->name('client.show') + ->middleware('can:view,client'); + Route::get('/client/{client}/edit', 'ClientController@edit') + ->name('client.edit') + ->middleware('can:update,client'); + Route::patch('/client/{client}/edit', 'ClientController@update') + ->name('client.update') + ->middleware('can:update,client'); + Route::delete('/client/{client}/destroy', 'ClientController@destroy') + ->name('client.destroy') + ->middleware('can:delete,client'); /* InvoiceItem */ - Route::delete('/invoice/item/{invoiceitem}/destroy', 'InvoiceItemController@destroy')->name('invoice.item.destroy')->middleware('can:delete,invoiceitem'); + Route::delete('/invoice/item/{invoiceitem}/destroy', 'InvoiceItemController@destroy') + ->name('invoice.item.destroy') + ->middleware('can:delete,invoiceitem'); /* Invoice */ - Route::get('/invoices', 'InvoiceController@index')->name('invoice.index')->middleware('can:index, App\Models\Invoice'); - Route::get('/invoices/archived', 'InvoiceController@index_archived')->name('invoice.index.archived')->middleware('can:index, App\Models\Invoice'); - Route::get('/invoice/create', 'InvoiceController@create')->name('invoice.create')->middleware('can:create, App\Models\Invoice'); - Route::post('/invoice/create', 'InvoiceController@store')->name('invoice.store')->middleware('can:create, App\Models\Invoice'); - Route::get('/invoice/{invoice}', 'InvoiceController@show')->name('invoice.show')->middleware('can:view,invoice'); - Route::get('/invoice/{invoice}/history', 'InvoiceController@history')->name('invoice.history.show')->middleware('can:view,invoice'); - Route::post('/invoice/{invoice}/duplicate', 'InvoiceController@duplicate')->name('invoice.duplicate')->middleware('can:update,invoice'); - Route::post('/invoice/{invoice}/convert', 'InvoiceController@convertToQuote')->name('invoice.convert')->middleware('can:update,invoice'); - Route::get('/invoice/{invoice}/download', 'InvoiceController@download')->name('invoice.download')->middleware('can:view,invoice'); - Route::get('/invoice/{invoice}/printview', 'InvoiceController@printview')->name('invoice.printview')->middleware('can:view,invoice'); - Route::get('/invoice/{invoice}/edit', 'InvoiceController@edit')->name('invoice.edit')->middleware('can:update,invoice'); - Route::patch('/invoice/{invoice}/edit', 'InvoiceController@update')->name('invoice.update')->middleware('can:update,invoice'); - Route::patch('/invoice/{invoice}/archive', 'InvoiceController@archive')->name('invoice.archive')->middleware('can:update,invoice'); - Route::patch('/invoice/{invoice}/writeoff', 'InvoiceController@writeoff')->name('invoice.writeoff')->middleware('can:update,invoice'); - Route::patch('/invoice/{invoice}/share', 'InvoiceController@share')->name('invoice.share')->middleware('can:view,invoice'); - Route::post('/invoice/{invoice}/send', 'InvoiceController@sendnotification')->name('invoice.send')->middleware(['throttle:60,1', 'can:view,invoice']); - Route::delete('/invoice/{invoice}/destroy', 'InvoiceController@destroy')->name('invoice.destroy')->middleware('can:delete,invoice'); - Route::get('/invoice/{invoice}/siblings/check', 'InvoiceController@checkSiblings')->name('invoice.siblings.check')->middleware('can:update,invoice'); - - Route::get('/invoice/adhoc/create', 'AdhocInvoiceController@create')->name('invoice.adhoc.create')->middleware('can:create, App\Models\Invoice'); - Route::post('/invoice/adhoc/create', 'AdhocInvoiceController@store')->name('invoice.adhoc.store')->middleware('can:create, App\Models\Invoice'); - Route::get('/invoice/adhoc/{invoice}/edit', 'AdhocInvoiceController@edit')->name('invoice.adhoc.edit')->middleware('can:update,invoice'); - Route::patch('/invoice/adhoc/{invoice}/edit', 'AdhocInvoiceController@update')->name('invoice.adhoc.update')->middleware('can:update,invoice'); + Route::get('/invoices', 'InvoiceController@index') + ->name('invoice.index') + ->middleware('can:index, App\Models\Invoice'); + Route::get('/invoices/archived', 'InvoiceController@index_archived') + ->name('invoice.index.archived') + ->middleware('can:index, App\Models\Invoice'); + Route::get('/invoice/create', 'InvoiceController@create') + ->name('invoice.create') + ->middleware('can:create, App\Models\Invoice'); + Route::post('/invoice/create', 'InvoiceController@store') + ->name('invoice.store') + ->middleware('can:create, App\Models\Invoice'); + Route::get('/invoice/{invoice}', 'InvoiceController@show') + ->name('invoice.show') + ->middleware('can:view,invoice'); + Route::get('/invoice/{invoice}/history', 'InvoiceController@history') + ->name('invoice.history.show') + ->middleware('can:view,invoice'); + Route::post('/invoice/{invoice}/duplicate', 'InvoiceController@duplicate') + ->name('invoice.duplicate') + ->middleware('can:update,invoice'); + Route::post('/invoice/{invoice}/convert', 'InvoiceController@convertToQuote') + ->name('invoice.convert') + ->middleware('can:update,invoice'); + Route::get('/invoice/{invoice}/download', 'InvoiceController@download') + ->name('invoice.download') + ->middleware('can:view,invoice'); + Route::get('/invoice/{invoice}/printview', 'InvoiceController@printview') + ->name('invoice.printview') + ->middleware('can:view,invoice'); + Route::get('/invoice/{invoice}/edit', 'InvoiceController@edit') + ->name('invoice.edit') + ->middleware('can:update,invoice'); + Route::patch('/invoice/{invoice}/edit', 'InvoiceController@update') + ->name('invoice.update') + ->middleware('can:update,invoice'); + Route::patch('/invoice/{invoice}/archive', 'InvoiceController@archive') + ->name('invoice.archive') + ->middleware('can:update,invoice'); + Route::patch('/invoice/{invoice}/writeoff', 'InvoiceController@writeoff') + ->name('invoice.writeoff') + ->middleware('can:update,invoice'); + Route::patch('/invoice/{invoice}/share', 'InvoiceController@share') + ->name('invoice.share') + ->middleware('can:view,invoice'); + Route::post('/invoice/{invoice}/send', 'InvoiceController@sendnotification') + ->name('invoice.send') + ->middleware(['throttle:60,1', 'can:view,invoice']); + Route::delete('/invoice/{invoice}/destroy', 'InvoiceController@destroy') + ->name('invoice.destroy') + ->middleware('can:delete,invoice'); + Route::get('/invoice/{invoice}/siblings/check', 'InvoiceController@checkSiblings') + ->name('invoice.siblings.check') + ->middleware('can:update,invoice'); + + Route::get('/invoice/adhoc/create', 'AdhocInvoiceController@create') + ->name('invoice.adhoc.create') + ->middleware('can:create, App\Models\Invoice'); + Route::post('/invoice/adhoc/create', 'AdhocInvoiceController@store') + ->name('invoice.adhoc.store') + ->middleware('can:create, App\Models\Invoice'); + Route::get('/invoice/adhoc/{invoice}/edit', 'AdhocInvoiceController@edit') + ->name('invoice.adhoc.edit') + ->middleware('can:update,invoice'); + Route::patch('/invoice/adhoc/{invoice}/edit', 'AdhocInvoiceController@update') + ->name('invoice.adhoc.update') + ->middleware('can:update,invoice'); /* Receipt */ - Route::post('/invoice/{invoice}/receipt', 'ReceiptController@generate')->name('receipt.generate')->middleware('can:create, App\Models\Receipt'); - Route::get('/receipts', 'ReceiptController@index')->name('receipt.index')->middleware('can:index, App\Models\Receipt'); - Route::get('/receipt/{receipt}', 'ReceiptController@show')->name('receipt.show')->middleware('can:view,receipt'); - Route::get('/receipt/{receipt}/download', 'ReceiptController@download')->name('receipt.download')->middleware('can:view,receipt'); - Route::get('/receipt/{receipt}/printview', 'ReceiptController@printview')->name('receipt.printview')->middleware('can:view,receipt'); + Route::post('/invoice/{invoice}/receipt', 'ReceiptController@generate') + ->name('receipt.generate') + ->middleware('can:create, App\Models\Receipt'); + Route::get('/receipts', 'ReceiptController@index') + ->name('receipt.index') + ->middleware('can:index, App\Models\Receipt'); + Route::get('/receipt/{receipt}', 'ReceiptController@show') + ->name('receipt.show') + ->middleware('can:view,receipt'); + Route::get('/receipt/{receipt}/download', 'ReceiptController@download') + ->name('receipt.download') + ->middleware('can:view,receipt'); + Route::get('/receipt/{receipt}/printview', 'ReceiptController@printview') + ->name('receipt.printview') + ->middleware('can:view,receipt'); /* Quotes */ - Route::get('/quotes', 'QuoteController@index')->name('quote.index')->middleware('can:index, App\Models\Quote'); - Route::get('/quotes/archived', 'QuoteController@index_archived')->name('quote.index.archived')->middleware('can:index, App\Models\Quote'); - Route::get('/quote/create', 'QuoteController@create')->name('quote.create')->middleware('can:create, App\Models\Quote'); - Route::post('/quote/create', 'QuoteController@store')->name('quote.store')->middleware('can:create, App\Models\Quote'); - Route::get('/quote/{quote}', 'QuoteController@show')->name('quote.show')->middleware('can:view,quote'); - Route::post('/quote/{quote}/duplicate', 'QuoteController@duplicate')->name('quote.duplicate')->middleware('can:update,quote'); - Route::post('/quote/{quote}/convert', 'QuoteController@convertToInvoice')->name('quote.convert')->middleware('can:update,quote'); - Route::get('/quote/{quote}/download', 'QuoteController@download')->name('quote.download')->middleware('can:view,quote'); - Route::get('/quote/{quote}/printview', 'QuoteController@printview')->name('quote.printview')->middleware('can:view,quote'); - Route::get('/quote/{quote}/edit', 'QuoteController@edit')->name('quote.edit')->middleware('can:update,quote'); - Route::patch('/quote/{quote}/edit', 'QuoteController@update')->name('quote.update')->middleware('can:update,quote'); - Route::patch('/quote/{quote}/archive', 'QuoteController@archive')->name('quote.archive')->middleware('can:update,quote'); - Route::patch('/quote/{quote}/writeoff', 'QuoteController@writeoff')->name('quote.writeoff')->middleware('can:update,quote'); - Route::patch('/quote/{quote}/share', 'QuoteController@share')->name('quote.share')->middleware('can:view,quote'); - Route::delete('/quote/{quote}/destroy', 'QuoteController@destroy')->name('quote.destroy')->middleware('can:delete,quote'); - - Route::get('/quote/adhoc/create', 'AdhocQuoteController@create')->name('quote.adhoc.create')->middleware('can:create, App\Models\Quote'); - Route::post('/quote/adhoc/create', 'AdhocQuoteController@store')->name('quote.adhoc.store')->middleware('can:create, App\Models\Quote'); - Route::get('/quote/adhoc/{quote}/edit', 'AdhocQuoteController@edit')->name('quote.adhoc.edit')->middleware('can:update,quote'); - Route::patch('/quote/adhoc/{quote}/edit', 'AdhocQuoteController@update')->name('quote.adhoc.update')->middleware('can:update,quote'); + Route::get('/quotes', 'QuoteController@index') + ->name('quote.index') + ->middleware('can:index, App\Models\Quote'); + Route::get('/quotes/archived', 'QuoteController@index_archived') + ->name('quote.index.archived') + ->middleware('can:index, App\Models\Quote'); + Route::get('/quote/create', 'QuoteController@create') + ->name('quote.create') + ->middleware('can:create, App\Models\Quote'); + Route::post('/quote/create', 'QuoteController@store') + ->name('quote.store') + ->middleware('can:create, App\Models\Quote'); + Route::get('/quote/{quote}', 'QuoteController@show') + ->name('quote.show') + ->middleware('can:view,quote'); + Route::post('/quote/{quote}/duplicate', 'QuoteController@duplicate') + ->name('quote.duplicate') + ->middleware('can:update,quote'); + Route::post('/quote/{quote}/convert', 'QuoteController@convertToInvoice') + ->name('quote.convert') + ->middleware('can:update,quote'); + Route::get('/quote/{quote}/download', 'QuoteController@download') + ->name('quote.download') + ->middleware('can:view,quote'); + Route::get('/quote/{quote}/printview', 'QuoteController@printview') + ->name('quote.printview') + ->middleware('can:view,quote'); + Route::get('/quote/{quote}/edit', 'QuoteController@edit') + ->name('quote.edit') + ->middleware('can:update,quote'); + Route::patch('/quote/{quote}/edit', 'QuoteController@update') + ->name('quote.update') + ->middleware('can:update,quote'); + Route::patch('/quote/{quote}/archive', 'QuoteController@archive') + ->name('quote.archive') + ->middleware('can:update,quote'); + Route::patch('/quote/{quote}/writeoff', 'QuoteController@writeoff') + ->name('quote.writeoff') + ->middleware('can:update,quote'); + Route::patch('/quote/{quote}/share', 'QuoteController@share') + ->name('quote.share') + ->middleware('can:view,quote'); + Route::delete('/quote/{quote}/destroy', 'QuoteController@destroy') + ->name('quote.destroy') + ->middleware('can:delete,quote'); + + Route::get('/quote/adhoc/create', 'AdhocQuoteController@create') + ->name('quote.adhoc.create') + ->middleware('can:create, App\Models\Quote'); + Route::post('/quote/adhoc/create', 'AdhocQuoteController@store') + ->name('quote.adhoc.store') + ->middleware('can:create, App\Models\Quote'); + Route::get('/quote/adhoc/{quote}/edit', 'AdhocQuoteController@edit') + ->name('quote.adhoc.edit') + ->middleware('can:update,quote'); + Route::patch('/quote/adhoc/{quote}/edit', 'AdhocQuoteController@update') + ->name('quote.adhoc.update') + ->middleware('can:update,quote'); /* OldInvoice */ - Route::get('/oldinvoice/{oldinvoice}', 'OldInvoiceController@show')->name('invoice.old.show')->middleware('can:view,oldinvoice'); - Route::get('/oldinvoice/{oldinvoice}/download', 'OldInvoiceController@download')->name('invoice.old.download')->middleware('can:view,oldinvoice'); - Route::get('/oldinvoice/{oldinvoice}/printview', 'OldInvoiceController@printview')->name('invoice.old.printview')->middleware('can:view,oldinvoice'); + Route::get('/oldinvoice/{oldinvoice}', 'OldInvoiceController@show') + ->name('invoice.old.show') + ->middleware('can:view,oldinvoice'); + Route::get('/oldinvoice/{oldinvoice}/download', 'OldInvoiceController@download') + ->name('invoice.old.download') + ->middleware('can:view,oldinvoice'); + Route::get('/oldinvoice/{oldinvoice}/printview', 'OldInvoiceController@printview') + ->name('invoice.old.printview') + ->middleware('can:view,oldinvoice'); /* ItemTemplate */ - Route::get('/itemtemplates', 'ItemTemplateController@index')->name('itemtemplate.index')->middleware('can:index, App\Models\ItemTemplate'); - Route::get('/itemtemplate/create', 'ItemTemplateController@create')->name('itemtemplate.create')->middleware('can:create, App\Models\ItemTemplate'); - Route::post('/itemtemplate/create', 'ItemTemplateController@store')->name('itemtemplate.store')->middleware('can:create, App\Models\ItemTemplate'); - Route::get('/itemtemplate/{itemtemplate}', 'ItemTemplateController@show')->name('itemtemplate.show')->middleware('can:view,itemtemplate'); - Route::get('/itemtemplate/{itemtemplate}/retrieve', 'ItemTemplateController@retrieve')->name('itemtemplate.retrieve')->middleware('can:view,itemtemplate'); - Route::post('/itemtemplate/{itemtemplate}/duplicate', 'ItemTemplateController@duplicate')->name('itemtemplate.duplicate')->middleware('can:update,itemtemplate'); - Route::get('/itemtemplate/{itemtemplate}/edit', 'ItemTemplateController@edit')->name('itemtemplate.edit')->middleware('can:update,itemtemplate'); - Route::patch('/itemtemplate/{itemtemplate}/edit', 'ItemTemplateController@update')->name('itemtemplate.update')->middleware('can:update,itemtemplate'); - Route::delete('/itemtemplate/{itemtemplate}/destroy', 'ItemTemplateController@destroy')->name('itemtemplate.destroy')->middleware('can:delete,itemtemplate'); + Route::get('/itemtemplates', 'ItemTemplateController@index') + ->name('itemtemplate.index') + ->middleware('can:index, App\Models\ItemTemplate'); + Route::get('/itemtemplate/create', 'ItemTemplateController@create') + ->name('itemtemplate.create') + ->middleware('can:create, App\Models\ItemTemplate'); + Route::post('/itemtemplate/create', 'ItemTemplateController@store') + ->name('itemtemplate.store') + ->middleware('can:create, App\Models\ItemTemplate'); + Route::get('/itemtemplate/{itemtemplate}', 'ItemTemplateController@show') + ->name('itemtemplate.show') + ->middleware('can:view,itemtemplate'); + Route::get('/itemtemplate/{itemtemplate}/retrieve', 'ItemTemplateController@retrieve') + ->name('itemtemplate.retrieve') + ->middleware('can:view,itemtemplate'); + Route::post('/itemtemplate/{itemtemplate}/duplicate', 'ItemTemplateController@duplicate') + ->name('itemtemplate.duplicate') + ->middleware('can:update,itemtemplate'); + Route::get('/itemtemplate/{itemtemplate}/edit', 'ItemTemplateController@edit') + ->name('itemtemplate.edit') + ->middleware('can:update,itemtemplate'); + Route::patch('/itemtemplate/{itemtemplate}/edit', 'ItemTemplateController@update') + ->name('itemtemplate.update') + ->middleware('can:update,itemtemplate'); + Route::delete('/itemtemplate/{itemtemplate}/destroy', 'ItemTemplateController@destroy') + ->name('itemtemplate.destroy') + ->middleware('can:delete,itemtemplate'); /* Payment */ - Route::get('/payments', 'PaymentController@index')->name('payment.index')->middleware('can:index, App\Models\Payment'); - Route::get('/invoice/{invoice}/payment/create', 'PaymentController@create')->name('payment.create')->middleware('can:create, App\Models\Payment'); - Route::post('/invoice/{invoice}/payment/create', 'PaymentController@store')->name('payment.store')->middleware('can:create, App\Models\Payment'); - Route::get('/payment/create', 'PaymentController@createsolo')->name('payment.createsolo')->middleware('can:create, App\Models\Payment'); - Route::post('/payment/create', 'PaymentController@storesolo')->name('payment.storesolo')->middleware('can:create, App\Models\Payment'); - Route::get('/payment/{payment}', 'PaymentController@show')->name('payment.show')->middleware('can:view,payment'); - Route::get('/payment/{payment}/edit', 'PaymentController@edit')->name('payment.edit')->middleware('can:update,payment'); - Route::patch('/payment/{payment}/edit', 'PaymentController@update')->name('payment.update')->middleware('can:update,payment'); - Route::delete('/payment/{payment}/destroy', 'PaymentController@destroy')->name('payment.destroy')->middleware('can:delete,payment'); + Route::get('/payments', 'PaymentController@index') + ->name('payment.index') + ->middleware('can:index, App\Models\Payment'); + Route::get('/invoice/{invoice}/payment/create', 'PaymentController@create') + ->name('payment.create') + ->middleware('can:create, App\Models\Payment'); + Route::post('/invoice/{invoice}/payment/create', 'PaymentController@store') + ->name('payment.store') + ->middleware('can:create, App\Models\Payment'); + Route::get('/payment/create', 'PaymentController@createsolo') + ->name('payment.createsolo') + ->middleware('can:create, App\Models\Payment'); + Route::post('/payment/create', 'PaymentController@storesolo') + ->name('payment.storesolo') + ->middleware('can:create, App\Models\Payment'); + Route::get('/payment/{payment}', 'PaymentController@show') + ->name('payment.show') + ->middleware('can:view,payment'); + Route::get('/payment/{payment}/edit', 'PaymentController@edit') + ->name('payment.edit') + ->middleware('can:update,payment'); + Route::patch('/payment/{payment}/edit', 'PaymentController@update') + ->name('payment.update') + ->middleware('can:update,payment'); + Route::delete('/payment/{payment}/destroy', 'PaymentController@destroy') + ->name('payment.destroy') + ->middleware('can:delete,payment'); }); }); }); diff --git a/server.php b/server.php index 472abe28..9a2653c6 100644 --- a/server.php +++ b/server.php @@ -5,9 +5,7 @@ * * @author Taylor Otwell */ -$uri = urldecode( - parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH) -); +$uri = urldecode(parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)); // This file allows us to emulate Apache's "mod_rewrite" functionality from the // built-in PHP web server. This provides a convenient way to test a Laravel diff --git a/tests/Browser/AdhocInvoiceTest.php b/tests/Browser/AdhocInvoiceTest.php index 31184631..cfb0a84c 100644 --- a/tests/Browser/AdhocInvoiceTest.php +++ b/tests/Browser/AdhocInvoiceTest.php @@ -28,16 +28,17 @@ public function test_creating_an_adhoc_invoice() $faker = Faker::create(); $this->browse(function (Browser $browser) use ($faker, $company, $itemTemplate) { - $browser->visit('/signin') + $browser + ->visit('/signin') ->type('username', $company->owner->email) ->type('password', 'secret') ->press('SIGN IN') - ->assertPathIs('/'.$company->domain_name.'/dashboard') + ->assertPathIs('/' . $company->domain_name . '/dashboard') ->clickLink('Invoices') - ->assertPathIs('/'.$company->domain_name.'/invoices') + ->assertPathIs('/' . $company->domain_name . '/invoices') ->clickLink('Create Ad-Hoc') - ->assertPathIs('/'.$company->domain_name.'/invoice/adhoc/create') - ->type('nice_invoice_id', substr($faker->slug, 0, 20).'sasdf') + ->assertPathIs('/' . $company->domain_name . '/invoice/adhoc/create') + ->type('nice_invoice_id', substr($faker->slug, 0, 20) . 'sasdf') ->type('companyname', $faker->company) ->type('block', $faker->buildingNumber) ->type('street', $faker->streetName) @@ -46,10 +47,10 @@ public function test_creating_an_adhoc_invoice() ->type('netdays', $faker->numberBetween($min = 1, $max = 60)) ->type('item_quantity[]', $faker->numberBetween($min = 1, $max = 999999999)) ->type('item_price[]', $faker->randomFloat($nbMaxDecimals = 2, $min = 0, $max = 999999999999)); - $browser - ->script('jQuery("#date").datepicker("setDate", new Date());jQuery("#date").val("'.Carbon::now()->format('j F, Y').'");'); - $browser - ->script('jQuery("#item_name_0").selectize()[0].selectize.setValue("'.addslashes($itemTemplate->name).'");'); + $browser->script( + 'jQuery("#date").datepicker("setDate", new Date());jQuery("#date").val("' . Carbon::now()->format('j F, Y') . '");', + ); + $browser->script('jQuery("#item_name_0").selectize()[0].selectize.setValue("' . addslashes($itemTemplate->name) . '");'); $browser->pause(2000); $browser ->press('CREATE') @@ -77,16 +78,17 @@ public function test_updating_an_adhoc_invoice() $faker = Faker::create(); $this->browse(function (Browser $browser) use ($faker, $company, $itemTemplate) { - $browser->visit('/signin') + $browser + ->visit('/signin') ->type('username', $company->owner->email) ->type('password', 'secret') ->press('SIGN IN') - ->assertPathIs('/'.$company->domain_name.'/dashboard') + ->assertPathIs('/' . $company->domain_name . '/dashboard') ->clickLink('Invoices') - ->assertPathIs('/'.$company->domain_name.'/invoices') + ->assertPathIs('/' . $company->domain_name . '/invoices') ->clickLink('Create Ad-Hoc') - ->assertPathIs('/'.$company->domain_name.'/invoice/adhoc/create') - ->type('nice_invoice_id', substr($faker->slug, 0, 20).'sasdf') + ->assertPathIs('/' . $company->domain_name . '/invoice/adhoc/create') + ->type('nice_invoice_id', substr($faker->slug, 0, 20) . 'sasdf') ->type('companyname', $faker->company) ->type('block', $faker->buildingNumber) ->type('street', $faker->streetName) @@ -95,17 +97,17 @@ public function test_updating_an_adhoc_invoice() ->type('netdays', $faker->numberBetween($min = 1, $max = 60)) ->type('item_quantity[]', $faker->numberBetween($min = 1, $max = 999999999)) ->type('item_price[]', $faker->randomFloat($nbMaxDecimals = 2, $min = 0, $max = 999999999999)); - $browser - ->script('jQuery("#date").datepicker("setDate", new Date());jQuery("#date").val("'.Carbon::now()->format('j F, Y').'");'); - $browser - ->script('jQuery("#item_name_0").selectize()[0].selectize.setValue("'.addslashes($itemTemplate->name).'");'); + $browser->script( + 'jQuery("#date").datepicker("setDate", new Date());jQuery("#date").val("' . Carbon::now()->format('j F, Y') . '");', + ); + $browser->script('jQuery("#item_name_0").selectize()[0].selectize.setValue("' . addslashes($itemTemplate->name) . '");'); $browser->pause(2000); $browser ->press('CREATE') ->pause(2000) ->assertPresent('#invoice-action-container') ->clickLink('Edit') - ->assertPathIs('/'.$company->domain_name.'/invoice/adhoc/'.$company->invoices->first()->id.'/edit') + ->assertPathIs('/' . $company->domain_name . '/invoice/adhoc/' . $company->invoices->first()->id . '/edit') ->type('companyname', $faker->company) ->type('block', $faker->buildingNumber) ->type('street', $faker->streetName) @@ -115,14 +117,15 @@ public function test_updating_an_adhoc_invoice() ->type('item_name[]', 'The Turbo Ultra Turbonator') ->type('item_quantity[]', $faker->numberBetween($min = 1, $max = 999999999)) ->type('item_price[]', $faker->randomFloat($nbMaxDecimals = 2, $min = 0, $max = 999999999999)); - $browser - ->script('jQuery("#date").datepicker("setDate", new Date());jQuery("#date").val("'.Carbon::now()->format('j F, Y').'");'); + $browser->script( + 'jQuery("#date").datepicker("setDate", new Date());jQuery("#date").val("' . Carbon::now()->format('j F, Y') . '");', + ); $browser ->pause(2000) ->press('UPDATE') ->assertPresent('#invoice-action-container') ->assertSee('The Turbo Ultra Turbonator') - ->assertPathIs('/'.$company->domain_name.'/invoice/'.$company->invoices->first()->id); + ->assertPathIs('/' . $company->domain_name . '/invoice/' . $company->invoices->first()->id); $browser->script('jQuery(".signmeout-btn").click()'); $browser->assertPathIs('/'); }); @@ -145,16 +148,17 @@ public function test_deleting_an_adhoc_invoice() $faker = Faker::create(); $this->browse(function (Browser $browser) use ($faker, $company, $itemTemplate) { - $browser->visit('/signin') + $browser + ->visit('/signin') ->type('username', $company->owner->email) ->type('password', 'secret') ->press('SIGN IN') - ->assertPathIs('/'.$company->domain_name.'/dashboard') + ->assertPathIs('/' . $company->domain_name . '/dashboard') ->clickLink('Invoices') - ->assertPathIs('/'.$company->domain_name.'/invoices') + ->assertPathIs('/' . $company->domain_name . '/invoices') ->clickLink('Create Ad-Hoc') - ->assertPathIs('/'.$company->domain_name.'/invoice/adhoc/create') - ->type('nice_invoice_id', substr($faker->slug, 0, 20).'sasdf') + ->assertPathIs('/' . $company->domain_name . '/invoice/adhoc/create') + ->type('nice_invoice_id', substr($faker->slug, 0, 20) . 'sasdf') ->type('companyname', $faker->company) ->type('block', $faker->buildingNumber) ->type('street', $faker->streetName) @@ -163,10 +167,10 @@ public function test_deleting_an_adhoc_invoice() ->type('netdays', $faker->numberBetween($min = 1, $max = 60)) ->type('item_quantity[]', $faker->numberBetween($min = 1, $max = 999999999)) ->type('item_price[]', $faker->randomFloat($nbMaxDecimals = 2, $min = 0, $max = 999999999999)); - $browser - ->script('jQuery("#date").datepicker("setDate", new Date());jQuery("#date").val("'.Carbon::now()->format('j F, Y').'");'); - $browser - ->script('jQuery("#item_name_0").selectize()[0].selectize.setValue("'.addslashes($itemTemplate->name).'");'); + $browser->script( + 'jQuery("#date").datepicker("setDate", new Date());jQuery("#date").val("' . Carbon::now()->format('j F, Y') . '");', + ); + $browser->script('jQuery("#item_name_0").selectize()[0].selectize.setValue("' . addslashes($itemTemplate->name) . '");'); $browser->pause(2000); $browser ->press('CREATE') @@ -199,16 +203,17 @@ public function test_log_payment_on_an_adhoc_invoice() $faker = Faker::create(); $this->browse(function (Browser $browser) use ($faker, $company, $itemTemplate) { - $browser->visit('/signin') + $browser + ->visit('/signin') ->type('username', $company->owner->email) ->type('password', 'secret') ->press('SIGN IN') - ->assertPathIs('/'.$company->domain_name.'/dashboard') + ->assertPathIs('/' . $company->domain_name . '/dashboard') ->clickLink('Invoices') - ->assertPathIs('/'.$company->domain_name.'/invoices') + ->assertPathIs('/' . $company->domain_name . '/invoices') ->clickLink('Create Ad-Hoc') - ->assertPathIs('/'.$company->domain_name.'/invoice/adhoc/create') - ->type('nice_invoice_id', substr($faker->slug, 0, 20).'sasdf') + ->assertPathIs('/' . $company->domain_name . '/invoice/adhoc/create') + ->type('nice_invoice_id', substr($faker->slug, 0, 20) . 'sasdf') ->type('companyname', $faker->company) ->type('block', $faker->buildingNumber) ->type('street', $faker->streetName) @@ -217,27 +222,29 @@ public function test_log_payment_on_an_adhoc_invoice() ->type('netdays', $faker->numberBetween($min = 1, $max = 60)) ->type('item_quantity[]', $faker->numberBetween($min = 1, $max = 999999999)) ->type('item_price[]', $faker->randomFloat($nbMaxDecimals = 2, $min = 0, $max = 999999999999)); - $browser - ->script('jQuery("#date").datepicker("setDate", new Date());jQuery("#date").val("'.Carbon::now()->format('j F, Y').'");'); - $browser - ->script('jQuery("#item_name_0").selectize()[0].selectize.setValue("'.addslashes($itemTemplate->name).'");'); + $browser->script( + 'jQuery("#date").datepicker("setDate", new Date());jQuery("#date").val("' . Carbon::now()->format('j F, Y') . '");', + ); + $browser->script('jQuery("#item_name_0").selectize()[0].selectize.setValue("' . addslashes($itemTemplate->name) . '");'); $browser->pause(2000); $browser ->press('CREATE') ->pause(2000) ->assertPresent('#invoice-action-container') ->clickLink('Log Payment') - ->assertPathIs('/'.$company->domain_name.'/invoice/'.$company->invoices->first()->id.'/payment/create') + ->assertPathIs('/' . $company->domain_name . '/invoice/' . $company->invoices->first()->id . '/payment/create') ->type('amount', $faker->randomFloat($nbMaxDecimals = 2, $min = 0, $max = 999999999999)) ->type('notes', $faker->text(50)); - $browser - ->script('jQuery("#receiveddate").datepicker("setDate", new Date());jQuery("#receiveddate").val("'.Carbon::now()->format('j F, Y').'");'); - $browser - ->script('jQuery("#mode").selectize()[0].selectize.setValue("Cheque");'); + $browser->script( + 'jQuery("#receiveddate").datepicker("setDate", new Date());jQuery("#receiveddate").val("' . + Carbon::now()->format('j F, Y') . + '");', + ); + $browser->script('jQuery("#mode").selectize()[0].selectize.setValue("Cheque");'); $browser ->press('SUBMIT') ->assertPresent('#invoice-action-container') - ->assertPathIs('/'.$company->domain_name.'/invoice/'.$company->invoices->first()->id); + ->assertPathIs('/' . $company->domain_name . '/invoice/' . $company->invoices->first()->id); $browser->script('jQuery(".signmeout-btn").click()'); $browser->assertPathIs('/'); }); @@ -260,16 +267,17 @@ public function test_end_to_end_adhoc_invoice() $faker = Faker::create(); $this->browse(function (Browser $browser) use ($faker, $company, $itemTemplate) { - $browser->visit('/signin') + $browser + ->visit('/signin') ->type('username', $company->owner->email) ->type('password', 'secret') ->press('SIGN IN') - ->assertPathIs('/'.$company->domain_name.'/dashboard') + ->assertPathIs('/' . $company->domain_name . '/dashboard') ->clickLink('Invoices') - ->assertPathIs('/'.$company->domain_name.'/invoices') + ->assertPathIs('/' . $company->domain_name . '/invoices') ->clickLink('Create Ad-Hoc') - ->assertPathIs('/'.$company->domain_name.'/invoice/adhoc/create') - ->type('nice_invoice_id', substr($faker->slug, 0, 20).'sasdf') + ->assertPathIs('/' . $company->domain_name . '/invoice/adhoc/create') + ->type('nice_invoice_id', substr($faker->slug, 0, 20) . 'sasdf') ->type('companyname', $faker->company) ->type('block', $faker->buildingNumber) ->type('street', $faker->streetName) @@ -278,17 +286,17 @@ public function test_end_to_end_adhoc_invoice() ->type('netdays', $faker->numberBetween($min = 1, $max = 60)) ->type('item_quantity[]', $faker->numberBetween($min = 1, $max = 999999999)) ->type('item_price[]', $faker->randomFloat($nbMaxDecimals = 2, $min = 0, $max = 999999999999)); - $browser - ->script('jQuery("#date").datepicker("setDate", new Date());jQuery("#date").val("'.Carbon::now()->format('j F, Y').'");'); - $browser - ->script('jQuery("#item_name_0").selectize()[0].selectize.setValue("'.addslashes($itemTemplate->name).'");'); + $browser->script( + 'jQuery("#date").datepicker("setDate", new Date());jQuery("#date").val("' . Carbon::now()->format('j F, Y') . '");', + ); + $browser->script('jQuery("#item_name_0").selectize()[0].selectize.setValue("' . addslashes($itemTemplate->name) . '");'); $browser->pause(2000); $browser ->press('CREATE') ->pause(2000) ->assertPresent('#invoice-action-container') ->clickLink('Edit') - ->assertPathIs('/'.$company->domain_name.'/invoice/adhoc/'.$company->invoices->first()->id.'/edit') + ->assertPathIs('/' . $company->domain_name . '/invoice/adhoc/' . $company->invoices->first()->id . '/edit') ->type('companyname', $faker->company) ->type('block', $faker->buildingNumber) ->type('street', $faker->streetName) @@ -298,28 +306,30 @@ public function test_end_to_end_adhoc_invoice() ->type('item_name[]', 'The Turbo Ultra Turbonator') ->type('item_quantity[]', $faker->numberBetween($min = 1, $max = 999999999)) ->type('item_price[]', $faker->randomFloat($nbMaxDecimals = 2, $min = 0, $max = 999999999999)); - $browser - ->script('jQuery("#date").datepicker("setDate", new Date());jQuery("#date").val("'.Carbon::now()->format('j F, Y').'");'); + $browser->script( + 'jQuery("#date").datepicker("setDate", new Date());jQuery("#date").val("' . Carbon::now()->format('j F, Y') . '");', + ); $browser ->pause(2000) ->press('UPDATE') ->assertPresent('#invoice-action-container') ->assertSee('The Turbo Ultra Turbonator') - ->assertPathIs('/'.$company->domain_name.'/invoice/'.$company->invoices->first()->id) + ->assertPathIs('/' . $company->domain_name . '/invoice/' . $company->invoices->first()->id) ->clickLink('Log Payment') - ->assertPathIs('/'.$company->domain_name.'/invoice/'.$company->invoices->first()->id.'/payment/create') + ->assertPathIs('/' . $company->domain_name . '/invoice/' . $company->invoices->first()->id . '/payment/create') ->type('amount', $faker->randomFloat($nbMaxDecimals = 2, $min = 0, $max = 999999999999)) ->type('notes', $faker->text(50)); - $browser - ->script('jQuery("#receiveddate").datepicker("setDate", new Date());jQuery("#receiveddate").val("'.Carbon::now()->format('j F, Y').'");'); - $browser - ->script('jQuery("#mode").selectize()[0].selectize.setValue("Cheque");'); + $browser->script( + 'jQuery("#receiveddate").datepicker("setDate", new Date());jQuery("#receiveddate").val("' . + Carbon::now()->format('j F, Y') . + '");', + ); + $browser->script('jQuery("#mode").selectize()[0].selectize.setValue("Cheque");'); $browser ->press('SUBMIT') ->assertPresent('#invoice-action-container') - ->assertPathIs('/'.$company->domain_name.'/invoice/'.$company->invoices->first()->id); - $browser - ->clickLink('Delete'); + ->assertPathIs('/' . $company->domain_name . '/invoice/' . $company->invoices->first()->id); + $browser->clickLink('Delete'); $browser ->pause(500) ->press('DELETE') diff --git a/tests/Browser/AdhocQuoteTest.php b/tests/Browser/AdhocQuoteTest.php index a9bf5c73..652c8006 100644 --- a/tests/Browser/AdhocQuoteTest.php +++ b/tests/Browser/AdhocQuoteTest.php @@ -28,16 +28,17 @@ public function test_creating_an_adhoc_quote() $faker = Faker::create(); $this->browse(function (Browser $browser) use ($faker, $company, $itemTemplate) { - $browser->visit('/signin') + $browser + ->visit('/signin') ->type('username', $company->owner->email) ->type('password', 'secret') ->press('SIGN IN') - ->assertPathIs('/'.$company->domain_name.'/dashboard') + ->assertPathIs('/' . $company->domain_name . '/dashboard') ->clickLink('Quotes') - ->assertPathIs('/'.$company->domain_name.'/quotes') + ->assertPathIs('/' . $company->domain_name . '/quotes') ->clickLink('Create Ad-Hoc') - ->assertPathIs('/'.$company->domain_name.'/quote/adhoc/create') - ->type('nice_quote_id', substr($faker->slug, 0, 20).'sasdf') + ->assertPathIs('/' . $company->domain_name . '/quote/adhoc/create') + ->type('nice_quote_id', substr($faker->slug, 0, 20) . 'sasdf') ->type('companyname', $faker->company) ->type('block', $faker->buildingNumber) ->type('street', $faker->streetName) @@ -46,10 +47,10 @@ public function test_creating_an_adhoc_quote() ->type('netdays', $faker->numberBetween($min = 1, $max = 60)) ->type('item_quantity[]', $faker->numberBetween($min = 1, $max = 999999999)) ->type('item_price[]', $faker->randomFloat($nbMaxDecimals = 2, $min = 0, $max = 999999999999)); - $browser - ->script('jQuery("#date").datepicker("setDate", new Date());jQuery("#date").val("'.Carbon::now()->format('j F, Y').'");'); - $browser - ->script('jQuery("#item_name_0").selectize()[0].selectize.setValue("'.addslashes($itemTemplate->name).'");'); + $browser->script( + 'jQuery("#date").datepicker("setDate", new Date());jQuery("#date").val("' . Carbon::now()->format('j F, Y') . '");', + ); + $browser->script('jQuery("#item_name_0").selectize()[0].selectize.setValue("' . addslashes($itemTemplate->name) . '");'); $browser->pause(2000); $browser ->press('CREATE') @@ -72,16 +73,17 @@ public function test_updating_an_adhoc_quote() $faker = Faker::create(); $this->browse(function (Browser $browser) use ($faker, $company, $itemTemplate) { - $browser->visit('/signin') + $browser + ->visit('/signin') ->type('username', $company->owner->email) ->type('password', 'secret') ->press('SIGN IN') - ->assertPathIs('/'.$company->domain_name.'/dashboard') + ->assertPathIs('/' . $company->domain_name . '/dashboard') ->clickLink('Quotes') - ->assertPathIs('/'.$company->domain_name.'/quotes') + ->assertPathIs('/' . $company->domain_name . '/quotes') ->clickLink('Create Ad-Hoc') - ->assertPathIs('/'.$company->domain_name.'/quote/adhoc/create') - ->type('nice_quote_id', substr($faker->slug, 0, 20).'sasdf') + ->assertPathIs('/' . $company->domain_name . '/quote/adhoc/create') + ->type('nice_quote_id', substr($faker->slug, 0, 20) . 'sasdf') ->type('companyname', $faker->company) ->type('block', $faker->buildingNumber) ->type('street', $faker->streetName) @@ -90,17 +92,17 @@ public function test_updating_an_adhoc_quote() ->type('netdays', $faker->numberBetween($min = 1, $max = 60)) ->type('item_quantity[]', $faker->numberBetween($min = 1, $max = 999999999)) ->type('item_price[]', $faker->randomFloat($nbMaxDecimals = 2, $min = 0, $max = 999999999999)); - $browser - ->script('jQuery("#date").datepicker("setDate", new Date());jQuery("#date").val("'.Carbon::now()->format('j F, Y').'");'); - $browser - ->script('jQuery("#item_name_0").selectize()[0].selectize.setValue("'.addslashes($itemTemplate->name).'");'); + $browser->script( + 'jQuery("#date").datepicker("setDate", new Date());jQuery("#date").val("' . Carbon::now()->format('j F, Y') . '");', + ); + $browser->script('jQuery("#item_name_0").selectize()[0].selectize.setValue("' . addslashes($itemTemplate->name) . '");'); $browser->pause(2000); $browser ->press('CREATE') ->pause(2000) ->assertPresent('#quote-action-container') ->clickLink('Edit') - ->assertPathIs('/'.$company->domain_name.'/quote/adhoc/'.$company->quotes->first()->id.'/edit') + ->assertPathIs('/' . $company->domain_name . '/quote/adhoc/' . $company->quotes->first()->id . '/edit') ->type('companyname', $faker->company) ->type('block', $faker->buildingNumber) ->type('street', $faker->streetName) @@ -110,8 +112,9 @@ public function test_updating_an_adhoc_quote() ->type('item_name[]', 'The Turbo Ultra Turbonator') ->type('item_quantity[]', $faker->numberBetween($min = 1, $max = 999999999)) ->type('item_price[]', $faker->randomFloat($nbMaxDecimals = 2, $min = 0, $max = 999999999999)); - $browser - ->script('jQuery("#date").datepicker("setDate", new Date());jQuery("#date").val("'.Carbon::now()->format('j F, Y').'");'); + $browser->script( + 'jQuery("#date").datepicker("setDate", new Date());jQuery("#date").val("' . Carbon::now()->format('j F, Y') . '");', + ); $browser ->pause(2000) ->press('UPDATE') @@ -134,16 +137,17 @@ public function test_deleting_an_adhoc_quote() $faker = Faker::create(); $this->browse(function (Browser $browser) use ($faker, $company, $itemTemplate) { - $browser->visit('/signin') + $browser + ->visit('/signin') ->type('username', $company->owner->email) ->type('password', 'secret') ->press('SIGN IN') - ->assertPathIs('/'.$company->domain_name.'/dashboard') + ->assertPathIs('/' . $company->domain_name . '/dashboard') ->clickLink('Quotes') - ->assertPathIs('/'.$company->domain_name.'/quotes') + ->assertPathIs('/' . $company->domain_name . '/quotes') ->clickLink('Create Ad-Hoc') - ->assertPathIs('/'.$company->domain_name.'/quote/adhoc/create') - ->type('nice_quote_id', substr($faker->slug, 0, 20).'sasdf') + ->assertPathIs('/' . $company->domain_name . '/quote/adhoc/create') + ->type('nice_quote_id', substr($faker->slug, 0, 20) . 'sasdf') ->type('companyname', $faker->company) ->type('block', $faker->buildingNumber) ->type('street', $faker->streetName) @@ -152,10 +156,10 @@ public function test_deleting_an_adhoc_quote() ->type('netdays', $faker->numberBetween($min = 1, $max = 60)) ->type('item_quantity[]', $faker->numberBetween($min = 1, $max = 999999999)) ->type('item_price[]', $faker->randomFloat($nbMaxDecimals = 2, $min = 0, $max = 999999999999)); - $browser - ->script('jQuery("#date").datepicker("setDate", new Date());jQuery("#date").val("'.Carbon::now()->format('j F, Y').'");'); - $browser - ->script('jQuery("#item_name_0").selectize()[0].selectize.setValue("'.addslashes($itemTemplate->name).'");'); + $browser->script( + 'jQuery("#date").datepicker("setDate", new Date());jQuery("#date").val("' . Carbon::now()->format('j F, Y') . '");', + ); + $browser->script('jQuery("#item_name_0").selectize()[0].selectize.setValue("' . addslashes($itemTemplate->name) . '");'); $browser->pause(2000); $browser ->press('CREATE') @@ -183,16 +187,17 @@ public function test_end_to_end_adhoc_quote() $faker = Faker::create(); $this->browse(function (Browser $browser) use ($faker, $company, $itemTemplate) { - $browser->visit('/signin') + $browser + ->visit('/signin') ->type('username', $company->owner->email) ->type('password', 'secret') ->press('SIGN IN') - ->assertPathIs('/'.$company->domain_name.'/dashboard') + ->assertPathIs('/' . $company->domain_name . '/dashboard') ->clickLink('Quotes') - ->assertPathIs('/'.$company->domain_name.'/quotes') + ->assertPathIs('/' . $company->domain_name . '/quotes') ->clickLink('Create Ad-Hoc') - ->assertPathIs('/'.$company->domain_name.'/quote/adhoc/create') - ->type('nice_quote_id', substr($faker->slug, 0, 20).'sasdf') + ->assertPathIs('/' . $company->domain_name . '/quote/adhoc/create') + ->type('nice_quote_id', substr($faker->slug, 0, 20) . 'sasdf') ->type('companyname', $faker->company) ->type('block', $faker->buildingNumber) ->type('street', $faker->streetName) @@ -201,17 +206,17 @@ public function test_end_to_end_adhoc_quote() ->type('netdays', $faker->numberBetween($min = 1, $max = 60)) ->type('item_quantity[]', $faker->numberBetween($min = 1, $max = 999999999)) ->type('item_price[]', $faker->randomFloat($nbMaxDecimals = 2, $min = 0, $max = 999999999999)); - $browser - ->script('jQuery("#date").datepicker("setDate", new Date());jQuery("#date").val("'.Carbon::now()->format('j F, Y').'");'); - $browser - ->script('jQuery("#item_name_0").selectize()[0].selectize.setValue("'.addslashes($itemTemplate->name).'");'); + $browser->script( + 'jQuery("#date").datepicker("setDate", new Date());jQuery("#date").val("' . Carbon::now()->format('j F, Y') . '");', + ); + $browser->script('jQuery("#item_name_0").selectize()[0].selectize.setValue("' . addslashes($itemTemplate->name) . '");'); $browser->pause(2000); $browser ->press('CREATE') ->pause(2000) ->assertPresent('#quote-action-container') ->clickLink('Edit') - ->assertPathIs('/'.$company->domain_name.'/quote/adhoc/'.$company->quotes->first()->id.'/edit') + ->assertPathIs('/' . $company->domain_name . '/quote/adhoc/' . $company->quotes->first()->id . '/edit') ->type('companyname', $faker->company) ->type('block', $faker->buildingNumber) ->type('street', $faker->streetName) @@ -221,16 +226,16 @@ public function test_end_to_end_adhoc_quote() ->type('item_name[]', 'The Turbo Ultra Turbonator') ->type('item_quantity[]', $faker->numberBetween($min = 1, $max = 999999999)) ->type('item_price[]', $faker->randomFloat($nbMaxDecimals = 2, $min = 0, $max = 999999999999)); - $browser - ->script('jQuery("#date").datepicker("setDate", new Date());jQuery("#date").val("'.Carbon::now()->format('j F, Y').'");'); + $browser->script( + 'jQuery("#date").datepicker("setDate", new Date());jQuery("#date").val("' . Carbon::now()->format('j F, Y') . '");', + ); $browser ->pause(2000) ->press('UPDATE') ->assertPresent('#quote-action-container') ->assertSee('The Turbo Ultra Turbonator') - ->assertPathIs('/'.$company->domain_name.'/quote/'.$company->quotes->first()->id); - $browser - ->clickLink('Delete'); + ->assertPathIs('/' . $company->domain_name . '/quote/' . $company->quotes->first()->id); + $browser->clickLink('Delete'); $browser ->pause(500) ->press('DELETE') diff --git a/tests/Browser/ClientTest.php b/tests/Browser/ClientTest.php index 0f7857a7..16ab0e59 100644 --- a/tests/Browser/ClientTest.php +++ b/tests/Browser/ClientTest.php @@ -27,26 +27,24 @@ public function test_create_a_client() $salutation = ['mr', 'mrs', 'mdm', 'miss']; $this->browse(function (Browser $browser) use ($faker, $company) { - $browser->visit('/signin') + $browser + ->visit('/signin') ->type('username', $company->owner->email) ->type('password', 'secret') ->press('SIGN IN') - ->assertPathIs('/'.$company->domain_name.'/dashboard') + ->assertPathIs('/' . $company->domain_name . '/dashboard') ->clickLink('Clients') - ->assertPathIs('/'.$company->domain_name.'/clients') + ->assertPathIs('/' . $company->domain_name . '/clients') ->clickLink('Create') - ->assertPathIs('/'.$company->domain_name.'/client/create') + ->assertPathIs('/' . $company->domain_name . '/client/create') ->type('companyname', $faker->company) ->type('block', $faker->buildingNumber) ->type('street', $faker->streetName) ->type('contactfirstname', $faker->firstName) ->type('contactemail', $faker->unique()->companyEmail) - ->type('contactphone', '+658'.$faker->numberBetween($min = 1, $max = 8).$faker->randomNumber(6, true)); - $browser - ->script('jQuery("#contactsalutation").selectize()[0].selectize.setValue("mr");'); - $browser - ->press('CREATE') - ->assertPresent('#client-container'); + ->type('contactphone', '+658' . $faker->numberBetween($min = 1, $max = 8) . $faker->randomNumber(6, true)); + $browser->script('jQuery("#contactsalutation").selectize()[0].selectize.setValue("mr");'); + $browser->press('CREATE')->assertPresent('#client-container'); $browser->script('jQuery(".signmeout-btn").click()'); $browser->assertPathIs('/'); }); @@ -66,13 +64,14 @@ public function test_update_a_client() $salutation = ['mr', 'mrs', 'mdm', 'miss']; $this->browse(function (Browser $browser) use ($faker, $company) { - $browser->visit('/signin') + $browser + ->visit('/signin') ->type('username', $company->owner->email) ->type('password', 'secret') ->press('SIGN IN') - ->assertPathIs('/'.$company->domain_name.'/dashboard') + ->assertPathIs('/' . $company->domain_name . '/dashboard') ->clickLink('Clients') - ->assertPathIs('/'.$company->domain_name.'/clients') + ->assertPathIs('/' . $company->domain_name . '/clients') ->click('.activator') ->pause('500') ->clickLink('Edit') @@ -81,12 +80,11 @@ public function test_update_a_client() ->type('street', $faker->streetName) ->type('contactfirstname', $faker->firstName) ->type('contactemail', $faker->unique()->companyEmail) - ->type('contactphone', '+658'.$faker->numberBetween($min = 1, $max = 8).$faker->randomNumber(6, true)); - $browser - ->script('jQuery("#contactsalutation").selectize()[0].selectize.setValue("mr");'); + ->type('contactphone', '+658' . $faker->numberBetween($min = 1, $max = 8) . $faker->randomNumber(6, true)); + $browser->script('jQuery("#contactsalutation").selectize()[0].selectize.setValue("mr");'); $browser ->press('UPDATE') - ->assertPathBeginsWith('/'.$company->domain_name.'/client') + ->assertPathBeginsWith('/' . $company->domain_name . '/client') ->assertSee('Client Details'); $browser->script('jQuery(".signmeout-btn").click()'); $browser->assertPathIs('/'); @@ -107,13 +105,14 @@ public function test_delete_a_client() $salutation = ['mr', 'mrs', 'mdm', 'miss']; $this->browse(function (Browser $browser) use ($company) { - $browser->visit('/signin') + $browser + ->visit('/signin') ->type('username', $company->owner->email) ->type('password', 'secret') ->press('SIGN IN') - ->assertPathIs('/'.$company->domain_name.'/dashboard') + ->assertPathIs('/' . $company->domain_name . '/dashboard') ->clickLink('Clients') - ->assertPathIs('/'.$company->domain_name.'/clients') + ->assertPathIs('/' . $company->domain_name . '/clients') ->click('.activator') ->pause(500) ->click('.client-delete-btn') @@ -135,23 +134,23 @@ public function test_end_to_end_client() $salutation = ['mr', 'mrs', 'mdm', 'miss']; $this->browse(function (Browser $browser) use ($faker, $company) { - $browser->visit('/signin') + $browser + ->visit('/signin') ->type('username', $company->owner->email) ->type('password', 'secret') ->press('SIGN IN') - ->assertPathIs('/'.$company->domain_name.'/dashboard') + ->assertPathIs('/' . $company->domain_name . '/dashboard') ->clickLink('Clients') - ->assertPathIs('/'.$company->domain_name.'/clients') + ->assertPathIs('/' . $company->domain_name . '/clients') ->clickLink('Create') - ->assertPathIs('/'.$company->domain_name.'/client/create') + ->assertPathIs('/' . $company->domain_name . '/client/create') ->type('companyname', $faker->company) ->type('block', $faker->buildingNumber) ->type('street', $faker->streetName) ->type('contactfirstname', $faker->firstName) ->type('contactemail', $faker->unique()->companyEmail) - ->type('contactphone', '+658'.$faker->numberBetween($min = 1, $max = 8).$faker->randomNumber(6, true)); - $browser - ->script('jQuery("#contactsalutation").selectize()[0].selectize.setValue("mr");'); + ->type('contactphone', '+658' . $faker->numberBetween($min = 1, $max = 8) . $faker->randomNumber(6, true)); + $browser->script('jQuery("#contactsalutation").selectize()[0].selectize.setValue("mr");'); $browser ->press('CREATE') ->assertPresent('#client-container') @@ -163,15 +162,14 @@ public function test_end_to_end_client() ->type('street', $faker->streetName) ->type('contactfirstname', $faker->firstName) ->type('contactemail', $faker->unique()->companyEmail) - ->type('contactphone', '+658'.$faker->numberBetween($min = 1, $max = 8).$faker->randomNumber(6, true)); - $browser - ->script('jQuery("#contactsalutation").selectize()[0].selectize.setValue("mr");'); + ->type('contactphone', '+658' . $faker->numberBetween($min = 1, $max = 8) . $faker->randomNumber(6, true)); + $browser->script('jQuery("#contactsalutation").selectize()[0].selectize.setValue("mr");'); $browser ->press('UPDATE') - ->assertPathBeginsWith('/'.$company->domain_name.'/client') + ->assertPathBeginsWith('/' . $company->domain_name . '/client') ->assertSee('Client Details') ->clickLink('Clients') - ->assertPathIs('/'.$company->domain_name.'/clients') + ->assertPathIs('/' . $company->domain_name . '/clients') ->click('.activator') ->pause(500) ->click('.client-delete-btn') diff --git a/tests/Browser/CompanyAddressTest.php b/tests/Browser/CompanyAddressTest.php index 4e76fe38..4be16d68 100644 --- a/tests/Browser/CompanyAddressTest.php +++ b/tests/Browser/CompanyAddressTest.php @@ -25,19 +25,20 @@ public function test_updating_company_address() $faker = Faker::create(); $this->browse(function (Browser $browser) use ($faker, $company) { $streetName = $faker->streetName; - $browser->visit('/signin') + $browser + ->visit('/signin') ->type('username', $company->owner->email) ->type('password', 'secret') ->press('SIGN IN') - ->assertPathIs('/'.$company->domain_name.'/dashboard') - ->visit('/'.$company->domain_name.'/company/address/edit') + ->assertPathIs('/' . $company->domain_name . '/dashboard') + ->visit('/' . $company->domain_name . '/company/address/edit') ->type('block', $faker->buildingNumber) ->type('street', $streetName) ->type('unitnumber', $faker->buildingNumber) ->type('postalcode', $faker->postcode) ->click('label[for="buildingtype-residential"]') ->press('UPDATE') - ->assertPathIs('/'.$company->domain_name.'/company/address/edit') + ->assertPathIs('/' . $company->domain_name . '/company/address/edit') ->assertPresent('#edit-address') ->assertInputValue('street', $streetName); $browser->script('jQuery(".signmeout-btn").click()'); diff --git a/tests/Browser/CompanySettingsTest.php b/tests/Browser/CompanySettingsTest.php index 1e913ecc..c5180a27 100644 --- a/tests/Browser/CompanySettingsTest.php +++ b/tests/Browser/CompanySettingsTest.php @@ -25,22 +25,21 @@ public function test_updating_company_settings() $faker = Faker::create(); $this->browse(function (Browser $browser) use ($faker, $company) { $invoicePrefix = $faker->domainWord; - $browser->visit('/signin') + $browser + ->visit('/signin') ->type('username', $company->owner->email) ->type('password', 'secret') ->press('SIGN IN') - ->assertPathIs('/'.$company->domain_name.'/dashboard') - ->visit('/'.$company->domain_name.'/company/settings/edit') + ->assertPathIs('/' . $company->domain_name . '/dashboard') + ->visit('/' . $company->domain_name . '/company/settings/edit') ->type('tax', $faker->numberBetween($min = 1, $max = 100)) ->type('invoice_prefix', $invoicePrefix) ->type('quote_prefix', $faker->domainWord); - $browser - ->script('jQuery("#invoice_conditions").trumbowyg("html", "'.$faker->text(200).'");'); - $browser - ->script('jQuery("#quote_conditions").trumbowyg("html", "'.$faker->text(200).'");'); + $browser->script('jQuery("#invoice_conditions").trumbowyg("html", "' . $faker->text(200) . '");'); + $browser->script('jQuery("#quote_conditions").trumbowyg("html", "' . $faker->text(200) . '");'); $browser ->press('UPDATE') - ->assertPathIs('/'.$company->domain_name.'/company/settings/edit') + ->assertPathIs('/' . $company->domain_name . '/company/settings/edit') ->assertPresent('#edit-company-settings') ->assertInputValue('invoice_prefix', $invoicePrefix); $browser->script('jQuery(".signmeout-btn").click()'); diff --git a/tests/Browser/CompanyTest.php b/tests/Browser/CompanyTest.php index 420cae8c..87392c3e 100644 --- a/tests/Browser/CompanyTest.php +++ b/tests/Browser/CompanyTest.php @@ -25,23 +25,24 @@ public function test_updating_a_company() $faker = Faker::create(); $this->browse(function (Browser $browser) use ($faker, $company) { - $browser->visit('/signin') + $browser + ->visit('/signin') ->type('username', $company->owner->email) ->type('password', 'secret') ->press('SIGN IN') - ->assertPathIs('/'.$company->domain_name.'/dashboard') - ->visit('/'.$company->domain_name.'/company/edit') + ->assertPathIs('/' . $company->domain_name . '/dashboard') + ->visit('/' . $company->domain_name . '/company/edit') ->type('name', $faker->company) ->type('crn', $faker->ean8) //TODO: Debug what's wrong with the doma_name input, dusk seems unable to find and use the input -// ->scrollTo('domain_name') -// ->type('domain_name', "invoiceneko.com") + // ->scrollTo('domain_name') + // ->type('domain_name', "invoiceneko.com") ->type('email', $faker->unique()->companyEmail) - ->type('phone', '+658'.$faker->numberBetween($min = 1, $max = 8).$faker->randomNumber(6, true)) + ->type('phone', '+658' . $faker->numberBetween($min = 1, $max = 8) . $faker->randomNumber(6, true)) ->press('UPDATE') - ->assertPathIs('/'.$company->domain_name.'/company/edit') + ->assertPathIs('/' . $company->domain_name . '/company/edit') ->assertPresent('#edit-company'); -// ->assertInputValue('domain_name', "invoiceneko.com"); + // ->assertInputValue('domain_name', "invoiceneko.com"); $browser->script('jQuery(".signmeout-btn").click()'); $browser->assertPathIs('/'); }); diff --git a/tests/Browser/CompanyUsersManagementTest.php b/tests/Browser/CompanyUsersManagementTest.php index 67d2069f..ddfcffd4 100644 --- a/tests/Browser/CompanyUsersManagementTest.php +++ b/tests/Browser/CompanyUsersManagementTest.php @@ -26,20 +26,20 @@ public function test_inviting_a_user_to_a_company() $faker = Faker::create(); $this->browse(function (Browser $browser) use ($faker, $company) { - $browser->visit('/signin') + $browser + ->visit('/signin') ->type('username', $company->owner->email) ->type('password', 'secret') ->press('SIGN IN') - ->assertPathIs('/'.$company->domain_name.'/dashboard') - ->visit('/'.$company->domain_name.'/company/users') + ->assertPathIs('/' . $company->domain_name . '/dashboard') + ->visit('/' . $company->domain_name . '/company/users') ->clickLink('Invite User') ->type('#email_0', $faker->unique()->safeEmail); - $browser - ->script('jQuery("#roles_0").selectize()[0].selectize.setValue("user");'); + $browser->script('jQuery("#roles_0").selectize()[0].selectize.setValue("user");'); $browser ->press('INVITE') ->assertPresent('#users-table') - ->assertPathIs('/'.$company->domain_name.'/company/users'); + ->assertPathIs('/' . $company->domain_name . '/company/users'); $browser->script('jQuery(".signmeout-btn").click()'); $browser->assertPathIs('/'); }); @@ -52,23 +52,21 @@ public function test_approve_user_request_to_join_company() $company->users()->attach($company->user_id); $companyUserRequest = CompanyUserRequest::factory()->create([ - 'status' => CompanyUserRequest::STATUS_PENDING, + 'status' => CompanyUserRequest::STATUS_PENDING, 'company_id' => $company->id, ]); $faker = Faker::create(); $this->browse(function (Browser $browser) use ($company) { - $browser->visit('/signin') + $browser + ->visit('/signin') ->type('username', $company->owner->email) ->type('password', 'secret') ->press('SIGN IN') - ->assertPathIs('/'.$company->domain_name.'/dashboard') - ->visit('/'.$company->domain_name.'/company/requests'); - $browser - ->script("jQuery(\"form[data-tooltip='Approve User']\").submit();"); - $browser - ->assertPresent('#request-container') - ->assertPathIs('/'.$company->domain_name.'/company/requests'); + ->assertPathIs('/' . $company->domain_name . '/dashboard') + ->visit('/' . $company->domain_name . '/company/requests'); + $browser->script("jQuery(\"form[data-tooltip='Approve User']\").submit();"); + $browser->assertPresent('#request-container')->assertPathIs('/' . $company->domain_name . '/company/requests'); $browser->script('jQuery(".signmeout-btn").click()'); $browser->assertPathIs('/'); }); @@ -81,23 +79,21 @@ public function test_reject_user_request_to_join_company() $company->users()->attach($company->user_id); $companyUserRequest = CompanyUserRequest::factory()->create([ - 'status' => CompanyUserRequest::STATUS_PENDING, + 'status' => CompanyUserRequest::STATUS_PENDING, 'company_id' => $company->id, ]); $faker = Faker::create(); $this->browse(function (Browser $browser) use ($company) { - $browser->visit('/signin') + $browser + ->visit('/signin') ->type('username', $company->owner->email) ->type('password', 'secret') ->press('SIGN IN') - ->assertPathIs('/'.$company->domain_name.'/dashboard') - ->visit('/'.$company->domain_name.'/company/requests'); - $browser - ->script("jQuery(\"form[data-tooltip='Reject User']\").submit();"); - $browser - ->assertPresent('#request-container') - ->assertPathIs('/'.$company->domain_name.'/company/requests'); + ->assertPathIs('/' . $company->domain_name . '/dashboard') + ->visit('/' . $company->domain_name . '/company/requests'); + $browser->script("jQuery(\"form[data-tooltip='Reject User']\").submit();"); + $browser->assertPresent('#request-container')->assertPathIs('/' . $company->domain_name . '/company/requests'); $browser->script('jQuery(".signmeout-btn").click()'); $browser->assertPathIs('/'); }); diff --git a/tests/Browser/Components/DatePicker.php b/tests/Browser/Components/DatePicker.php index 2f8fec37..f511bcd8 100644 --- a/tests/Browser/Components/DatePicker.php +++ b/tests/Browser/Components/DatePicker.php @@ -38,9 +38,9 @@ public function elements() { return [ '@date-field' => 'input.datepicker', - '@year-list' => 'div.select-year > select.orig-select-year', + '@year-list' => 'div.select-year > select.orig-select-year', '@month-list' => 'div.select-month > select.orig-select-month', - '@day-list' => 'div.datepicker-table-wrapper > table.datepicker-table', + '@day-list' => 'div.datepicker-table-wrapper > table.datepicker-table', ]; } } diff --git a/tests/Browser/InvoiceTest.php b/tests/Browser/InvoiceTest.php index 0afb7467..b9921e7e 100644 --- a/tests/Browser/InvoiceTest.php +++ b/tests/Browser/InvoiceTest.php @@ -33,25 +33,25 @@ public function test_creating_an_invoice() $faker = Faker::create(); $this->browse(function (Browser $browser) use ($faker, $client, $company, $itemTemplate) { - $browser->visit('/signin') + $browser + ->visit('/signin') ->type('username', $company->owner->email) ->type('password', 'secret') ->press('SIGN IN') - ->assertPathIs('/'.$company->domain_name.'/dashboard') + ->assertPathIs('/' . $company->domain_name . '/dashboard') ->clickLink('Invoices') - ->assertPathIs('/'.$company->domain_name.'/invoices') + ->assertPathIs('/' . $company->domain_name . '/invoices') ->clickLink('Create') - ->assertPathIs('/'.$company->domain_name.'/invoice/create') - ->type('nice_invoice_id', substr($faker->slug, 0, 20).'sasdf') + ->assertPathIs('/' . $company->domain_name . '/invoice/create') + ->type('nice_invoice_id', substr($faker->slug, 0, 20) . 'sasdf') ->type('netdays', $faker->numberBetween($min = 1, $max = 60)) ->type('item_quantity[]', $faker->numberBetween($min = 1, $max = 999999999)) ->type('item_price[]', $faker->randomFloat($nbMaxDecimals = 2, $min = 0, $max = 999999999999)); - $browser - ->script('jQuery("#client_id").selectize()[0].selectize.setValue('.$client->id.');'); - $browser - ->script('jQuery("#date").datepicker("setDate", new Date());jQuery("#date").val("'.Carbon::now()->format('j F, Y').'");'); - $browser - ->script('jQuery("#item_name_0").selectize()[0].selectize.setValue("'.addslashes($itemTemplate->name).'");'); + $browser->script('jQuery("#client_id").selectize()[0].selectize.setValue(' . $client->id . ');'); + $browser->script( + 'jQuery("#date").datepicker("setDate", new Date());jQuery("#date").val("' . Carbon::now()->format('j F, Y') . '");', + ); + $browser->script('jQuery("#item_name_0").selectize()[0].selectize.setValue("' . addslashes($itemTemplate->name) . '");'); $browser->pause(2000); $browser ->press('CREATE') @@ -82,33 +82,29 @@ public function test_adding_a_second_invoice_item() $faker = Faker::create(); $this->browse(function (Browser $browser) use ($faker, $client, $company, $itemTemplates) { - $browser->visit('/signin') + $browser + ->visit('/signin') ->type('username', $company->owner->email) ->type('password', 'secret') ->press('SIGN IN') - ->assertPathIs('/'.$company->domain_name.'/dashboard') + ->assertPathIs('/' . $company->domain_name . '/dashboard') ->clickLink('Invoices') - ->assertPathIs('/'.$company->domain_name.'/invoices') + ->assertPathIs('/' . $company->domain_name . '/invoices') ->clickLink('Create') - ->assertPathIs('/'.$company->domain_name.'/invoice/create') - ->type('nice_invoice_id', substr($faker->slug, 0, 20).'sasdf') + ->assertPathIs('/' . $company->domain_name . '/invoice/create') + ->type('nice_invoice_id', substr($faker->slug, 0, 20) . 'sasdf') ->type('netdays', $faker->numberBetween($min = 1, $max = 60)) ->type('item_quantity[]', $faker->numberBetween($min = 1, $max = 999999999)) ->type('item_price[]', $faker->randomFloat($nbMaxDecimals = 2, $min = 0, $max = 999999999999)); - $browser - ->script('jQuery("#client_id").selectize()[0].selectize.setValue('.$client->id.');'); - $browser - ->script('jQuery("#date").datepicker("setDate", new Date());jQuery("#date").val("'.Carbon::now()->format('j F, Y').'");'); - $browser - ->script('jQuery("#item_name_0").selectize()[0].selectize.setValue("'.addslashes($itemTemplates[0]->name).'");'); - $browser - ->click('a[id="invoice-item-add"]'); - $browser - ->script('jQuery("#item_name_1").selectize()[0].selectize.setValue("'.addslashes($itemTemplates[1]->name).'");'); + $browser->script('jQuery("#client_id").selectize()[0].selectize.setValue(' . $client->id . ');'); + $browser->script( + 'jQuery("#date").datepicker("setDate", new Date());jQuery("#date").val("' . Carbon::now()->format('j F, Y') . '");', + ); + $browser->script('jQuery("#item_name_0").selectize()[0].selectize.setValue("' . addslashes($itemTemplates[0]->name) . '");'); + $browser->click('a[id="invoice-item-add"]'); + $browser->script('jQuery("#item_name_1").selectize()[0].selectize.setValue("' . addslashes($itemTemplates[1]->name) . '");'); $browser->pause(2000); - $browser - ->press('CREATE') - ->assertPresent('#invoice-action-container'); + $browser->press('CREATE')->assertPresent('#invoice-action-container'); $browser->script('jQuery(".signmeout-btn").click()'); $browser->assertPathIs('/'); }); @@ -127,9 +123,9 @@ public function test_updating_an_invoice() $company->users()->attach($company->user_id); $invoice = Invoice::factory()->create([ - 'status' => Invoice::STATUS_OPEN, - 'archived' => false, - 'client_id' => $client->id, + 'status' => Invoice::STATUS_OPEN, + 'archived' => false, + 'client_id' => $client->id, 'company_id' => $company->id, ]); $invoiceItems = InvoiceItem::factory(3)->create([ @@ -143,26 +139,26 @@ public function test_updating_an_invoice() $salutation = ['mr', 'mrs', 'mdm', 'miss']; $this->browse(function (Browser $browser) use ($faker, $client, $company, $invoice) { - $browser->visit('/signin') + $browser + ->visit('/signin') ->type('username', $company->owner->email) ->type('password', 'secret') ->press('SIGN IN') - ->assertPathIs('/'.$company->domain_name.'/dashboard') + ->assertPathIs('/' . $company->domain_name . '/dashboard') ->clickLink('Invoices') - ->assertPathIs('/'.$company->domain_name.'/invoices') + ->assertPathIs('/' . $company->domain_name . '/invoices') ->clickLink('Pending') ->pause(500); - $browser - ->script("jQuery(\"a[href='{$this->baseUrl()}/{$company->domain_name}/invoice/{$invoice->id}/edit'] > i\").click();"); + $browser->script("jQuery(\"a[href='{$this->baseUrl()}/{$company->domain_name}/invoice/{$invoice->id}/edit'] > i\").click();"); $browser ->type('netdays', $faker->numberBetween($min = 1, $max = 60)) ->type('item_name[]', 'The Turbo Ultra Turbonator') ->type('item_quantity[]', $faker->numberBetween($min = 1, $max = 999999999)) ->type('item_price[]', $faker->randomFloat($nbMaxDecimals = 2, $min = 0, $max = 999999999999)); - $browser - ->script('jQuery("#client_id").selectize()[0].selectize.setValue('.$client->id.');'); - $browser - ->script('jQuery("#date").datepicker("setDate", new Date());jQuery("#date").val("'.Carbon::now()->format('j F, Y').'");'); + $browser->script('jQuery("#client_id").selectize()[0].selectize.setValue(' . $client->id . ');'); + $browser->script( + 'jQuery("#date").datepicker("setDate", new Date());jQuery("#date").val("' . Carbon::now()->format('j F, Y') . '");', + ); $browser ->pause(2000) ->press('UPDATE') @@ -186,9 +182,9 @@ public function test_deleting_an_invoice() $company->users()->attach($company->user_id); $invoice = Invoice::factory()->create([ - 'status' => Invoice::STATUS_OPEN, - 'archived' => false, - 'client_id' => $client->id, + 'status' => Invoice::STATUS_OPEN, + 'archived' => false, + 'client_id' => $client->id, 'company_id' => $company->id, ]); $invoiceItems = InvoiceItem::factory(3)->create([ @@ -199,17 +195,17 @@ public function test_deleting_an_invoice() $salutation = ['mr', 'mrs', 'mdm', 'miss']; $this->browse(function (Browser $browser) use ($company) { - $browser->visit('/signin') + $browser + ->visit('/signin') ->type('username', $company->owner->email) ->type('password', 'secret') ->press('SIGN IN') - ->assertPathIs('/'.$company->domain_name.'/dashboard') + ->assertPathIs('/' . $company->domain_name . '/dashboard') ->clickLink('Invoices') - ->assertPathIs('/'.$company->domain_name.'/invoices') + ->assertPathIs('/' . $company->domain_name . '/invoices') ->clickLink('Pending') ->pause(500); - $browser - ->script('jQuery(".invoice-delete-btn > i").click();'); + $browser->script('jQuery(".invoice-delete-btn > i").click();'); $browser ->pause(500) ->press('DELETE') @@ -232,9 +228,9 @@ public function test_invoice_log_payment() $company->users()->attach($company->user_id); $invoice = Invoice::factory()->create([ - 'status' => Invoice::STATUS_OPEN, - 'archived' => false, - 'client_id' => $client->id, + 'status' => Invoice::STATUS_OPEN, + 'archived' => false, + 'client_id' => $client->id, 'company_id' => $company->id, ]); $invoiceItems = InvoiceItem::factory(3)->create([ @@ -247,31 +243,33 @@ public function test_invoice_log_payment() $faker = Faker::create(); $salutation = ['mr', 'mrs', 'mdm', 'miss']; - $this->browse(function (Browser $browser) use ($faker , $company) { - $browser->visit('/signin') + $this->browse(function (Browser $browser) use ($faker, $company) { + $browser + ->visit('/signin') ->type('username', $company->owner->email) ->type('password', 'secret') ->press('SIGN IN') - ->assertPathIs('/'.$company->domain_name.'/dashboard') + ->assertPathIs('/' . $company->domain_name . '/dashboard') ->clickLink('Invoices') - ->assertPathIs('/'.$company->domain_name.'/invoices') + ->assertPathIs('/' . $company->domain_name . '/invoices') ->clickLink('Pending') ->pause(500); + $browser->script("jQuery(\"a[data-tooltip='View Invoice'] > i\").click();"); $browser - ->script("jQuery(\"a[data-tooltip='View Invoice'] > i\").click();"); - $browser - ->assertPathBeginsWith('/'.$company->domain_name.'/invoice') + ->assertPathBeginsWith('/' . $company->domain_name . '/invoice') ->clickLink('Log Payment') ->type('amount', $faker->randomFloat($nbMaxDecimals = 2, $min = 0, $max = 999999999999)) ->type('notes', $faker->text(50)); - $browser - ->script('jQuery("#receiveddate").datepicker("setDate", new Date());jQuery("#receiveddate").val("'.Carbon::now()->format('j F, Y').'");'); - $browser - ->script('jQuery("#mode").selectize()[0].selectize.setValue("Cheque");'); + $browser->script( + 'jQuery("#receiveddate").datepicker("setDate", new Date());jQuery("#receiveddate").val("' . + Carbon::now()->format('j F, Y') . + '");', + ); + $browser->script('jQuery("#mode").selectize()[0].selectize.setValue("Cheque");'); $browser ->press('SUBMIT') ->assertPresent('#invoice-action-container') - ->assertPathBeginsWith('/'.$company->domain_name.'/invoice'); + ->assertPathBeginsWith('/' . $company->domain_name . '/invoice'); $browser->script('jQuery(".signmeout-btn").click()'); $browser->assertPathIs('/'); }); @@ -296,78 +294,77 @@ public function test_end_to_end_invoice() $faker = Faker::create(); $this->browse(function (Browser $browser) use ($faker, $client, $company, $itemTemplate) { - $browser->visit('/signin') + $browser + ->visit('/signin') ->type('username', $company->owner->email) ->type('password', 'secret') ->press('SIGN IN') - ->assertPathIs('/'.$company->domain_name.'/dashboard') + ->assertPathIs('/' . $company->domain_name . '/dashboard') ->clickLink('Invoices') - ->assertPathIs('/'.$company->domain_name.'/invoices') + ->assertPathIs('/' . $company->domain_name . '/invoices') ->clickLink('Create') - ->assertPathIs('/'.$company->domain_name.'/invoice/create') - ->type('nice_invoice_id', substr($faker->slug, 0, 20).'sasdf') + ->assertPathIs('/' . $company->domain_name . '/invoice/create') + ->type('nice_invoice_id', substr($faker->slug, 0, 20) . 'sasdf') ->type('netdays', $faker->numberBetween($min = 1, $max = 60)) ->type('item_quantity[]', $faker->numberBetween($min = 1, $max = 999999999)) ->type('item_price[]', $faker->randomFloat($nbMaxDecimals = 2, $min = 0, $max = 999999999999)); - $browser - ->script('jQuery("#client_id").selectize()[0].selectize.setValue('.$client->id.');'); - $browser - ->script('jQuery("#date").datepicker("setDate", new Date());jQuery("#date").val("'.Carbon::now()->format('j F, Y').'");'); - $browser - ->script('jQuery("#item_name_0").selectize()[0].selectize.setValue("'.addslashes($itemTemplate->name).'");'); + $browser->script('jQuery("#client_id").selectize()[0].selectize.setValue(' . $client->id . ');'); + $browser->script( + 'jQuery("#date").datepicker("setDate", new Date());jQuery("#date").val("' . Carbon::now()->format('j F, Y') . '");', + ); + $browser->script('jQuery("#item_name_0").selectize()[0].selectize.setValue("' . addslashes($itemTemplate->name) . '");'); $browser->pause(2000); $browser ->press('CREATE') ->assertPresent('#invoice-action-container') ->clickLink('Invoices') - ->assertPathIs('/'.$company->domain_name.'/invoices') + ->assertPathIs('/' . $company->domain_name . '/invoices') ->clickLink('Pending') ->pause(500); - $browser - ->script("jQuery(\"a[data-tooltip='Edit Invoice'] > i\").click();"); + $browser->script("jQuery(\"a[data-tooltip='Edit Invoice'] > i\").click();"); $browser ->type('netdays', $faker->numberBetween($min = 1, $max = 60)) ->type('item_name[]', $faker->bs()) ->type('item_quantity[]', $faker->numberBetween($min = 1, $max = 999999999)) ->type('item_price[]', $faker->randomFloat($nbMaxDecimals = 2, $min = 0, $max = 999999999999)); - $browser - ->script('jQuery("#client_id").selectize()[0].selectize.setValue('.$client->id.');'); - $browser - ->script('jQuery("#date").datepicker("setDate", new Date());jQuery("#date").val("'.Carbon::now()->format('j F, Y').'");'); + $browser->script('jQuery("#client_id").selectize()[0].selectize.setValue(' . $client->id . ');'); + $browser->script( + 'jQuery("#date").datepicker("setDate", new Date());jQuery("#date").val("' . Carbon::now()->format('j F, Y') . '");', + ); $browser ->pause(2000) ->press('UPDATE') ->assertPresent('#invoice-action-container') ->clickLink('Invoices') - ->assertPathIs('/'.$company->domain_name.'/invoices') + ->assertPathIs('/' . $company->domain_name . '/invoices') ->clickLink('Pending') ->pause(500); + $browser->script("jQuery(\"a[data-tooltip='View Invoice'] > i\").click();"); $browser - ->script("jQuery(\"a[data-tooltip='View Invoice'] > i\").click();"); - $browser - ->assertPathBeginsWith('/'.$company->domain_name.'/invoice') + ->assertPathBeginsWith('/' . $company->domain_name . '/invoice') ->clickLink('Log Payment') ->type('amount', $faker->randomFloat($nbMaxDecimals = 2, $min = 0, $max = 999999999999)) ->type('notes', $faker->text(50)); - $browser - ->script('jQuery("#receiveddate").datepicker("setDate", new Date());jQuery("#receiveddate").val("'.Carbon::now()->format('j F, Y').'");'); - $browser - ->script('jQuery("#mode").selectize()[0].selectize.setValue("Cheque");'); + $browser->script( + 'jQuery("#receiveddate").datepicker("setDate", new Date());jQuery("#receiveddate").val("' . + Carbon::now()->format('j F, Y') . + '");', + ); + $browser->script('jQuery("#mode").selectize()[0].selectize.setValue("Cheque");'); $browser ->press('SUBMIT') ->assertPresent('#invoice-action-container') - ->assertPathBeginsWith('/'.$company->domain_name.'/invoice') + ->assertPathBeginsWith('/' . $company->domain_name . '/invoice') ->clickLink('Invoices') - ->assertPathIs('/'.$company->domain_name.'/invoices') + ->assertPathIs('/' . $company->domain_name . '/invoices') ->clickLink('Pending') ->pause(500); - $browser - ->script('jQuery(".invoice-delete-btn > i").click();'); + $browser->script('jQuery(".invoice-delete-btn > i").click();'); $browser ->pause(500) ->press('DELETE') ->assertPresent('#invoice-container') - ->assertPathBeginsWith('/'.$company->domain_name.'/invoice'); + ->assertPathBeginsWith('/' . $company->domain_name . '/invoice'); $browser->script('jQuery(".signmeout-btn").click()'); $browser->assertPathIs('/'); }); diff --git a/tests/Browser/ItemTemplateTest.php b/tests/Browser/ItemTemplateTest.php index 2c1b0404..f3bd9ac9 100644 --- a/tests/Browser/ItemTemplateTest.php +++ b/tests/Browser/ItemTemplateTest.php @@ -25,23 +25,23 @@ public function test_create_an_item_template() $faker = Faker::create(); $this->browse(function (Browser $browser) use ($faker, $company) { - $browser->visit('/signin') + $browser + ->visit('/signin') ->type('username', $company->owner->email) ->type('password', 'secret') ->press('SIGN IN') - ->assertPathIs('/'.$company->domain_name.'/dashboard') - ->visit('/'.$company->domain_name.'/itemtemplates') + ->assertPathIs('/' . $company->domain_name . '/dashboard') + ->visit('/' . $company->domain_name . '/itemtemplates') ->clickLink('Create') ->type('name', $faker->bs()) ->type('quantity', $faker->numberBetween($min = 1, $max = 999999999)) ->type('price', $faker->randomFloat($nbMaxDecimals = 2, $min = 0, $max = 999999999999)); - $browser - ->script('jQuery("#description").trumbowyg("html", "'.$faker->text(200).'");'); + $browser->script('jQuery("#description").trumbowyg("html", "' . $faker->text(200) . '");'); $browser ->press('CREATE') ->assertSee('Item Template Details') ->assertPresent('#delete-itemtemplate-form') - ->assertPathBeginsWith('/'.$company->domain_name.'/itemtemplate'); + ->assertPathBeginsWith('/' . $company->domain_name . '/itemtemplate'); $browser->script('jQuery(".signmeout-btn").click()'); $browser->assertPathIs('/'); }); @@ -59,25 +59,26 @@ public function test_update_an_item_template() $faker = Faker::create(); $this->browse(function (Browser $browser) use ($faker, $company, $itemTemplate) { - $browser->visit('/signin') + $browser + ->visit('/signin') ->type('username', $company->owner->email) ->type('password', 'secret') ->press('SIGN IN') - ->assertPathIs('/'.$company->domain_name.'/dashboard') - ->visit('/'.$company->domain_name.'/itemtemplates'); - $browser - ->script("jQuery(\"a[href='{$this->baseUrl()}/{$company->domain_name}/itemtemplate/{$itemTemplate->id}/edit'] > i\").click();"); + ->assertPathIs('/' . $company->domain_name . '/dashboard') + ->visit('/' . $company->domain_name . '/itemtemplates'); + $browser->script( + "jQuery(\"a[href='{$this->baseUrl()}/{$company->domain_name}/itemtemplate/{$itemTemplate->id}/edit'] > i\").click();", + ); $browser ->type('name', $faker->bs()) ->type('quantity', $faker->numberBetween($min = 1, $max = 999999999)) ->type('price', $faker->randomFloat($nbMaxDecimals = 2, $min = 0, $max = 999999999999)); - $browser - ->script('jQuery("#description").trumbowyg("html", "'.$faker->text(200).'");'); + $browser->script('jQuery("#description").trumbowyg("html", "' . $faker->text(200) . '");'); $browser ->press('UPDATE') ->assertSee('Item Template Details') ->assertPresent('#delete-itemtemplate-form') - ->assertPathBeginsWith('/'.$company->domain_name.'/itemtemplate'); + ->assertPathBeginsWith('/' . $company->domain_name . '/itemtemplate'); $browser->script('jQuery(".signmeout-btn").click()'); $browser->assertPathIs('/'); }); @@ -95,19 +96,19 @@ public function test_delete_an_item_template() $faker = Faker::create(); $this->browse(function (Browser $browser) use ($company) { - $browser->visit('/signin') + $browser + ->visit('/signin') ->type('username', $company->owner->email) ->type('password', 'secret') ->press('SIGN IN') - ->assertPathIs('/'.$company->domain_name.'/dashboard') - ->visit('/'.$company->domain_name.'/itemtemplates'); - $browser - ->script('jQuery(".itemtemplate-delete-btn > i").click();'); + ->assertPathIs('/' . $company->domain_name . '/dashboard') + ->visit('/' . $company->domain_name . '/itemtemplates'); + $browser->script('jQuery(".itemtemplate-delete-btn > i").click();'); $browser ->pause(500) ->press('DELETE') ->assertPresent('#itemtemplate-container') - ->assertPathIs('/'.$company->domain_name.'/itemtemplates'); + ->assertPathIs('/' . $company->domain_name . '/itemtemplates'); $browser->script('jQuery(".signmeout-btn").click()'); $browser->assertPathIs('/'); }); @@ -121,40 +122,39 @@ public function test_end_to_end_item_template() $faker = Faker::create(); $this->browse(function (Browser $browser) use ($faker, $company) { - $browser->visit('/signin') + $browser + ->visit('/signin') ->type('username', $company->owner->email) ->type('password', 'secret') ->press('SIGN IN') - ->assertPathIs('/'.$company->domain_name.'/dashboard') - ->visit('/'.$company->domain_name.'/itemtemplates') + ->assertPathIs('/' . $company->domain_name . '/dashboard') + ->visit('/' . $company->domain_name . '/itemtemplates') ->clickLink('Create') ->type('name', $faker->bs()) ->type('quantity', $faker->numberBetween($min = 1, $max = 999999999)) ->type('price', $faker->randomFloat($nbMaxDecimals = 2, $min = 0, $max = 999999999999)); - $browser - ->script('jQuery("#description").trumbowyg("html", "'.$faker->text(200).'");'); + $browser->script('jQuery("#description").trumbowyg("html", "' . $faker->text(200) . '");'); $browser ->press('CREATE') ->assertSee('Item Template Details') ->assertPresent('#delete-itemtemplate-form') - ->assertPathBeginsWith('/'.$company->domain_name.'/itemtemplate') + ->assertPathBeginsWith('/' . $company->domain_name . '/itemtemplate') ->clickLink('Edit') ->assertSee('Update Item Template') ->type('name', $faker->bs()) ->type('quantity', $faker->numberBetween($min = 1, $max = 999999999)) ->type('price', $faker->randomFloat($nbMaxDecimals = 2, $min = 0, $max = 999999999999)); - $browser - ->script('jQuery("#description").trumbowyg("html", "'.$faker->text(200).'");'); + $browser->script('jQuery("#description").trumbowyg("html", "' . $faker->text(200) . '");'); $browser ->press('UPDATE') ->assertSee('Item Template Details') ->assertPresent('#delete-itemtemplate-form') - ->assertPathBeginsWith('/'.$company->domain_name.'/itemtemplate') + ->assertPathBeginsWith('/' . $company->domain_name . '/itemtemplate') ->clickLink('Delete') ->pause(500) ->press('DELETE') ->assertPresent('#itemtemplate-container') - ->assertPathIs('/'.$company->domain_name.'/itemtemplates'); + ->assertPathIs('/' . $company->domain_name . '/itemtemplates'); $browser->script('jQuery(".signmeout-btn").click()'); $browser->assertPathIs('/'); }); diff --git a/tests/Browser/LoginTest.php b/tests/Browser/LoginTest.php index 21eb1800..d09f4649 100644 --- a/tests/Browser/LoginTest.php +++ b/tests/Browser/LoginTest.php @@ -20,7 +20,8 @@ public function test_sign_in() $user = User::factory()->create(); $this->browse(function (Browser $browser) use ($user) { - $browser->visit('/signin') + $browser + ->visit('/signin') ->type('username', $user->email) ->type('password', 'secret') ->press('SIGN IN') diff --git a/tests/Browser/PaymentTest.php b/tests/Browser/PaymentTest.php index 34bb54ae..543561e8 100644 --- a/tests/Browser/PaymentTest.php +++ b/tests/Browser/PaymentTest.php @@ -28,26 +28,26 @@ public function test_create_a_payment() $faker = Faker::create(); $this->browse(function (Browser $browser) use ($faker, $invoice, $company) { - $browser->visit('/signin') + $browser + ->visit('/signin') ->type('username', $company->owner->email) ->type('password', 'secret') ->press('SIGN IN') - ->assertPathIs('/'.$company->domain_name.'/dashboard') + ->assertPathIs('/' . $company->domain_name . '/dashboard') ->clickLink('Payments') - ->assertPathIs('/'.$company->domain_name.'/payments') + ->assertPathIs('/' . $company->domain_name . '/payments') ->clickLink('Create') - ->assertPathIs('/'.$company->domain_name.'/payment/create') + ->assertPathIs('/' . $company->domain_name . '/payment/create') ->type('amount', $faker->randomFloat($nbMaxDecimals = 2, $min = 0, $max = 999999999999)) ->type('notes', $faker->text(50)); - $browser - ->script('jQuery("#receiveddate").datepicker("setDate", new Date());jQuery("#receiveddate").val("'.Carbon::now()->format('j F, Y').'");'); - $browser - ->script('jQuery("#invoice_id").selectize()[0].selectize.setValue("'.$invoice->id.'");'); - $browser - ->script('jQuery("#mode").selectize()[0].selectize.setValue("Cheque");'); - $browser - ->press('SUBMIT') - ->assertPresent('#payment-container'); + $browser->script( + 'jQuery("#receiveddate").datepicker("setDate", new Date());jQuery("#receiveddate").val("' . + Carbon::now()->format('j F, Y') . + '");', + ); + $browser->script('jQuery("#invoice_id").selectize()[0].selectize.setValue("' . $invoice->id . '");'); + $browser->script('jQuery("#mode").selectize()[0].selectize.setValue("Cheque");'); + $browser->press('SUBMIT')->assertPresent('#payment-container'); $browser->script('jQuery(".signmeout-btn").click()'); $browser->assertPathIs('/'); }); @@ -67,28 +67,30 @@ public function test_update_a_payment() $faker = Faker::create(); - $this->browse(function (Browser $browser) use ($faker , $company, $payment) { - $browser->visit('/signin') + $this->browse(function (Browser $browser) use ($faker, $company, $payment) { + $browser + ->visit('/signin') ->type('username', $company->owner->email) ->type('password', 'secret') ->press('SIGN IN') - ->assertPathIs('/'.$company->domain_name.'/dashboard') + ->assertPathIs('/' . $company->domain_name . '/dashboard') ->clickLink('Payments') - ->assertPathIs('/'.$company->domain_name.'/payments'); - $browser - ->script("jQuery(\"a[href='{$this->baseUrl()}/{$company->domain_name}/payment/{$payment->id}/edit'] > i\").click();"); + ->assertPathIs('/' . $company->domain_name . '/payments'); + $browser->script("jQuery(\"a[href='{$this->baseUrl()}/{$company->domain_name}/payment/{$payment->id}/edit'] > i\").click();"); $browser - ->assertPathBeginsWith('/'.$company->domain_name.'/payment') + ->assertPathBeginsWith('/' . $company->domain_name . '/payment') ->type('amount', $faker->randomFloat($nbMaxDecimals = 2, $min = 0, $max = 999999999999)) ->type('notes', $faker->text(50)); - $browser - ->script('jQuery("#receiveddate").datepicker("setDate", new Date());jQuery("#receiveddate").val("'.Carbon::now()->format('j F, Y').'");'); - $browser - ->script('jQuery("#mode").selectize()[0].selectize.setValue("Cheque");'); + $browser->script( + 'jQuery("#receiveddate").datepicker("setDate", new Date());jQuery("#receiveddate").val("' . + Carbon::now()->format('j F, Y') . + '");', + ); + $browser->script('jQuery("#mode").selectize()[0].selectize.setValue("Cheque");'); $browser ->press('SUBMIT') ->assertPresent('#payment-container') - ->assertPathIs('/'.$company->domain_name.'/payments'); + ->assertPathIs('/' . $company->domain_name . '/payments'); $browser->script('jQuery(".signmeout-btn").click()'); $browser->assertPathIs('/'); }); @@ -109,20 +111,20 @@ public function test_delete_a_payment() $faker = Faker::create(); $this->browse(function (Browser $browser) use ($company) { - $browser->visit('/signin') + $browser + ->visit('/signin') ->type('username', $company->owner->email) ->type('password', 'secret') ->press('SIGN IN') - ->assertPathIs('/'.$company->domain_name.'/dashboard') + ->assertPathIs('/' . $company->domain_name . '/dashboard') ->clickLink('Payments') - ->assertPathIs('/'.$company->domain_name.'/payments'); - $browser - ->script('jQuery(".payment-delete-btn > i").click();'); + ->assertPathIs('/' . $company->domain_name . '/payments'); + $browser->script('jQuery(".payment-delete-btn > i").click();'); $browser ->pause(500) ->press('DELETE') ->assertPresent('#payment-container') - ->assertPathIs('/'.$company->domain_name.'/payments'); + ->assertPathIs('/' . $company->domain_name . '/payments'); $browser->script('jQuery(".signmeout-btn").click()'); $browser->assertPathIs('/'); }); @@ -138,49 +140,51 @@ public function test_end_to_end_payment() $faker = Faker::create(); $this->browse(function (Browser $browser) use ($faker, $invoice, $company) { - $browser->visit('/signin') + $browser + ->visit('/signin') ->type('username', $company->owner->email) ->type('password', 'secret') ->press('SIGN IN') - ->assertPathIs('/'.$company->domain_name.'/dashboard') + ->assertPathIs('/' . $company->domain_name . '/dashboard') ->clickLink('Payments') - ->assertPathIs('/'.$company->domain_name.'/payments') + ->assertPathIs('/' . $company->domain_name . '/payments') ->clickLink('Create') - ->assertPathIs('/'.$company->domain_name.'/payment/create') + ->assertPathIs('/' . $company->domain_name . '/payment/create') ->type('amount', $faker->randomFloat($nbMaxDecimals = 2, $min = 0, $max = 999999999999)) ->type('notes', $faker->text(50)); - $browser - ->script('jQuery("#receiveddate").datepicker("setDate", new Date());jQuery("#receiveddate").val("'.Carbon::now()->format('j F, Y').'");'); - $browser - ->script('jQuery("#invoice_id").selectize()[0].selectize.setValue("'.$invoice->id.'");'); - $browser - ->script('jQuery("#mode").selectize()[0].selectize.setValue("Cheque");'); + $browser->script( + 'jQuery("#receiveddate").datepicker("setDate", new Date());jQuery("#receiveddate").val("' . + Carbon::now()->format('j F, Y') . + '");', + ); + $browser->script('jQuery("#invoice_id").selectize()[0].selectize.setValue("' . $invoice->id . '");'); + $browser->script('jQuery("#mode").selectize()[0].selectize.setValue("Cheque");'); $browser ->press('SUBMIT') ->assertPresent('#payment-container') ->clickLink('Payments') - ->assertPathIs('/'.$company->domain_name.'/payments'); - $browser - ->script("jQuery(\"a[data-tooltip='Edit Payment'] > i\").click();"); + ->assertPathIs('/' . $company->domain_name . '/payments'); + $browser->script("jQuery(\"a[data-tooltip='Edit Payment'] > i\").click();"); $browser - ->assertPathBeginsWith('/'.$company->domain_name.'/payment') + ->assertPathBeginsWith('/' . $company->domain_name . '/payment') ->type('amount', $faker->randomFloat($nbMaxDecimals = 2, $min = 0, $max = 999999999999)) ->type('notes', $faker->text(50)); - $browser - ->script('jQuery("#receiveddate").datepicker("setDate", new Date());jQuery("#receiveddate").val("'.Carbon::now()->format('j F, Y').'");'); - $browser - ->script('jQuery("#mode").selectize()[0].selectize.setValue("Cheque");'); + $browser->script( + 'jQuery("#receiveddate").datepicker("setDate", new Date());jQuery("#receiveddate").val("' . + Carbon::now()->format('j F, Y') . + '");', + ); + $browser->script('jQuery("#mode").selectize()[0].selectize.setValue("Cheque");'); $browser ->press('SUBMIT') ->assertPresent('#payment-container') - ->assertPathIs('/'.$company->domain_name.'/payments'); - $browser - ->script('jQuery(".payment-delete-btn > i").click();'); + ->assertPathIs('/' . $company->domain_name . '/payments'); + $browser->script('jQuery(".payment-delete-btn > i").click();'); $browser ->pause(500) ->press('DELETE') ->assertPresent('#payment-container') - ->assertPathIs('/'.$company->domain_name.'/payments'); + ->assertPathIs('/' . $company->domain_name . '/payments'); $browser->script('jQuery(".signmeout-btn").click()'); $browser->assertPathIs('/'); }); diff --git a/tests/Browser/PolicyTest.php b/tests/Browser/PolicyTest.php index f1d688ca..81beaa20 100644 --- a/tests/Browser/PolicyTest.php +++ b/tests/Browser/PolicyTest.php @@ -29,9 +29,9 @@ public function test_accessing_another_company_invoice() $company->users()->attach($company->user_id); $invoice = Invoice::factory()->create([ - 'status' => Invoice::STATUS_OPEN, - 'archived' => false, - 'client_id' => $client->id, + 'status' => Invoice::STATUS_OPEN, + 'archived' => false, + 'client_id' => $client->id, 'company_id' => $company->id, ]); $invoiceItems = InvoiceItem::factory(3)->create([ @@ -48,26 +48,26 @@ public function test_accessing_another_company_invoice() $secondCompany->users()->attach($secondCompany->user_id); $this->browse(function (Browser $browser) use ($faker, $client, $company, $secondCompany, $invoice) { - $browser->visit('/signin') + $browser + ->visit('/signin') ->type('username', $company->owner->email) ->type('password', 'secret') ->press('SIGN IN') - ->assertPathIs('/'.$company->domain_name.'/dashboard') + ->assertPathIs('/' . $company->domain_name . '/dashboard') ->clickLink('Invoices') - ->assertPathIs('/'.$company->domain_name.'/invoices') + ->assertPathIs('/' . $company->domain_name . '/invoices') ->clickLink('Pending') ->pause(500); - $browser - ->script("jQuery(\"a[href='{$this->baseUrl()}/{$company->domain_name}/invoice/{$invoice->id}/edit'] > i\").click();"); + $browser->script("jQuery(\"a[href='{$this->baseUrl()}/{$company->domain_name}/invoice/{$invoice->id}/edit'] > i\").click();"); $browser ->type('netdays', $faker->numberBetween($min = 1, $max = 60)) ->type('item_name[]', 'The Turbo Ultra Turbonator') ->type('item_quantity[]', $faker->numberBetween($min = 1, $max = 999999999)) ->type('item_price[]', $faker->randomFloat($nbMaxDecimals = 2, $min = 0, $max = 999999999999)); - $browser - ->script('jQuery("#client_id").selectize()[0].selectize.setValue('.$client->id.');'); - $browser - ->script('jQuery("#date").datepicker("setDate", new Date());jQuery("#date").val("'.Carbon::now()->format('j F, Y').'");'); + $browser->script('jQuery("#client_id").selectize()[0].selectize.setValue(' . $client->id . ');'); + $browser->script( + 'jQuery("#date").datepicker("setDate", new Date());jQuery("#date").val("' . Carbon::now()->format('j F, Y') . '");', + ); $browser ->pause(2000) ->press('UPDATE') @@ -75,16 +75,17 @@ public function test_accessing_another_company_invoice() ->assertSee('The Turbo Ultra Turbonator'); $browser->script('jQuery(".signmeout-btn").click()'); $browser->assertPathIs('/'); - $browser->visit('/signin') + $browser + ->visit('/signin') ->type('username', $secondCompany->owner->email) ->type('password', 'secret') ->press('SIGN IN') - ->assertPathIs('/'.$secondCompany->domain_name.'/dashboard') - ->visit('/'.$company->domain_name.'/invoice/'.$invoice->id) + ->assertPathIs('/' . $secondCompany->domain_name . '/dashboard') + ->visit('/' . $company->domain_name . '/invoice/' . $invoice->id) ->assertSee('Error 401') ->screenshot('view-another-company-invoice-test') ->visit('/') - ->assertPathIs('/'.$secondCompany->domain_name.'/dashboard'); + ->assertPathIs('/' . $secondCompany->domain_name . '/dashboard'); $browser->script('jQuery(".signmeout-btn").click()'); $browser->assertPathIs('/'); }); @@ -98,9 +99,9 @@ public function test_accessing_another_company_quote() $company->users()->attach($company->user_id); $quote = Quote::factory()->create([ - 'status' => Quote::STATUS_OPEN, - 'archived' => false, - 'client_id' => $client->id, + 'status' => Quote::STATUS_OPEN, + 'archived' => false, + 'client_id' => $client->id, 'company_id' => $company->id, ]); $quoteItems = QuoteItem::factory(3)->create([ @@ -117,26 +118,26 @@ public function test_accessing_another_company_quote() $secondCompany->users()->attach($secondCompany->user_id); $this->browse(function (Browser $browser) use ($faker, $client, $company, $secondCompany, $quote) { - $browser->visit('/signin') + $browser + ->visit('/signin') ->type('username', $company->owner->email) ->type('password', 'secret') ->press('SIGN IN') - ->assertPathIs('/'.$company->domain_name.'/dashboard') + ->assertPathIs('/' . $company->domain_name . '/dashboard') ->clickLink('Quotes') - ->assertPathIs('/'.$company->domain_name.'/quotes') + ->assertPathIs('/' . $company->domain_name . '/quotes') ->clickLink('Pending') ->pause(500); - $browser - ->script("jQuery(\"a[href='{$this->baseUrl()}/{$company->domain_name}/quote/{$quote->id}/edit'] > i\").click();"); + $browser->script("jQuery(\"a[href='{$this->baseUrl()}/{$company->domain_name}/quote/{$quote->id}/edit'] > i\").click();"); $browser ->type('netdays', $faker->numberBetween($min = 1, $max = 60)) ->type('item_name[]', 'The Turbo Ultra Turbonator') ->type('item_quantity[]', $faker->numberBetween($min = 1, $max = 999999999)) ->type('item_price[]', $faker->randomFloat($nbMaxDecimals = 2, $min = 0, $max = 999999999999)); - $browser - ->script('jQuery("#client_id").selectize()[0].selectize.setValue('.$client->id.');'); - $browser - ->script('jQuery("#date").datepicker("setDate", new Date());jQuery("#date").val("'.Carbon::now()->format('j F, Y').'");'); + $browser->script('jQuery("#client_id").selectize()[0].selectize.setValue(' . $client->id . ');'); + $browser->script( + 'jQuery("#date").datepicker("setDate", new Date());jQuery("#date").val("' . Carbon::now()->format('j F, Y') . '");', + ); $browser ->pause(2000) ->press('UPDATE') @@ -144,16 +145,17 @@ public function test_accessing_another_company_quote() ->assertSee('The Turbo Ultra Turbonator'); $browser->script('jQuery(".signmeout-btn").click()'); $browser->assertPathIs('/'); - $browser->visit('/signin') + $browser + ->visit('/signin') ->type('username', $secondCompany->owner->email) ->type('password', 'secret') ->press('SIGN IN') - ->assertPathIs('/'.$secondCompany->domain_name.'/dashboard') - ->visit('/'.$company->domain_name.'/quote/'.$quote->id) + ->assertPathIs('/' . $secondCompany->domain_name . '/dashboard') + ->visit('/' . $company->domain_name . '/quote/' . $quote->id) ->assertSee('Error 401') ->screenshot('view-another-company-quote-test') ->visit('/') - ->assertPathIs('/'.$secondCompany->domain_name.'/dashboard'); + ->assertPathIs('/' . $secondCompany->domain_name . '/dashboard'); $browser->script('jQuery(".signmeout-btn").click()'); $browser->assertPathIs('/'); }); diff --git a/tests/Browser/QuoteTest.php b/tests/Browser/QuoteTest.php index ff37b3fa..bb16d4db 100644 --- a/tests/Browser/QuoteTest.php +++ b/tests/Browser/QuoteTest.php @@ -33,29 +33,27 @@ public function test_creating_a_quote() $faker = Faker::create(); $this->browse(function (Browser $browser) use ($faker, $client, $company, $itemTemplate) { - $browser->visit('/signin') + $browser + ->visit('/signin') ->type('username', $company->owner->email) ->type('password', 'secret') ->press('SIGN IN') - ->assertPathIs('/'.$company->domain_name.'/dashboard') + ->assertPathIs('/' . $company->domain_name . '/dashboard') ->clickLink('Quotes') - ->assertPathIs('/'.$company->domain_name.'/quotes') + ->assertPathIs('/' . $company->domain_name . '/quotes') ->clickLink('Create') - ->assertPathIs('/'.$company->domain_name.'/quote/create') - ->type('nice_quote_id', substr($faker->slug, 0, 20).'sasdf') + ->assertPathIs('/' . $company->domain_name . '/quote/create') + ->type('nice_quote_id', substr($faker->slug, 0, 20) . 'sasdf') ->type('netdays', $faker->numberBetween($min = 1, $max = 60)) ->type('item_quantity[]', $faker->numberBetween($min = 1, $max = 999999999)) ->type('item_price[]', $faker->randomFloat($nbMaxDecimals = 2, $min = 0, $max = 999999999999)); - $browser - ->script('jQuery("#client_id").selectize()[0].selectize.setValue('.$client->id.');'); - $browser - ->script('jQuery("#date").datepicker("setDate", new Date());jQuery("#date").val("'.Carbon::now()->format('j F, Y').'");'); - $browser - ->script('jQuery("#item_name_0").selectize()[0].selectize.setValue("'.addslashes($itemTemplate->name).'");'); + $browser->script('jQuery("#client_id").selectize()[0].selectize.setValue(' . $client->id . ');'); + $browser->script( + 'jQuery("#date").datepicker("setDate", new Date());jQuery("#date").val("' . Carbon::now()->format('j F, Y') . '");', + ); + $browser->script('jQuery("#item_name_0").selectize()[0].selectize.setValue("' . addslashes($itemTemplate->name) . '");'); $browser->pause(2000); - $browser - ->press('CREATE') - ->assertPresent('#quote-action-container'); + $browser->press('CREATE')->assertPresent('#quote-action-container'); $browser->script('jQuery(".signmeout-btn").click()'); $browser->assertPathIs('/'); }); @@ -74,33 +72,29 @@ public function test_adding_a_second_quote_item() $faker = Faker::create(); $this->browse(function (Browser $browser) use ($faker, $client, $company, $itemTemplates) { - $browser->visit('/signin') + $browser + ->visit('/signin') ->type('username', $company->owner->email) ->type('password', 'secret') ->press('SIGN IN') - ->assertPathIs('/'.$company->domain_name.'/dashboard') + ->assertPathIs('/' . $company->domain_name . '/dashboard') ->clickLink('Quotes') - ->assertPathIs('/'.$company->domain_name.'/quotes') + ->assertPathIs('/' . $company->domain_name . '/quotes') ->clickLink('Create') - ->assertPathIs('/'.$company->domain_name.'/quote/create') - ->type('nice_quote_id', substr($faker->slug, 0, 20).'sasdf') + ->assertPathIs('/' . $company->domain_name . '/quote/create') + ->type('nice_quote_id', substr($faker->slug, 0, 20) . 'sasdf') ->type('netdays', $faker->numberBetween($min = 1, $max = 60)) ->type('item_quantity[]', $faker->numberBetween($min = 1, $max = 999999999)) ->type('item_price[]', $faker->randomFloat($nbMaxDecimals = 2, $min = 0, $max = 999999999999)); - $browser - ->script('jQuery("#client_id").selectize()[0].selectize.setValue('.$client->id.');'); - $browser - ->script('jQuery("#date").datepicker("setDate", new Date());jQuery("#date").val("'.Carbon::now()->format('j F, Y').'");'); - $browser - ->script('jQuery("#item_name_0").selectize()[0].selectize.setValue("'.addslashes($itemTemplates[0]->name).'");'); - $browser - ->click('a[id="quote-item-add"]'); - $browser - ->script('jQuery("#item_name_1").selectize()[0].selectize.setValue("'.addslashes($itemTemplates[1]->name).'");'); + $browser->script('jQuery("#client_id").selectize()[0].selectize.setValue(' . $client->id . ');'); + $browser->script( + 'jQuery("#date").datepicker("setDate", new Date());jQuery("#date").val("' . Carbon::now()->format('j F, Y') . '");', + ); + $browser->script('jQuery("#item_name_0").selectize()[0].selectize.setValue("' . addslashes($itemTemplates[0]->name) . '");'); + $browser->click('a[id="quote-item-add"]'); + $browser->script('jQuery("#item_name_1").selectize()[0].selectize.setValue("' . addslashes($itemTemplates[1]->name) . '");'); $browser->pause(2000); - $browser - ->press('CREATE') - ->assertPresent('#quote-action-container'); + $browser->press('CREATE')->assertPresent('#quote-action-container'); $browser->script('jQuery(".signmeout-btn").click()'); $browser->assertPathIs('/'); }); @@ -114,9 +108,9 @@ public function test_update_a_quote() $company->users()->attach($company->user_id); $quote = Quote::factory()->create([ - 'status' => Quote::STATUS_OPEN, - 'archived' => false, - 'client_id' => $client->id, + 'status' => Quote::STATUS_OPEN, + 'archived' => false, + 'client_id' => $client->id, 'company_id' => $company->id, ]); $quoteItems = QuoteItem::factory(3)->create([ @@ -130,24 +124,24 @@ public function test_update_a_quote() $salutation = ['mr', 'mrs', 'mdm', 'miss']; $this->browse(function (Browser $browser) use ($faker, $client, $company, $quote) { - $browser->visit('/signin') + $browser + ->visit('/signin') ->type('username', $company->owner->email) ->type('password', 'secret') ->press('SIGN IN') - ->assertPathIs('/'.$company->domain_name.'/dashboard') + ->assertPathIs('/' . $company->domain_name . '/dashboard') ->clickLink('Quotes') - ->assertPathIs('/'.$company->domain_name.'/quotes'); - $browser - ->script("jQuery(\"a[href='{$this->baseUrl()}/{$company->domain_name}/quote/{$quote->id}/edit'] > i\").click();"); + ->assertPathIs('/' . $company->domain_name . '/quotes'); + $browser->script("jQuery(\"a[href='{$this->baseUrl()}/{$company->domain_name}/quote/{$quote->id}/edit'] > i\").click();"); $browser ->type('netdays', $faker->numberBetween($min = 1, $max = 60)) ->type('item_name[]', 'The Turbo Ultra Turbonator') ->type('item_quantity[]', $faker->numberBetween($min = 1, $max = 999999999)) ->type('item_price[]', $faker->randomFloat($nbMaxDecimals = 2, $min = 0, $max = 999999999999)); - $browser - ->script('jQuery("#client_id").selectize()[0].selectize.setValue('.$client->id.');'); - $browser - ->script('jQuery("#date").datepicker("setDate", new Date());jQuery("#date").val("'.Carbon::now()->format('j F, Y').'");'); + $browser->script('jQuery("#client_id").selectize()[0].selectize.setValue(' . $client->id . ');'); + $browser->script( + 'jQuery("#date").datepicker("setDate", new Date());jQuery("#date").val("' . Carbon::now()->format('j F, Y') . '");', + ); $browser ->pause(2000) ->press('UPDATE') @@ -166,9 +160,9 @@ public function test_delete_a_quote() $company->users()->attach($company->user_id); $quote = Quote::factory()->create([ - 'status' => Quote::STATUS_OPEN, - 'archived' => false, - 'client_id' => $client->id, + 'status' => Quote::STATUS_OPEN, + 'archived' => false, + 'client_id' => $client->id, 'company_id' => $company->id, ]); $quoteItems = QuoteItem::factory(3)->create([ @@ -179,15 +173,15 @@ public function test_delete_a_quote() $salutation = ['mr', 'mrs', 'mdm', 'miss']; $this->browse(function (Browser $browser) use ($company) { - $browser->visit('/signin') + $browser + ->visit('/signin') ->type('username', $company->owner->email) ->type('password', 'secret') ->press('SIGN IN') - ->assertPathIs('/'.$company->domain_name.'/dashboard') + ->assertPathIs('/' . $company->domain_name . '/dashboard') ->clickLink('Quotes') - ->assertPathIs('/'.$company->domain_name.'/quotes'); - $browser - ->script('jQuery(".quote-delete-btn > i").click();'); + ->assertPathIs('/' . $company->domain_name . '/quotes'); + $browser->script('jQuery(".quote-delete-btn > i").click();'); $browser ->pause(500) ->press('DELETE') @@ -210,55 +204,53 @@ public function test_end_to_end_quote() $faker = Faker::create(); $this->browse(function (Browser $browser) use ($faker, $client, $company, $itemTemplate) { - $browser->visit('/signin') + $browser + ->visit('/signin') ->type('username', $company->owner->email) ->type('password', 'secret') ->press('SIGN IN') - ->assertPathIs('/'.$company->domain_name.'/dashboard') + ->assertPathIs('/' . $company->domain_name . '/dashboard') ->clickLink('Quotes') - ->assertPathIs('/'.$company->domain_name.'/quotes') + ->assertPathIs('/' . $company->domain_name . '/quotes') ->clickLink('Create') - ->assertPathIs('/'.$company->domain_name.'/quote/create') - ->type('nice_quote_id', substr($faker->slug, 0, 20).'sasdf') + ->assertPathIs('/' . $company->domain_name . '/quote/create') + ->type('nice_quote_id', substr($faker->slug, 0, 20) . 'sasdf') ->type('netdays', $faker->numberBetween($min = 1, $max = 60)) ->type('item_quantity[]', $faker->numberBetween($min = 1, $max = 999999999)) ->type('item_price[]', $faker->randomFloat($nbMaxDecimals = 2, $min = 0, $max = 999999999999)); - $browser - ->script('jQuery("#client_id").selectize()[0].selectize.setValue('.$client->id.');'); - $browser - ->script('jQuery("#date").datepicker("setDate", new Date());jQuery("#date").val("'.Carbon::now()->format('j F, Y').'");'); - $browser - ->script('jQuery("#item_name_0").selectize()[0].selectize.setValue("'.addslashes($itemTemplate->name).'");'); + $browser->script('jQuery("#client_id").selectize()[0].selectize.setValue(' . $client->id . ');'); + $browser->script( + 'jQuery("#date").datepicker("setDate", new Date());jQuery("#date").val("' . Carbon::now()->format('j F, Y') . '");', + ); + $browser->script('jQuery("#item_name_0").selectize()[0].selectize.setValue("' . addslashes($itemTemplate->name) . '");'); $browser->pause(2000); $browser ->press('CREATE') ->assertPresent('#quote-action-container') ->clickLink('Quotes') - ->assertPathIs('/'.$company->domain_name.'/quotes'); - $browser - ->script("jQuery(\"a[data-tooltip='Edit Quote'] > i\").click();"); + ->assertPathIs('/' . $company->domain_name . '/quotes'); + $browser->script("jQuery(\"a[data-tooltip='Edit Quote'] > i\").click();"); $browser ->type('netdays', $faker->numberBetween($min = 1, $max = 60)) ->type('item_name[]', $faker->bs()) ->type('item_quantity[]', $faker->numberBetween($min = 1, $max = 999999999)) ->type('item_price[]', $faker->randomFloat($nbMaxDecimals = 2, $min = 0, $max = 999999999999)); - $browser - ->script('jQuery("#client_id").selectize()[0].selectize.setValue('.$client->id.');'); - $browser - ->script('jQuery("#date").datepicker("setDate", new Date());jQuery("#date").val("'.Carbon::now()->format('j F, Y').'");'); + $browser->script('jQuery("#client_id").selectize()[0].selectize.setValue(' . $client->id . ');'); + $browser->script( + 'jQuery("#date").datepicker("setDate", new Date());jQuery("#date").val("' . Carbon::now()->format('j F, Y') . '");', + ); $browser ->pause(2000) ->press('UPDATE') ->assertPresent('#quote-action-container') ->clickLink('Quotes') - ->assertPathIs('/'.$company->domain_name.'/quotes'); - $browser - ->script('jQuery(".quote-delete-btn > i").click();'); + ->assertPathIs('/' . $company->domain_name . '/quotes'); + $browser->script('jQuery(".quote-delete-btn > i").click();'); $browser ->pause(500) ->press('DELETE') ->assertPresent('#quote-container') - ->assertPathBeginsWith('/'.$company->domain_name.'/quote'); + ->assertPathBeginsWith('/' . $company->domain_name . '/quote'); $browser->script('jQuery(".signmeout-btn").click()'); $browser->assertPathIs('/'); }); diff --git a/tests/Browser/SignUpTest.php b/tests/Browser/SignUpTest.php index aefb607c..d6bb037a 100644 --- a/tests/Browser/SignUpTest.php +++ b/tests/Browser/SignUpTest.php @@ -22,13 +22,14 @@ public function test_creating_a_user_and_company() $this->browse(function (Browser $browser) use ($faker) { $browser->maximize(); - $browser->visit('/user/create') + $browser + ->visit('/user/create') ->type('username', Str::random(10)) ->type('email', $faker->unique()->safeEmail) ->type('password', 'secret') ->type('password_confirmation', 'secret') ->type('full_name', $faker->name) - ->type('phone', '+659'.$faker->numberBetween($min = 0, $max = 8).$faker->randomNumber(6, true)) + ->type('phone', '+659' . $faker->numberBetween($min = 0, $max = 8) . $faker->randomNumber(6, true)) ->click('label[for="gender-male"]') ->press('NEXT') ->assertPathIs('/company/create') @@ -36,9 +37,9 @@ public function test_creating_a_user_and_company() ->type('crn', $faker->ean8) ->type('domain_name', $faker->domainName) ->type('email', $faker->unique()->companyEmail) - ->type('phone', '+658'.$faker->numberBetween($min = 1, $max = 8).$faker->randomNumber(6, true)) - ->attach('logo', __DIR__.'/assets/files/logo.png') - ->attach('smlogo', __DIR__.'/assets/files/smlogo.png') + ->type('phone', '+658' . $faker->numberBetween($min = 1, $max = 8) . $faker->randomNumber(6, true)) + ->attach('logo', __DIR__ . '/assets/files/logo.png') + ->attach('smlogo', __DIR__ . '/assets/files/smlogo.png') ->press('CREATE') ->assertPathIs('/signin'); }); diff --git a/tests/CreatesApplication.php b/tests/CreatesApplication.php index 547152f6..ab924025 100644 --- a/tests/CreatesApplication.php +++ b/tests/CreatesApplication.php @@ -13,7 +13,7 @@ trait CreatesApplication */ public function createApplication() { - $app = require __DIR__.'/../bootstrap/app.php'; + $app = require __DIR__ . '/../bootstrap/app.php'; $app->make(Kernel::class)->bootstrap(); diff --git a/tests/DuskTestCase.php b/tests/DuskTestCase.php index df18812f..457cbe1d 100644 --- a/tests/DuskTestCase.php +++ b/tests/DuskTestCase.php @@ -11,7 +11,7 @@ abstract class DuskTestCase extends BaseTestCase { use CreatesApplication; -// use DatabaseMigrations; + // use DatabaseMigrations; /** * Notes for Dusk. @@ -60,24 +60,17 @@ protected function setUp(): void */ protected function driver() { - $options = (new ChromeOptions())->addArguments([ - '--window-size=1024,768', - '--disable-gpu', - '--headless', - '--no-sandbox', - ]); + $options = (new ChromeOptions())->addArguments(['--window-size=1024,768', '--disable-gpu', '--headless', '--no-sandbox']); if (env('USE_SELENIUM', 'false') == 'true') { return RemoteWebDriver::create( - 'http://selenium:4444/wd/hub', DesiredCapabilities::chrome()->setCapability( - ChromeOptions::CAPABILITY, $options - ) + 'http://selenium:4444/wd/hub', + DesiredCapabilities::chrome()->setCapability(ChromeOptions::CAPABILITY, $options), ); } else { return RemoteWebDriver::create( - 'http://localhost:9515', DesiredCapabilities::chrome()->setCapability( - ChromeOptions::CAPABILITY, $options - ) + 'http://localhost:9515', + DesiredCapabilities::chrome()->setCapability(ChromeOptions::CAPABILITY, $options), ); } } diff --git a/tests/TestCase.php b/tests/TestCase.php index 279e1b7a..734e9af1 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -16,7 +16,7 @@ public function tearDown(): void $refl = new ReflectionObject($this); foreach ($refl->getProperties() as $prop) { - if (! $prop->isStatic() && 0 !== strpos($prop->getDeclaringClass()->getName(), 'PHPUnit_')) { + if (!$prop->isStatic() && 0 !== strpos($prop->getDeclaringClass()->getName(), 'PHPUnit_')) { $prop->setAccessible(true); $prop->setValue($this, null); } diff --git a/tests/Unit/ClientTest.php b/tests/Unit/ClientTest.php index 1cb3a778..977d568c 100644 --- a/tests/Unit/ClientTest.php +++ b/tests/Unit/ClientTest.php @@ -21,23 +21,23 @@ public function test_create_client() Client::unguard(); $client = Client::create([ - 'companyname' => 'Poowf Labs', - 'phone' => '+6581234567', - 'block' => '123', - 'street' => '123 Street Name', - 'unitnumber' => '00-00', - 'postalcode' => '123456', - 'country_code' => 'SG', - 'nickname' => 'Poowf the Bunny', - 'crn' => '201810000A', - 'website' => 'http://poowf.com', + 'companyname' => 'Poowf Labs', + 'phone' => '+6581234567', + 'block' => '123', + 'street' => '123 Street Name', + 'unitnumber' => '00-00', + 'postalcode' => '123456', + 'country_code' => 'SG', + 'nickname' => 'Poowf the Bunny', + 'crn' => '201810000A', + 'website' => 'http://poowf.com', 'contactsalutation' => 'Ms.', - 'contactfirstname' => 'Poowf', - 'contactlastname' => 'Bunny', - 'contactgender' => 'female', - 'contactemail' => 'bunny@poowf.com', - 'contactphone' => '+6579328669', - 'company_id' => $company->id, + 'contactfirstname' => 'Poowf', + 'contactlastname' => 'Bunny', + 'contactgender' => 'female', + 'contactemail' => 'bunny@poowf.com', + 'contactphone' => '+6579328669', + 'company_id' => $company->id, ]); Client::reguard(); @@ -65,12 +65,12 @@ public function test_update_client() $this->assertEquals('+6564142762', $client->phone); $data = [ - 'postalcode' => '585151', + 'postalcode' => '585151', 'country_code' => 'SG', - 'nickname' => 'Shoop da Whoop', - 'crn' => 'C-ARE-AND', - 'website' => 'itsawebsite.com', - 'company_id' => $company2->id, + 'nickname' => 'Shoop da Whoop', + 'crn' => 'C-ARE-AND', + 'website' => 'itsawebsite.com', + 'company_id' => $company2->id, ]; $client->fill($data); diff --git a/tests/Unit/CompanyAddressTest.php b/tests/Unit/CompanyAddressTest.php index 65bb6f4f..a1983e32 100644 --- a/tests/Unit/CompanyAddressTest.php +++ b/tests/Unit/CompanyAddressTest.php @@ -20,12 +20,12 @@ public function test_create_company_address() CompanyAddress::unguard(); $companyAddress = CompanyAddress::create([ - 'block' => '123', - 'street' => '123 Street Name', - 'unitnumber' => '00-00', - 'postalcode' => '123456', + 'block' => '123', + 'street' => '123 Street Name', + 'unitnumber' => '00-00', + 'postalcode' => '123456', 'buildingtype' => '1', - 'company_id' => $company->id, + 'company_id' => $company->id, ]); CompanyAddress::reguard(); @@ -52,8 +52,8 @@ public function test_update_company_address() $this->assertEquals('234523', $companyAddress->postalcode); $data = [ - 'block' => '1231', - 'street' => 'Monster Moon Street', + 'block' => '1231', + 'street' => 'Monster Moon Street', 'unitnumber' => '#100-100', ]; diff --git a/tests/Unit/CompanySettingsTest.php b/tests/Unit/CompanySettingsTest.php index 8af2f173..53e8594d 100644 --- a/tests/Unit/CompanySettingsTest.php +++ b/tests/Unit/CompanySettingsTest.php @@ -20,18 +20,21 @@ public function test_create_company_settings() CompanySetting::unguard(); $companySettings = CompanySetting::create([ - 'invoice_prefix' => 'PWF', - 'quote_prefix' => 'PWFQ', + 'invoice_prefix' => 'PWF', + 'quote_prefix' => 'PWFQ', 'invoice_conditions' => 'asdfasfdasfasfasdf asdfasdfasdf asfdassafas

asdfasdfasdfas

', - 'quote_conditions' => 'asdfasfdasfasfasdf asdfasdfasdf asfdassafas

asdfasdfasdfas

', - 'tax' => '20', - 'company_id' => $company->id, + 'quote_conditions' => 'asdfasfdasfasfasdf asdfasdfasdf asfdassafas

asdfasdfasdfas

', + 'tax' => '20', + 'company_id' => $company->id, ]); CompanySetting::reguard(); $this->assertEquals($companySettings->company->name, $company->name); - $this->assertEquals('

asdfasfdasfasfasdf asdfasdfasdf asfdassafas

asdfasdfasdfas

\n', $companySettings->invoice_conditions); + $this->assertEquals( + '

asdfasfdasfasfasdf asdfasdfasdf asfdassafas

asdfasdfasdfas

\n', + $companySettings->invoice_conditions, + ); } public function test_update_company_settings() @@ -43,19 +46,23 @@ public function test_update_company_settings() $this->assertInstanceOf(CompanySetting::class, $companySettings); - $companySettings->quote_conditions = 'THIS IS SHTEASDF SACONDITIONS OF THE QUOTE OMGOMGOMGOGMG THESE ARE NOT THE DROIDS YOU ARE LOOKING FOR'; + $companySettings->quote_conditions = + 'THIS IS SHTEASDF SACONDITIONS OF THE QUOTE OMGOMGOMGOGMG THESE ARE NOT THE DROIDS YOU ARE LOOKING FOR'; $companySettings->tax = '12'; $companySettings->save(); $companySettings->refresh(); - $this->assertEquals('

THIS IS SHTEASDF SACONDITIONS OF THE QUOTE OMGOMGOMGOGMG THESE ARE NOT THE DROIDS YOU ARE LOOKING FOR

\n', $companySettings->quote_conditions); + $this->assertEquals( + '

THIS IS SHTEASDF SACONDITIONS OF THE QUOTE OMGOMGOMGOGMG THESE ARE NOT THE DROIDS YOU ARE LOOKING FOR

\n', + $companySettings->quote_conditions, + ); $this->assertEquals('12', $companySettings->tax); $data = [ - 'quote_prefix' => 'OINKQ', + 'quote_prefix' => 'OINKQ', 'invoice_conditions' => 'I TAWT I SAW A PUTTY TAT', - 'quote_conditions' => 'THIS IS TEH CONDIXION.', - 'tax' => '5', + 'quote_conditions' => 'THIS IS TEH CONDIXION.', + 'tax' => '5', ]; $companySettings->fill($data); diff --git a/tests/Unit/CompanyTest.php b/tests/Unit/CompanyTest.php index 69c1be8c..f3f915b3 100644 --- a/tests/Unit/CompanyTest.php +++ b/tests/Unit/CompanyTest.php @@ -21,14 +21,14 @@ public function test_create_company() Company::unguard(); $company = Company::create([ - 'name' => 'Poowf Labs', + 'name' => 'Poowf Labs', 'invoice_index' => '2342', - 'quote_index' => '12313', - 'timezone' => 'UTC', - 'crn' => '201810000A', - 'phone' => '+6579328669', - 'email' => 'bunny@poowf.com', - 'user_id' => $user->id, + 'quote_index' => '12313', + 'timezone' => 'UTC', + 'crn' => '201810000A', + 'phone' => '+6579328669', + 'email' => 'bunny@poowf.com', + 'user_id' => $user->id, ]); Company::reguard(); @@ -55,12 +55,12 @@ public function test_update_company() $this->assertEquals('+6564142762', $company->phone); $data = [ - 'name' => 'Nyan Industries', - 'crn' => 'CERRRANDFSADFS', - 'domain_name' => 'nekonyanyananannynayynaynaya.com', - 'phone' => '+659774123', + 'name' => 'Nyan Industries', + 'crn' => 'CERRRANDFSADFS', + 'domain_name' => 'nekonyanyananannynayynaynaya.com', + 'phone' => '+659774123', 'invoice_index' => '2342', - 'user_id' => $user->id, + 'user_id' => $user->id, ]; $company->fill($data); diff --git a/tests/Unit/CompanyUserRequestTest.php b/tests/Unit/CompanyUserRequestTest.php index b3990354..895e748e 100644 --- a/tests/Unit/CompanyUserRequestTest.php +++ b/tests/Unit/CompanyUserRequestTest.php @@ -20,11 +20,11 @@ public function test_create_company_user_request() CompanyUserRequest::unguard(); $companyUserRequest = CompanyUserRequest::create([ - 'full_name' => 'Poowf Bunny', - 'email' => 'bunny@poowf.com', - 'phone' => '+6579328669', - 'token' => 'asdfounasifdnasfinasasdfasf', - 'status' => '1', + 'full_name' => 'Poowf Bunny', + 'email' => 'bunny@poowf.com', + 'phone' => '+6579328669', + 'token' => 'asdfounasifdnasfinasasdfasf', + 'status' => '1', 'company_id' => $company->id, ]); @@ -53,9 +53,9 @@ public function test_update_company_user_request() $data = [ 'full_name' => 'NyanIndustries', - 'email' => 'nowaythiscannotbe@example.com', - 'phone' => '+659774123', - 'token' => 'asdfnasuifasuifnasidfas', + 'email' => 'nowaythiscannotbe@example.com', + 'phone' => '+659774123', + 'token' => 'asdfnasuifasuifnasidfas', ]; $companyUserRequest->fill($data); diff --git a/tests/Unit/InvoiceItemTemplateTest.php b/tests/Unit/InvoiceItemTemplateTest.php index a23f0287..6b4a6c6b 100644 --- a/tests/Unit/InvoiceItemTemplateTest.php +++ b/tests/Unit/InvoiceItemTemplateTest.php @@ -20,10 +20,10 @@ public function test_create_invoice_item_template() InvoiceItemTemplate::unguard(); $invoiceItemTemplate = InvoiceItemTemplate::create([ - 'name' => 'This is an Invoice Item Template la', - 'quantity' => '250', - 'price' => '5.00', - 'description' => 'asfdasfasfasfsf

asasdfasdfasfas

', + 'name' => 'This is an Invoice Item Template la', + 'quantity' => '250', + 'price' => '5.00', + 'description' => 'asfdasfasfasfsf

asasdfasdfasfas

', 'invoice_template_id' => $invoiceTemplate->id, ]); @@ -51,8 +51,8 @@ public function test_update_invoice_item_template() $this->assertEquals('2000', $invoiceItemTemplate->quantity); $data = [ - 'price' => '213131.00', - 'quantity' => '25000', + 'price' => '213131.00', + 'quantity' => '25000', 'invoice_template_id' => $invoiceTemplate2->id, ]; diff --git a/tests/Unit/InvoiceItemTest.php b/tests/Unit/InvoiceItemTest.php index 387760a7..5a72a15f 100644 --- a/tests/Unit/InvoiceItemTest.php +++ b/tests/Unit/InvoiceItemTest.php @@ -21,11 +21,11 @@ public function test_create_invoice_item() InvoiceItem::unguard(); $invoiceItem = InvoiceItem::create([ - 'name' => 'This is an Invoice Item la', - 'quantity' => '250', - 'price' => '5.00', + 'name' => 'This is an Invoice Item la', + 'quantity' => '250', + 'price' => '5.00', 'description' => 'asfdasfasfasfsf

asasdfasdfasfas

', - 'invoice_id' => $invoice->id, + 'invoice_id' => $invoice->id, ]); InvoiceItem::reguard(); @@ -51,7 +51,7 @@ public function test_update_invoice_item() $this->assertEquals('2000', $invoiceItem->quantity); $data = [ - 'price' => '213131.00', + 'price' => '213131.00', 'quantity' => '25000', ]; diff --git a/tests/Unit/InvoiceRecurrenceTest.php b/tests/Unit/InvoiceRecurrenceTest.php index 37cd7892..7b2c21ba 100644 --- a/tests/Unit/InvoiceRecurrenceTest.php +++ b/tests/Unit/InvoiceRecurrenceTest.php @@ -22,11 +22,11 @@ public function test_create_invoice_recurrence() $invoiceRecurrence = InvoiceRecurrence::create([ 'time_interval' => '1', - 'time_period' => 'month', - 'until_type' => 'never', - 'until_meta' => null, - 'rule' => 'FREQ=MONTHLY;INTERVAL=1', - 'company_id' => $company->id, + 'time_period' => 'month', + 'until_type' => 'never', + 'until_meta' => null, + 'rule' => 'FREQ=MONTHLY;INTERVAL=1', + 'company_id' => $company->id, ]); InvoiceRecurrence::reguard(); @@ -51,9 +51,9 @@ public function test_update_invoice_recurrence() $data = [ 'time_interval' => '3', - 'time_period' => 'year', - 'until_type' => 'date', - 'until_meta' => '2020-10-31 00:00:00', + 'time_period' => 'year', + 'until_type' => 'date', + 'until_meta' => '2020-10-31 00:00:00', ]; $this->expectException(MassAssignmentException::class); diff --git a/tests/Unit/InvoiceTemplateTest.php b/tests/Unit/InvoiceTemplateTest.php index fa397528..4cafb40a 100644 --- a/tests/Unit/InvoiceTemplateTest.php +++ b/tests/Unit/InvoiceTemplateTest.php @@ -28,10 +28,10 @@ public function test_create_invoice_template() InvoiceTemplate::unguard(); $invoiceTemplate = InvoiceTemplate::create([ - 'date' => '2018-11-01 00:00:00', - 'netdays' => '20', - 'notify' => '0', - 'client_id' => $client->id, + 'date' => '2018-11-01 00:00:00', + 'netdays' => '20', + 'notify' => '0', + 'client_id' => $client->id, 'invoice_recurrence_id' => $invoiceEvent->id, ]); @@ -57,9 +57,9 @@ public function test_update_invoice_template() //Testing fillable properties $data = [ - 'date' => '2018-11-26 00:00:00', + 'date' => '2018-11-26 00:00:00', 'netdays' => '30', - 'notify' => '1', + 'notify' => '1', ]; $invoiceTemplate->fill($data); diff --git a/tests/Unit/InvoiceTest.php b/tests/Unit/InvoiceTest.php index 070f9f79..bfe12c49 100644 --- a/tests/Unit/InvoiceTest.php +++ b/tests/Unit/InvoiceTest.php @@ -21,15 +21,15 @@ public function test_create_invoice() $invoice = Invoice::create([ 'nice_invoice_id' => 'PWF-000001', - 'date' => '2 September, 2018', - 'netdays' => '20', - 'total' => '650.80', - 'share_token' => '7e57d004-2b97-0e7a-b45f-5387367791cd', - 'status' => '2', - 'archived' => '0', - 'notify' => '0', - 'client_id' => $client->id, - 'company_id' => $client->company->id, + 'date' => '2 September, 2018', + 'netdays' => '20', + 'total' => '650.80', + 'share_token' => '7e57d004-2b97-0e7a-b45f-5387367791cd', + 'status' => '2', + 'archived' => '0', + 'notify' => '0', + 'client_id' => $client->id, + 'company_id' => $client->company->id, ]); Invoice::reguard(); @@ -52,9 +52,9 @@ public function test_update_invoice() //Testing fillable properties $data = [ - 'date' => '1 November, 2018', + 'date' => '1 November, 2018', 'netdays' => '25', - 'total' => '19293313.00', + 'total' => '19293313.00', ]; $invoice->fill($data); diff --git a/tests/Unit/ItemTemplateTest.php b/tests/Unit/ItemTemplateTest.php index c6845df0..5b19e27a 100644 --- a/tests/Unit/ItemTemplateTest.php +++ b/tests/Unit/ItemTemplateTest.php @@ -20,11 +20,11 @@ public function test_create_item_template() ItemTemplate::unguard(); $itemTemplate = ItemTemplate::create([ - 'name' => 'This is an Item Template la', - 'quantity' => '250', - 'price' => '5.00', + 'name' => 'This is an Item Template la', + 'quantity' => '250', + 'price' => '5.00', 'description' => 'asfdasfasfasfsf

asasdfasdfasfas

', - 'company_id' => $company->id, + 'company_id' => $company->id, ]); ItemTemplate::reguard(); @@ -51,8 +51,8 @@ public function test_update_item_template() $this->assertEquals('2000', $itemTemplate->quantity); $data = [ - 'price' => '213131.00', - 'quantity' => '25000', + 'price' => '213131.00', + 'quantity' => '25000', 'company_id' => $company2->id, ]; diff --git a/tests/Unit/PaymentTest.php b/tests/Unit/PaymentTest.php index 79f6e54c..c4dafa0c 100644 --- a/tests/Unit/PaymentTest.php +++ b/tests/Unit/PaymentTest.php @@ -27,11 +27,11 @@ public function test_create_payment() Payment::unguard(); $payment = Payment::create([ - 'amount' => '516556.52', + 'amount' => '516556.52', 'receiveddate' => '2018-11-01 00:00:00', - 'invoice_id' => $invoice->id, - 'client_id' => $client->id, - 'company_id' => $company->id, + 'invoice_id' => $invoice->id, + 'client_id' => $client->id, + 'company_id' => $company->id, ]); Payment::reguard(); @@ -51,7 +51,7 @@ public function test_update_payment() ]); $payment = Payment::factory()->create([ 'invoice_id' => $invoice->id, - 'client_id' => $client->id, + 'client_id' => $client->id, 'company_id' => $company->id, ]); $this->assertInstanceOf(Payment::class, $payment); @@ -65,8 +65,8 @@ public function test_update_payment() $this->assertEquals('asdfasfasfasdfasfsfaffsa', $payment->notes); $data = [ - 'amount' => '12341451541.00', - 'notes' => 'sdfasfasdvcasd asodcnaio9sjecoamfoe[casmo;cnasi;cndik; andio;asno;asdcnio; asdnio;asdcno;asdncio;asdn;', + 'amount' => '12341451541.00', + 'notes' => 'sdfasfasdvcasd asodcnaio9sjecoamfoe[casmo;cnasi;cndik; andio;asno;asdcnio; asdnio;asdcno;asdncio;asdn;', 'receiveddate' => '2018-12-01 00:00:00', ]; @@ -75,7 +75,10 @@ public function test_update_payment() $payment->refresh(); $this->assertEquals('12341451541.00', $payment->amount); - $this->assertEquals('sdfasfasdvcasd asodcnaio9sjecoamfoe[casmo;cnasi;cndik; andio;asno;asdcnio; asdnio;asdcno;asdncio;asdn;', $payment->notes); + $this->assertEquals( + 'sdfasfasdvcasd asodcnaio9sjecoamfoe[casmo;cnasi;cndik; andio;asno;asdcnio; asdnio;asdcno;asdncio;asdn;', + $payment->notes, + ); $this->assertNotEquals('2018-12-01 00:00:00', $payment->receiveddate->format('Y-m-d H:i:s')); } @@ -90,7 +93,7 @@ public function test_delete_payment() ]); $payment = Payment::factory()->create([ 'invoice_id' => $invoice->id, - 'client_id' => $client->id, + 'client_id' => $client->id, 'company_id' => $company->id, ]); diff --git a/tests/Unit/QuoteItemTest.php b/tests/Unit/QuoteItemTest.php index d61bf22d..a21dae32 100644 --- a/tests/Unit/QuoteItemTest.php +++ b/tests/Unit/QuoteItemTest.php @@ -21,11 +21,11 @@ public function test_create_quote_item() QuoteItem::unguard(); $quoteItem = QuoteItem::create([ - 'name' => 'This is a Quote Item la', - 'quantity' => '250', - 'price' => '5.00', + 'name' => 'This is a Quote Item la', + 'quantity' => '250', + 'price' => '5.00', 'description' => 'asfdasfasfasfsf

asasdfasdfasfas

', - 'quote_id' => $quote->id, + 'quote_id' => $quote->id, ]); QuoteItem::reguard(); @@ -51,7 +51,7 @@ public function test_update_quote_item() $this->assertEquals('2000', $quoteItem->quantity); $data = [ - 'price' => '213131.00', + 'price' => '213131.00', 'quantity' => '25000', ]; diff --git a/tests/Unit/QuoteTest.php b/tests/Unit/QuoteTest.php index 3daef2a1..2eba7d71 100644 --- a/tests/Unit/QuoteTest.php +++ b/tests/Unit/QuoteTest.php @@ -20,14 +20,14 @@ public function test_create_quote() $quote = Quote::create([ 'nice_quote_id' => 'PWFQ-000001', - 'date' => '2 August, 2018', - 'netdays' => '20', - 'total' => '650.50', - 'share_token' => '7e57d004-2b97-0e7a-b45f-5387367791cd', - 'status' => '2', - 'archived' => '0', - 'client_id' => $client->id, - 'company_id' => $client->company->id, + 'date' => '2 August, 2018', + 'netdays' => '20', + 'total' => '650.50', + 'share_token' => '7e57d004-2b97-0e7a-b45f-5387367791cd', + 'status' => '2', + 'archived' => '0', + 'client_id' => $client->id, + 'company_id' => $client->company->id, ]); Quote::reguard(); @@ -50,9 +50,9 @@ public function test_update_quote() //Testing fillable properties $data = [ - 'date' => '1 January, 2018', + 'date' => '1 January, 2018', 'netdays' => '25', - 'total' => '19293313.00', + 'total' => '19293313.00', ]; $quote->fill($data); diff --git a/tests/Unit/UserTest.php b/tests/Unit/UserTest.php index 065101dd..0552dd3f 100644 --- a/tests/Unit/UserTest.php +++ b/tests/Unit/UserTest.php @@ -20,12 +20,12 @@ public function test_create_user() User::unguard(); $user = User::create([ - 'full_name' => 'Poowf Bunny', - 'username' => 'poowf', - 'password' => 'secret', - 'email' => 'bunny@poowf.com', - 'phone' => '+6579328669', - 'gender' => 'female', + 'full_name' => 'Poowf Bunny', + 'username' => 'poowf', + 'password' => 'secret', + 'email' => 'bunny@poowf.com', + 'phone' => '+6579328669', + 'gender' => 'female', 'remember_token' => 'sadfaxsfie', ]); @@ -53,12 +53,12 @@ public function test_update_user() $this->assertEquals('bargabarbararba', $user->remember_token); $data = [ - 'username' => 'NyanIndustries', - 'email' => 'nowaythiscannotbe@example.com', - 'phone' => '+659774123', - 'gender' => 'female', + 'username' => 'NyanIndustries', + 'email' => 'nowaythiscannotbe@example.com', + 'phone' => '+659774123', + 'gender' => 'female', 'country_code' => 'SG', - 'company_id' => $company->id, + 'company_id' => $company->id, ]; $user->fill($data); diff --git a/webpack.mix.js b/webpack.mix.js index c1f02932..e0c19c00 100644 --- a/webpack.mix.js +++ b/webpack.mix.js @@ -15,70 +15,75 @@ const imageminMozjpeg = require('imagemin-mozjpeg'); */ mix - .setPublicPath('public') - .options({ - fileLoaderDirs: { - fonts: 'assets/fonts' - } - }) - .webpackConfig({ + .setPublicPath('public') + .options({ + fileLoaderDirs: { + fonts: 'assets/fonts' + } + }) + .webpackConfig({ + plugins: [ + new CopyWebpackPlugin({ + patterns: [ + { + from: 'resources/assets/images', + to: 'assets/img' // Laravel mix will place this in 'public/img' + } + ] + }), + new ImageminPlugin({ + test: /\.(jpe?g|png|gif|svg)$/i, plugins: [ - new CopyWebpackPlugin({ - patterns: [{ - from: 'resources/assets/images', - to: 'assets/img', // Laravel mix will place this in 'public/img' - }] - }), - new ImageminPlugin({ - test: /\.(jpe?g|png|gif|svg)$/i, - plugins: [ - imageminMozjpeg({ - quality: 100, - }) - ] - }) + imageminMozjpeg({ + quality: 100 + }) ] - }) + }) + ] + }) - .js('resources/assets/js/app.js', 'assets/js') - .js('resources/assets/js/core.js', 'assets/js') - .js('resources/assets/js/unicorn.js', 'assets/js') - .js('node_modules/trumbowyg/dist/plugins/colors/trumbowyg.colors.min.js', 'assets/js') - .js('node_modules/trumbowyg/dist/plugins/cleanpaste/trumbowyg.cleanpaste.min.js', 'assets/js') - .js('node_modules/trumbowyg/dist/plugins/fontsize/trumbowyg.fontsize.min.js', 'assets/js') - .js('node_modules/trumbowyg/dist/plugins/history/trumbowyg.history.min.js', 'assets/js') - .js('node_modules/intl-tel-input/build/js/intlTelInput.js', 'assets/js') - .js('node_modules/intl-tel-input/build/js/utils.js', 'assets/js') + .js('resources/assets/js/app.js', 'assets/js') + .js('resources/assets/js/core.js', 'assets/js') + .js('resources/assets/js/unicorn.js', 'assets/js') + .js('node_modules/trumbowyg/dist/plugins/colors/trumbowyg.colors.min.js', 'assets/js') + .js('node_modules/trumbowyg/dist/plugins/cleanpaste/trumbowyg.cleanpaste.min.js', 'assets/js') + .js('node_modules/trumbowyg/dist/plugins/fontsize/trumbowyg.fontsize.min.js', 'assets/js') + .js('node_modules/trumbowyg/dist/plugins/history/trumbowyg.history.min.js', 'assets/js') + .js('node_modules/intl-tel-input/build/js/intlTelInput.js', 'assets/js') + .js('node_modules/intl-tel-input/build/js/utils.js', 'assets/js') - .sass('resources/assets/sass/core.scss', 'public/assets/css') - .sass('resources/assets/sass/style.scss', 'public/assets/css') - .sass('node_modules/materialize-css/sass/materialize.scss', 'assets/css') - .sass('node_modules/@mdi/font/scss/materialdesignicons.scss', 'assets/css') + .sass('resources/assets/sass/core.scss', 'public/assets/css') + .sass('resources/assets/sass/style.scss', 'public/assets/css') + .sass('node_modules/materialize-css/sass/materialize.scss', 'assets/css') + .sass('node_modules/@mdi/font/scss/materialdesignicons.scss', 'assets/css') - .sass('node_modules/trumbowyg/dist/ui/sass/trumbowyg.scss', 'assets/css') - .sass('node_modules/trumbowyg/dist/plugins/colors/ui/sass/trumbowyg.colors.scss', 'assets/css') + .sass('node_modules/trumbowyg/dist/ui/sass/trumbowyg.scss', 'assets/css') + .sass('node_modules/trumbowyg/dist/plugins/colors/ui/sass/trumbowyg.colors.scss', 'assets/css') - .sass('node_modules/slick-carousel/slick/slick.scss', 'assets/css') - .sass('node_modules/slick-carousel/slick/slick-theme.scss', 'assets/css') + .sass('node_modules/slick-carousel/slick/slick.scss', 'assets/css') + .sass('node_modules/slick-carousel/slick/slick-theme.scss', 'assets/css') - .sass('node_modules/chartist/dist/scss/chartist.scss', 'assets/css') + .sass('node_modules/chartist/dist/scss/chartist.scss', 'assets/css') - .less('node_modules/selectize/dist/less/selectize.less', 'public/assets/css') - .copy('node_modules/prismjs/themes/prism-okaidia.css', 'public/assets/css/prism-okaidia.css') - .copy('node_modules/intl-tel-input/build/css/intlTelInput.css', 'public/assets/css/intlTelInput.css') - .copy('node_modules/intl-tel-input/build/img/flags.png', 'public/assets/img/flags.png') - .copy('node_modules/intl-tel-input/build/img/flags@2x.png', 'public/assets/img/flags@2x.png') - .copy('node_modules/trumbowyg/dist/ui/icons.svg', 'public/assets/fonts/trumbowygicons.svg') - .extract(['jquery']) - .browserSync({ - //Browser Sync does not do any host or php processing, it just proxies the connection to the backend web server. - //Port defines what port that browsersync will run on and it's basically a wrapper so that browsersync can be ran - port: 8080, - ui: { - port: 8081 - }, - //When configuring proxy, remember that this must be added onto the hosts file on the VM also, otherwise browsersync will not be able to find a dns entry for it - proxy: 'invoiceneko.test:80', - open: false - }) - .version(); + .less('node_modules/selectize/dist/less/selectize.less', 'public/assets/css') + .copy('node_modules/prismjs/themes/prism-okaidia.css', 'public/assets/css/prism-okaidia.css') + .copy( + 'node_modules/intl-tel-input/build/css/intlTelInput.css', + 'public/assets/css/intlTelInput.css' + ) + .copy('node_modules/intl-tel-input/build/img/flags.png', 'public/assets/img/flags.png') + .copy('node_modules/intl-tel-input/build/img/flags@2x.png', 'public/assets/img/flags@2x.png') + .copy('node_modules/trumbowyg/dist/ui/icons.svg', 'public/assets/fonts/trumbowygicons.svg') + .extract(['jquery']) + .browserSync({ + //Browser Sync does not do any host or php processing, it just proxies the connection to the backend web server. + //Port defines what port that browsersync will run on and it's basically a wrapper so that browsersync can be ran + port: 8080, + ui: { + port: 8081 + }, + //When configuring proxy, remember that this must be added onto the hosts file on the VM also, otherwise browsersync will not be able to find a dns entry for it + proxy: 'invoiceneko.test:80', + open: false + }) + .version();