marcopierac

marcopierac

Member Since 1 Month Ago

Experience Points
160
Total
Experience

4,840 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
0
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.

Level 1
160 XP
May
21
1 week ago
Activity icon

Started a new Conversation Lumen 7 - Get Registered Route URI

Hello, i'd like to know if it's possible to get the registered route URI of the current request, in Lumen 7. For example, if i have the following route registered:

$app->get('foo/{bar}[/optional]', function () {
    //
});

and if i do an HTTP call like this: GET foo/xxx/123

i'd like to be able to retrieve 'foo/{bar}[/optional]'in a middleware.

I tried with $request->decodedPath(), $request->path(), $request->url(), $request->route(). All of these give me at most the interpolated value foo/xxx/123, but i need the uninterpolated value.

thank you for your time

May
01
1 month ago
Activity icon

Replied to Handling Incoming FormData

Hello sir,

by using form request validation class you mean creating a custom Request class and use that one in my controllers, correct?

I did not specify it in the title, but i'm using Lumen; the make:request command and FormRequests are not available on Lumen.

Anyway i already tried creating an extension of Illuminate\Http\Request, but everything breaks. I have already created a dedicated thread here: https://laracasts.com/discuss/channels/lumen/extend-or-decorate-request-in-lumen-7

Thank you for your time

Apr
30
1 month ago
Activity icon

Started a new Conversation Handling Incoming FormData

Hello,

in my frontend i have the following object that i need to send to my backend:

let obj = {
  a: 123,
  b: "test",
  c: [ null, File ]
};

where File is a File object.

I am transforming this object into a correctly structured FormData object, like this:

let form = new FormData;
form.append("a", JSON.stringify(obj.a));
form.append("b", JSON.stringify(obj.b));
form.append("c[]", JSON.stringify(obj.c[0]));
form.append("c[]", obj.c[1]); // this is the file

The reason why i'm stringifying everything is simple: FormData only accepts and sends blobs or strings, so the number 123 would become "123" anyways, but the string "test" would remain "test"; i'm converting to json so that i can decode and figure out the correct types, afterwards.

The problem comes in my backend.

If, and only if, the request was a multipart form data, i have to pass every $request->input throughjson_decode, to get the original value with the correct type.

Normally, with application/json requests, i can access the correct value right away via the input method.

How can i "hook" into $request->input to do this just once? or how can i edit all of the incoming request inputs, just once?

Thanks in advance

Ps: I already thought about using a custom extension of the Request class, without success: https://laracasts.com/discuss/channels/lumen/extend-or-decorate-request-in-lumen-7

Activity icon

Started a new Conversation Extend Or Decorate Request In Lumen 7

Hello,

i'd like to know if it's possible to extend the Illuminate\Http\Request class to alter the behaviour of some of its functions (in particular, ->input and ->all).

I tried creating a custom Request (by extending the base Illuminate Request) and using it as parameter in the controller. The framework throws the following error:

Class My\Custom\Request does not exist
file: "T:\test\backend\vendor\illuminate\container\BoundMethod.php"
line: 165
class: "ReflectionException"

Please note: the class DOES exist, it just can't be "reflected", i think...

I also tried to create a decorator in the web.php file, encapsulating the $router variable, but using my custom request throws error about not being an instance of request.

I also tried using passing a decorated instance of the request inside my first app middleware (by passing it to the $next() closure), without success.

Can anyone help me?

thanks

have a nice day