1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-21 08:51:34 +02:00
invoiceninja/app/Http/Controllers/ClientPortal/ProfileController.php
Benjamin Beganović ac5525c9ac
[V2] Client portal rework (#3516)
* Client login, reset and update password page

* Client dashboard, sidebar, PortalComposer.php

* wip

* Personal page & update for details

* Invoices, paying & pagination.blade.php

* Invoices, recurring invoice & buttons

* Payments, link component

* Payment methods

* Breadcrums, clean up & wrap up

* Remove format_date() method to formatDate on object

* Payments
- $this->render is now proxy for render()
- Removed logic from Controller.php to ClientPortal.php
- Added MakesDates to ClientGatewayToken.php
- StripePaymentDriver.php now returns correct views
- Refactor of adding new payment method
- Ignoring all local builds for public/js/clients/*

* Signature, wip

* Fix "Pay now" on single invoice

* Payments:
- Added ProcessInvoicesInBulk request class
- Refactor InvoiceController::bulk()
- Displaying terms & payments
- New signature.blade.php
- Removed comment from webpack.mix.js

* Quotes:
- Refactor ProcessInvoicesInBulk.php to ProcessInvoicesInBulkRequest.php
- Add new 'Quotes' field inside of PortalComposer.php
- Added MakesDates to Quote.php
- Added Quote::badgeForStatus()
- Cleanup payment.blade.php
- Quote showing and approving
- New resource 'quotes' in client.php
- New image for quotes, align-left.svg

* Credits:
- New 'credits' resource in client.php
- Fixes for client.php typo

* Breadcrumbs:
- Quotes
- Credits

* Placeholder for translations.

* Restore whereIn & client scope

Co-authored-by: David Bomba <turbo124@gmail.com>
2020-03-24 04:10:42 +11:00

81 lines
2.2 KiB
PHP

<?php
/**
* Invoice Ninja (https://invoiceninja.com)
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace App\Http\Controllers\ClientPortal;
use App\Http\Controllers\Controller;
use App\Http\Requests\ClientPortal\UpdateContactRequest;
use App\Http\Requests\ClientPortal\UpdateClientRequest;
use App\Jobs\Util\UploadAvatar;
use App\Models\ClientContact;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Log;
class ProfileController extends Controller
{
/**
* Show the form for editing the specified resource.
*
* @param ClientContact $client_contact
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function edit(ClientContact $client_contact)
{
return $this->render('profile.index');
}
/**
* Update the specified resource in storage.
*
* @param UpdateContactRequest $request
* @param ClientContact $client_contact
* @return \Illuminate\Http\RedirectResponse
*/
public function update(UpdateContactRequest $request, ClientContact $client_contact)
{
$client_contact->fill($request->all());
if ($request->has('password')) {
$client_contact->password = encrypt($request->password);
}
$client_contact->save();
// auth()->user()->fresh();
return back()->withSuccess(
ctrans('texts.profile_updated_successfully')
);
}
public function updateClient(UpdateClientRequest $request, ClientContact $client_contact)
{
$client = $client_contact->client;
//update avatar if needed
if ($request->file('logo')) {
$path = UploadAvatar::dispatchNow($request->file('logo'), auth()->user()->client->client_hash);
if ($path) {
$client->logo = $path;
}
}
$client->fill($request->all());
$client->save();
return back()->withSuccess(
ctrans('texts.profile_updated_successfully')
);
}
}