Skip to content

Commit

Permalink
city is null fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Dimimo committed Oct 27, 2019
1 parent 9d3b45a commit 1799bec
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 22 deletions.
30 changes: 16 additions & 14 deletions resources/views/customers/_datatable.blade.php
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
<table id="customers_table" class="table table-hover">
<thead>
<tr>
<th>Name</th>
<th>Email</th>
<th>City</th>
<th>List</th>
<th title="Accepts mail?"><span class="fas fa-at"></span></th>
<th title="Reads mail?"><span class="fas fa-eye"></span></th>
<th><span class="fas fa-link" title="Has a known website?"></span></th>
<th></th>
</tr>
</thead>
</table>
<div class="table-responsive">
<table id="customers_table" class="table table-hover">
<thead>
<tr>
<th>Name</th>
<th>Email</th>
<th>City</th>
<th>List</th>
<th title="Accepts mail?"><span class="fas fa-at"></span></th>
<th title="Reads mail?"><span class="fas fa-eye"></span></th>
<th><span class="fas fa-link" title="Has a known website?"></span></th>
<th></th>
</tr>
</thead>
</table>
</div>

@push('css')
<link rel="stylesheet" type="text/css" href="/vendor/admin-mailer/css/datatables.min.css">
Expand Down
8 changes: 4 additions & 4 deletions resources/views/customers/includes/_action.blade.php
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<div class="row justify-content-end text-nowrap">
<div class="row">
<a href="{{ route($prefix.'customers.edit', [$customer->id]) }}"
class="btn btn-link col-auto green">
<span class="fas fa-edit"></span>
<span class="fas fa-edit"></span> Edit
</a>
<form action="{{ route($prefix.'customers.destroy', [$customer->id]) }}"
class="col-auto ml-n3 pr-1"
onsubmit="return confirm('Are you sure you want to delete?');" method="post">
{{ csrf_field() }}
@method('DELETE')
<button type="submit" class="btn btn-link" title="Delete this customer">
<span class="fas fa-trash-alt red"></span>
<button type="submit" class="btn btn-link red" title="Delete this customer">
<span class="fas fa-trash-alt"></span> Delete
</button>
</form>
</div>
7 changes: 3 additions & 4 deletions src/Models/LaratablesCustomers.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public static function laratablesQueryConditions(LaratablesCustomers $query)
mailer_customers.deleted_at,
cities.name AS city_name')
->with(['city', 'list'])
->join('cities', 'mailer_customers.city_id', '=', 'cities.id');
->leftJoin('cities', 'mailer_customers.city_id', '=', 'cities.id');
if (request('mailer_list_id'))
{
return $query->whereIn('mailer_list_id', request('mailer_list_id'));
Expand Down Expand Up @@ -163,12 +163,11 @@ public static function laratablesListName($customer)
*/
public static function laratablesCityName(MailerCustomerModel $customer)
{
/*if ($customer->city)
if ($customer->city)
{
return $customer->city->name;
}
return '';*/
return $customer->city->name;
return '---';
}

/**
Expand Down

0 comments on commit 1799bec

Please sign in to comment.