海南旅游SAAS
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
633 B

  1. <?php
  2. namespace App\Http\Controllers\Api;
  3. use App\Http\Controllers\Controller;
  4. use App\Models\UserChannel;
  5. class UserChannelController extends Controller
  6. {
  7. // 我的频道编辑
  8. public function update()
  9. {
  10. $formData = request()->only('channels');
  11. $channels = array_filter(json_decode($formData['channels'], true));
  12. if (!$channels) {
  13. return $this->error('未选择任何频道');
  14. }
  15. $UserChannel = UserChannel::where('user_id', $this->user_id)->first();
  16. $UserChannel->channels = $channels;
  17. $UserChannel->save();
  18. return $this->success();
  19. }
  20. }