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


PHP Storage::get方法代码示例

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


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

示例1: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $file = Request::file('xmlfile');
     $type = Input::get('type');
     $userid = Input::get('userid');
     $alpha = Input::get('alpha');
     $extension = $file->getClientOriginalExtension();
     $oname = $file->getClientOriginalName();
     Storage::disk('local')->put("uploads/" . $file->getClientOriginalName(), File::get($file));
     $parser = new Parser();
     $contents = Storage::get("uploads/" . $file->getClientOriginalName());
     $rawxml = $parser->xml($contents);
     $importer = new Importer();
     if ($type == 'recipes') {
         $importer->parseRecipe($rawxml, $userid, $alpha, 1);
     }
     if ($type == 'blocks') {
         $importer->parseBlocks($rawxml, $userid, $alpha, 1);
     }
     if ($type == 'materials') {
         $importer->parseMaterial($rawxml, $userid, $alpha, 1);
     }
     if ($type == 'items') {
         $importer->parseItems($rawxml, $userid, $alpha, 1);
     }
     //Flash::success('You successfully imported a '.$type.' xml file for 7 Days to Die Alpha '.$alpha.'!');
     return view('pages.import');
 }
开发者ID:jhansen69,项目名称:7Days,代码行数:33,代码来源:ImportController.php

示例2: getLastVisit

 /**
  * Read last visited timestamp from file and return
  * timestamp as Carbon object or return zero.
  *
  * @return int|\Carbon\Carbon
  */
 protected function getLastVisit()
 {
     if (Storage::exists('visited.txt')) {
         return Carbon::createFromTimestamp(Storage::get('visited.txt'));
     }
     return 0;
 }
开发者ID:raffw7912,项目名称:challenge,代码行数:13,代码来源:CompanyController.php

示例3: membersMapNorway

 /**
  * Norwegian map with municipalities where Alternativet is represented highlighted
  */
 public function membersMapNorway()
 {
     $data = "";
     if (!Storage::exists('members-norway-map.svg') || Storage::lastModified('members-norway-map.svg') <= time() - 60 * 60 * 24) {
         $svg = simplexml_load_file(base_path() . '/resources/svg/Norway_municipalities_2012_blank.svg');
         // Determine which municipalities there are members in
         $result = DB::select(DB::raw("\n              select postal_areas.municipality_code, count(*) as count\n              from users\n              left join postal_areas\n              on (users.postal_code = postal_areas.postal_code)\n              group by municipality_code"));
         $municipalities = [];
         foreach ($result as $row) {
             if ($row->municipality_code) {
                 $municipalities[] = $row->municipality_code;
             }
         }
         foreach ($svg->g as $county) {
             foreach ($county->path as $path) {
                 if (in_array($path['id'], $municipalities)) {
                     // There are members in this municipality
                     $path['style'] = 'fill:#0f0;fill-opacity:1;stroke:none';
                 } else {
                     $path['style'] = 'fill:#777;fill-opacity:1;stroke:none';
                 }
             }
         }
         $data = $svg->asXML();
         Storage::put('members-norway-map.svg', $data);
     }
     if (empty($data)) {
         $data = Storage::get('members-norway-map.svg');
     }
     return response($data)->header('Content-Type', 'image/svg+xml');
 }
开发者ID:partialternativet,项目名称:api,代码行数:34,代码来源:GraphicsController.php

示例4: getRawPageContent

 /**
  * Get the raw page content
  * @param  string $path file path
  * @return string
  */
 public function getRawPageContent($path)
 {
     $content = null;
     if (Storage::exists($path) === true) {
         $content = Storage::get($path);
     }
     return $content;
 }
开发者ID:mrjuliuss,项目名称:lecter,代码行数:13,代码来源:Lecter.php

示例5: GetColumnAudioSample

 public function GetColumnAudioSample($syllabaryId, $columnId)
 {
     $column = SyllabaryColumnHeader::where('syllabary_id', '=', $syllabaryId)->where('id', '=', $columnId)->first();
     if ($column == NULL || $column->audio_sample == NULL) {
         return '';
     }
     return response()->make(Storage::get($column->audio_sample));
 }
开发者ID:ChristopherCotnoir,项目名称:Sequoyah,代码行数:8,代码来源:AudioController.php

示例6: compose

 /**
  * Bind data to the view.
  *
  * @param View $view
  *
  * @return void
  */
 public function compose(View $view)
 {
     $locale = app()->getLocale();
     $filename = Request::route()->getName() . '.md';
     $filepath = 'userhelp' . DIRECTORY_SEPARATOR . $locale . DIRECTORY_SEPARATOR . $filename;
     $help = Storage::exists($filepath) ? Markdown::convertToHtml(Storage::get($filepath)) : '';
     $view->with('help', $help);
 }
