create() public method

Create a video.
public create ( array $data ) : array
$data array
return array
コード例 #1
0
 /**
  * Store a video.
  *
  * /admin/videos post
  *
  * @return \Illuminate\Http\JsonResponse
  */
 public function store()
 {
     $form = $this->videos->getSaveForm();
     if (!$form->isValid()) {
         return $this->responseJson(['errors' => $form->getErrors()], 400);
     }
     $data = $form->getInputData();
     $resourceInfo = $this->getResourceInfo($data['resource_type'], $data['resource_id']);
     $data['image'] = $resourceInfo['thumbnail_url'];
     $data['duration'] = $resourceInfo['duration'];
     $video = $this->videos->create($data);
     return $this->responseJson(['message' => '成功添加视频', 'video' => $video]);
 }