public function search(DanhmuclinhvucchuyendeSearchIndexRequest $query)
 {
     $menus = Menu::all();
     $querys = $query->input('query');
     $danhmuclinhvucchuyendes = Linhvucchuyende::where('name', 'LIKE', '%' . $querys . '%')->orderBy('name')->paginate(10);
     if ($danhmuclinhvucchuyendes == NULL) {
         $danhmuclinhvucchuyendes = 'Không Tìm Thấy';
     }
     return view('danhmuclinhvucchuyende.index')->with(array('danhmuclinhvucchuyendes' => $danhmuclinhvucchuyendes, 'menus' => $this->menus));
 }
 public function resulttheolinhvucchuyende(IncongvandiFormRequest $request)
 {
     $menus = Menu::all();
     $linhvucchuyendes = Linhvucchuyende::all();
     $ngaynhanbatdau = $request->input('ngaynhanbatdau');
     $ngaynhanketthuc = $request->input('ngaynhanketthuc');
     $linhvucchuyende = $request->input('linhvucchuyende');
     //$capphathanhresult = 'Tất cả';
     if ($linhvucchuyende == 0) {
         $querylinhvucchuyende = 'linhvucchuyende_id > 0';
         $linhvucchuyenderesult = 'Tất cả';
     } else {
         $querylinhvucchuyende = 'linhvucchuyende_id = ' . $linhvucchuyende;
         $linhvucchuyenderesult = Linhvucchuyende::where('id', $linhvucchuyende)->select('name')->first();
     }
     if ($ngaynhanbatdau != '' && $ngaynhanketthuc != '') {
         $ngaynhanbatdau = date('Y-m-d', strtotime(str_replace('/', '-', $ngaynhanbatdau)));
         //date('Y-m-d', strtotime(str_replace('/', '-', Input::get('ngayphathanh-start'))) ) ;
         $ngaynhanketthuc = date('Y-m-d', strtotime(str_replace('/', '-', $ngaynhanketthuc)));
         if ($ngaynhanbatdau > $ngaynhanketthuc) {
             return \Redirect::route('baocaocongvandi.theolinhvucchuyende')->withErrors('Ngày nhận bắt đầu phải nhỏ hơn ngày nhận kết thúc!')->withInput();
         } else {
             $congvandis = Congvandi::where('ngayphathanh', '>=', $ngaynhanbatdau)->where('ngayphathanh', '<=', $ngaynhanketthuc)->whereRaw($querylinhvucchuyende)->get();
         }
     }
     //$tungay = '01/02/2015';
     //$denngay = '01/06/2015';
     $tungays = date('d/m/Y', strtotime($ngaynhanbatdau));
     //date('Y-m-d', strtotime(str_replace('/', '-', Input::get('ngayphathanh-start'))) ) ;
     $denngays = date('d/m/Y', strtotime($ngaynhanketthuc));
     //echo '<pre>';
     //print_r($congvandis);
     return view('baocaocongvandi.theolinhvucchuyende')->with(['menus' => $this->menus, 'tungay' => $tungays, 'denngay' => $denngays, 'congvandis' => $congvandis, 'linhvucchuyendes' => $linhvucchuyendes, 'linhvucchuyenderesult' => $linhvucchuyenderesult])->withInput($request);
 }