@@ -1334,7 +1334,13 @@ public function toSql()
13341334 */
13351335 public function get ($ limit = null )
13361336 {
1337- return $ this ->limit ($ limit )->getBuilder (true , false , __FUNCTION__ );
1337+ // only allow get limit parameter
1338+ // if limit has not been set and if not empty
1339+ if (empty ($ this ->limit ) && !empty ($ limit )){
1340+ $ this ->limit ($ limit );
1341+ }
1342+
1343+ return $ this ->getBuilder (true , false , __FUNCTION__ );
13381344 }
13391345
13401346 /**
@@ -1507,18 +1513,10 @@ public function updateOrIgnore(array $values)
15071513 /**
15081514 * Delete records from the database.
15091515 *
1510- * @param mixed $id
15111516 * @return int
15121517 */
1513- public function delete ($ id = null )
1518+ public function delete ()
15141519 {
1515- // If an ID is passed to the method, we will set the where clause to check the
1516- // ID to let developers to simply and quickly remove a single row from this
1517- // database without manually specifying the "where" clauses on the query.
1518- if (! is_null ($ id )) {
1519- $ this ->where ($ this ->from .'.id ' , '= ' , $ id );
1520- }
1521-
15221520 $ this ->applyBeforeQueryCallbacks ();
15231521
15241522 $ sql = $ this ->compile ()->compileDelete ($ this );
@@ -1535,16 +1533,19 @@ public function delete($id = null)
15351533 }
15361534
15371535 /**
1538- * Destroy/Delete records from the database.
1536+ * Destroy records from the database.
1537+ * [performing where clause under the hood]
1538+ *
1539+ * @param mixed $id
15391540 *
1540- * @param string|int $id
1541+ * @param string $column
15411542 * [default column name is 'id']
15421543 *
15431544 * @return int
15441545 */
1545- public function destroy (string | int $ id )
1546+ public function destroy ($ id , $ column = ' id ' )
15461547 {
1547- return $ this ->where (' id ' , $ id )->delete ();
1548+ return $ this ->where ($ column , $ id )->delete ();
15481549 }
15491550
15501551 /**
0 commit comments