-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #942 from ladybirdweb/development
Laravel Version update
- Loading branch information
Showing
5,797 changed files
with
99,885 additions
and
321,535 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
use App\Http\Controllers\Controller; | ||
use App\Model\Common\StatusSetting; | ||
use App\Model\Order\Order; | ||
use Carbon\Carbon; | ||
use App\Model\Product\Subscription; | ||
use Bugsnag; | ||
use Illuminate\Http\Request; | ||
|
@@ -36,7 +37,10 @@ public function advanceSearch( | |
$expiryTill = '', | ||
$from = '', | ||
$till = '', | ||
$domain = '' | ||
$domain = '', | ||
$paidUnpaid = '', | ||
$allInstallation = '', | ||
$version = '' | ||
) { | ||
try { | ||
$join = Order::leftJoin('subscriptions', 'orders.id', '=', 'subscriptions.order_id'); | ||
|
@@ -47,7 +51,9 @@ public function advanceSearch( | |
$this->orderFrom($till, $from, $join); | ||
$this->orderTill($from, $till, $join); | ||
$this->domain($domain, $join); | ||
|
||
$this->paidOrUnpaid($paidUnpaid,$join); | ||
$this->allInstallations($allInstallation,$join); | ||
$this->getSelectedVersionOrders($version,$join); | ||
$join = $join->orderBy('created_at', 'desc') | ||
->select( | ||
'orders.id', | ||
|
@@ -66,6 +72,88 @@ public function advanceSearch( | |
} | ||
} | ||
|
||
|
||
/** | ||
* Searches for order for selected versions | ||
* | ||
* @author Ashutosh Pathak <[email protected]> | ||
* | ||
* | ||
* @param string $version | ||
* @param App\Model\Order $join The order instance | ||
* | ||
* @return $join | ||
*/ | ||
private function getSelectedVersionOrders($version,$join) | ||
{ | ||
if($version) { | ||
$currentVer = ($version[0] == 'v') ? $version : 'v'.$version; | ||
$join = $join->whereHas('subscription', function($query) use($currentVer) { | ||
$query->where('version', '=', $currentVer); | ||
}); | ||
} | ||
return $join; | ||
} | ||
|
||
/** | ||
* Searches for Active/Inactive Installation | ||
* | ||
* @author Ashutosh Pathak <[email protected]> | ||
* | ||
* @date 2020-01-29T17:35:05+0530 | ||
* | ||
* @param string $allInstallation | ||
* @param App\Model\Order $join The order instance | ||
* | ||
* @return $join | ||
*/ | ||
public function allInstallations($allInstallation,$join) | ||
{ | ||
if($allInstallation) { | ||
$dayUtc = new Carbon('-30 days'); | ||
$minus30Day = $dayUtc->toDateTimeString(); | ||
if($allInstallation == 'paid_ins') { | ||
$join = $join->where('price_override', '>', 0)->whereHas('subscription', function($query) use($minus30Day) { | ||
$query->where('updated_at', '>', $minus30Day); | ||
}); | ||
} elseif($allInstallation == 'unpaid_ins') { | ||
$join = $join->where('price_override', '=', 0)->whereHas('subscription', function($query) use($minus30Day) { | ||
$query->where('updated_at', '>', $minus30Day); | ||
}); | ||
} elseif ($allInstallation == 'all_ins') { | ||
$join = $join->whereHas('subscription', function($query) use($minus30Day) { | ||
$query->where('updated_at', '>', $minus30Day); | ||
}); | ||
} | ||
} | ||
return $join; | ||
} | ||
|
||
/** | ||
* Searches for Paid/Unpaid Products | ||
* | ||
* @author Ashutosh Pathak <[email protected]> | ||
* | ||
* @date 2020-01-29T17:35:05+0530 | ||
* | ||
* @param string $paidUnpaid | ||
* @param App\Model\Order $join The order instance | ||
* | ||
* @return $join | ||
*/ | ||
private function paidOrUnpaid($paidUnpaid,$join) | ||
{ | ||
if($paidUnpaid) { | ||
if($paidUnpaid == 'paid') { | ||
$join = $join->where('price_override', '>', 0); | ||
} elseif($paidUnpaid == 'unpaid') { | ||
$join = $join->where('price_override', '=', 0); | ||
} | ||
|
||
} | ||
return $join; | ||
} | ||
|
||
/** | ||
* Searches for Order No. | ||
* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.