SergioGregorutti

SergioGregorutti

Senior Front-end Developer at FansWorld

Buenos Aires

Member Since 3 Years Ago

Experience Points 12,130
Experience
Level
Lessons Completed 221
Lessons
Completed
Best Reply Awards 0
Best Answer
Awards
  • Start Your Engines Achievement

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • First Thousand Achievement

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • One Year Member Achievement

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • Two Year Member Achievement

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • Three Year Member Achievement

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • Four Year Member Achievement

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • Five Year Member Achievement

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • School In Session Achievement

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • Welcome To The Community Achievement

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • Full Time Learner Achievement

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • Pay It Forward Achievement

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • Subscriber Achievement

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • Lifer Achievement

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • Laracasts Evangelist Achievement

    Laracasts Evangelist

    Earned if you share a link to Laracasts on social media. Please email [email protected] with your username and post URL to be awarded this badge.

  • Chatty Cathy Achievement

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • Laracasts Veteran Achievement

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • Ten Thousand Strong Achievement

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • Laracasts Master Achievement

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • Laracasts Tutor Achievement

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • Laracasts Sensei Achievement

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • Top 50 Achievement

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

21 Sep
2 years ago

SergioGregorutti left a reply on [5.2] Get Current Route Name In Blade Templates

@zachleigh Thanks for your asrwer. That's the URI. I need the route name.

SergioGregorutti left a reply on [5.2] Get Current Route Name In Blade Templates

@SaeedPrez thanks for your reply. I forgot to tell that Im using Laravel 5.2 :(

SergioGregorutti started a new conversation [5.2] Get Current Route Name In Blade Templates

Hi all,

This seems to be a simple question but I can't figure out how to do it.

I need to know what is the current route name in a Blade template to be able to do something like: ´´´ @if ($currentRoute == 'homepage') ... ´´´

Can someone help me on this?

Thanks in advance!

03 Jul
2 years ago

SergioGregorutti started a new conversation Conflict Between Eloquence And Sluggable Packages

Hi everyone,

I'm using both packages (Eloquence and Sluggable) in my project with Laravel 5.2 and it seems like there's a blocker issue.

I get this error on my models:

Trait method replicate has not been applied, because there are collisions with other trait methods on App\User

This is because both packages have a "replicate" method and there's a conflict. I know that the solution is something related to this: http://php.net/manual/en/language.oop5.traits.php#language.oop5.traits.conflict

But, with my experience I don't know how to apply that solution. Can someone help me on this?

Thanks in advance!

02 Jul
2 years ago

SergioGregorutti left a reply on Where Are You All From?

I am from Buenos Aires, Argentina! The country of Messi :)

SergioGregorutti left a reply on [Upgrading To 5.2] Trait Method Replicate Has Not Been Applied, Because There Are Collisions With Other Trait Methods

@zachleigh thanks again for your response.

You're right. But the problem is between Eloquence and Sluggable. To be more specific, this is my issue: https://github.com/cviebrock/eloquent-sluggable/issues/287

Anyway, I understand the problem now but I don't know what exactly I need to do.

Can you share a snipped or be a little more specific?

Thanks in advance!

SergioGregorutti left a reply on [Upgrading To 5.2] Trait Method Replicate Has Not Been Applied, Because There Are Collisions With Other Trait Methods

Oh, all the models that have the problem are using Eloquence (~5.2@dev) and Sluggable (^4.0.2).

SergioGregorutti left a reply on [Upgrading To 5.2] Trait Method Replicate Has Not Been Applied, Because There Are Collisions With Other Trait Methods

@zachleigh Thanks for your quick response.

This is my User model:

<?php namespace Argemundo;

use Illuminate\Foundation\Auth\User as Authenticatable;
use Sofa\Eloquence\Eloquence;
use Cviebrock\EloquentSluggable\Sluggable;
use Illuminate\Database\Eloquent\SoftDeletes;

class User extends Authenticatable
{

    use Sluggable, SoftDeletes, Eloquence;

    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'fb_id',
        'tw_id',
        'name',
        'email',
        'password',
        'avatar',
        'has_commerces',
        'email_comment_response',
        'email_commerce_comment',
        'email_commerce_recommendation',
        'email_admin_notifications'
    ];

    /**
     * Set the soft delete status.
     *
     * @var boolean
     */
    protected $dates = ['deleted_at'];

    /**
     * The attributes excluded from the model's JSON form.
     *
     * @var array
     */
    protected $hidden = ['password', 'remember_token'];

    /**
     * Return the sluggable configuration array for this model.
     *
     * @return array
     */
    public function sluggable()
    {
        return [
            'slug' => [
                'source' => 'name'
            ]
        ];
    }

    /**
     * Default searchable columns.
     *
     * @var array
     */
    protected $searchableColumns = ['name', 'email'];

    /**
     * The commerces that belong to the user.
     */
    public function commerces()
    {
        return $this->belongsToMany('Argemundo\Commerce');
    }

}

Anyway, the same problem is happening in other models.

SergioGregorutti started a new conversation [Upgrading To 5.2] Trait Method Replicate Has Not Been Applied, Because There Are Collisions With Other Trait Methods

Hi all,

Im trying to update my Laravel application from 5.1.* to 5.2 and I'm dealing with this problem.

It seems like there's a problem with Models/Eloquent or so. This is the error:

FatalErrorException in User.php line 8:
Trait method replicate has not been applied, because there are collisions with other trait methods on Argemundo\User
...
in User.php line 8
at FatalErrorException->__construct() in HandleExceptions.php line 132
at HandleExceptions->fatalExceptionFromError() in HandleExceptions.php line 118
at HandleExceptions->handleShutdown() in HandleExceptions.php line 0
in ClassLoader.php line 412
at Composer\Autoload\includeFile() in ClassLoader.php line 301
at ClassLoader->loadClass() in Model.php line 797
at spl_autoload_call() in Model.php line 797
at Model->belongsTo() in CommerceComment.php line 36
at CommerceComment->user() in Builder.php line 692
at Builder->Illuminate\Database\Eloquent\{closure}() in Relation.php line 184
at call_user_func:{/home/vagrant/Code/argemundo_app/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/Relation.php:184}() in Relation.php line 184

