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


PHP File::where方法代码示例

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


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

示例1: listFiles

 public function listFiles($target, $target_action, $target_id)
 {
     $resource_type = 'App\\Models\\' . ucfirst(str_singular($target));
     $uploader_id = Auth::user()->active_contact->id;
     if ($target == "posts") {
         if ($target_action == "create") {
             $post = Post::where('author_id', $uploader_id)->where("status_id", "=", POST_DRAFT_STATUS_ID)->where("ticket_id", $target_id)->first();
         } elseif ($target_action == "edit") {
             $post = Post::where("id", $target_id)->first();
         }
         $id = isset($post->id) ? $post->id : null;
     } elseif ($target == "tickets") {
         if ($target_action == "create") {
             $ticket = Ticket::where('status_id', TICKET_DRAFT_STATUS_ID)->where('creator_id', $uploader_id)->first();
         } else {
             $ticket = Ticket::where("id", $target_id)->first();
         }
         $id = isset($ticket->id) ? $ticket->id : null;
     } elseif ($target == "people") {
         $target_id = is_null($target_id) ? Auth::user()->owner->id : $target_id;
         $person = Person::find($target_id);
         $id = $person->id;
     }
     $files = is_null($id) ? [] : File::where('resource_type', $resource_type)->where("resource_id", $id)->get();
     foreach ($files as $file) {
         $file->size = filesize(RESOURCES . DS . $file->file_path . DS . $file->file_name);
     }
     return $files;
 }
开发者ID:pinkynrg,项目名称:convergence2.0,代码行数:29,代码来源:FilesController.php

示例2: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $filecount = \App\Models\File::where('file_type_id', $id)->count();
     if ($filecount > 0) {
         return back()->withMsg('There are files in the category');
     }
     FileType::findOrFail($id)->delete();
     return back();
 }
开发者ID:jardayn,项目名称:portfolio,代码行数:15,代码来源:FileTypesController.php

示例3: delete

 public function delete(Request $request, $banqueId, $fileId)
 {
     // verify request inputs
     if (is_null($fileId)) {
         return response()->json(['error' => 'Bad request'], HttpResponse::HTTP_BAD_REQUEST);
     } else {
         $item = File::where('id_File', '=', $fileId)->delete();
         return is_null($item) ? response()->json(['error' => 'Bad request'], HttpResponse::HTTP_BAD_REQUEST) : $item;
     }
 }
开发者ID:S4M37,项目名称:Project_GangOfThree,代码行数:10,代码来源:FileController.php

示例4: index

 public function index()
 {
     $fields = Field::all();
     $fileTitles = File::distinct()->groupBy('parsed_title')->select('parsed_title')->get();
     $fileArray = [];
     foreach ($fileTitles as $title) {
         $file = File::where('parsed_title', '=', $title->parsed_title)->select('parsed_date', 'full_title')->orderBy('parsed_date', 'desc');
         $fileData = $file->get();
         foreach ($file->get() as $multiFile) {
             $fileArray[$title->parsed_title][] = $multiFile;
         }
     }
     return view("home.index")->with('fileArray', $fileArray);
 }
开发者ID:progyny-joe,项目名称:claimsbybatch,代码行数:14,代码来源:HomeController.php

示例5: APIindex

 /**
  * API - get list of files, optionally filtered by category
  */
 public function APIindex($category = null)
 {
     // get all files of this category
     if ($category) {
         if ($category == 'newest') {
             // Recently added files
             $files = File::orderBy('id', 'desc')->paginate(18);
         } else {
             $files = File::where('file_category_id', $category)->paginate(18);
         }
     } else {
         $files = File::paginate(18);
     }
     return response()->json($files);
 }
开发者ID:matthiku,项目名称:cSpot,代码行数:18,代码来源:FileController.php

