Commit a6a20feca3135af86529a91f7a1c9623b3b0e5f1
1 parent
bab729aa7e
Exists in
master
and in
4 other branches
Check if relation doesn't exist for MLTD then respond appropriately
Showing 1 changed file with 4 additions and 0 deletions
api/app/Http/Controllers/V1/Components/MltdController.php
View file @
a6a20fe
... | ... | @@ -8,6 +8,7 @@ |
8 | 8 | use Illuminate\Support\Facades\DB; |
9 | 9 | use Illuminate\Support\Facades\Http; |
10 | 10 | use Illuminate\Support\Facades\Log; |
11 | +use Illuminate\Support\Facades\Schema; | |
11 | 12 | |
12 | 13 | class MltdController extends Controller |
13 | 14 | { |
... | ... | @@ -81,6 +82,9 @@ |
81 | 82 | |
82 | 83 | public function last(Request $request, $x) |
83 | 84 | { |
85 | + if (!Schema::hasTable('mltd')) { | |
86 | + return []; | |
87 | + } | |
84 | 88 | return DB::table('mltd')->orderBy('created_on', 'desc')->limit($x)->get()->toArray(); |
85 | 89 | } |
86 | 90 | } |