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


PHP Upload::where方法代码示例

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


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

示例1: remove

 /**
  * Removes all uploads based on upload type and the type_id.
  * @param  boolean $upload_type The type of upload ('news', 'gallery', 'section') etc
  * @param  boolean $type_id     The ID of the item (above) that the upload is linked to
  * @param  string  $path_to     There might be a different physical path that the upload is at (not sure why, enter that here)
  * @return int                  Notification of whether or not the upload object was deleted
  */
 public static function remove($upload_type = false, $type_id = false, $path_to = './uploads/')
 {
     if (!$upload_type || !$type_id) {
         return false;
     }
     $uploads = Upload::where('link_type', '=', $upload_type)->where('link_id', '=', $type_id)->get();
     if ($uploads) {
         foreach ($uploads as $upload) {
             if ($upload->filename && file_exists($path_to . $upload->filename)) {
                 @unlink($path_to . $upload->filename);
             }
             if ($upload->small_filename && file_exists($path_to . $upload->small_filename)) {
                 @unlink($path_to . $upload->small_filename);
             }
             if ($upload->thumb_filename && file_exists($path_to . $upload->thumb_filename)) {
                 @unlink($path_to . $upload->thumb_filename);
             }
         }
     }
     return Upload::where('link_type', '=', $upload_type)->where('link_id', '=', $type_id)->delete();
 }
开发者ID:victoroliveira1605,项目名称:Laravel-Bootstrap,代码行数:28,代码来源:uploadr.php

示例2: destroy

 public function destroy($id)
 {
     Allow::permission($this->module['group'], 'delete');
     if (!Request::ajax()) {
         App::abort(404);
     }
     $json_request = array('status' => FALSE, 'responseText' => '');
     $element = Upload::where('id', $id)->first();
     if (is_object($element)) {
         #Helper::tad($element);
         #Helper::dd($element->fullpath());
         @unlink($element->fullpath());
         $element->delete();
     }
     $json_request['responseText'] = 'Удалено';
     $json_request['status'] = TRUE;
     return Response::json($json_request, 200);
 }
开发者ID:Grapheme,项目名称:dada,代码行数:18,代码来源:admin_uploads.controller.php

示例3: remove_singular

 public static function remove_singular($upload_id = false, $path_to_store = false)
 {
     if (!$upload_id) {
         return false;
     }
     if (!$path_to_store) {
         $path_to_store = path('public') . 'uploads/';
     }
     $uploads = Upload::where('id', '=', $upload_id)->get();
     if ($uploads) {
         foreach ($uploads as $upload) {
             if ($upload->filename && file_exists($path_to_store . $upload->filename)) {
                 @unlink($path_to_store . $upload->filename);
             }
             if ($upload->small_filename && file_exists($path_to_store . $upload->small_filename)) {
                 @unlink($path_to_store . $upload->small_filename);
             }
             if ($upload->thumb_filename && file_exists($path_to_store . $upload->thumb_filename)) {
                 @unlink($path_to_store . $upload->thumb_filename);
             }
         }
     }
     return Upload::where('id', '=', $upload_id)->delete();
 }
开发者ID:acmadi,项目名称:diantaksi,代码行数:24,代码来源:uploadr.php

示例4: saveAboutUploads

 public function saveAboutUploads()
 {
     $file_1_db = Upload::where('where', 'about_1')->first();
     if (empty($file_1_db)) {
         $file_1_row = new Upload();
         $file_1_row->where = 'about_1';
     } else {
         $file_1_row = $file_1_db;
     }
     // If there is a file then lets upload it
     $file_1 = Input::file('download_1_file');
     if ($file_1) {
         $file = Input::file('download_1_file');
         $destinationPath = 'uploads/about/';
         $extension = $file->getClientOriginalExtension();
         $filename = str_random(12) . '.' . $extension;
         $upload_success = Input::file('download_1_file')->move($destinationPath, $filename);
         if ($upload_success) {
             $file_1_row->file_location = $destinationPath . $filename;
             $file_1_row->file_type = $extension;
             $file_1_row->file_name = $file->getClientOriginalName();
             $file_1_row->title = Input::get('download_1');
             $file_1_row->save();
         }
     }
     $file_2_db = Upload::where('where', 'about_2')->first();
     if (empty($file_2_db)) {
         $file_2_row = new Upload();
         $file_2_row->where = 'about_2';
     } else {
         $file_2_row = $file_2_db;
     }
     // If there is a file then lets upload it
     $file_1 = Input::file('download_2_file');
     if ($file_1) {
         $file = Input::file('download_2_file');
         $destinationPath = 'uploads/about/';
         $extension = $file->getClientOriginalExtension();
         $filename = str_random(12) . '.' . $extension;
         $upload_success = Input::file('download_2_file')->move($destinationPath, $filename);
         if ($upload_success) {
             $file_2_row->file_location = $destinationPath . $filename;
             $file_2_row->file_type = $extension;
             $file_2_row->file_name = $file->getClientOriginalName();
             $file_2_row->title = Input::get('download_2');
             $file_2_row->save();
         }
     }
     return Redirect::back();
 }
开发者ID:TheCompleteCode,项目名称:laravel-kdc,代码行数:50,代码来源:AdminController.php

示例5: associateAdvancedUploads

 public function associateAdvancedUploads()
 {
     $class = get_class($this);
     Upload::where('uploadable_type', $class)->where('uploadable_id', 0)->where('token', csrf_token())->update(['id' => $this->id]);
 }
开发者ID:k4ml,项目名称:laravel-base,代码行数:5,代码来源:UploadableTrait.php

示例6: foreach

<?
/**
 * TITLE: Путеводитель
 * AVAILABLE_ONLY_IN_ADVANCED_MODE
 */
?>
<?php 
if ($infrastructures = Dictionary::valuesBySlug('infrastructures', NULL, 'all', TRUE)) {
    foreach ($infrastructures as $index => $infrastructure) {
        if ($infrastructure['photo']) {
            $infrastructures[$index]['photo_path'] = Upload::where('id', $infrastructure['photo'])->pluck('path');
        }
    }
}
?>
@extends(Helper::layout())
@section('style')
@stop
@section('content')
    <div class="half-page infra-page">
        <div id="infra-map" class="infra-map"></div>
        <div class="wrapper">
            <div class="page__left">
                <div class="tabs-title">
                    <h1 class="us-title title-red"><span>{{ $page->seo->h1 }}</span></h1>
                    <div class="tabs-right">
                        <div class="right-cont">
                            <a href="{{ pageurl('raspolojenie') }}" class="title__link">Расположение</a>
                        </div>
                    </div>
                </div>
开发者ID:Grapheme,项目名称:zemaktiv,代码行数:31,代码来源:infrastructure.blade.php


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