Skip to content

Instantly share code, notes, and snippets.

@young-steveo

young-steveo/search.php

Last active Jun 20, 2018
Embed
What would you like to do?
Bad Example
<?php
if (empty($data["username"])) {
throw new \Exception("Username is required.");
}
if (empty($data["name"])) {
$first = $data["first_name"] ?? '';
$last = $data["last_name"] ?? '';
$data["name"] = "$first $last";
}
$params = new SearchParams($data['username'], $data['name']);
$model = new User();
$result = $model->search($params);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.