本文整理汇总了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');
}
示例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;
}
示例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');
}
示例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;
}
示例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));
}
示例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);
}
示例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);
}
示例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);
}
}
示例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));
}
示例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);
}
}
}
示例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;
}
示例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());
}
示例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);
}
示例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]);
}
}
}
}
示例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("");
}
}