开发者ID:josevh,项目名称:timegrid,代码行数:15,代码来源:UserHelpComposer.php

示例7: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (!Cache::has('settings')) {
         $settings = json_decode(Storage::get('settings.json'), true);
         Cache::forever('settings', $settings);
     }
     return $next($request);
 }
开发者ID:ambarsetyawan,项目名称:brewski,代码行数:15,代码来源:SettingsCacheMiddleware.php

示例8: show

 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($path)
 {
     $entry = FileEntry::where('filename', '=', $path)->first();
     if ($entry == null || !Storage::exists($path)) {
         return response('NotFound', 404);
     } else {
         $file = Storage::get($entry->filename);
         return response($file)->header('Content-Type', $entry->mime);
     }
 }
开发者ID:mg9,项目名称:koalaBazaar,代码行数:16,代码来源:FileEntryController.php

示例9: get

 public function get($filename)
 {
     $path = config('images.path') . $filename;
     if (!Storage::exists($path)) {
         throw new ImageNotFoundHttpException();
     }
     $data = Storage::get($path);
     $mime = finfo_buffer(finfo_open(FILEINFO_MIME_TYPE), $data);
     return Response::make($data)->header('Content-Type', $mime)->header('Content-Length', strlen($data));
 }
开发者ID:B1naryStudio,项目名称:asciit,代码行数:10,代码来源:ImageService.php

示例10: cards

 public static function cards()
 {
     $sets = json_decode(Storage::get('raw.json'), true);
     foreach ($sets as $cards) {
         foreach ($cards as $card) {
             unset($card['mechanics']);
             HearthstoneCards::create($card);
         }
     }
 }
开发者ID:JLopezDev,项目名称:sly-dev.com,代码行数:10,代码来源:Import.php

示例11: getRSS

    /**
     * Crée un RSS a partir du flux (fb ou non) et le store
     * @param $feed : feed got from the database
     * @return string
     * @throws \Facebook\FacebookRequestException
     */
    public function getRSS($feed)
    {
        //get directly the rss in the storage if exists
        if (Storage::exists($this->rssDirectory . 'feed_' . $feed->id . '.xml')) {
            return Storage::get($this->rssDirectory . 'feed_' . $feed->id . '.xml');
        }
        //if it's a facebook page : convert to rss
        if ($feed->is_facebook) {
            $url = parse_url($feed->url);
            $page = $url['path'];
            $application = array('app_id' => getenv('FACEBOOK_APP_ID'), 'app_secret' => getenv('FACEBOOK_APP_SECRET'));
            FacebookSession::setDefaultApplication($application['app_id'], $application['app_secret']);
            $session = new FacebookSession($application['app_id'] . '|' . $application['app_secret']);
            $request = new FacebookRequest($session, 'GET', '/' . $page . '/feed');
            $response = $request->execute();
            $graphObject = $response->getGraphObject();
            $facebook_feed = $graphObject->asArray();
            $xml = '
<?xml version="1.0"?>
<rss version="2.0">
<channel>
<title>RSS ' . $feed->name . '</title>
<description></description>
';
            foreach ($facebook_feed['data'] as $entry) {
                //récupere l'id de la page et l'id du post
                $ids = explode('_', $entry->id);
                if ($entry->from->id == $ids[0] && isset($entry->message)) {
                    //si il y a un message et que la page est auteur
                    $title = Str::words($entry->message, 20, '...');
                    //limit mots
                    $pubDate = date("D, d M Y H:i:s T", strtotime($entry->created_time));
                    $item = '
             <item>
             <title><![CDATA[' . $title . ']]></title>
            <link>http://www.facebook.com/' . $ids[0] . '/posts/' . $ids[1] . '</link>
            <pubDate>' . date("r", strtotime($pubDate)) . '</pubDate>
            </item>';
                    $xml .= $item;
                }
            }
            $xml .= '</channel></rss>';
        } else {
            $context = stream_context_create(array('http' => array('user_agent' => 'Mozilla/5.0 (Windows NT 5.1) AppleWebKit/536.11 (KHTML, like Gecko) Chrome/20.0.1132.57 Safari/536.11')));
            $xml = @file_get_contents($feed->url, FALSE, $context);
        }
        $xml = trim($xml);
        // if the file is not xml return false
        $xml_is_valid = @simplexml_load_string($xml);
        if (!$xml_is_valid) {
            throw new \Exception('invalid xml');
        }
        Storage::put($this->rssDirectory . 'feed_' . $feed->id . '.xml', $xml);
        return $xml;
    }
