public static function getall() { $root_url = dirname($_SERVER['PHP_SELF']); $customer = customer::orderBy('symbol')->get(); foreach ($customer as $record) { echo "<tr><td class='text-center'><a href='customer_detail/" . $record->id . "'>" . $record->symbol . "</a></td><td class='text-center'>" . $record->name . "</td><td class='text-center'>" . $record->phone . "</td><td><a target='blank' href='" . $record->website . "'>" . $record->website . "</a></td><td class='text-center'><a href='edit_customer/" . $record->id . "'><img src='" . $root_url . "/public/image/file_edit.png' width='20px' /></a></td></tr>"; } }
public static function main() { $Customer = customer::orderBy('symbol')->get(); $customer_list = array(); foreach ($Customer as $query) { $full_name = $query->symbol . " - " . $query->name; $customer_id = $query->id; $customer_list[] = "[" . $customer_id . "] " . $full_name; } echo json_encode($customer_list); }
public static function getcustomer($id, $type) { if ($type == 'edit') { $event = event::where("id", "=", $id)->first(); $id = $event->customer_id; } $customer = customer::orderBy('symbol')->get(); echo "<select name='customer_id' id='customer_id' class='form-control'><option value='0'>none</option>"; foreach ($customer as $recode) { echo "<option value='" . $recode->id . "'"; if ($id == $recode->id) { echo " selected='selected'"; } echo ">" . $recode->symbol . " - " . $recode->name . "</option>"; } echo "</select>"; }