当前位置: 首页>>代码示例>>PHP>>正文


PHP File::savefiles方法代码示例

本文整理汇总了PHP中app\File::savefiles方法的典型用法代码示例。如果您正苦于以下问题:PHP File::savefiles方法的具体用法?PHP File::savefiles怎么用?PHP File::savefiles使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\File的用法示例。


在下文中一共展示了File::savefiles方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: update

 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id, CongviecCreateFormRequest $request)
 {
     if (Auth::check() && $this->rolechucnangs && $this->rolechucnangs->Sua == 1) {
         $congviec = Congviec::findOrFail($id);
         $canbonhans = $request->input('nguoinhan');
         if ($canbonhans != NULL) {
             $congviecfind->users()->sync($canbonhans);
         }
         // luu file
         if ($request->input('upload-file') && $request->hasFile('files')) {
             $files = $request->file('files');
             $newnamefiles = File::savefiles($files, Auth::user()->id);
             $congviec->files()->sync($newnamefiles);
         }
         $congviec->update(['ngaybatdau' => makedatemodel($request->input('ngaybatdau')), 'ngayketthuc' => makedatemodel($request->input('ngayketthuc')), 'user_created' => $canbogiao, 'tencongviec' => $request->input('tencongviec'), 'noidungcongviec' => $request->input('noidungcongviec'), 'tinhtrangcongviec_id' => $tinhtrangcongviec]);
         return \Redirect::route('congviec.index')->with('message', 'Cập nhật thành công');
     } else {
         return \Redirect::route('congviec.index')->with('message-error', 'Không có quyền truy cập');
     }
 }
开发者ID:thaigialai1987,项目名称:qlcv,代码行数:26,代码来源:CongviecController.php

示例2: luunoibo

 public function luunoibo(LuuMailNoiBoFormRequest $request)
 {
     if (Auth::check() && $this->rolechucnangs && $this->rolechucnangs->Them == 1) {
         $tos = $request->input('nguoinhan');
         $subject = $request->input('tieude');
         $message = $request->input('noidung');
         // has file
         if ($request->hasFile('attachment')) {
             $now_date = str_replace('/', '_', date('d/m/Y'));
             $files = $request->file('attachment');
             $newnamefiles = File::savefiles($files, Auth::user()->id);
             $email = new Mymail(array('subject' => $subject, 'message' => $message, 'nguoigui_id' => \Auth::user()->id, 'draf' => 1));
             $email->save();
             $insertedId = $email->id;
             $emailfind = Mymail::findOrFail($insertedId);
             if ($tos != NULL) {
                 $emailfind->danhmuccanbosends()->sync($tos);
             }
             if ($newnamefiles) {
                 $emailfind->files()->sync($newnamefiles);
             }
             return \Redirect::route('thuden.index')->with('message', 'Lưu thành công!');
         } else {
             $email = new Mymail(array('subject' => $subject, 'message' => $message, 'nguoigui_id' => \Auth::user()->id, 'draf' => 1));
             $email->save();
             $insertedId = $email->id;
             $emailfind = Mymail::findOrFail($insertedId);
             if ($tos != NULL) {
                 $emailfind->danhmuccanbosends()->sync($tos);
             }
             return \Redirect::route('thuden.index')->with('message', 'Lưu thành công!');
         }
         //end send
     } else {
         return \Redirect::route('thuden.index')->with('message-error', 'Không có quyền truy cập');
     }
 }
开发者ID:thaigialai1987,项目名称:qlcv,代码行数:37,代码来源:ThudenController.php

