1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-18 00:53:10 +01:00
invoiceninja/app/Http/Livewire/Profile/Settings/NameWebsiteLogo.php

52 lines
1.2 KiB
PHP
Raw Normal View History

2020-09-24 13:44:56 +02:00
<?php
namespace App\Http\Livewire\Profile\Settings;
use Livewire\Component;
class NameWebsiteLogo extends Component
{
public $profile;
public $name;
public $website;
2020-11-27 12:08:39 +01:00
public $phone;
2020-09-24 13:44:56 +02:00
public $saved;
public $rules = [
2021-01-15 14:07:33 +01:00
'name' => ['sometimes', 'min:3'],
'website' => ['sometimes'],
'phone' => ['sometimes', 'string', 'max:255'],
2020-09-24 13:44:56 +02:00
];
public function mount()
{
$this->fill([
'profile' => auth()->user('contact')->client,
'name' => auth()->user('contact')->client->present()->name,
'website' => auth()->user('contact')->client->present()->website,
2020-11-27 12:08:39 +01:00
'phone' => auth()->user('contact')->client->present()->phone,
2020-09-24 13:44:56 +02:00
'saved' => ctrans('texts.save'),
]);
}
public function render()
{
return render('profile.settings.name-website-logo');
}
public function submit()
{
$data = $this->validate($this->rules);
2020-11-27 12:08:39 +01:00
$this->profile->name = $data['name'];
$this->profile->website = $data['website'];
$this->profile->phone = $data['phone'];
$this->profile->save();
2020-09-24 13:44:56 +02:00
$this->saved = ctrans('texts.saved_at', ['time' => now()->toTimeString()]);
}
}