duqinya преди 5 години
родител
ревизия
8616104c1d
променени са 2 файла, в които са добавени 6 реда и са изтрити 5 реда
  1. 1 4
      app/Http/Controllers/V2/PlatformContentController.php
  2. 5 1
      app/Repositories/PlatformContentRepository.php

+ 1 - 4
app/Http/Controllers/V2/PlatformContentController.php

@@ -2,11 +2,8 @@
 namespace App\Http\Controllers\V2;
 namespace App\Http\Controllers\V2;
 use App\Http\Controllers\BaseController;
 use App\Http\Controllers\BaseController;
 use App\Repositories\PlatformContentRepository;
 use App\Repositories\PlatformContentRepository;
-use App\Transformers\PlatformContentTransformer;
 use Illuminate\Http\Request;
 use Illuminate\Http\Request;
-use League\Fractal\Resource\Collection;
-use League\Fractal\Manager;
-use League\Fractal\Pagination\IlluminatePaginatorAdapter;
+
 /**
 /**
  * Created by PhpStorm.
  * Created by PhpStorm.
  * User: durong
  * User: durong

+ 5 - 1
app/Repositories/PlatformContentRepository.php

@@ -19,8 +19,12 @@ class PlatformContentRepository
 
 
     public function index($request)
     public function index($request)
     {
     {
+        $where = [];
+        if(isset($request['id'])){
+            $where[] = ['id',$request['id']];
+        }
         $this->platformContent = $this->platformContent
         $this->platformContent = $this->platformContent
-            ->orderBy('id', 'desc')->get();
+            ->where($where)->orderBy('id', 'desc')->get();
 
 
         return $this->platformContent;
         return $this->platformContent;
     }
     }