I really don't have any idea of where the error comes from. Any ideas?

Thanks in advance.

06 May
2 years ago

SergioGregorutti left a reply on Homestead: Not Working After "El Capitan" Installation

Update: I just made the "re-installing virtual box, vagrant and then clone homestead again" and the error still persist.

Any other ideas to try?

SergioGregorutti left a reply on Homestead: Not Working After "El Capitan" Installation

@JMarcher Im just trying with "vagrant up"

@ejdelmonico Im doing that. If I had lucky I'll let you know.

Thanks!

SergioGregorutti started a new conversation Homestead: Not Working After "El Capitan" Installation

Hi all,

Im using Homestead on a Mac OS. After the "El Capitan" os update I had a lot of issues.

I installed last versions of VirtualBox and Vagrant, and now when I hit the "vagrant up" I get this error:

The SSH connection was unexpectedly closed by the remote end. This
usually indicates that SSH within the guest machine was unable to
properly start up. Please boot the VM in GUI mode to check whether
it is booting properly.

I don`t know how to fix this issue. Any ideas? Maybe I need to re-install everything from scratch? (how?)

Thanks in advance!

03 May
2 years ago

SergioGregorutti started a new conversation How Can I Create Different Environments With Subdomains?

Hi all,

I have a Laravel application and I was wondering how can I create a dev and stage environment.

I mean, for example if I have www.myapplication.com I want a dev.myapplication.com and stage.myapplication.com with different deployment script, ddbb and environment variables for each domain but with the same application.

Im not sure how can I do this. Im using GoDaddy for my domain, Laravel Forge + Digital Ocean.

Anyone have an idea of how can I figure out this?

Thanks in advance!

02 May
2 years ago

SergioGregorutti started a new conversation How Can I Create Different Environments With Subdomains?

Hi all,

I have a Laravel application and I was wondering how can I create a dev and stage environment.

I mean, for example if I have www.myapplication.com I want a dev.myapplication.com and stage.myapplication.com with different deployment script, ddbb and environment variables for each domain but with the same application.

Im not sure how can I do this. Im using GoDaddy for my domain, Laravel Forge + Digital Ocean.

Anyone have an idea of how can I figure out this?

Thanks in advance!

29 Jan
2 years ago

SergioGregorutti started a new conversation How To Make Posts On Facebook Pages With SDK?

Hi all,

I want to make posts on my Facebook pages with a cronjob using a Laravel package. I don't know if its possible. I can't find a tutorial or something like that.

I fount this package: https://github.com/SammyK/LaravelFacebookSdk

But I don't know how to use it to make a post on a Facebook page.

Can someone help me?

Thanks in advance!

09 Jan
2 years ago

SergioGregorutti started a new conversation Laravel Pagination: Change Page Parameter Name

Hi all,

I want to make a simple change on the Laravel pagination.

By default I get a "?page=x" URI but I need this: "?pag=x".

How can I make this change? I read the documentation and I found this:

Customizing The Paginator URI

The setPath method allows you to customize the URI used by the paginator when generating links. For example, if you want the paginator to generate links like http://example.com/custom/url?page=N, you should pass custom/url to the setPath method:

Route::get('users', function () {
    $users = App\User::paginate(15);

    $users->setPath('custom/url');

    //
});

But it is no so clear for me.

Can someone help me?

Thanks in advance!

03 Jan
2 years ago

SergioGregorutti left a reply on $config->set Not Working?

The problem was in the helper function. Thanks both!

SergioGregorutti started a new conversation $config->set Not Working?

Hi all,

I'm using the Config facade to set and use global variables on my site and it's working fine, but I have a problem.

On the AppServiceProvider.php (boot method) Im doing this:

$config->set('world.name', 'Mundo Hurlingham');

And then on a controller Im trying to overwrite the value doing this:

$config->set('world.name', 'Test');
echo "Result: ".config('world.name').'.';

But the problem is that the config('world.name') result is always "Mundo Hurlingham". And then I use the value on a view an is still the old value.

How can I overwrite the value? Is there a way to do this? Maybe clearing the cache or something like that?

Thanks in advance!

18 Dec
2 years ago

SergioGregorutti left a reply on I Can't See My Artisan Created Command

Thanks @ohffs

That was the key. Is not so clear in the docs. Now is working fine.

SergioGregorutti left a reply on I Can't See My Artisan Created Command

@ohffs Sorry, that was a mistake on my post.

Even with 'emails:send' is not working. And there's no new command on the artisan commands list.

SergioGregorutti started a new conversation I Can't See My Artisan Created Command

Hi everyone,

Im trying to create an Artisan command but for some reason is not working.

I can see my command on the list (php artisan list) and when I hit it I get this error:

[InvalidArgumentException]                               
  There are no commands defined in the "email" namespace.

I followed the steps on the official documentation: http://laravel.com/docs/5.1/artisan#writing-commands

This is my file generated on 'app/Console/Commands/SendEmails.php':

<?php

namespace Argemundo\Console\Commands;

use Illuminate\Console\Command;

class SendEmails extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'emails:send';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Send Emails queue';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
        $this->info('Test.');
    }
}

My Laravel version is 5.1.26 (LTS). I "think" that is working fine. I upgrated it manually.

Can someone help me?

Thanks in advance!

15 Dec
2 years ago

SergioGregorutti started a new conversation How To Show 404 Error Page When "No Input File Specified" Appears?

Hi all,

I just launched a Laravel application replacing an existing site.

The problem is that Google has a lot of pages indexed from the old site with urls like: "/results.php?id=3".

And when I click the link I go to the new website but the "No input file specified" error appears.

How can I show a 404 error page instead or handle this error to redirect to the new page?

Thanks in advance!

11 Dec
2 years ago

SergioGregorutti started a new conversation [Laravel Intervention Image] Image Source Not Readable

Hi all,

I'm trying to import images from an external server with the Intervention Image package and if the image exists and it's readable it's works fine.

But some images are not readable and I get this error:

NotReadableException in AbstractDecoder.php line 302:
Image source not readable

I know that if the image doesn't exists I can't create it, but I want to say to the script "Hey, if the images is not readable continuous with the next image".

This is my script:

public function importCommerceImage() {
        $commerces = DB::table('am_avisos')->where('Estado', 'Habilitado')->where('FotoImportada', null)->take
        (5)->get();

        foreach ($commerces as $oldCommerce) {
            $commerce = Commerce::find($oldCommerce->Id);

            // Path:
            $path = 'sites/test/'.'images/commerces/'.$commerce->id.'/';

            // Set Image name:
            $imageName = time().'-'.$oldCommerce->Foto;

            // Create Image (normal size):
            try {
                $image = Image::make('http://www.mundohurlingham.com/imagenes/avisos/'.$oldCommerce->Foto)->resize(1000, null, function ($constraint) {
                    $constraint->aspectRatio();
                });
            } catch (Exception $e) {
                //return Redirect::to('img')->withErrors('Error: ' . $e->getMessage());
                dd('Error.');
            }
            $image = $image->stream();
            Storage::disk('s3')->put($path.$imageName, $image->__toString());

            // Create Image (thumbnail):
            $image = Image::make('http://www.mundohurlingham.com/imagenes/avisos/'.$oldCommerce->Foto)->resize(200, null, function ($constraint) {
                $constraint->aspectRatio();
            });
            $image = $image->stream();
            Storage::disk('s3')->put($path.'thumbnail/'.$imageName, $image->__toString());

            // Create Image (thumbnail square):
            $image = Image::make('http://www.mundohurlingham.com/imagenes/avisos/'.$oldCommerce->Foto)->fit(150);
            $image = $image->stream();
            Storage::disk('s3')->put($path.'thumbnail_square/'.$imageName, $image->__toString());

            // Update Commerce:
            $exists = Storage::disk('s3')->exists($path.$imageName);
            if ($exists) {
                $image = $this->getFileFullPath($path.$imageName);
                $imageSrc = $imageName;
                $imageThumbnail = $this->getFileFullPath($path.'thumbnail/'.$imageName);
                $imageThumbnailSquare = $this->getFileFullPath($path.'thumbnail_square/'.$imageName);

                $commerce->image = $image;
                $commerce->image_src = $imageSrc;
                $commerce->image_thumbnail = $imageThumbnail;
                $commerce->image_thumbnail_square = $imageThumbnailSquare;
                $commerce->save();

                DB::table('am_avisos')
                    ->where('Id', $oldCommerce->Id)
                    ->update(['FotoImportada' => 'Si']);
            }
        }

        flash()->success('Las fotos de los negocios han sido importadas exitosamente.');
        return redirect(route('admin.configuration'));
    }

How can I manage the exception to continuous with the foreach loop?

Thanks in advance!

22 Oct
3 years ago

SergioGregorutti started a new conversation Calling A Repository Method From A Seeder Class

Hi all,

Im trying to call a Repository method from a Seeder class but I get an error:

[ErrorException]                                                                                                                                             
  Non-static method Argemundo\Repositories\GuideRepository::updateGuideCategories() should not be called statically, assuming $this from incompatible context

This is my seeder class:

<?php
use Illuminate\Database\Seeder;
use Illuminate\Database\Eloquent\Model;
use Argemundo\Repositories\GuideRepository;

class CommerceCategoriesSeeder extends Seeder {

    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        Model::unguard();

        DB::table('commerce_category')->insert([
            'commerce_id' => 1,
            'category_id' => 9,
            'category_type' => 'Argemundo\CommercesCategoryLevel1',
            'children' => 2]);

        GuideRepository::updateGuideCategories();
    }

}

I dont know is this is possible. Can someone help me?

Thanks in advance!

16 Oct
3 years ago

SergioGregorutti left a reply on Rev-manifest.json Is Not Updated (Heroku Environment)

Well.. It seems to be a Heroku specific issue but not related with paths.

There's no SSH access to a Heroku server. Instead I can run "heroku run bash" that is similar but if I delete a file there nothing happens on the site. I don't know how the "dynos" work.

For a begginer/intermediate developer working with Laravel and Heroku is a headache hehe

Thanks for your help... I'll try to contact Heroku help center.

SergioGregorutti left a reply on Rev-manifest.json Is Not Updated (Heroku Environment)

Everything seems to be right:

...

[18:24:45] Starting 'version'...

Fetching Version Source Files...
   - ./public/css/app.css
   - ./public/css/admin.css
   - ./public/css/forms.css
   - ./public/js/app.js
   - ./public/js/forms.js
   - ./public/js/landing.js
   - ./public/js/admin/app.js


Saving To...
   - public/build

[18:24:45] Finished 'version' after 105 ms

SergioGregorutti started a new conversation Rev-manifest.json Is Not Updated (Heroku Environment)

Hi all,

I have a Laravel application on a Heroku server.

Im using the Heroku multi buildpack that includes PHP, Node, Gulp, etc.

My Gulp file is working fine on my local environment but for some reason when I hit the "gulp" command on Heroku ("heroku run gulp") the files are generated but the rev-manifest.json is not updated, so I can't see the changes on the site.

This is my gulp file:

var gulp = require("gulp");
var elixir = require('laravel-elixir');

elixir(function(mix) {
    // Compile main less styles
    mix.less('global.less');

    // Compile admin less styles
    mix.less('global-admin.less');

    // jQuery
    mix.copy(
        'vendor/bower_components/jquery/dist/jquery.min.js',
        'public/js/vendor/jquery.js'
    );

    // Bootstrap JS
    mix.copy(
        'vendor/bower_components/bootstrap/dist/js/bootstrap.min.js',
        'public/js/vendor/bootstrap.js'
    );

    // Checkboxes
    mix.copy(
        'vendor/bower_components/jquery-icheck/icheck.min.js',
        'public/js/vendor/checkboxes.js'
    );
    mix.copy(
        'vendor/bower_components/jquery-icheck/skins/minimal/blue.css',
        'public/css/vendor/checkboxes.css'
    );

    // jQuery Validate
    mix.copy(
        'vendor/bower_components/jquery-validate/dist/jquery.validate.min.js',
        'public/js/vendor/validation.js'
    );

    // Select2
    mix.copy(
        'vendor/bower_components/select2/dist/js/select2.full.min.js',
        'public/js/vendor/selects.js'
    );
    mix.copy(
        'vendor/bower_components/select2/dist/css/select2.min.css',
        'public/css/vendor/selects.css'
    );

    // Jasny Bootstrap
    mix.copy(
        'vendor/bower_components/jasny-bootstrap/dist/js/jasny-bootstrap.min.js',
        'public/js/vendor/jasny.js'
    );
    mix.copy(
        'vendor/bower_components/jasny-bootstrap/dist/css/jasny-bootstrap.min.css',
        'public/css/vendor/jasny.css'
    );

    // DataTables
    mix.copy(
        'vendor/bower_components/datatables/media/js/jquery.dataTables.min.js',
        'public/js/vendor/datatables.js'
    );
    mix.copy(
        'vendor/bower_components/datatables/media/js/dataTables.bootstrap.min.js',
        'public/js/vendor/datatables-bootstrap.js'
    );
    mix.copy(
        'vendor/bower_components/datatables/media/css/dataTables.bootstrap.min.css',
        'public/css/vendor/datatables-bootstrap.css'
    );

    // Compile app.css
    mix.styles([
        'global.css'
    ], 'public/css/app.css', 'public/css');

    // Compile admin.css
    mix.styles([
        'global-admin.css',
        'vendor/datatables-bootstrap.css'
    ], 'public/css/admin.css', 'public/css');

    // Compile app.js
    mix.scripts([
        'vendor/jquery.js',
        'vendor/bootstrap.js',
        'controllers/general-controller.js',
        'controllers/common/login-controller.js'
    ], 'public/js/app.js', 'public/js');

    // Compile forms.css
    mix.styles([
        'vendor/checkboxes.css',
        'vendor/selects.css',
        'vendor/jasny.css'
    ], 'public/css/forms.css', 'public/css');

    // Compile forms.js
    mix.scripts([
        'vendor/checkboxes.js',
        'vendor/selects.js',
        'vendor/jasny.js',
        'vendor/validation.js',
        'controllers/forms-controller.js'
    ], 'public/js/forms.js', 'public/js');

    // Compile landing.js
    mix.scripts([
        'controllers/landing-controller.js'
    ], 'public/js/landing.js', 'public/js');

    // Compile app.js (admin)
    mix.scripts([
        'vendor/datatables.js',
        'vendor/datatables-bootstrap.js'
    ], 'public/js/admin/app.js', 'public/js');

    // Version scripts
    mix.version([
        "./public/css/app.css",
        "./public/css/admin.css",
        "./public/css/forms.css",
        "./public/js/app.js",
        "./public/js/forms.js",
        "./public/js/landing.js",
        "./public/js/admin/app.js"
    ]);
});

gulp.task('heroku:', function() {
    console.log('Heroku stage');
});

Any ideas of what can be happening?

Thanks in advance!

05 Oct
3 years ago

SergioGregorutti left a reply on Heroku: Failed To Create Symbolic Link ‘./heroku-hhvm-apache2’: File Exists

Im still dealing with this issue. Anyone had the same problem?

24 Sep
3 years ago

SergioGregorutti left a reply on API + Backoffice + Front End: Code Organization

Thanks @luddinus

Another suggestions/ideas are welcome!

SergioGregorutti started a new conversation Route Not Defined (environment Problem)

Hi all,

Im dealing with a weird problem. Im getting on my local environment (Homestead - Mac OS) this error:

ErrorException in UrlGenerator.php line 278:
Route [homepage] not defined. (View: /home/vagrant/Code/argemundo/resources/views/partials/header.blade.php) (View: /home/vagrant/Code/argemundo/resources/views/partials/header.blade.php) (View: /home/vagrant/Code/argemundo/resources/views/partials/header.blade.php)

The route is already defined and the same code is working on another local environment (Homestead - Linux) and on a stage server (Laravel Forge). That is why I think that is an environment problem.

I tried restoring the vagrant machine but issue still persist.

Any ideas of what is happening?

Thanks!

23 Sep
3 years ago

SergioGregorutti started a new conversation API + Backoffice + Front End: Code Organization

Hi all,

Im working on my first Laravel project and I have an API, a Backoffice and of course the front end.

For each one I have different controllers and my concern is about what is the best way to improve the code and not repeat it.

For example, on my application for "Create a new commerce" I have 3 ways to do it:

  • via Backoffice (with backoffice Admin/CommerceController)
  • via Front end (the register user with CommerceController)
  • via API (API/CommerceController, maybe in the future from a native mobile app)

So, I have 3 times the same code. What is the best approach to have the code just once? I think that maybe I need to do all the actions with the API, and call it from Front-end/Backoffice controllers, but how?

Any suggestions?

Thanks in advance!

15 Sep
3 years ago

SergioGregorutti left a reply on Amazon S3 Files: Get Full Url Of File Uploaded And Set Permissions To Public

Ok, I finally fix the error.

The problem was in the Amazon S3 bucket configuration.

In the Bucket Policy Editor I added this:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "AddPerm",
            "Effect": "Allow",
            "Principal": "*",
            "Action": [
                "s3:GetObject"
            ],
            "Resource": [
                "arn:aws:s3:::{{my_bucket_name}}/*"
            ]
        }
    ]
}

And now is working :)

More info: https://docs.aws.amazon.com/AmazonS3/latest/dev/example-bucket-policies.html

Thanks @jakeryansmith for your help.

SergioGregorutti left a reply on Amazon S3 Files: Get Full Url Of File Uploaded And Set Permissions To Public

According to Laravel docs, when I try this:

$exists = Storage::disk('s3')->exists('file.jpg');

I get this error:

S3Exception in WrappedHttpHandler.php line 152:
Error executing "HeadObject" on "https://s3-us-west-2.amazonaws.com/argemundoapp/images/commerces/24/1442321281-cocinapng"; AWS HTTP error: Client error: 403 (client): 403 Forbidden (Request-ID: C586DCB415A7790D) -

And I dont know why.

14 Sep
3 years ago

SergioGregorutti started a new conversation Amazon S3 Files: Get Full Url Of File Uploaded And Set Permissions To Public

Hi all,

Im working with an Amazon S3 bucket. The upload functionality is working fine.

But I dont know how to do a simple thing like show an image uploaded to the Amazon S3 bucket.

How can I get the link to the image?

Also, I dont know how to set the permissions of the file to public. By default the owner can see the image.

Thanks!

SergioGregorutti left a reply on Saving An Intervention Image Instance Into Amazon S3

@JustinLien Saving it to AWS.

But finally I fixed the error and now is working.

Here´s is the code. Maybe it will help someone on the future:

...
$image_normal = Image::make($image)->widen(800, function ($constraint) {
            $constraint->upsize();
        });
        $image_thumb = Image::make($image)->crop(100,100);
        $image_normal = $image_normal->stream();
        $image_thumb = $image_thumb->stream();

        Storage::disk('s3')->put($path.$file, $image_normal->__toString());
        Storage::disk('s3')->put($path.'thumbnails/'.$file, $image_thumb->__toString());

The key was using "->stream()" and then "->__toString()".

SergioGregorutti left a reply on Saving An Intervention Image Instance Into Amazon S3

I read something about using this:

$img->stream()

But the error still persist.

SergioGregorutti started a new conversation Saving An Intervention Image Instance Into Amazon S3

Hi,

Im using Intervention Image to create thumbnails, etc. And I want to save the file into a Amazon S3 bucket.

This gives me an error:

...
$image = Image::make($image)->widen(800);
Storage::disk('s3')->put($path.$file, $image);
fstat() expects parameter 1 to be resource, object given

I think that I can save the image on my public directory and then copy the file into the bucket.

But, is there a best approach to do this? Like create the image and then save it into the bucket?

Thanks!

SergioGregorutti left a reply on Composer Error With League/flysystem-aws-s3-v3 ~1.0

Its weird.. I made the "composer self-update" and the error still persist.

Btw, this is the list of the packages that I have:

    "require": {
        "laravel/framework": "5.1.*",
        "laravel/socialite": "~2.0",
        "barryvdh/laravel-debugbar": "~2.0",
        "jenssegers/agent": "~2.1",
        "laravelcollective/html": "5.1.*",
        "guzzlehttp/guzzle": "~4.0",
        "laracasts/flash": "~1.3",
        "cviebrock/eloquent-sluggable": "dev-master",
        "intervention/image": "^2.3",
        "lord/laroute" : "2.*",
        "dingo/api": "0.10.*",
        "yajra/laravel-datatables-oracle": "~5.0"
    },
    "require-dev": {
        "phpunit/phpunit": "~4.0",
        "phpspec/phpspec": "~2.1",
        "laracasts/testdummy": "~2.0"
    },

SergioGregorutti left a reply on Error Trying To Upload A File On Amazon S3

@sid405 Yes, sorry. I dont know if I made the correct thing. They are different errors.

Im using Laravel 5.1.16

SergioGregorutti left a reply on Error Trying To Upload A File On Amazon S3

You are right @michaelvolst.

But, now Im trying to install "league/flysystem-aws-s3-v3 ~1.0" and I dealing with this issue:

Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - league/flysystem-aws-s3-v3 1.0.0 requires aws/aws-sdk-php 3.*@dev -> satisfiable by aws/aws-sdk-php[3.0.0, 3.0.1, 3.0.2, 3.0.3, 3.0.4, 3.0.5, 3.0.6, 3.0.7, 3.1.0, 3.2.0, 3.2.1, 3.2.2, 3.2.3, 3.2.4, 3.2.5, 3.2.6, 3.3.0, 3.3.1, 3.3.2, 3.3.3, 3.3.4, 3.3.5].
    - league/flysystem-aws-s3-v3 1.0.1 requires aws/aws-sdk-php ^3.0.0 -> satisfiable by aws/aws-sdk-php[3.0.0, 3.0.1, 3.0.2, 3.0.3, 3.0.4, 3.0.5, 3.0.6, 3.0.7, 3.1.0, 3.2.0, 3.2.1, 3.2.2, 3.2.3, 3.2.4, 3.2.5, 3.2.6, 3.3.0, 3.3.1, 3.3.2, 3.3.3, 3.3.4, 3.3.5].
    - league/flysystem-aws-s3-v3 1.0.2 requires aws/aws-sdk-php ^3.0.0 -> satisfiable by aws/aws-sdk-php[3.0.0, 3.0.1, 3.0.2, 3.0.3, 3.0.4, 3.0.5, 3.0.6, 3.0.7, 3.1.0, 3.2.0, 3.2.1, 3.2.2, 3.2.3, 3.2.4, 3.2.5, 3.2.6, 3.3.0, 3.3.1, 3.3.2, 3.3.3, 3.3.4, 3.3.5].
    - league/flysystem-aws-s3-v3 1.0.3 requires aws/aws-sdk-php ^3.0.0 -> satisfiable by aws/aws-sdk-php[3.0.0, 3.0.1, 3.0.2, 3.0.3, 3.0.4, 3.0.5, 3.0.6, 3.0.7, 3.1.0, 3.2.0, 3.2.1, 3.2.2, 3.2.3, 3.2.4, 3.2.5, 3.2.6, 3.3.0, 3.3.1, 3.3.2, 3.3.3, 3.3.4, 3.3.5].
    - league/flysystem-aws-s3-v3 1.0.4 requires aws/aws-sdk-php ^3.0.0 -> satisfiable by aws/aws-sdk-php[3.0.0, 3.0.1, 3.0.2, 3.0.3, 3.0.4, 3.0.5, 3.0.6, 3.0.7, 3.1.0, 3.2.0, 3.2.1, 3.2.2, 3.2.3, 3.2.4, 3.2.5, 3.2.6, 3.3.0, 3.3.1, 3.3.2, 3.3.3, 3.3.4, 3.3.5].
    - aws/aws-sdk-php 3.3.5 requires guzzlehttp/guzzle ~5.3|~6.0.1|~6.1 -> no matching package found.
    - aws/aws-sdk-php 3.3.4 requires guzzlehttp/guzzle >=5.3|~6.0.1|~6.1 -> no matching package found.
    - aws/aws-sdk-php 3.3.3 requires guzzlehttp/guzzle >=5.3|~6.0.1|~6.1 -> no matching package found.
    - aws/aws-sdk-php 3.3.2 requires guzzlehttp/guzzle >=5.3|~6.0.1|~6.1 -> no matching package found.
    - aws/aws-sdk-php 3.3.1 requires guzzlehttp/guzzle >=5.3|~6.0.1|~6.1 -> no matching package found.
    - aws/aws-sdk-php 3.3.0 requires guzzlehttp/guzzle >=5.3|~6.0.1|~6.1 -> no matching package found.
    - aws/aws-sdk-php 3.2.6 requires guzzlehttp/guzzle >=5.3|~6.0.1|~6.1 -> no matching package found.
    - aws/aws-sdk-php 3.2.5 requires guzzlehttp/guzzle >=5.3|~6.0.1|~6.1 -> no matching package found.
    - aws/aws-sdk-php 3.2.4 requires guzzlehttp/guzzle >=5.3|~6.0.1|~6.1 -> no matching package found.
    - aws/aws-sdk-php 3.2.3 requires guzzlehttp/guzzle >=5.3|~6.0.1|~6.1 -> no matching package found.
    - aws/aws-sdk-php 3.2.2 requires guzzlehttp/guzzle >=5.3|~6.0.1|~6.1 -> no matching package found.
    - aws/aws-sdk-php 3.2.1 requires guzzlehttp/guzzle >=5.3|~6.0.1|~6.1 -> no matching package found.
    - aws/aws-sdk-php 3.2.0 requires guzzlehttp/guzzle >=5.3|~6.0.1|~6.1 -> no matching package found.
    - aws/aws-sdk-php 3.1.0 requires guzzlehttp/guzzle >=5.3|~6.0.1|~6.1 -> no matching package found.
    - aws/aws-sdk-php 3.0.7 requires guzzlehttp/guzzle >=5.3|~6.0.1|~6.1 -> no matching package found.
    - aws/aws-sdk-php 3.0.6 requires guzzlehttp/guzzle >=5.3|~6.0.1|~6.1 -> no matching package found.
    - aws/aws-sdk-php 3.0.5 requires guzzlehttp/guzzle >=5.3|~6.0.1|~6.1 -> no matching package found.
    - aws/aws-sdk-php 3.0.4 requires guzzlehttp/guzzle >=5.3|~6.0.1|~6.1 -> no matching package found.
    - aws/aws-sdk-php 3.0.3 requires guzzlehttp/guzzle >=5.3|~6.0.1|~6.1 -> no matching package found.
    - aws/aws-sdk-php 3.0.2 requires guzzlehttp/guzzle >=5.3|~6.0.1|~6.1 -> no matching package found.
    - aws/aws-sdk-php 3.0.1 requires guzzlehttp/guzzle >=5.3|~6.0.1|~6.1 -> no matching package found.
    - aws/aws-sdk-php 3.0.0 requires guzzlehttp/guzzle ^5.3 || ^6.0.1 -> no matching package found.
    - Installation request for league/flysystem-aws-s3-v3 ~1.0 -> satisfiable by league/flysystem-aws-s3-v3[1.0.0, 1.0.1, 1.0.2, 1.0.3, 1.0.4].

Potential causes:
 - A typo in the package name
 - The package is not available in a stable-enough version according to your minimum-stability setting
   see <https://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion> for more details.

Read <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.

Installation failed, reverting ./composer.json to its original content.

SergioGregorutti started a new conversation Composer Error With League/flysystem-aws-s3-v3 ~1.0

Hi,

Im trying to install the league/flysystem-aws-s3-v3 ~1.0 to use the Laravel Filesystem.

But when I hit the "composer require league/flysystem-aws-s3-v3 ~1.0" I get this error:

Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - league/flysystem-aws-s3-v3 1.0.0 requires aws/aws-sdk-php 3.*@dev -> satisfiable by aws/aws-sdk-php[3.0.0, 3.0.1, 3.0.2, 3.0.3, 3.0.4, 3.0.5, 3.0.6, 3.0.7, 3.1.0, 3.2.0, 3.2.1, 3.2.2, 3.2.3, 3.2.4, 3.2.5, 3.2.6, 3.3.0, 3.3.1, 3.3.2, 3.3.3, 3.3.4, 3.3.5].
    - league/flysystem-aws-s3-v3 1.0.1 requires aws/aws-sdk-php ^3.0.0 -> satisfiable by aws/aws-sdk-php[3.0.0, 3.0.1, 3.0.2, 3.0.3, 3.0.4, 3.0.5, 3.0.6, 3.0.7, 3.1.0, 3.2.0, 3.2.1, 3.2.2, 3.2.3, 3.2.4, 3.2.5, 3.2.6, 3.3.0, 3.3.1, 3.3.2, 3.3.3, 3.3.4, 3.3.5].
    - league/flysystem-aws-s3-v3 1.0.2 requires aws/aws-sdk-php ^3.0.0 -> satisfiable by aws/aws-sdk-php[3.0.0, 3.0.1, 3.0.2, 3.0.3, 3.0.4, 3.0.5, 3.0.6, 3.0.7, 3.1.0, 3.2.0, 3.2.1, 3.2.2, 3.2.3, 3.2.4, 3.2.5, 3.2.6, 3.3.0, 3.3.1, 3.3.2, 3.3.3, 3.3.4, 3.3.5].
    - league/flysystem-aws-s3-v3 1.0.3 requires aws/aws-sdk-php ^3.0.0 -> satisfiable by aws/aws-sdk-php[3.0.0, 3.0.1, 3.0.2, 3.0.3, 3.0.4, 3.0.5, 3.0.6, 3.0.7, 3.1.0, 3.2.0, 3.2.1, 3.2.2, 3.2.3, 3.2.4, 3.2.5, 3.2.6, 3.3.0, 3.3.1, 3.3.2, 3.3.3, 3.3.4, 3.3.5].
    - league/flysystem-aws-s3-v3 1.0.4 requires aws/aws-sdk-php ^3.0.0 -> satisfiable by aws/aws-sdk-php[3.0.0, 3.0.1, 3.0.2, 3.0.3, 3.0.4, 3.0.5, 3.0.6, 3.0.7, 3.1.0, 3.2.0, 3.2.1, 3.2.2, 3.2.3, 3.2.4, 3.2.5, 3.2.6, 3.3.0, 3.3.1, 3.3.2, 3.3.3, 3.3.4, 3.3.5].
    - aws/aws-sdk-php 3.3.5 requires guzzlehttp/guzzle ~5.3|~6.0.1|~6.1 -> no matching package found.
    - aws/aws-sdk-php 3.3.4 requires guzzlehttp/guzzle >=5.3|~6.0.1|~6.1 -> no matching package found.
    - aws/aws-sdk-php 3.3.3 requires guzzlehttp/guzzle >=5.3|~6.0.1|~6.1 -> no matching package found.
    - aws/aws-sdk-php 3.3.2 requires guzzlehttp/guzzle >=5.3|~6.0.1|~6.1 -> no matching package found.
    - aws/aws-sdk-php 3.3.1 requires guzzlehttp/guzzle >=5.3|~6.0.1|~6.1 -> no matching package found.
    - aws/aws-sdk-php 3.3.0 requires guzzlehttp/guzzle >=5.3|~6.0.1|~6.1 -> no matching package found.
    - aws/aws-sdk-php 3.2.6 requires guzzlehttp/guzzle >=5.3|~6.0.1|~6.1 -> no matching package found.
    - aws/aws-sdk-php 3.2.5 requires guzzlehttp/guzzle >=5.3|~6.0.1|~6.1 -> no matching package found.
    - aws/aws-sdk-php 3.2.4 requires guzzlehttp/guzzle >=5.3|~6.0.1|~6.1 -> no matching package found.
    - aws/aws-sdk-php 3.2.3 requires guzzlehttp/guzzle >=5.3|~6.0.1|~6.1 -> no matching package found.
    - aws/aws-sdk-php 3.2.2 requires guzzlehttp/guzzle >=5.3|~6.0.1|~6.1 -> no matching package found.
    - aws/aws-sdk-php 3.2.1 requires guzzlehttp/guzzle >=5.3|~6.0.1|~6.1 -> no matching package found.
    - aws/aws-sdk-php 3.2.0 requires guzzlehttp/guzzle >=5.3|~6.0.1|~6.1 -> no matching package found.
    - aws/aws-sdk-php 3.1.0 requires guzzlehttp/guzzle >=5.3|~6.0.1|~6.1 -> no matching package found.
    - aws/aws-sdk-php 3.0.7 requires guzzlehttp/guzzle >=5.3|~6.0.1|~6.1 -> no matching package found.
    - aws/aws-sdk-php 3.0.6 requires guzzlehttp/guzzle >=5.3|~6.0.1|~6.1 -> no matching package found.
    - aws/aws-sdk-php 3.0.5 requires guzzlehttp/guzzle >=5.3|~6.0.1|~6.1 -> no matching package found.
    - aws/aws-sdk-php 3.0.4 requires guzzlehttp/guzzle >=5.3|~6.0.1|~6.1 -> no matching package found.
    - aws/aws-sdk-php 3.0.3 requires guzzlehttp/guzzle >=5.3|~6.0.1|~6.1 -> no matching package found.
    - aws/aws-sdk-php 3.0.2 requires guzzlehttp/guzzle >=5.3|~6.0.1|~6.1 -> no matching package found.
    - aws/aws-sdk-php 3.0.1 requires guzzlehttp/guzzle >=5.3|~6.0.1|~6.1 -> no matching package found.
    - aws/aws-sdk-php 3.0.0 requires guzzlehttp/guzzle ^5.3 || ^6.0.1 -> no matching package found.
    - Installation request for league/flysystem-aws-s3-v3 ~1.0 -> satisfiable by league/flysystem-aws-s3-v3[1.0.0, 1.0.1, 1.0.2, 1.0.3, 1.0.4].

Potential causes:
 - A typo in the package name
 - The package is not available in a stable-enough version according to your minimum-stability setting
   see <https://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion> for more details.

Read <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.

Installation failed, reverting ./composer.json to its original content.

Can someone help me with this error?

Thanks in advance!

11 Sep
3 years ago

SergioGregorutti left a reply on Error Trying To Upload A File On Amazon S3

@vitorarjol Thanks for your response.

Yes, I added all the composer requirements mentioned there and the error still persist. Also I added the Providers.

I read the official documentation: http://laravel.com/docs/5.1/filesystem

But is not so clear when it does work and there is no much information about this error.

SergioGregorutti started a new conversation Error Trying To Upload Fine On Amason S3

Hi all,

Im trying to upload an image to a Amazon S3 bucket but Im dealing with this error:

Class 'League\Flysystem\AwsS3v3\AwsS3Adapter' not found

In my composer.json file I have:

...
"yajra/laravel-datatables-oracle": "~5.0",
"league/flysystem-aws-s3-v2": "~1.0",
"aws/aws-sdk-php-laravel": "~2.0",
"graham-campbell/flysystem": "~2.1"

An in the controller:

...
    $file = time().'-'.$image->getClientOriginalName();
        $path = 'images/commerces/'.$commerce->id.'/';

        $image = Image::make($image)->widen(800, function ($constraint) {
            $constraint->upsize();
        });
        //$image->save($path . $image);

        Storage::disk('s3')->put($path.$file, $image);

        $commerce->image = $file;
        $commerce->save();
...

Someone can help me with this?

Thanks in advance!

09 Sep
3 years ago

SergioGregorutti left a reply on Target [Illuminate\Contracts\Auth\Registrar] Is Not Instantiable

Ok, I'll need to re-write all the authentication logic for the new 5.1 Laravel version... Thanks.

SergioGregorutti left a reply on Target [Illuminate\Contracts\Auth\Registrar] Is Not Instantiable

Hmmm.... There's something different between both projects and I dont know why.

This is the 'config/app.php' from the project that the code is working:

...
'providers' => [

        /*
         * Laravel Framework Service Providers...
         */
        'Illuminate\Foundation\Providers\ArtisanServiceProvider',
        'Illuminate\Auth\AuthServiceProvider',
        'Illuminate\Bus\BusServiceProvider',
        'Illuminate\Cache\CacheServiceProvider',
        'Illuminate\Foundation\Providers\ConsoleSupportServiceProvider',
        'Illuminate\Routing\ControllerServiceProvider',
        'Illuminate\Cookie\CookieServiceProvider',
        'Illuminate\Database\DatabaseServiceProvider',
        'Illuminate\Encryption\EncryptionServiceProvider',
        'Illuminate\Filesystem\FilesystemServiceProvider',
        'Illuminate\Foundation\Providers\FoundationServiceProvider',
        'Illuminate\Hashing\HashServiceProvider',
        'Illuminate\Mail\MailServiceProvider',
        'Illuminate\Pagination\PaginationServiceProvider',
        'Illuminate\Pipeline\PipelineServiceProvider',
        'Illuminate\Queue\QueueServiceProvider',
        'Illuminate\Redis\RedisServiceProvider',
        'Illuminate\Auth\Passwords\PasswordResetServiceProvider',
        'Illuminate\Session\SessionServiceProvider',
        'Illuminate\Translation\TranslationServiceProvider',
        'Illuminate\Validation\ValidationServiceProvider',
        'Illuminate\View\ViewServiceProvider',

        /*
         * Application Service Providers...
         */
        'Argemundo\Providers\AppServiceProvider',
        'Argemundo\Providers\BusServiceProvider',
        'Argemundo\Providers\ConfigServiceProvider',
        'Argemundo\Providers\EventServiceProvider',
        'Argemundo\Providers\RouteServiceProvider',

        /*
         * Custom Service Providers...
         */
        'Laravel\Socialite\SocialiteServiceProvider',
        'Cviebrock\EloquentSluggable\SluggableServiceProvider',
        'Barryvdh\Debugbar\ServiceProvider',
        'Jenssegers\Agent\AgentServiceProvider',
        'Collective\Html\HtmlServiceProvider',
        'Laracasts\Flash\FlashServiceProvider',
        'Lord\Laroute\LarouteServiceProvider',
        'Dingo\Api\Provider\LaravelServiceProvider',
        'yajra\Datatables\DatatablesServiceProvider',

    ],
...

And this is the same file from the proyect that is giving the error:

...
'providers' => [

        /*
         * Laravel Framework Service Providers...
         */
        Illuminate\Foundation\Providers\ArtisanServiceProvider::class,
        Illuminate\Auth\AuthServiceProvider::class,
        Illuminate\Broadcasting\BroadcastServiceProvider::class,
        Illuminate\Bus\BusServiceProvider::class,
        Illuminate\Cache\CacheServiceProvider::class,
        Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class,
        Illuminate\Routing\ControllerServiceProvider::class,
        Illuminate\Cookie\CookieServiceProvider::class,
        Illuminate\Database\DatabaseServiceProvider::class,
        Illuminate\Encryption\EncryptionServiceProvider::class,
        Illuminate\Filesystem\FilesystemServiceProvider::class,
        Illuminate\Foundation\Providers\FoundationServiceProvider::class,
        Illuminate\Hashing\HashServiceProvider::class,
        Illuminate\Mail\MailServiceProvider::class,
        Illuminate\Pagination\PaginationServiceProvider::class,
        Illuminate\Pipeline\PipelineServiceProvider::class,
        Illuminate\Queue\QueueServiceProvider::class,
        Illuminate\Redis\RedisServiceProvider::class,
        Illuminate\Auth\Passwords\PasswordResetServiceProvider::class,
        Illuminate\Session\SessionServiceProvider::class,
        Illuminate\Translation\TranslationServiceProvider::class,
        Illuminate\Validation\ValidationServiceProvider::class,
        Illuminate\View\ViewServiceProvider::class,

        /*
         * Application Service Providers...
         */
        StudApp\Providers\AppServiceProvider::class,
        StudApp\Providers\EventServiceProvider::class,
        StudApp\Providers\RouteServiceProvider::class,

        /*
         * Custom Service Providers...
         */
        'Laravel\Socialite\SocialiteServiceProvider',
        'Cviebrock\EloquentSluggable\SluggableServiceProvider',
        'Barryvdh\Debugbar\ServiceProvider',
        'Jenssegers\Agent\AgentServiceProvider',
        'Collective\Html\HtmlServiceProvider',
        'Laracasts\Flash\FlashServiceProvider',
        'Lord\Laroute\LarouteServiceProvider',
        'Dingo\Api\Provider\LaravelServiceProvider',

    ],
...

What is the different between:

'Illuminate\Foundation\Providers\ArtisanServiceProvider',

and this?

Illuminate\Foundation\Providers\ArtisanServiceProvider::class,