Skip to content

Commit

Permalink
Merge pull request #8815 from turbo124/v5-develop
Browse files Browse the repository at this point in the history
v5.7.17
  • Loading branch information
turbo124 committed Sep 20, 2023
2 parents 4b6f049 + 12b26e1 commit 91c669b
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 38 deletions.
2 changes: 1 addition & 1 deletion VERSION.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.7.16
5.7.17
79 changes: 44 additions & 35 deletions app/Http/Controllers/SearchController.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@

namespace App\Http\Controllers;

use App\Models\User;
use App\Http\Requests\Search\GenericSearchRequest;
use App\Models\Client;
use App\Models\ClientContact;
use App\Models\Invoice;
use App\Models\User;

class SearchController extends Controller
{
public function __invoke()
public function __invoke(GenericSearchRequest $request)
{
/** @var \App\Models\User $user */
$user = auth()->user();
Expand All @@ -32,66 +33,75 @@ public function __invoke()

}

private function clientMap(User $user) {
private function clientMap(User $user)
{

return Client::query()
->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);
})
->cursor()
->map(function ($client){
return [
'name' => $client->present()->name(),
'type' => '/client',
'id' => $client->hashed_id,
'path' => "/clients/{$client->hashed_id}/edit",
'heading' => ctrans('texts.clients')
];
->map(function ($client) {
return [
'name' => $client->present()->name(),
'type' => '/client',
'id' => $client->hashed_id,
'path' => "/clients/{$client->hashed_id}/edit"
];
});
}

private function clientContactMap(User $user) {
private function clientContactMap(User $user)
{

return ClientContact::query()
->company()
->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);
})
->cursor()
->map(function ($contact){
return [
'name' => $contact->present()->search_display(),
'type' => '/client_contact',
'id' => $contact->client->hashed_id,
'path' => "/clients/{$contact->client->hashed_id}",
'heading' => ctrans('texts.contacts')
];
->map(function ($contact) {
return [
'name' => $contact->present()->search_display(),
'type' => '/client_contact',
'id' => $contact->client->hashed_id,
'path' => "/clients/{$contact->client->hashed_id}"
];
});
}

private function invoiceMap(User $user) {
private function invoiceMap(User $user)
{

return Invoice::query()
->company()
->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);
})
->cursor()
->map(function ($invoice){
return [
'name' => $invoice->client->present()->name() . ' - ' . $invoice->number,
'type' => '/invoice',
'id' => $invoice->hashed_id,
'path' => "/invoices/{$invoice->hashed_id}/edit",
'heading' => ctrans('texts.invoices')
];
->map(function ($invoice) {
return [
'name' => $invoice->client->present()->name() . ' - ' . $invoice->number,
'type' => '/invoice',
'id' => $invoice->hashed_id,
'path' => "/clients/{$invoice->hashed_id}/edit"
];
});
}

private function settingsMap() {
private function settingsMap()
{

$paths = [
'user_details' => '/settings/user_details',
Expand All @@ -103,7 +113,7 @@ private function settingsMap() {
'custom_fields' => '/settings/user_details/custom_fields',
'preferences' => '/settings/user_details/preferences',
'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,logo' => '/settings/company_details/logo',
'company_details,defaults' => '/settings/company_details/defaults',
Expand Down Expand Up @@ -181,7 +191,6 @@ private function settingsMap() {
'path' => $value,
'type' => $transkey,
'name' => $translation,
'heading' => ctrans('texts.settings')
];
}

Expand Down
4 changes: 2 additions & 2 deletions config/ninja.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
'require_https' => env('REQUIRE_HTTPS', true),
'app_url' => rtrim(env('APP_URL', ''), '/'),
'app_domain' => env('APP_DOMAIN', 'invoicing.co'),
'app_version' => env('APP_VERSION','5.7.16'),
'app_tag' => env('APP_TAG','5.7.16'),
'app_version' => env('APP_VERSION','5.7.17'),
'app_tag' => env('APP_TAG','5.7.17'),
'minimum_client_version' => '5.0.16',
'terms_version' => '1.0.1',
'api_secret' => env('API_SECRET', ''),
Expand Down

0 comments on commit 91c669b

Please sign in to comment.