1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-14 15:13:29 +01:00
invoiceninja/app/Ninja/Intents/WebApp/NavigateToIntent.php
2017-04-04 20:49:03 +03:00

28 lines
730 B
PHP

<?php
namespace App\Ninja\Intents\WebApp;
use App\Models\Account;
use App\Ninja\Intents\BaseIntent;
class NavigateToIntent extends BaseIntent
{
public function process()
{
$location = $this->getField('Location');
$location = str_replace(' ', '_', $location);
if (in_array($location, array_merge(Account::$basicSettings, Account::$advancedSettings))) {
$location = '/settings/' . $location;
} elseif (in_array($location, ['report', 'reports'])) {
$location = '/reports';
} elseif ($location == 'settings') {
$location = '/settings';
} else {
$location = '/dashboard';
}
return redirect($location);
}
}