开发者ID:gabva,项目名称:feeds,代码行数:61,代码来源:EloquentFeedRepository.php

示例12: download

 public function download(Request $request, $original_filename)
 {
     $entry = FileEntry::where('original_filename', '=', $original_filename)->firstOrFail();
     if (Storage::has($request->user()->id . '/' . $entry->original_filename)) {
         $file = Storage::get($request->user()->id . '/' . $entry->original_filename);
         return (new Response($file, 200))->header('Content-Description', 'File Transfer')->header('Content-Type', $entry->mime)->header('Content-Disposition', 'attachment; filename=' . $entry->original_filename)->header('Content-Transfer-Encoding', 'binary')->header('Connection', 'Keep-Alive')->header('Expires', 0)->header('Cache-Control', 'must-revalidate, post-check=0, pre-check=0')->header('Pragma', 'public')->header('Content-Length', $entry->size);
         // ->header('Content-Type', $entry->mime);
     }
     $sys_notifications[] = array('type' => 'danger', 'message' => 'O arquivo não existe!');
     $request->session()->flash('sys_notifications', $sys_notifications);
     return back()->withInput($request->all());
 }
开发者ID:system3d,项目名称:consultas-tecnicas,代码行数:12,代码来源:FileEntryController.php

示例13: show

 /**
  * Display the specified resource.
  *
  * @param  int $filename
  * @return Response
  */
 public function show($filename)
 {
     $publicMessageFile = PublicMessageFile::whereFilename($filename)->firstOrFail();
     $file = Storage::get($publicMessageFile->filepath);
     $headers = array();
     $headers['Content-type'] = $publicMessageFile->mime;
     // force the file to download if its not an image
     if (!$publicMessageFile->isImage()) {
         $headers['Content-Disposition'] = 'attachment; filename="' . $publicMessageFile->filename . '"';
     }
     return response($file, 200, $headers);
 }
开发者ID:mapcompasskey,项目名称:support-ticketing-app,代码行数:18,代码来源:PublicMessageFilesController.php

示例14: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $modules = json_decode(Storage::get('packages.json'));
     foreach ($modules as $module) {
         $module = Module::create(['packname' => $module->packname, 'provider' => $module->provider, 'name' => $module->name, 'status' => $module->status, 'icon' => $module->icon, 'tables' => $module->tables, 'seeder' => $module->seeder, 'description' => $module->description]);
         if ($module->status > 0) {
             if (!$module->checkMigration()) {
                 Artisan::call('vendor:publish');
                 Artisan::call('migrate');
                 Artisan::call('db:seed', ["--class" => $module->seeder]);
             }
         }
     }
 }
开发者ID:edizarca,项目名称:socms,代码行数:19,代码来源:ModulesTableSeeder.php

示例15: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $json = Storage::get('questions.json');
     $this->command->info($json);
     $questions = json_decode($json, true);
     foreach ($questions['questions'] as $question_keys => $question) {
         $this->command->info("Adding Question: " . $question_keys . "...");
         if ($question["type"] != "true-false") {
             $answers = $question['answers'];
             unset($question['answers']);
         }
         $q = new Question($question);
         $q->save();
         foreach ($question as $question_attribute_name => $question_attribute_value) {
             $this->command->info($question_attribute_name);
         }
         if ($q->type == "true-false") {
             $this->command->info("Adding True/False Question...");
             $answer = $question['answer'];
             $aFalse;
             $aTrue;
             if (Answer::where('text', 'true')->count() >= 1) {
                 $aTrue = Answer::where('text', 'true')->first();
             } else {
                 $aTrue = new Answer(['text' => 'true']);
                 $aTrue->save();
             }
             if (Answer::where('text', 'false')->count() >= 1) {
                 $aFalse = Answer::where('text', 'false')->first();
             } else {
                 $aFalse = new Answer(['text' => 'false']);
                 $aFalse->save();
             }
             $q->answers()->save($aFalse, ['is_correct' => $answer ? 0 : 1]);
             $q->answers()->save($aTrue, ['is_correct' => $answer ? 1 : 0]);
         } else {
             $this->command->info("Adding answers...");
             $answer_ids = array();
             foreach ($answers as $answer_index => $answer) {
                 $this->command->info("Adding " . ($answer_index + 1) . "...");
                 $a = new Answer($answer);
                 $a->save();
                 $q->answers()->save($a, ['is_correct' => $answer['is_correct'] === "false" ? 0 : 1]);
             }
         }
         $this->command->info("");
     }
 }
开发者ID:sgomez118,项目名称:ASM-Software-Management,代码行数:53,代码来源:QuestionSeeder.php


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