Browse Source

增加UserChannelController

dev
李可松 4 years ago
parent
commit
52b05afdc4
  1. 23
      app/Http/Controllers/Api/UserChannelController.php

23
app/Http/Controllers/Api/UserChannelController.php

@ -0,0 +1,23 @@
<?php
namespace App\Http\Controllers\Api;
use App\Http\Controllers\Controller;
use App\Models\UserChannel;
class UserChannelController extends Controller
{
// 我的频道编辑
public function update()
{
$formData = request()->only('channels');
$channels = array_filter(json_decode($formData['channels'], true));
if (!$channels) {
return $this->error('未选择任何频道');
}
$UserChannel = UserChannel::where('user_id', $this->user_id)->first();
$UserChannel->channels = $channels;
$UserChannel->save();
return $this->success();
}
}
Loading…
Cancel
Save