MartinW12

MartinW12

Member Since 5 Months Ago

Experience Points
340
Total
Experience

4,660 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
340 XP
Jul
17
4 weeks ago
Activity icon

Started a new Conversation Best Way To Send Postmark Emails

Hello,

I am using Laravel 7 and want to send some of my emails using Postmark.

However I'm slightly confused as to what is the best way to do this.

The Laravel docs say to use the official Swiftmailer Transport for Postmark by Wildbit:

https://github.com/wildbit/swiftmailer-postmark

However the Postmark blog says to use the Laravel Postmark Adapter by CoconutCraig or SMTP:

https://postmarkapp.com/blog/how-to-send-transactional-emails-with-laravel-php-framework

My inclination is to go with the Laravel docs, but do all of these 3 options work equally well and are any of these 3 options more efficient?

Thanks,

Martin

Apr
23
3 months ago
Activity icon

Replied to Complex Substitution In Blade ...

Thanks, seems like that is they way to go :-)

Apr
22
3 months ago
Activity icon

Started a new Conversation Complex Substitution In Blade ...

I have a database field that contains an address as multi-line text.

To display it I currently use:

{!! str_replace("\n", '', e($address)) !!}

Which works, but is a bit messy - is there a better way of doing this that is also intuitive?

I know I could create a new blade directive, something like "@multiline($address)" but I don't really like that because it's not really intuitive.

What I would like is to be able to define is something like "{## $address ##}" - is that possible at all?

Apr
04
4 months ago
Activity icon

Replied to Session Flash Doesn't Work With Multiple Browser Sessions Open

To clarify, I have the following routes:

Route::get('/mytest', '[email protected]'); Route::post('/mytest', '[email protected]');

In "TestController::showForm()" I set a session variable with some data about the user's state when they started the test. I could put this in a hidden form field but I prefer to keep this data outside the form.

In "TestController::postForm()" I want to be able to retrieve the aforementioned data about the user's state .

What I have had to do is use normal session data and then delete the session data myself - I tried using "flash()" but it didn't work if the user had my website open in another tab and then did something in that other tab between being shown the form and posting the form (ie if they did something in the other tab while considering what data to enter into the form they have been shown).

Therefore my question was a general one as to whether this was a known limitation of flashing session data, or whether there is another way around this that I haven't thought of.

Apr
03
4 months ago
Activity icon

Started a new Conversation Session Flash Doesn't Work With Multiple Browser Sessions Open

Hello,

I am using "session()->flash()" to pass data outside of a form - ie. I flash some session data when I show the user the form, then pick up the flashed session data up when the user posts the form.

However I have come across a limitation which stops it working - if the user does something in another browser tab before posting the form, the flashed data is no longer available when they do post the form.

Obviously that is because the page on the other browser tab is the next request for this session.

Is it just a limitation of flashed session data that you can only use it before doing a "redirect()" and otherwise it assumes that the user will only ever have a single browser tab open at your website, or is there some way around this?

Thanks,

Martin

Feb
27
5 months ago
Activity icon

Awarded Best Reply on How To Get POST Only Data In Laravel 6

As you say, a GET request has no POST data so surely the "post()" method should return nothing.

Anyway, as you guessed, I have a trait function that has to work with both GET and POST requests, but cannot rely on $request->method() to determine which it is.

Either way, it appears as if that if statement is needed, so that is what I will do ...

Thanks :-)

Feb
26
5 months ago
Activity icon

Replied to How To Get POST Only Data In Laravel 6

As you say, a GET request has no POST data so surely the "post()" method should return nothing.

Anyway, as you guessed, I have a trait function that has to work with both GET and POST requests, but cannot rely on $request->method() to determine which it is.

Either way, it appears as if that if statement is needed, so that is what I will do ...

Thanks :-)

Activity icon

Replied to How To Get POST Only Data In Laravel 6

Ok, just to clarify, I am talking about a GET route.

It does indeed seem as if in a POST route the post() method works as expected, but in a GET route the post() method returns the query string whereas it should in fact return an empty array/string or NULL.

I guess what I could do is call the query() method to see if post() is in fact returning the query string (for various reasons I can't use $request->method() to see if actual form data has been posted), but surely there is a better way?

Activity icon

Started a new Conversation How To Get POST Only Data In Laravel 6

Hello,

I am using Laravel 6.

If I do a $request->post('foo') it returns the value of "foo" in the query string.

Similarly, if I do a $request->has('foo') it returns TRUE if "foo" is set in the query string.

However I want it to ONLY look at POST data, and to ignore the query string in both cases.

How can I make it do this?

Thanks,

Martin

Feb
22
5 months ago
Activity icon

Started a new Conversation How To Catch A 419 Error

I have a number of pages where a logged-in user submits form information.

Obviously these forms use @csrf as required.

However if the user takes a long time to enter the information (or if they open another tab and logout in that other tab) then when they submit the form they get a 419 error.

However what I would like to do is to catch the error, save the form data they entered and then show them a login form.

If they then successfully login I want to carry on with the saved form data as if their session had not timed out in the first place.

Is this possible and if so how?

Thanks,

Martin

=====================================

By way of illustration, I would like my code to say something like:

if ( !logged_in() ) return view ('login-form', ["request_for_field_data_to_save" => $request]; // Process form data in $request

and obviously each page would have a separate 'login-form' view that knew what fields to preserve