1234567891011121314151617181920212223242526272829303132 |
- <?php
- namespace App\Models;
- use Illuminate\Database\Eloquent\Model;
- class SitePreviewVideo extends Model
- {
- protected $table = 'site_preview_video';
- public static function changeVideo($albumId,$voidData) {
- if (is_string($voidData)) {
- $voidData = json_decode($voidData, true);
- }
- $result = SitePreviewVideo::where('album_id', $albumId)->get();
- foreach ($voidData as $key => $value) {
- $voidData[$key]['preview_url'] = '';
- foreach ($result as $item) {
- if ($item->video_url == $value['video_src']) {
- $voidData[$key]['preview_url'] = $item->preview_url;
- }
- }
- }
- return json_encode($voidData);
- }
- }
|