示例6: addComments

 public function addComments(Request $request)
 {
     $name = $request->name;
     $end = isset($request->end) ? strtotime($request->end) : time();
     $start = isset($request->start) ? strtotime($request->start) : $end - 86400 * 180;
     $site = isset($request->site) ? $request->site : '';
     $mode = isset($request->mode) ? $request->mode : '';
     $f = $s = 0;
     if (empty($name) || empty($site) || empty($mode)) {
         return AJAX::argumentError();
     }
     $file = File::where(array('name' => $name))->first();
     if (empty($file) || empty($file->path)) {
         return AJAX::notExist();
     }
     $list = $this->getFileContents($file->path);
     switch ($mode) {
         case 'insertComments':
             $result = $this->checkCommentsFile($list, 4);
             break;
         case 'insertCommentsWithTid':
             $result = $this->checkCommentsFile($list, 5);
             break;
         default:
             $result['code'] = 500;
             $result['data'] = 'arguments error';
             break;
     }
     if ($result['code'] != 200) {
         return AJAX::badData(array('message' => $result['message']));
     }
     $commentModule = new CommentModule($site);
     foreach ($list as $line) {
         $comment_time = $this->getCommentRandTime($start, $end);
         $res = $commentModule->addCommentByLine($line, $comment_time, $mode);
         if ($res['code'] != 200) {
             Log::error($site . ':' . $name . $res['message']);
             $f++;
             continue;
         }
         $s++;
     }
     return AJAX::success(array('success' => $s, 'fail' => $f));
 }
开发者ID:nosun,项目名称:laravel_base,代码行数:44,代码来源:CommentController.php

示例7: detail

 public function detail($banqueId = null)
 {
     if (is_null($banqueId)) {
         // display the hole banque
         return view('banque', ['banqueItems' => Banque::all(), 'contexteItems' => Contexte::all(), 'critereItems' => Critere::all(), 'domaineItems' => Domaine::all(), 'systemeItems' => Systeme::all(), 'competenceItems' => Competence::all(), 'enseignantList' => Enseignant::all()]);
     } else {
         // display specific banque
         $banque = $this->gestSession->getBanque($banqueId);
         $items = Item::join('TitreGItem', 'TitreGItem.id_TitreGItem', '=', 'Item.id_TitreGItem')->where('Item.id_Banque', '=', $banqueId)->join('Competence', 'Item.id_Competence', '=', 'Competence.id_Competence')->get();
         $auteurs = Banque_Enseignant::where('id_Banque', '=', $banqueId)->get();
         $files = File::where('id_Banque', '=', $banqueId)->get();
         return view("banqueDetail")->with("banque", $banque)->with("items", $items)->with("files", $files)->with("auteurs", $auteurs);
     }
 }
开发者ID:S4M37,项目名称:Project_GangOfThree,代码行数:14,代码来源:BanqueController.php

示例8: getFilesByTypeId

 public function getFilesByTypeId($id)
 {
     $file = File::where('file_type_id', $id)->get();
     return response()->json($file);
 }
开发者ID:jardayn,项目名称:portfolio,代码行数:5,代码来源:FilesController.php

示例9: files

 public function files($user)
 {
     $files = File::where("folder_id", $this->id)->where("created_by", $user->id)->orderBy("name")->get();
     return $files;
 }
开发者ID:ravimalik20,项目名称:docsManage,代码行数:5,代码来源:Folder.php

示例10: onDelete

 /**
  * Function Remove
  * Process Delete the Brand Data
  *
  * @return \Illuminate\Http\JsonResponse
  */
 public function onDelete()
 {
     $id = Input::get('id');
     $Model = \App\Models\File::select(['id', 'name'])->where('id', $id)->first();
     $path = base_path() . '/public/uploads/';
     if ($Model) {
         File::delete($path . $Model->name);
         \App\Models\File::where('id', $id)->delete();
         \App\Models\FileUser::where('file_id', $id)->delete();
         $param['message'] = Lang::get('message.has deleted');
         $param['error'] = false;
     } else {
         $param['message'] = Lang::get('message.has error');
         $param['error'] = true;
     }
     return json_encode($param);
 }
开发者ID:suhe,项目名称:bdoportal,代码行数:23,代码来源:FileController.php


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