I want to move some file with
Storage::move('posts/temp/'.$val,'photos/'.$post->id.'/'.$val);
but it gives me the
File not found at path: home/vagrant/Code/......
is there some special configuration to look for? Btw, the file is indeed at the not found path.
You need to add disk() detail that you are using for example if you are using amazon s3 you need to add disk('s3') before move so the code will be:
Storage::disk('s3')->move('posts/temp/'.$val,'photos/'.$post->id.'/'.$val);
I had to change to:
'disks' => [
'local' => [
'driver' => 'local',
'root' => public_path(),
],
I had the same problem. I stored files in storage app folder (Storage/app/temp_files) for finding the files I tried public_path(), storage_path(), url() but none of this worked for me. But at the end using PHP native function rename() its worked like a charm.
Here is my example of how I implement this
rename(storage_path("app\\temp_files\\$fileNames"),storage_path("app\\post\\$fileNames"));
Where the 1st argument is for the old path and 2nd for the new path e.g.
rename($oldPath, $newPath);
Note: rename will be move(delete file from old location) your file
from old location to new location
Related
I have a problem with a file named
storage\logs\laravel.log
From LARAVEL Project Files
The strange thing is that this file is automatically increased in size every day, so I needed to delete it so that the site would not stop working
Do you have a solution to this problem how to stop this file from working automatically
So that the site does not stop because there is no free space
You can change logging driver to daily. This will create new log file daily, with date in file name.
in config/logging.php
'default' => env('LOG_CHANNEL', 'daily'),
'channels' => [
....
'daily' => [
'driver' => 'daily',
'path' => storage_path('logs/laravel.log'),
'level' => env('LOG_LEVEL', 'debug'),
'days' => 14,
],
....
Set the number days that you want log files to keep. After that the old log files will be deleted automatically.
For more information Check the Laravel documentation for Logging.
After searching around, I found this aws_account_utils which does exactly what I hope to achieve - programmatically create aws account.
Unfortunately as a total ruby noob, I have no idea how to start using it even after reading the README.md.
I suspect I'd need the following steps:
Create create-account.rb
Use the util in the code
Run ruby create-account.rb
How should the content of create-account.rb be like?
Please show me a template.
With that I should be able to start experimenting and hacking.
Any other steps I should do?
Thanks in advance.
Plan below is rough and must be supplemented.
Create Gemfile file. This file is needed to specify project dependencies (libraries)
Put this line into Gemfile
gem 'aws_account_utils'
Run bundle install in your console / terminal
Create create-account.rb file with next code
require 'aws_account_utils'
aws_utils = AwsAccountUtils::AwsAccountUtils.new()
details = { 'fullName' => 'Herman Munster',
'company' => 'The Munsters',
'addressLine1' => '1313 Mockingbird Lane',
'city' => 'Mockingbird Heights',
'state' => 'CA',
'postalCode' => '92000',
'phoneNumber' => '(800) 555-1212',
'guess' => 'Test Account' }
resp = aws_utils.create_account(account_name: 'My Test Account 01',
account_email: 'adfefef#gmail.com',
account_password: 'foobar1212121',
account_details: details)
This code uses aws_account_utils library. Documentation you can find here.
After steps above you can run ruby create-account.rb.
I'm thinking I installed this wrong, but keep getting the same error. Installed league/flysystem-aws-s3-v3. S3 creds are setup in .env file.
Added these to the require in composer.
"aws/aws-sdk-php"
"aws/aws-sdk-php-laravel": "~3.0"
--------------------------------------------
Code:
$s3 = \Storage::disk('s3');
$s3->put($location, file_get_contents($image), 'public');
Getting the following error:
exception 'InvalidArgumentException' with message 'Missing required client configuration options:
' in /var/www/laravel/vendor/aws/aws-sdk-php/src/ClientResolver.php:328
Did some research online and couldn't find a solution.
Try to update :
composer update
Try This: go into config/filesystems.php and eliminate any env that encompasses a value.
For example mine showed 'cloud' => env('FILESYSTEM_CLOUD', 's3'),
so I changed it into 'cloud' => 'FILESYSTEM_CLOUD', 's3',
Do this to ALL values in this file, INCLUDING the S3 key, secret, region, and bucket. After that it should get you up and going.
I believe the issue is with Caching the values as Null rather than the actual edited values.
I have the following flyway.pp Puppet class which installs Flyway onto Windows machines. It copies two files into the installation folder.
class rehan::flyway {
package { 'flyway':
ensure => latest,
provider => chocolatey
}
file { 'C:/Program Files/flyway/ntlmauth.dll':
ensure => 'file',
source => 'puppet:///modules/rehan/manifests/ntlmauth.dll',
}
file { 'C:/Program Files/flyway/drivers/sqljdbc4.jar':
ensure => 'file',
source => 'puppet:///modules/rehan/manifests/sqljdbc4.jar',
}
}
The above modules lives at modules/rehan/manifests/flyway.pp. I have placed the two files ntlmauth.dll and sqljdbc4.jar along side it but it seems a bit messy. Is there a standard directory or location where these files are normally placed? Also, how can I refer to these files using a relative path, I use puppet:///modules/rehan/manifests/ntlmauth.dll because I've seen it somewhere but that does not work.
This could be a bit confusing.
In your module's directory, you should have a subdirectory named 'files' and all files you want to be copied/installed somewhere need to be put there.
The confusing bit is that when addressing one of the objects stored there, you don't mention 'files' in the path!
So,
source => 'puppet:///modules/rehan/sqljdbc4.jar'
picks up the jar file from the following path:
/etc/puppet/modules/rehan/files/sqljdbc4.jar
The reason why puppet:///modules/rehan/manifests/ntlmauth.dll doesn't work is that it maps the path to /etc/puppet/modules/rehan/files/manifests/ntlmauth.dll which doesn't exist.
You can not reference an object located in your manifests directory using puppet:///
I want to use sass/scss in a new project, but it somehow doesn't work.
I am using the yii2-asset-converter and when I try to convert the scss-file, the following error is thrown:
Class #app/extensions/assetparser/vendors/phamlp/sass/SassParser does not exist
I am checking the path ../phamlp/ and notice, that the Folder sass resp. SassParser.php doesn't exist.
The SassParser.php is located in the extension vendor/richthegeek/phpsass, which is required by yii2-asset-converter.
I have tried out some paths like:
# vendor/richthegeek/phpsass or
__DIR__/../../vendor/richthegeek/phpsass
But it doesn't worked .After a lot of unsuccessful attempts I hope some of you know how to solve the problem.
PS:I use the advanced app template
Don't use PhalmP or phpsass. These are outdated. You'll never get satisfactory results with them, especially when using modern Sass libraries.
Use original Sass as a standalone.
Simply install Ruby (you might already have it) and Sass and use the sass command line tool to compile.
Also, using Compass might make your life easier. Compass helps organizing your Sass code and also provides a Sass library with a lot of useful helpers.
You can use this plugin.
But you must combine your sass code in single file.
Here's example of config/web.php
'assetManager'=>[
'converter'=>[
'class'=> 'nizsheanez\assetConverter\Converter',
'force'=> true, // true : If you want convert your sass each time without time dependency
'destinationDir' => '', //at which folder of #webroot put compiled files
'parsers' => [
'scss' => [ // file extension to parse
'class' => 'nizsheanez\assetConverter\Scss',
'output' => 'css', // parsed output file type
'options' => [ // optional options
'enableCompass' => true, // default is true
'importPaths' => ['/sass','/sass/_offers'], // import paths, you may use path alias here,
// e.g., `['#path/to/dir', '#path/to/dir1', ...]`
'lineComments' => true, // if true — compiler will place line numbers in your compiled output
'outputStyle' => 'expanded', // May be `compressed`, `crunched`, `expanded` or `nested`,
// see more at http://sass-lang.com/documentation/file.SASS_REFERENCE.html#output_style
],
],
]
]
]