DavidSprauel

Web developer at Freelance

Member Since 5 Years Ago

Strasbourg

Experience Points
30,485
Total
Experience

4,515 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
314
Lessons
Completed
Best Reply Awards
0
Best Reply
Awards
  • start your engines Created with Sketch.

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • first-thousand Created with Sketch.

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • 1-year Created with Sketch.

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • 2-years Created with Sketch.

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • 3-years Created with Sketch.

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • 4-years Created with Sketch.

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • 5-years Created with Sketch.

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • school-in-session Created with Sketch.

    School In Session

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

  • welcome-newcomer Created with Sketch.

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • full-time-student Created with Sketch.

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • pay-it-forward Created with Sketch.

    Pay It Forward

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

  • subscriber Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • evangelist Created with Sketch.

    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 Created with Sketch.

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • lara-veteran Created with Sketch.

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • 10k-strong Created with Sketch.

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • lara-master Created with Sketch.

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • laracasts-tutor Created with Sketch.

    Laracasts Tutor

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

  • laracasts-sensei Created with Sketch.

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • top-50 Created with Sketch.

    Top 50

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

  • Community Pillar

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

Level 7
30,485 XP
Nov
10
2 months ago
Activity icon

Replied to Search Input And JWT Token

The logout issue is theoretical but i'm pretty sure it gonna happens this way.

I'm gonna try this solution and give a feedback, thanks for that ^^

Nov
09
2 months ago
Activity icon

Replied to Search Input And JWT Token

Yes I use this package and no, I use the middleware this way and the token is automatically set in the response as authorization header.

Route::group(['middleware' => ['jwt.auth', 'jwt.refresh', 'api']], function () {});

In my front I have interceptors that update the token after each call. The TTL is indeed set on 20 minutes. But I don't want my user to be disconnected after 20 minutes if he's active on the app.

Activity icon

Replied to Search Input And JWT Token

@niush The token has a 20 minutes lifetime when there is no activities on the account. It refresh it each time a request is made to avoid the user to be disconnected after 20 minutes.

To be honest, this is JWT package which manage that and I have not look further for other solutions to manage but i'm open to any idea.

Activity icon

Started a new Conversation Search Input And JWT Token

Hi ,

I'm facing a problem one of you may already have encountered. For the context i'm using laravel 7 as REST API and Vue2 CLI as an SPA for my front .

Both are different project in different folders. I use JWT auth to auth my client into the back. At each call of the back, I refresh the token, which comes back as a header in the response and I update it with interceptors.

My question is, on a page where you can manage some uploaded documents, there is a search bar (searching by document name). When I type in this input, it should trigger an XHR to my API. But, the problem is if the request takes more time to answer than the user to type the next letter on the search, it gonna log out my user (Token is gonna be blacklisted in api side). I've thought about using a debounce time but same, this is a static time of delay i'm entering, but what if my request needs more time than the debounce time ?

I'm sure one of you must have met this problem once, no ?

Sep
09
4 months ago
Activity icon

Replied to Calling Envoy From A Controller

@christopher Did you find any solution ?

Activity icon

Started a new Conversation Valet Requires Homebrew To Be Installed On Your Mac

I'm working on a project which use nextcloud as a document manager and when i'm upload a file, I want to launch nextcloud files sync so I use envoy to manage my command.

My command works when i type it in the CLI, it works when i'm running a test of my store new document. But when I use it the normal way through the interface and add a document, the buffer logs me : Valet requires Homebrew to be installed on your Mac.

Of course I have homebrew on my Mac and i'm running anything related to valet in my task.

@servers(['localhost' => '127.0.0.1'])

@task('synchronize', ['on' => 'localhost'])
    cd {{ $path }}
    docker-compose exec -T --user www-data app php occ files:scan {{ $user }}
@endtask

As I said, it work manually and through a unit test but not when i'm using it from my interface... Any Idea ?

EDIT: Here are my logs

[2020-09-09 07:41:33] local.DEBUG: Nextcloud Syncronized
[2020-09-09 07:41:33] local.DEBUG: ["Valet requires Homebrew to be installed on your Mac."]
[2020-09-09 07:47:06] testing.DEBUG: Nextcloud Syncronized
[2020-09-09 07:47:06] testing.DEBUG: ["Starting scan for user 1 out of 1 (admin)\n","+---------+-------+--------------+\n| Folders | Files | Elapsed time |\n+---------+-------+--------------+\n","| 28      | 13    | 00:00:01     |\n+---------+-------+--------------+\n"]

testing env is my unit test and local is my normal env for dev. nothing changes between the 2 except DB credentials

Sep
08
4 months ago
Activity icon

Started a new Conversation Symfony Process: No Such File Or Directory

Hi fellow developers,

I experienced Envoy and Laravel this afternoon and everything work fine until i'm trying to exec the command from the code.

 $command = ["~/.composer/vendor/bin/envoy run synchronize", " --path={$path} --user={$user}"];

        $process = new Process($command);
        $process->run(
            function ($type, $buffer) use ($result) {
                dd($buffer);
                $buffer = str_replace('[127.0.0.1]: ', '', $buffer);
                $result[] = $buffer;
            }
        );

Here is the code i'm trying to run. the dd I got in $buffer returns me this :

sh: /Users/David/.composer/vendor/bin/envoy run synchronize: No such file or directory\n
sh: line 0: exec: /Users/David/.composer/vendor/bin/envoy run synchronize: cannot execute: No such file or directory

I've tried to execute ~/.composer/vendor/bin/envoy run synchronize --path=myPath --user=myUser manually and it works just fine. But no way to get it working from my function.

The function is in a class i'm just calling from a unit test :

 /** @test */
    public function files_are_scanned() {
        dd((new NextCloud())->synchronize(true));
    }

EDIT: the problem is that Process escape my arguments and add a ' on my command so it doesn't work. I don't know how to avoid that. This function is modifying my command:

 private function escapeArgument(?string $argument): string
    {
        if ('' === $argument || null === $argument) {
            return '""';
        }

        if ('\' !== \DIRECTORY_SEPARATOR) {
            return $argument;
            return "'".str_replace("'", "'\''", $argument)."'";
        }
        if (false !== strpos($argument, "LARACASTS_SNIPPET_PLACEHOLDER")) {
            $argument = str_replace("LARACASTS_SNIPPET_PLACEHOLDER", '?', $argument);
        }
        if (!preg_match('/[\/()%!^"<>&|\s]/', $argument)) {
            return $argument;
        }

        $argument = preg_replace('/(\\+)$/', '', $argument);

        return '"'.str_replace(['"', '^', '%', '!', "\n"], ['""', '"^^"', '"^%"', '"^!"', '!LF!'], $argument).'"';
    }

I've tried to return the argument without modifying it and it works.