示例3: update

 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id, CongvandiUpdateFormRequest $request)
 {
     if (Auth::check() && $this->rolechucnangs && $this->rolechucnangs->Sua == 1) {
         $congvandi = Congvandi::findOrFail($id);
         // $nowtime = date();
         $nowtime = date("m/d/Y", time());
         $nowyear = date('Y');
         $namky = date('Y-m-d', strtotime(str_replace('/', '-', $request->input('ngayky'))));
         $namkys = substr($namky, 0, 4);
         $namphathanh = date('Y-m-d', strtotime(str_replace('/', '-', $request->input('ngayphathanh'))));
         $namphathanhs = substr($namphathanh, 0, 4);
         $namluu = date('Y-m-d', strtotime(str_replace('/', '-', $request->input('ngayluu'))));
         $namluus = substr($namluu, 0, 4);
         if ($namkys != $nowyear || $namphathanhs != $nowyear || $namluus != $nowyear) {
             return \Redirect::route('congvandi.edit', $id)->withErrors('Năm văn bản không đúng')->withInput();
         } else {
             //update cong van
             $congvandi->update(['socongvandichu' => $request->input('socongvandichu'), 'ngayky' => date('Y-m-d', strtotime(str_replace('/', '-', $request->input('ngayky')))), 'noisoanthao_id' => $request->input('noisoanthao'), 'nguoiky_id' => $request->input('nguoiky'), 'danhmucloaicongvan_id' => $request->input('loaicongvan'), 'sobanphathanh' => $request->input('sobanphathanh'), 'trichyeucongvandi' => $request->input('trichyeucongvandi'), 'noinhancongvan' => $request->input('noinhancongvan'), 'danhmucdomat_id' => $request->input('domatcongvan'), 'ngayphathanh' => date('Y-m-d', strtotime(str_replace('/', '-', $request->input('ngayphathanh')))), 'danhmucdokhan_id' => $request->input('dokhancongvan'), 'ngaynhap' => date('Y-m-d', strtotime(str_replace('/', '-', $request->input('ngayluu')))), 'danhmucmucdich_id' => $request->input('mucdichcongvan'), 'danhmuchinhthucchuyen_id' => $request->input('hinhthucchuyen'), 'linhvucchuyende_id' => $request->input('linhvucchuyende'), 'danhmucchuyende_id' => $request->input('chuyende'), 'hantraloi' => date('Y-m-d', strtotime(str_replace('/', '-', $request->input('hantraloi')))), 'noiluu' => $request->input('noiluutru'), 'nguoisua_id' => \Auth::user()->id]);
             $congvandifind = Congvandi::find($id);
             //var_dump($congvandifind);
             $phongs = $request->input('phong');
             if ($phongs != NULL) {
                 $congvandifind->danhmucphongs()->sync($phongs);
             } else {
                 $congvandifind->danhmucphongs()->detach();
             }
             $dois = $request->input('doi');
             if ($dois != NULL) {
                 $congvandifind->danhmucdois()->sync($dois);
             } else {
                 $congvandifind->danhmucdois()->detach();
             }
             $canbos = $request->input('canbo');
             if ($canbos != NULL) {
                 $congvandifind->danhmuccanbos()->sync($canbos);
             } else {
                 $congvandifind->danhmuccanbos()->detach();
             }
             // xu ly file
             $now_date = str_replace('/', '_', date('d/m/Y'));
             if ($request->input('upload-file') && $request->hasFile('files')) {
                 $files = $request->file('files');
                 $newnamefiles = File::savefiles($files, Auth::user()->id);
             }
             if ($request->input('upload-file') && $request->hasFile('files') && $newnamefiles) {
                 $congvandifind->files()->sync($newnamefiles);
             }
             return \Redirect::route('congvandi.index')->with('message', 'Cập nhật thành công!');
         }
     } else {
         return \Redirect::route('congvandi.index')->with('message-error', 'Không có quyền truy cập');
     }
 }
开发者ID:thaigialai1987,项目名称:qlcv,代码行数:59,代码来源:CongvandiController.php

示例4: traloi

 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function traloi($id, CongvandenTraloiFormRequest $request)
 {
     $congvandenfind = Congvanden::findOrFail($id);
     $congvandenfind->traloicongvan = $request->input('traloicongvan');
     $congvandenfind->save();
     // xu ly file
     $now_date = str_replace('/', '_', date('d/m/Y'));
     if ($request->input('upload-file') && $request->hasFile('files')) {
         $files = $request->file('files');
         $newnamefiles = File::savefiles($files, Auth::user()->id);
     }
     $traloicongvan = $request->input('traloicongvan');
     if ($request->input('upload-file') && $request->hasFile('files') && $newnamefiles) {
         $user = Auth::user();
         $congvandenfind->filetralois()->attach($newnamefiles, ['noidung' => $traloicongvan]);
         $stt = Congvanden::getsolanuptheouserid($id, $user->id);
         foreach ($newnamefiles as $value) {
             \DB::table('file_traloicongvandens')->where('congvanden_id', $id)->whereNull('user_id')->where('file_id', $value)->update(['user_id' => $user->id, 'stt' => $stt]);
         }
     } else {
         $user = Auth::user();
         $stt = Congvanden::getsolanuptheouserid($id, $user->id);
         $traloicongvankhongfile = new File_Traloicongvanden(['congvanden_id' => $congvandenfind->id, 'user_id' => $user->id, 'stt' => $stt, 'noidung' => $traloicongvan]);
         $traloicongvankhongfile->save();
     }
     return \Redirect::route('congvanden.index')->with('message', 'Trả lời thành công!');
 }
开发者ID:thaigialai1987,项目名称:qlcv,代码行数:33,代码来源:CongvandenController.php

示例5: update

 /**
  * Update the specified resource in storage.
  *
  * @param  Request $request
  * @param  int $id
  * @return Response
  */
 public function update(Request $request, $id)
 {
     if (Auth::check() && $this->rolechucnangs && $this->rolechucnangs->Sua == 1) {
         $cuochopfind = Cuochop::findOrFail($id);
         $cuochopfind->update(['name' => $request->input('name'), 'phamvi' => $request->input('phamvi'), 'thoigian' => makedatemodel($request->input('thoigian')), 'luc' => $request->input('luc'), 'diadiemhop_id' => $request->input('diadiem'), 'lanhdao' => $request->input('lanhdao'), 'thuky' => $request->input('thuky'), 'danhsachthamdu' => $request->input('danhsachthamdu')]);
         // xu ly file
         if ($request->input('upload-file') && $request->hasFile('files')) {
             $files = $request->file('files');
             $newnamefiles = File::savefiles($files, Auth::user()->id);
             $cuochopfind->files()->sync($newnamefiles);
         }
         return redirect()->route('cuochop.index')->with('message', 'Cập nhật thành công');
     } else {
         return \Redirect::to('cuochop.index')->with('message-error', 'Không có quyền truy cập');
     }
 }
开发者ID:thaigialai1987,项目名称:qlcv,代码行数:23,代码来源:CuochopController.php


注:本文中的app\File::savefiles方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。