public function store(Request $request) { $input = $request->except('_token', '_method'); $this->validate($request, ['title' => 'required', 'image_url' => 'required', 'route_url' => 'required']); $banner = Banner::create($input); if ($banner) { flash()->success('操作成功'); return redirect()->route('dashboard.banner.index'); } else { flash()->error('操作失败'); } return redirect()->back(); }
public static function addForTwitcher(User $twitcher, User $client, Ref $bannerType, $file, $limit) { $banner = Banner::create(['client_id' => $client->id, 'twitcher_id' => $twitcher->id, 'type_id' => $bannerType->id, 'title' => $client->name . ' ' . $bannerType->title, 'file' => $file, 'is_active' => 0, 'status' => 'waiting', 'amount_limit' => $limit]); return $banner; }