Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
ildyria committed Jan 16, 2023
1 parent afcae6a commit 1746991
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 32 deletions.
2 changes: 1 addition & 1 deletion app/Contracts/Http/RuleSet.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
interface RuleSet
{
/**
* Return an array containing the rules to be applied to the request attributes
* Return an array containing the rules to be applied to the request attributes.
*
* @return array
*/
Expand Down
6 changes: 1 addition & 5 deletions app/Http/Livewire/Components/Header.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ class Header extends Component
public ?BaseAlbum $baseAlbum = null;
public ?BaseSmartAlbum $smartAlbum = null;


/**
* Render the header.
*
Expand All @@ -39,7 +38,6 @@ public function render(): View
return view('livewire.components.header');
}


/**
* Open a login modal box.
*
Expand All @@ -51,7 +49,7 @@ public function openLoginModal(): void
}

/**
* Go back one step
* Go back one step.
*
* @return void
*/
Expand Down Expand Up @@ -79,6 +77,4 @@ public function toggleSideBar(): void
{
$this->emitTo('components.sidebar', 'toggle');
}


}
12 changes: 7 additions & 5 deletions app/Http/Livewire/Forms/Settings/BooleanSetting.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@
use Illuminate\Database\Eloquent\InvalidCastException;
use Illuminate\Database\Eloquent\JsonEncodingException;
use Livewire\Component;
use RuntimeException;

class BooleanSetting extends Component
{
public Configs $config;
public string $description;
public string $footer;
public bool $flag; //! Wired
public bool $flag; // ! Wired

public function mount(string $description, string $name, string $footer = '') {
public function mount(string $description, string $name, string $footer = '')
{
$this->description = Lang::get($description);
$this->footer = $footer !== '' ? Lang::get($footer) : '';
$this->config = Configs::where('key', '=', $name)->firstOrFail();
Expand All @@ -25,6 +25,7 @@ public function mount(string $description, string $name, string $footer = '') {
public function render()
{
$this->flag = $this->config->value === '1';

return view('livewire.form.form-toggle');
}

Expand All @@ -33,15 +34,16 @@ public function render()
*
* @param mixed $field
* @param mixed $value
*
* @return void
*
* @throws InvalidCastException
* @throws JsonEncodingException
* @throws RuntimeException
* @throws \RuntimeException
*/
public function updating($field, $value)
{
$this->config->value = $value === true ? '1' : '0';
$this->config->save();
}

}
13 changes: 8 additions & 5 deletions app/Http/Livewire/Forms/Settings/GetApiToken.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ class GetApiToken extends Component
// token is hidden
public bool $isHidden;

public function mount() {
public function mount()
{
$user = Auth::user();

$this->isDisabled = !$user->has_token;
Expand All @@ -47,9 +48,10 @@ public function close(): void
$this->closeModal();
}

public function resetToken(TokenReset $tokenReset) {
public function resetToken(TokenReset $tokenReset)
{
/**
* Authorize the request
* Authorize the request.
*/
$this->authorize(UserPolicy::CAN_EDIT, [User::class]);

Expand All @@ -58,9 +60,10 @@ public function resetToken(TokenReset $tokenReset) {
$this->isHidden = false;
}

public function disableToken(TokenDisable $tokenDisable) {
public function disableToken(TokenDisable $tokenDisable)
{
/**
* Authorize the request
* Authorize the request.
*/
$this->authorize(UserPolicy::CAN_EDIT, [User::class]);

Expand Down
22 changes: 10 additions & 12 deletions app/Http/Livewire/Forms/Settings/SetLogin.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,31 +18,31 @@
class SetLogin extends Component
{
use InteractWithModal;
use AuthorizesRequests;
use AuthorizesRequests;

public string $oldPassword = ''; //! wired
public string $username = ''; //! wired
public string $password = ''; //! wired
public string $confirm = ''; //! wired
public string $oldPassword = ''; // ! wired
public string $username = ''; // ! wired
public string $password = ''; // ! wired
public string $confirm = ''; // ! wired

public function render()
{
return view('livewire.form.form-set-login');
}

/**
* Update Username & Password of current user
* Update Username & Password of current user.
*/
public function submit(UpdateLogin $updateLogin) {

public function submit(UpdateLogin $updateLogin)
{
/**
* For the validation to work it is important that the above wired property match
* the keys in the rules applied
* the keys in the rules applied.
*/
$this->validate(ChangeLoginRuleSet::rules());

/**
* Authorize the request
* Authorize the request.
*/
$this->authorize(UserPolicy::CAN_EDIT, [User::class]);

Expand All @@ -59,7 +59,6 @@ public function submit(UpdateLogin $updateLogin) {
Auth::login($currentUser);
}


/**
* Open a login modal box.
*
Expand All @@ -69,5 +68,4 @@ public function openApiTokenModal(): void
{
$this->openModal('forms.settings.get-api-token');
}

}
1 change: 0 additions & 1 deletion app/Http/Livewire/Pages/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,4 @@ public function render(): View
{
return view('livewire.pages.settings');
}

}
6 changes: 3 additions & 3 deletions app/Http/Livewire/Traits/UrlChange.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ trait UrlChange
* Send an event to trigger updating the URL in the browser.
*
* @param PageMode $page
* @param string $albumId
* @param string $photoId
* @param string $albumId
* @param string $photoId
*
* @return void
*
* @throws BindingResolutionException
* @throws RouteNotFoundException
*/
Expand All @@ -27,5 +28,4 @@ protected function emitUrlChange(PageMode $page, string $albumId, string $photoI
// This ensures that the history has been updated
$this->emit('urlChange', route('livewire_index', ['page' => $page, 'albumId' => $albumId, 'photoId' => $photoId]));
}

}

0 comments on commit 1746991

Please sign in to comment.