mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-13 06:32:40 +01:00
19080933b6
Shift automatically applies the Laravel coding style - which uses the PSR-2 coding style as a base with some minor additions. You may customize the code style applied by adding a [PHP CS Fixer][1] or [PHP CodeSniffer][2] ruleset to your project root. Feel free to use [Shift's Laravel ruleset][3] to help you get started. For more information on customizing the code style applied by Shift, [watch this short video][4]. [1]: https://github.com/FriendsOfPHP/PHP-CS-Fixer [2]: https://github.com/squizlabs/PHP_CodeSniffer [3]: https://gist.github.com/laravel-shift/cab527923ed2a109dda047b97d53c200 [4]: https://laravelshift.com/videos/shift-code-style
59 lines
1.5 KiB
PHP
59 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Livewire\Profile\Settings;
|
|
|
|
use Livewire\Component;
|
|
|
|
class NameWebsiteLogo extends Component
|
|
{
|
|
public $profile;
|
|
|
|
public $name;
|
|
|
|
public $vat_number;
|
|
|
|
public $website;
|
|
|
|
public $phone;
|
|
|
|
public $saved;
|
|
|
|
public $rules = [
|
|
'name' => ['sometimes', 'min:3'],
|
|
'vat_number' => ['sometimes'],
|
|
'website' => ['sometimes'],
|
|
'phone' => ['sometimes', 'string', 'max:255'],
|
|
];
|
|
|
|
public function mount()
|
|
{
|
|
$this->fill([
|
|
'profile' => auth()->guard('contact')->user()->client,
|
|
'name' => auth()->guard('contact')->user()->client->present()->name,
|
|
'vat_number' => auth()->guard('contact')->user()->client->present()->vat_number,
|
|
'website' => auth()->guard('contact')->user()->client->present()->website,
|
|
'phone' => auth()->guard('contact')->user()->client->present()->phone,
|
|
'saved' => ctrans('texts.save'),
|
|
]);
|
|
}
|
|
|
|
public function render()
|
|
{
|
|
return render('profile.settings.name-website-logo');
|
|
}
|
|
|
|
public function submit()
|
|
{
|
|
$data = $this->validate($this->rules);
|
|
|
|
$this->profile->name = $data['name'];
|
|
$this->profile->vat_number = $data['vat_number'];
|
|
$this->profile->website = $data['website'];
|
|
$this->profile->phone = $data['phone'];
|
|
|
|
$this->profile->save();
|
|
|
|
$this->saved = ctrans('texts.saved_at', ['time' => now()->toTimeString()]);
|
|
}
|
|
}
|