laloutre

laloutre

Member Since 5 Years Ago

Strasbourg, France

Experience Points 22,245
Experience Level 5

2,755 experience to go until the next level!

In case you were wondering, you earn Laracasts experience when you:

  • Complete a lesson — 100pts
  • Create a forum thread — 50pts
  • Reply to a thread — 10pts
  • Leave a reply that is liked — 50pts
  • Receive a "Best Reply" award — 500pts
Lessons Completed 396
Lessons
Completed
Best Reply Awards 1
Best Reply
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.

12 Dec
6 months ago

laloutre left a reply on Using Passport, Personal Access Token Expiration Behaviour?

Hi ; I'm also disappointed on the expiration thing, experiencing the same. Do Personal tokens never expire?

On your second question, you can select the Personal access client used by the generator (but I don't really understand the point here, like you). It's explained here: https://laravel.com/docs/5.7/passport#personal-access-tokens

If you have already defined a personal access client, you may instruct Passport to use it using the personalAccessClientId method. Typically, this method should be called from the boot method of your AuthServiceProvider

Passport::personalAccessClientId('client-id');

13 May
3 years ago

laloutre left a reply on Forge, GitHub Error

Just getting the same error: did you find out where it came from?

06 Nov
3 years ago

laloutre left a reply on Using Filesystem, Cloud And Queue

Okay, I think either my question is stupid, or I'm the only one to fall in this issue... Well, I'm gonna think of another way to do this.

31 Oct
3 years ago

laloutre started a new conversation Using Filesystem, Cloud And Queue

I my application, user can upload some files in various forms. I use Laravel 5.1 Filesystem, and I tried last week to swap from local file system to a Rackspace instance.

Everything worked for a bit, but the next day files weren't sent anymore to the Rackspace cloud. In the logs, I saw a lot of 401 Unauthorized errors for those calls.

I tried to discuss this with the Rackspace support, but northing really helpful came out of it, except that I'm not hitting some API file limit or file rate.

One think I must add is that for obvious performance matter I use queues to upload the files. Here is my handle() code for the queued job responsible of the upload:

public function handle(Factory $fileSystemManager)
{
    $fileSystemManager->disk('rackspace')->put(
        $this->dest,
        $fileSystemManager->disk('local')->get($this->src)
    );
}

Note that the FileSystemManager instance is injected here.

I was wondering if this could be the problem (since I don't really know the implementation details of the Rackspace connection): do you think that given this is queued it's possible that the token auth or something expires at some point? If so, how should I code this in order to keep the queue?

Thanks a lot for any help.

24 Sep
3 years ago

laloutre left a reply on Error While Sending STMT_PREPARE Packet On Queued Jobs

Hi @jpral, I'm having this issue with a queued event listener. From what I could understand, the problem occurs when Laravel tries to restore the serialized model from the event. For instance:

public function handle($event)
{
    $player = $event->payer; // -> here
}

Can you explain to me how your "DB::connection()->reconnect()" trick would work?

Thanks!

15 Jun
4 years ago

laloutre left a reply on Use L5.1 With 5.0 Packages

Well, I'm the package owner :).
I'm going to try 5.* and see.

laloutre left a reply on Use L5.1 With 5.0 Packages

@mstnorris what would be the correct way, in sharp's composer.json, to indicate that it accepts both 5.0.* and 5.1.? I can't just put "5.", right?

laloutre started a new conversation Use L5.1 With 5.0 Packages

I'm not this good with composer, and I'm trying to figure a way to declare in my laravel 5 specific package that it requires L5.0 or 5.1.

Right now the package composer.json looks like this:

"require": {
     "laravel/framework": "5.0.*"
}

Of course "composer update" fails on a new 5.1 project. The solution I found is to cheat on my project composer.json (where dvlpp/sharp is the package I was talking about):

"require": {
     "php": ">=5.5.9",
     "laravel/framework": "5.1.1 as 5.0.28",
     "dvlpp/sharp": "dev-master"
}

How can I update dvlpp/sharp's composer.json to accept both 5.0 and 5.1?

Thanks!

30 Mar
4 years ago

laloutre started a new conversation Response()->download Is Cropping One Char Of My File

This is a strange issue. I'm working on a .ics file generation, with eluceo/ical package. My code is simple:

$filepath = storage_path("app/tmp/" . uniqid() . ".ics");
\File::put($filepath, $contents);

return response()->download($filepath, "maillon.ics", [
    'Content-Type' => 'text/calendar',
    'charset' => 'utf-8'
]);

The app/tmp/XXX.ics file on disk seems OK. But the downloaded file has a blank line at the top, and the very last char is missing.

Do you see where I'm doing it wrong?

26 Feb
4 years ago

laloutre left a reply on Elixir: Version With 2 JS Files Seems Buggy

@vedmaque Yes, I noticed your last point too. But it's a bit twisted, since I have to fake an update to generate the file...

laloutre started a new conversation Elixir: Version With 2 JS Files Seems Buggy

I encounter a strange problem with this simple config:

mix.less('main.less')

    .scripts([
        "../vendor/jquery/dist/jquery.min.js",
        "main.js",
    ], 'public/js/project.js', 'resources/assets/js')

    .scripts([
        "../vendor/gmaps.js",
        "map.js"
    ], 'public/js/project-maps.js', 'resources/assets/js')

    .version(["public/css/main.css", "public/js/project-maps.js", "public/js/project.js"]);

Running gulp only generate one versioned js file (in this case, project-map.js). It seems that every "version" call on the same resource type (JS here) overrides the previous one.

I found a StackOverflow post on this, but I'm still stuck.

Has someone saw this problem before?

25 Feb
4 years ago

laloutre left a reply on Elixir On Laravel Forge

@sitesense OK, thanks. It's clear now, I must find a way to tell PHPStorm to add the "-a" flag to the commit instruction when hitting cmd-K.

And for the Elixir --production flag, you always use it it dev mode?

24 Feb
4 years ago

laloutre left a reply on Elixir On Laravel Forge

@sitesense Well, maybe I'm using git the wrong way, or maybe it's a PHPStorm thing, but when a new file is created from outside the IDE (this is the case with versioned JS or CSS files from Elixir), I have to add them to version control, otherwise they just stay out of it (and red in PHPStorm)...

laloutre left a reply on Laravel 5 Set Current Page Programatically

Your solution isn't working with Laravel 5, right? I think it was working when Paginator was a facade, but this isn't the case anymore... Or am I missing something?

I'm looking for a simple way to force the page before a paginate() eloquent call.

laloutre left a reply on Elixir On Laravel Forge

I don't want to install node.js and gulp in my production server. But how do you manage your deployment then? I mean, before git push, you have to run gulp in your dev env with the --production flag, and then run a git add . because of new generated files (from the elixir versioning feature)?

And you have to remember to do that only if JS or LESS/SASS was updated (because otherwise, you lost the browser ressource caching for nothing).

Is someone has a better workflow (I think so...)?

19 Feb
4 years ago

laloutre left a reply on Mail.driver Change On Runtime, Is Being Ignored!

@lollypopgr are you using queues for sending emails? (in case you missed my post above)

If yes, simply restart the queue worker.

laloutre left a reply on Mail.driver Change On Runtime, Is Being Ignored!

Oh, OK, this was obvious: I was using queues. I simply restarted the queue job, and all is good now.

laloutre left a reply on Mail.driver Change On Runtime, Is Being Ignored!

I'm running the exact same issue. Very strange...

06 Feb
4 years ago

laloutre left a reply on Add Logic In Eloquent Relations

OK. So, does anyone think of a clever solution to achieve this particular scenario nicely, without having to update every $model->children call in the whole project?

laloutre left a reply on Add Logic In Eloquent Relations

Subprojects don't have events. In fact, the code above is exactly what I'm trying to build: return your events, or your master events if you have one. But my point is: this code won't work, the $this->master->children(); code is never executed, because no matter what, at this point, $this->master_id is always null. I tried for the record with a $this->master test in replacement, and this is the opposite: there's always a related model, which is a false value too.

I think this is because of Eloquent design, that we shouldn't code anything but a hasMany or belongTo (...) return in relationship methods, but I'm not sure.

laloutre left a reply on Add Logic In Eloquent Relations

@pmall Here's the real case: a Project can have many ProjectEvents. But a Project can be a sub-project: in this case, he defines a master, which is another Project, and can have some differences, but he have to share ProjectEvents with his master.

Since it's an update, I would like to keep this transparent in the code, returning either ProjectEvents of the current Project (regular case), or those of the master Project (sub-project case).

laloutre left a reply on Add Logic In Eloquent Relations

@pmall I'm not sure... You mean there's a risk of self-reference? Well, I can manage that, this is a typical tree-node relation. Or did I miss something in your answer?

laloutre started a new conversation Add Logic In Eloquent Relations

Is it possible to add logic in eloquent relationship methods? For a particular case, I'd like to do something like this :

class MyModel extends Model {

    (...)

    public function master()
    {
        return $this->belongsTo('MyModel');
    }

    public function children()
    {
        if($this->master_id)
        {
            return $this->master->children();
        }
        return $this->hasMany('Child');
    }
}

The idea is to get children directly from an instance of MyModel or from MyModel's master (which is another MyModel) if defined. It should be transparent.

I think it's not working as it is because of Eloquent's design, but can somebody thing to an alternative solution?

Thanks

12 Jan
4 years ago

laloutre left a reply on How To Handle Laravel 5 Exceptions

Not sure how to exactly, but I heard Taylor saying the new way will be to use regular try... catch in the Kernels classes.

18 Dec
4 years ago

laloutre left a reply on Laravel 5 Validation: How To Handle Multidimensional Arrays

Oh, I see. Of course you're right. Sometimes I'm unable to see the obvious solution: I have to put the line id first. Thanks a lot.

laloutre left a reply on Laravel 5 Validation: How To Handle Multidimensional Arrays

@pmall thanks for your answer. This is more or less what I have now, except that I have a meaningful id as array key. So my question is: how do I write the Laravel Request rules() method?

laloutre started a new conversation Laravel 5 Validation: How To Handle Multidimensional Arrays

Hi,

Here's my problem: I have a view with a list of guys, on per "line". For each guy, I ask the email address, and if the system already knows it (ajax request), all done; if not, I need address details.

So the data posted is like:

    [
        'person_id' => [
            40 => 58,
            41 => ''
        ],
        'email' => [
            40 => '',
            41 => 'test@example.com'
        ]
        'name' => [
            40 => '',
            41 => 'John Doe'
        ]
        ...
    ]

40 and 41 are line id. For line 40, I've entered a known email, so person_id is set. For line 41, I need to enter all fields, email is new.

In the controller and the validation request, I can access each field with the key email.40, or name.41. What rule can I write to validate email, for instance, but only when person_id isn't provided?

Hope I was clear...

27 Oct
4 years ago

laloutre left a reply on Laravel 5 View Composers

Well, maybe not.

21 Oct
4 years ago

laloutre started a new conversation Laravel 5 View Composers

What are your solutions to register View Composers in Laravel 5 (I have to confess that I used route.php in L4 for that...)?

Mine is to create a app/Http/viewcomposer.php file, and to load it in RouteServiceProvider like that:

public function map(Router $router)
{
    require app_path('Http/viewcomposers.php');
}

Is there a better way?

11 Oct
4 years ago

laloutre left a reply on Laravel Elixir

Well, I think that environment dependant config is very important, and will be included in this tool, to allow quick processes in dev case.

laloutre left a reply on Laravel Elixir

I didn't catch the way to install Elixir on an existing Laravel 5 project: is there something to add in composer.json file, or a simple composer update will do?

26 Sep
4 years ago

laloutre left a reply on Laravel 5 Package Dev

Yes, I agree, but in one specific package (a CMS with an admin panel) I really need Controllers, Views and assets. And I like very much the way Laravel authorize it (I just have to remember how I've done that in CodeIgniter to start jumping around and crying).

laloutre left a reply on Laravel 5 Package Dev

@TravisBlasingame Well, for now I managed to keep the L4 structure in my L5 package, meaning that Controllers don't have namespaces, and that I kept my L4 directories structure. Bu I think this isn't the right way...

laloutre left a reply on Laravel 5 Package Dev

Of course, there's no much difference on the deploy thing, by my concern was about package structure, especially one with controllers and views — and if there's a way (I haven't found it) do make change without breaking L4 compatibility.

17 Sep
4 years ago

laloutre left a reply on Laravel 5.0 Homestead Blank Page

I think this could be related to https://laracasts.com/discuss/channels/general-discussion/errors-not-showing-in-laravel-5-app: Whoops error displaying is buggy with Laravel 5. To be sure, try to delete storage/meta/compiled.php file and reload.

laloutre left a reply on Errors Not Showing In Laravel 5 App

Or delete storage/meta/compiled.php file.

laloutre started a new conversation Laravel 5 Package Dev

I'm starting 2 new projects right now, and I think that develop on Laravel 5 instead of 4.2 is a good choice — as the stable version is coming on November.

My concern is that I'm maintaining and using for these projects a package, which has controllers, views, ... and is impacted by Laravel 5. So, 2 questions came to my mind:

  • is there already somewhere a documentation regarding package dev changes for L5?
  • is there a way to develop a package on L5 but to authorize it on L4 apps?