/**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     //        $userCa = UserCa::all()->orderBy('update-date','desc');
     $userCa = UserCa::orderBy('id', 'desc')->get();
     $data['userCa'] = $userCa;
     return view('admin.userDo', $data);
 }
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function seed(SeedMessageRequest $request)
 {
     $postData = $request->all();
     //获取请求过来的数据
     $startTime = e($postData['startTime']);
     $endTime = e($postData['endTime']);
     $text = e($postData['text']);
     //$user = User::findOrFail(1);
     $user = $request->user();
     //$cards = UserCa::where('created_at','>',$startTime)->where('created_at','<',$endTime)->get();
     $cards = UserCa::whereBetween('created_at', [$startTime, $endTime])->get();
     if (count($cards) < 1) {
         return redirect()->back()->withInput()->withErrors(array('attempt' => '未查到数据'));
         //回传错误信息
     }
     foreach ($cards as $key => $li) {
         $job = (new SeedMessage($user, $text, $li->phone))->delay(1);
         $jobS = $this->dispatch($job);
     }
     return redirect()->route('adminMsgSeed')->with('fail', '成功发送短信队列!共发送' . count($cards) . "条记录");
 }