Commit ff453931 by 杨昕

code format

parent 0873898c
Pipeline #9804 passed with stages
in 33 seconds
...@@ -22,14 +22,7 @@ class MediaModel extends Eloquent ...@@ -22,14 +22,7 @@ class MediaModel extends Eloquent
if ($request->name){ if ($request->name){
$where['name'] = $request->name; $where['name'] = $request->name;
} }
$medias = DB::connection('mongodb')->collection('media')->select("media.*",'media_category.name')->leftJoin('media_category',"media.media_type",'media_category._id')->where($where)->paginate(10); $medias = DB::connection('mongodb')->collection('media_category')->leftJoin('media_category',"media.media_type",'media_category._id')->where($where)->paginate(10);
foreach ($medias as $media){
var_dump($media);die;
}
var_dump($medias[0]);die;
}catch (\Exception $exception){ }catch (\Exception $exception){
throw new DatabaseException($exception->getMessage()); throw new DatabaseException($exception->getMessage());
...@@ -52,8 +45,10 @@ class MediaModel extends Eloquent ...@@ -52,8 +45,10 @@ class MediaModel extends Eloquent
* 判断媒资ID是否存在 * 判断媒资ID是否存在
*/ */
$media_id = $request->media_id; $media_id = $request->media_id;
$media = MediaModel::find($media_id); $media = MediaModel::find($media_id);
if ($media){ if (!empty($media)){
throw new \Exception('媒资已经存在'); throw new \Exception('媒资已经存在');
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment