Skip to content

Commit 0462058

Browse files
authored
Merge pull request #5 from alt-design/update
Fix for Eloquent Driver sites
2 parents aaef2ae + 2b2bd2e commit 0462058

File tree

3 files changed

+9
-35
lines changed

3 files changed

+9
-35
lines changed

resources/js/components/AltRedirect.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ export default ({
134134
<th class="group to-column pr-8" style="width:8%">
135135
<span>Type</span>
136136
</th>
137-
<th class="group to-column pr-8">
137+
<th class="group to-column pr-8" style="width:15%">
138138
<span>Sites</span>
139139
</th>
140140
<th class="actions-column" style="width:13.4%"></th>
@@ -152,7 +152,7 @@ export default ({
152152
{{ item.redirect_type }}
153153
</td>
154154
<td>
155-
{{ item.sites.join(', ') }}
155+
{{ item.sites ? item.sites.join(', ') : "Unknown" }}
156156
</td>
157157
<td>
158158
<button @click="deleteRedirect(item.from, item.id)" class="btn"

resources/views/index.blade.php

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -14,33 +14,5 @@
1414
<!-- -->
1515
</div>
1616

17-
<!--<div class="card overflow-hidden p-0">
18-
<table data-size="sm" tabindex="0" class="data-table">
19-
<thead>
20-
<tr>
21-
<th class="group from-column sortable-column">
22-
<span>From</span>
23-
</th>
24-
<th class="group to-column pr-8">
25-
<span>To</span>
26-
</th>
27-
<th class="actions-column"></th>
28-
</tr>
29-
</thead>
30-
<tbody>
31-
@foreach ($data as $key => $value)
32-
<tr class="redirect-row outline-none">
33-
@foreach ($value as $key => $value)
34-
@if($key === 'sites')
35-
<td style="width:50%;">{{ implode(', ', $value) }}</td>
36-
@elseif ($key !== 'id')
37-
<td style="width:50%;">{{ $value }}</td>
38-
@endif
39-
@endforeach
40-
<td><button class="btn" style="color: #bc2626;">Remove</button></td>
41-
</tr>
42-
@endforeach
43-
</tbody>
44-
</table>
45-
</div>-->
17+
4618
@endsection

src/Http/Controllers/AltRedirectController.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ public function index()
3232
$fields = $fields->preProcess();
3333

3434
// Reset the directory to the old one
35-
Blueprint::setDirectory($oldDirectory);
35+
if ($oldDirectory) {
36+
Blueprint::setDirectory($oldDirectory);
37+
}
3638

3739
return view('alt-redirect::index', [
3840
'blueprint' => $blueprint->toPublishArray(),
@@ -46,7 +48,7 @@ public function create(Request $request)
4648
{
4749

4850
// Grab the old directory just in case
49-
$oldDirectory = Blueprint::directory();
51+
// $oldDirectory = Blueprint::directory();
5052

5153
$data = new Data('redirects');
5254

@@ -68,7 +70,7 @@ public function create(Request $request)
6870
$values = $data->all();
6971

7072
// Reset the directory to the old one
71-
Blueprint::setDirectory($oldDirectory);
73+
// Blueprint::setDirectory($oldDirectory);
7274

7375
return [
7476
'data' => $values
@@ -123,7 +125,7 @@ public function import(Request $request)
123125
'from' => $row[0],
124126
'to' => $row[1],
125127
'redirect_type' => $row[2],
126-
'sites' => explode(',', $row[3]),
128+
'sites' => isset($row[3]) ? explode(',', $row[3]) : false,
127129
'id' => $row[4] ?? uniqid(),
128130
];
129131
foreach ($currentData as $rdKey => $redirect) {

0 commit comments

Comments
 (0)