mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-11-16 06:38:09 +00:00
Various PSR12 code cleanup
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* ConfigurationController.php
|
||||
* Copyright (c) 2019 james@firefly-iii.org
|
||||
@@ -30,6 +31,8 @@ use Illuminate\Contracts\View\Factory;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\View\View;
|
||||
use Log;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
|
||||
/**
|
||||
* Class ConfigurationController.
|
||||
@@ -47,7 +50,7 @@ class ConfigurationController extends Controller
|
||||
|
||||
$this->middleware(
|
||||
static function ($request, $next) {
|
||||
app('view')->share('title', (string) trans('firefly.administration'));
|
||||
app('view')->share('title', (string)trans('firefly.administration'));
|
||||
app('view')->share('mainTitleIcon', 'fa-hand-spock-o');
|
||||
|
||||
return $next($request);
|
||||
@@ -61,12 +64,12 @@ class ConfigurationController extends Controller
|
||||
*
|
||||
* @return Factory|View
|
||||
* @throws FireflyException
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$subTitle = (string) trans('firefly.instance_configuration');
|
||||
$subTitle = (string)trans('firefly.instance_configuration');
|
||||
$subTitleIcon = 'fa-wrench';
|
||||
|
||||
Log::channel('audit')->info('User visits admin config index.');
|
||||
@@ -86,7 +89,7 @@ class ConfigurationController extends Controller
|
||||
/**
|
||||
* Store new configuration values.
|
||||
*
|
||||
* @param ConfigurationRequest $request
|
||||
* @param ConfigurationRequest $request
|
||||
*
|
||||
* @return RedirectResponse
|
||||
*/
|
||||
@@ -102,7 +105,7 @@ class ConfigurationController extends Controller
|
||||
app('fireflyconfig')->set('is_demo_site', $data['is_demo_site']);
|
||||
|
||||
// flash message
|
||||
session()->flash('success', (string) trans('firefly.configuration_updated'));
|
||||
session()->flash('success', (string)trans('firefly.configuration_updated'));
|
||||
app('preferences')->mark();
|
||||
|
||||
return redirect()->route('admin.configuration.index');
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* HomeController.php
|
||||
* Copyright (c) 2019 james@firefly-iii.org
|
||||
@@ -34,6 +35,8 @@ use Illuminate\Http\Request;
|
||||
use Illuminate\Routing\Redirector;
|
||||
use Illuminate\View\View;
|
||||
use Log;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
|
||||
/**
|
||||
* Class HomeController.
|
||||
@@ -56,13 +59,13 @@ class HomeController extends Controller
|
||||
*
|
||||
* @return Factory|View
|
||||
* @throws FireflyException
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
Log::channel('audit')->info('User visits admin index.');
|
||||
$title = (string) trans('firefly.administration');
|
||||
$title = (string)trans('firefly.administration');
|
||||
$mainTitleIcon = 'fa-hand-spock-o';
|
||||
$email = auth()->user()->email;
|
||||
$pref = app('preferences')->get('remote_guard_alt_email');
|
||||
@@ -89,7 +92,7 @@ class HomeController extends Controller
|
||||
}
|
||||
FireflyConfig::set(sprintf('notification_%s', $item), $value);
|
||||
}
|
||||
$url = (string) $request->get('slackUrl');
|
||||
$url = (string)$request->get('slackUrl');
|
||||
if ('' === $url) {
|
||||
FireflyConfig::delete('slack_webhook_url');
|
||||
}
|
||||
@@ -97,14 +100,14 @@ class HomeController extends Controller
|
||||
FireflyConfig::set('slack_webhook_url', $url);
|
||||
}
|
||||
|
||||
session()->flash('success', (string) trans('firefly.notification_settings_saved'));
|
||||
session()->flash('success', (string)trans('firefly.notification_settings_saved'));
|
||||
return redirect(route('admin.index'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a test message to the admin.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param Request $request
|
||||
*
|
||||
* @return RedirectResponse|Redirector
|
||||
*/
|
||||
@@ -115,7 +118,7 @@ class HomeController extends Controller
|
||||
$user = auth()->user();
|
||||
Log::debug('Now in testMessage() controller.');
|
||||
event(new AdminRequestedTestMessage($user));
|
||||
session()->flash('info', (string) trans('firefly.send_test_triggered'));
|
||||
session()->flash('info', (string)trans('firefly.send_test_triggered'));
|
||||
|
||||
return redirect(route('admin.index'));
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* LinkController.php
|
||||
* Copyright (c) 2019 james@firefly-iii.org
|
||||
@@ -52,7 +53,7 @@ class LinkController extends Controller
|
||||
|
||||
$this->middleware(
|
||||
function ($request, $next) {
|
||||
app('view')->share('title', (string) trans('firefly.administration'));
|
||||
app('view')->share('title', (string)trans('firefly.administration'));
|
||||
app('view')->share('mainTitleIcon', 'fa-hand-spock-o');
|
||||
$this->repository = app(LinkTypeRepositoryInterface::class);
|
||||
|
||||
@@ -71,7 +72,7 @@ class LinkController extends Controller
|
||||
{
|
||||
Log::channel('audit')->info('User visits link index.');
|
||||
|
||||
$subTitle = (string) trans('firefly.create_new_link_type');
|
||||
$subTitle = (string)trans('firefly.create_new_link_type');
|
||||
$subTitleIcon = 'fa-link';
|
||||
|
||||
// put previous url in session if not redirect from store (not "create another").
|
||||
@@ -85,25 +86,25 @@ class LinkController extends Controller
|
||||
/**
|
||||
* Delete a link form.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param LinkType $linkType
|
||||
* @param Request $request
|
||||
* @param LinkType $linkType
|
||||
*
|
||||
* @return Factory|RedirectResponse|Redirector|View
|
||||
*/
|
||||
public function delete(Request $request, LinkType $linkType)
|
||||
{
|
||||
if (!$linkType->editable) {
|
||||
$request->session()->flash('error', (string) trans('firefly.cannot_edit_link_type', ['name' => e($linkType->name)]));
|
||||
$request->session()->flash('error', (string)trans('firefly.cannot_edit_link_type', ['name' => e($linkType->name)]));
|
||||
|
||||
return redirect(route('admin.links.index'));
|
||||
}
|
||||
|
||||
Log::channel('audit')->info(sprintf('User wants to delete link type #%d', $linkType->id));
|
||||
$subTitle = (string) trans('firefly.delete_link_type', ['name' => $linkType->name]);
|
||||
$subTitle = (string)trans('firefly.delete_link_type', ['name' => $linkType->name]);
|
||||
$otherTypes = $this->repository->get();
|
||||
$count = $this->repository->countJournals($linkType);
|
||||
$moveTo = [];
|
||||
$moveTo[0] = (string) trans('firefly.do_not_save_connection');
|
||||
$moveTo[0] = (string)trans('firefly.do_not_save_connection');
|
||||
|
||||
/** @var LinkType $otherType */
|
||||
foreach ($otherTypes as $otherType) {
|
||||
@@ -121,8 +122,8 @@ class LinkController extends Controller
|
||||
/**
|
||||
* Actually destroy the link.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param LinkType $linkType
|
||||
* @param Request $request
|
||||
* @param LinkType $linkType
|
||||
*
|
||||
* @return RedirectResponse|Redirector
|
||||
*/
|
||||
@@ -130,10 +131,10 @@ class LinkController extends Controller
|
||||
{
|
||||
Log::channel('audit')->info(sprintf('User destroyed link type #%d', $linkType->id));
|
||||
$name = $linkType->name;
|
||||
$moveTo = $this->repository->find((int) $request->get('move_link_type_before_delete'));
|
||||
$moveTo = $this->repository->find((int)$request->get('move_link_type_before_delete'));
|
||||
$this->repository->destroy($linkType, $moveTo);
|
||||
|
||||
$request->session()->flash('success', (string) trans('firefly.deleted_link_type', ['name' => $name]));
|
||||
$request->session()->flash('success', (string)trans('firefly.deleted_link_type', ['name' => $name]));
|
||||
app('preferences')->mark();
|
||||
|
||||
return redirect($this->getPreviousUrl('link-types.delete.url'));
|
||||
@@ -142,19 +143,19 @@ class LinkController extends Controller
|
||||
/**
|
||||
* Edit a link form.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param LinkType $linkType
|
||||
* @param Request $request
|
||||
* @param LinkType $linkType
|
||||
*
|
||||
* @return Factory|RedirectResponse|Redirector|View
|
||||
*/
|
||||
public function edit(Request $request, LinkType $linkType)
|
||||
{
|
||||
if (!$linkType->editable) {
|
||||
$request->session()->flash('error', (string) trans('firefly.cannot_edit_link_type', ['name' => e($linkType->name)]));
|
||||
$request->session()->flash('error', (string)trans('firefly.cannot_edit_link_type', ['name' => e($linkType->name)]));
|
||||
|
||||
return redirect(route('admin.links.index'));
|
||||
}
|
||||
$subTitle = (string) trans('firefly.edit_link_type', ['name' => $linkType->name]);
|
||||
$subTitle = (string)trans('firefly.edit_link_type', ['name' => $linkType->name]);
|
||||
$subTitleIcon = 'fa-link';
|
||||
|
||||
Log::channel('audit')->info(sprintf('User wants to edit link type #%d', $linkType->id));
|
||||
@@ -175,7 +176,7 @@ class LinkController extends Controller
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$subTitle = (string) trans('firefly.journal_link_configuration');
|
||||
$subTitle = (string)trans('firefly.journal_link_configuration');
|
||||
$subTitleIcon = 'fa-link';
|
||||
$linkTypes = $this->repository->get();
|
||||
|
||||
@@ -192,13 +193,13 @@ class LinkController extends Controller
|
||||
/**
|
||||
* Show a single link.
|
||||
*
|
||||
* @param LinkType $linkType
|
||||
* @param LinkType $linkType
|
||||
*
|
||||
* @return Factory|View
|
||||
*/
|
||||
public function show(LinkType $linkType)
|
||||
{
|
||||
$subTitle = (string) trans('firefly.overview_for_link', ['name' => $linkType->name]);
|
||||
$subTitle = (string)trans('firefly.overview_for_link', ['name' => $linkType->name]);
|
||||
$subTitleIcon = 'fa-link';
|
||||
$links = $this->repository->getJournalLinks($linkType);
|
||||
|
||||
@@ -210,7 +211,7 @@ class LinkController extends Controller
|
||||
/**
|
||||
* Store the new link.
|
||||
*
|
||||
* @param LinkTypeFormRequest $request
|
||||
* @param LinkTypeFormRequest $request
|
||||
*
|
||||
* @return $this|RedirectResponse|Redirector
|
||||
*/
|
||||
@@ -225,9 +226,9 @@ class LinkController extends Controller
|
||||
|
||||
Log::channel('audit')->info('User stored new link type.', $linkType->toArray());
|
||||
|
||||
$request->session()->flash('success', (string) trans('firefly.stored_new_link_type', ['name' => $linkType->name]));
|
||||
$request->session()->flash('success', (string)trans('firefly.stored_new_link_type', ['name' => $linkType->name]));
|
||||
$redirect = redirect($this->getPreviousUrl('link-types.create.url'));
|
||||
if (1 === (int) $request->get('create_another')) {
|
||||
if (1 === (int)$request->get('create_another')) {
|
||||
// set value so create routine will not overwrite URL:
|
||||
$request->session()->put('link-types.create.fromStore', true);
|
||||
|
||||
@@ -241,15 +242,15 @@ class LinkController extends Controller
|
||||
/**
|
||||
* Update an existing link.
|
||||
*
|
||||
* @param LinkTypeFormRequest $request
|
||||
* @param LinkType $linkType
|
||||
* @param LinkTypeFormRequest $request
|
||||
* @param LinkType $linkType
|
||||
*
|
||||
* @return $this|RedirectResponse|Redirector
|
||||
*/
|
||||
public function update(LinkTypeFormRequest $request, LinkType $linkType)
|
||||
{
|
||||
if (!$linkType->editable) {
|
||||
$request->session()->flash('error', (string) trans('firefly.cannot_edit_link_type', ['name' => e($linkType->name)]));
|
||||
$request->session()->flash('error', (string)trans('firefly.cannot_edit_link_type', ['name' => e($linkType->name)]));
|
||||
|
||||
return redirect(route('admin.links.index'));
|
||||
}
|
||||
@@ -263,10 +264,10 @@ class LinkController extends Controller
|
||||
|
||||
Log::channel('audit')->info(sprintf('User update link type #%d.', $linkType->id), $data);
|
||||
|
||||
$request->session()->flash('success', (string) trans('firefly.updated_link_type', ['name' => $linkType->name]));
|
||||
$request->session()->flash('success', (string)trans('firefly.updated_link_type', ['name' => $linkType->name]));
|
||||
app('preferences')->mark();
|
||||
$redirect = redirect($this->getPreviousUrl('link-types.edit.url'));
|
||||
if (1 === (int) $request->get('return_to_edit')) {
|
||||
if (1 === (int)$request->get('return_to_edit')) {
|
||||
// set value so edit routine will not overwrite URL:
|
||||
$request->session()->put('link-types.edit.fromUpdate', true);
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* UpdateController.php
|
||||
* Copyright (c) 2019 james@firefly-iii.org
|
||||
@@ -31,6 +32,8 @@ use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Routing\Redirector;
|
||||
use Illuminate\View\View;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
|
||||
/**
|
||||
* Class HomeController.
|
||||
@@ -47,7 +50,7 @@ class UpdateController extends Controller
|
||||
parent::__construct();
|
||||
$this->middleware(
|
||||
static function ($request, $next) {
|
||||
app('view')->share('title', (string) trans('firefly.administration'));
|
||||
app('view')->share('title', (string)trans('firefly.administration'));
|
||||
app('view')->share('mainTitleIcon', 'fa-hand-spock-o');
|
||||
|
||||
return $next($request);
|
||||
@@ -61,27 +64,27 @@ class UpdateController extends Controller
|
||||
*
|
||||
* @return Factory|View
|
||||
* @throws FireflyException
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$subTitle = (string) trans('firefly.update_check_title');
|
||||
$subTitle = (string)trans('firefly.update_check_title');
|
||||
$subTitleIcon = 'fa-star';
|
||||
$permission = app('fireflyconfig')->get('permission_update_check', -1);
|
||||
$channel = app('fireflyconfig')->get('update_channel', 'stable');
|
||||
$selected = $permission->data;
|
||||
$channelSelected = $channel->data;
|
||||
$options = [
|
||||
-1 => (string) trans('firefly.updates_ask_me_later'),
|
||||
0 => (string) trans('firefly.updates_do_not_check'),
|
||||
1 => (string) trans('firefly.updates_enable_check'),
|
||||
-1 => (string)trans('firefly.updates_ask_me_later'),
|
||||
0 => (string)trans('firefly.updates_do_not_check'),
|
||||
1 => (string)trans('firefly.updates_enable_check'),
|
||||
];
|
||||
|
||||
$channelOptions = [
|
||||
'stable' => (string) trans('firefly.update_channel_stable'),
|
||||
'beta' => (string) trans('firefly.update_channel_beta'),
|
||||
'alpha' => (string) trans('firefly.update_channel_alpha'),
|
||||
'stable' => (string)trans('firefly.update_channel_stable'),
|
||||
'beta' => (string)trans('firefly.update_channel_beta'),
|
||||
'alpha' => (string)trans('firefly.update_channel_alpha'),
|
||||
];
|
||||
|
||||
return view('admin.update.index', compact('subTitle', 'subTitleIcon', 'selected', 'options', 'channelSelected', 'channelOptions'));
|
||||
@@ -90,20 +93,20 @@ class UpdateController extends Controller
|
||||
/**
|
||||
* Post new settings.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param Request $request
|
||||
*
|
||||
* @return RedirectResponse|Redirector
|
||||
*/
|
||||
public function post(Request $request)
|
||||
{
|
||||
$checkForUpdates = (int) $request->get('check_for_updates');
|
||||
$checkForUpdates = (int)$request->get('check_for_updates');
|
||||
$channel = $request->get('update_channel');
|
||||
$channel = in_array($channel, ['stable', 'beta', 'alpha'], true) ? $channel : 'stable';
|
||||
|
||||
app('fireflyconfig')->set('permission_update_check', $checkForUpdates);
|
||||
app('fireflyconfig')->set('last_update_check', time());
|
||||
app('fireflyconfig')->set('update_channel', $channel);
|
||||
session()->flash('success', (string) trans('firefly.configuration_updated'));
|
||||
session()->flash('success', (string)trans('firefly.configuration_updated'));
|
||||
|
||||
return redirect(route('admin.update-check'));
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* UserController.php
|
||||
* Copyright (c) 2019 james@firefly-iii.org
|
||||
@@ -32,7 +33,6 @@ use FireflyIII\User;
|
||||
use Illuminate\Contracts\Foundation\Application;
|
||||
use Illuminate\Contracts\View\Factory;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Routing\Redirector;
|
||||
use Illuminate\View\View;
|
||||
use Log;
|
||||
@@ -54,7 +54,7 @@ class UserController extends Controller
|
||||
|
||||
$this->middleware(
|
||||
function ($request, $next) {
|
||||
app('view')->share('title', (string) trans('firefly.administration'));
|
||||
app('view')->share('title', (string)trans('firefly.administration'));
|
||||
app('view')->share('mainTitleIcon', 'fa-hand-spock-o');
|
||||
$this->repository = app(UserRepositoryInterface::class);
|
||||
|
||||
@@ -68,7 +68,7 @@ class UserController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* @param User $user
|
||||
* @param User $user
|
||||
*
|
||||
* @return Application|Factory|RedirectResponse|Redirector|View
|
||||
*/
|
||||
@@ -80,7 +80,7 @@ class UserController extends Controller
|
||||
return redirect(route('admin.users'));
|
||||
}
|
||||
|
||||
$subTitle = (string) trans('firefly.delete_user', ['email' => $user->email]);
|
||||
$subTitle = (string)trans('firefly.delete_user', ['email' => $user->email]);
|
||||
|
||||
return view('admin.users.delete', compact('user', 'subTitle'));
|
||||
}
|
||||
@@ -88,7 +88,7 @@ class UserController extends Controller
|
||||
/**
|
||||
* Destroy a user.
|
||||
*
|
||||
* @param User $user
|
||||
* @param User $user
|
||||
*
|
||||
* @return RedirectResponse|Redirector
|
||||
*/
|
||||
@@ -100,7 +100,7 @@ class UserController extends Controller
|
||||
return redirect(route('admin.users'));
|
||||
}
|
||||
$this->repository->destroy($user);
|
||||
session()->flash('success', (string) trans('firefly.user_deleted'));
|
||||
session()->flash('success', (string)trans('firefly.user_deleted'));
|
||||
|
||||
return redirect(route('admin.users'));
|
||||
}
|
||||
@@ -108,7 +108,7 @@ class UserController extends Controller
|
||||
/**
|
||||
* Edit user form.
|
||||
*
|
||||
* @param User $user
|
||||
* @param User $user
|
||||
*
|
||||
* @return Factory|View
|
||||
*/
|
||||
@@ -124,15 +124,15 @@ class UserController extends Controller
|
||||
}
|
||||
session()->forget('users.edit.fromUpdate');
|
||||
|
||||
$subTitle = (string) trans('firefly.edit_user', ['email' => $user->email]);
|
||||
$subTitle = (string)trans('firefly.edit_user', ['email' => $user->email]);
|
||||
$subTitleIcon = 'fa-user-o';
|
||||
$currentUser = auth()->user();
|
||||
$isAdmin = $this->repository->hasRole($user, 'owner');
|
||||
$codes = [
|
||||
'' => (string) trans('firefly.no_block_code'),
|
||||
'bounced' => (string) trans('firefly.block_code_bounced'),
|
||||
'expired' => (string) trans('firefly.block_code_expired'),
|
||||
'email_changed' => (string) trans('firefly.block_code_email_changed'),
|
||||
'' => (string)trans('firefly.no_block_code'),
|
||||
'bounced' => (string)trans('firefly.block_code_bounced'),
|
||||
'expired' => (string)trans('firefly.block_code_expired'),
|
||||
'email_changed' => (string)trans('firefly.block_code_email_changed'),
|
||||
];
|
||||
|
||||
return view('admin.users.edit', compact('user', 'canEditDetails', 'subTitle', 'subTitleIcon', 'codes', 'currentUser', 'isAdmin'));
|
||||
@@ -145,7 +145,7 @@ class UserController extends Controller
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$subTitle = (string) trans('firefly.user_administration');
|
||||
$subTitle = (string)trans('firefly.user_administration');
|
||||
$subTitleIcon = 'fa-users';
|
||||
$users = $this->repository->all();
|
||||
$singleUserMode = app('fireflyconfig')->get('single_user_mode', config('firefly.configuration.single_user_mode'))->data;
|
||||
@@ -168,18 +168,34 @@ class UserController extends Controller
|
||||
return view('admin.users.index', compact('subTitle', 'subTitleIcon', 'users', 'allowInvites', 'invitedUsers'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param InviteUserFormRequest $request
|
||||
* @return RedirectResponse
|
||||
*/
|
||||
public function invite(InviteUserFormRequest $request): RedirectResponse
|
||||
{
|
||||
$address = (string)$request->get('invited_user');
|
||||
$invitee = $this->repository->inviteUser(auth()->user(), $address);
|
||||
session()->flash('info', trans('firefly.user_is_invited', ['address' => $address]));
|
||||
|
||||
// event!
|
||||
event(new InvitationCreated($invitee));
|
||||
|
||||
return redirect(route('admin.users'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Show single user.
|
||||
*
|
||||
* @param User $user
|
||||
* @param User $user
|
||||
*
|
||||
* @return Factory|View
|
||||
*/
|
||||
public function show(User $user)
|
||||
{
|
||||
$title = (string) trans('firefly.administration');
|
||||
$title = (string)trans('firefly.administration');
|
||||
$mainTitleIcon = 'fa-hand-spock-o';
|
||||
$subTitle = (string) trans('firefly.single_user_administration', ['email' => $user->email]);
|
||||
$subTitle = (string)trans('firefly.single_user_administration', ['email' => $user->email]);
|
||||
$subTitleIcon = 'fa-user';
|
||||
$information = $this->repository->getUserData($user);
|
||||
|
||||
@@ -196,27 +212,11 @@ class UserController extends Controller
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param InviteUserFormRequest $request
|
||||
* @return RedirectResponse
|
||||
*/
|
||||
public function invite(InviteUserFormRequest $request): RedirectResponse
|
||||
{
|
||||
$address = (string) $request->get('invited_user');
|
||||
$invitee = $this->repository->inviteUser(auth()->user(), $address);
|
||||
session()->flash('info', trans('firefly.user_is_invited', ['address' => $address]));
|
||||
|
||||
// event!
|
||||
event(new InvitationCreated($invitee));
|
||||
|
||||
return redirect(route('admin.users'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update single user.
|
||||
*
|
||||
* @param UserFormRequest $request
|
||||
* @param User $user
|
||||
* @param UserFormRequest $request
|
||||
* @param User $user
|
||||
*
|
||||
* @return $this|RedirectResponse|Redirector
|
||||
*/
|
||||
@@ -242,10 +242,10 @@ class UserController extends Controller
|
||||
$this->repository->changeStatus($user, $data['blocked'], $data['blocked_code']);
|
||||
$this->repository->updateEmail($user, $data['email']);
|
||||
|
||||
session()->flash('success', (string) trans('firefly.updated_user', ['email' => $user->email]));
|
||||
session()->flash('success', (string)trans('firefly.updated_user', ['email' => $user->email]));
|
||||
app('preferences')->mark();
|
||||
$redirect = redirect($this->getPreviousUrl('users.edit.url'));
|
||||
if (1 === (int) $request->get('return_to_edit')) {
|
||||
if (1 === (int)$request->get('return_to_edit')) {
|
||||
session()->put('users.edit.fromUpdate', true);
|
||||
|
||||
$redirect = redirect(route('admin.users.edit', [$user->id]))->withInput(['return_to_edit' => 1]);
|
||||
|
||||
Reference in New Issue
Block a user