Created
February 2, 2017 18:14
-
-
Save ahuggins/0a56a9881849214f34388bd13fb610f7 to your computer and use it in GitHub Desktop.
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
<?php | |
// Before | |
public function getIDsForClient() | |
{ | |
$sql = "SELECT DISTINCT FilingID FROM Snapshot1094C WHERE ClientID = ?"; | |
$params = [$this->clientID]; | |
$stmt = sqlsrv_query($this->mssqli, $sql, $params); | |
$ids = []; | |
while ( $row = sqlsrv_fetch_array ( $stmt, SQLSRV_FETCH_ASSOC ) ) { | |
$ids[] = $row['FilingID']; | |
} | |
return $ids; | |
} | |
// After | |
public function getIDsForClient() | |
{ | |
return Snapshot1094C::where('ClientID', $this->clientID) | |
->select('FilingID') | |
->distinct('FilingID') | |
->get() | |
->pluck('FilingID') | |
->toArray(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment