mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
commit
91c669b894
@ -1 +1 @@
|
|||||||
5.7.16
|
5.7.17
|
@ -11,14 +11,15 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
use App\Models\User;
|
use App\Http\Requests\Search\GenericSearchRequest;
|
||||||
use App\Models\Client;
|
use App\Models\Client;
|
||||||
use App\Models\ClientContact;
|
use App\Models\ClientContact;
|
||||||
use App\Models\Invoice;
|
use App\Models\Invoice;
|
||||||
|
use App\Models\User;
|
||||||
|
|
||||||
class SearchController extends Controller
|
class SearchController extends Controller
|
||||||
{
|
{
|
||||||
public function __invoke()
|
public function __invoke(GenericSearchRequest $request)
|
||||||
{
|
{
|
||||||
/** @var \App\Models\User $user */
|
/** @var \App\Models\User $user */
|
||||||
$user = auth()->user();
|
$user = auth()->user();
|
||||||
@ -32,66 +33,75 @@ class SearchController extends Controller
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function clientMap(User $user) {
|
private function clientMap(User $user)
|
||||||
|
{
|
||||||
|
|
||||||
return Client::query()
|
return Client::query()
|
||||||
->company()
|
->company()
|
||||||
->when($user->cannot('view_all') || $user->cannot('view_client'), function ($query) use($user) {
|
->where('is_deleted', 0)
|
||||||
|
->when($user->cannot('view_all') || $user->cannot('view_client'), function ($query) use ($user) {
|
||||||
$query->where('user_id', $user->id);
|
$query->where('user_id', $user->id);
|
||||||
})
|
})
|
||||||
->cursor()
|
->cursor()
|
||||||
->map(function ($client){
|
->map(function ($client) {
|
||||||
return [
|
return [
|
||||||
'name' => $client->present()->name(),
|
'name' => $client->present()->name(),
|
||||||
'type' => '/client',
|
'type' => '/client',
|
||||||
'id' => $client->hashed_id,
|
'id' => $client->hashed_id,
|
||||||
'path' => "/clients/{$client->hashed_id}/edit",
|
'path' => "/clients/{$client->hashed_id}/edit"
|
||||||
'heading' => ctrans('texts.clients')
|
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private function clientContactMap(User $user) {
|
private function clientContactMap(User $user)
|
||||||
|
{
|
||||||
|
|
||||||
return ClientContact::query()
|
return ClientContact::query()
|
||||||
->company()
|
->company()
|
||||||
->with('client')
|
->with('client')
|
||||||
->when($user->cannot('view_all') || $user->cannot('view_client'), function ($query) use($user) {
|
->whereHas('client', function ($q) {
|
||||||
|
$q->where('is_deleted', 0);
|
||||||
|
})
|
||||||
|
->when($user->cannot('view_all') || $user->cannot('view_client'), function ($query) use ($user) {
|
||||||
$query->where('user_id', $user->id);
|
$query->where('user_id', $user->id);
|
||||||
})
|
})
|
||||||
->cursor()
|
->cursor()
|
||||||
->map(function ($contact){
|
->map(function ($contact) {
|
||||||
return [
|
return [
|
||||||
'name' => $contact->present()->search_display(),
|
'name' => $contact->present()->search_display(),
|
||||||
'type' => '/client_contact',
|
'type' => '/client_contact',
|
||||||
'id' => $contact->client->hashed_id,
|
'id' => $contact->client->hashed_id,
|
||||||
'path' => "/clients/{$contact->client->hashed_id}",
|
'path' => "/clients/{$contact->client->hashed_id}"
|
||||||
'heading' => ctrans('texts.contacts')
|
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private function invoiceMap(User $user) {
|
private function invoiceMap(User $user)
|
||||||
|
{
|
||||||
|
|
||||||
return Invoice::query()
|
return Invoice::query()
|
||||||
->company()
|
->company()
|
||||||
->with('client')
|
->with('client')
|
||||||
->when($user->cannot('view_all') || $user->cannot('view_invoice'), function ($query) use($user) {
|
->where('is_deleted', 0)
|
||||||
|
->whereHas('client', function ($q) {
|
||||||
|
$q->where('is_deleted', 0);
|
||||||
|
})
|
||||||
|
->when($user->cannot('view_all') || $user->cannot('view_invoice'), function ($query) use ($user) {
|
||||||
$query->where('user_id', $user->id);
|
$query->where('user_id', $user->id);
|
||||||
})
|
})
|
||||||
->cursor()
|
->cursor()
|
||||||
->map(function ($invoice){
|
->map(function ($invoice) {
|
||||||
return [
|
return [
|
||||||
'name' => $invoice->client->present()->name() . ' - ' . $invoice->number,
|
'name' => $invoice->client->present()->name() . ' - ' . $invoice->number,
|
||||||
'type' => '/invoice',
|
'type' => '/invoice',
|
||||||
'id' => $invoice->hashed_id,
|
'id' => $invoice->hashed_id,
|
||||||
'path' => "/invoices/{$invoice->hashed_id}/edit",
|
'path' => "/clients/{$invoice->hashed_id}/edit"
|
||||||
'heading' => ctrans('texts.invoices')
|
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private function settingsMap() {
|
private function settingsMap()
|
||||||
|
{
|
||||||
|
|
||||||
$paths = [
|
$paths = [
|
||||||
'user_details' => '/settings/user_details',
|
'user_details' => '/settings/user_details',
|
||||||
@ -103,7 +113,7 @@ class SearchController extends Controller
|
|||||||
'custom_fields' => '/settings/user_details/custom_fields',
|
'custom_fields' => '/settings/user_details/custom_fields',
|
||||||
'preferences' => '/settings/user_details/preferences',
|
'preferences' => '/settings/user_details/preferences',
|
||||||
'company_details' => '/settings/company_details',
|
'company_details' => '/settings/company_details',
|
||||||
'company_details,details' => '/settings/company_details/',
|
'company_details,details' => '/settings/company_details/details',
|
||||||
'company_details,address' => '/settings/company_details/address',
|
'company_details,address' => '/settings/company_details/address',
|
||||||
'company_details,logo' => '/settings/company_details/logo',
|
'company_details,logo' => '/settings/company_details/logo',
|
||||||
'company_details,defaults' => '/settings/company_details/defaults',
|
'company_details,defaults' => '/settings/company_details/defaults',
|
||||||
@ -181,7 +191,6 @@ class SearchController extends Controller
|
|||||||
'path' => $value,
|
'path' => $value,
|
||||||
'type' => $transkey,
|
'type' => $transkey,
|
||||||
'name' => $translation,
|
'name' => $translation,
|
||||||
'heading' => ctrans('texts.settings')
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,8 +15,8 @@ return [
|
|||||||
'require_https' => env('REQUIRE_HTTPS', true),
|
'require_https' => env('REQUIRE_HTTPS', true),
|
||||||
'app_url' => rtrim(env('APP_URL', ''), '/'),
|
'app_url' => rtrim(env('APP_URL', ''), '/'),
|
||||||
'app_domain' => env('APP_DOMAIN', 'invoicing.co'),
|
'app_domain' => env('APP_DOMAIN', 'invoicing.co'),
|
||||||
'app_version' => env('APP_VERSION','5.7.16'),
|
'app_version' => env('APP_VERSION','5.7.17'),
|
||||||
'app_tag' => env('APP_TAG','5.7.16'),
|
'app_tag' => env('APP_TAG','5.7.17'),
|
||||||
'minimum_client_version' => '5.0.16',
|
'minimum_client_version' => '5.0.16',
|
||||||
'terms_version' => '1.0.1',
|
'terms_version' => '1.0.1',
|
||||||
'api_secret' => env('API_SECRET', ''),
|
'api_secret' => env('API_SECRET', ''),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user