Software Developer at Sabio Ltd

Member Since 4 Years Ago


Experience Points

0 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
Best Reply Awards
Best Reply
  • start-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-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-token Created with Sketch.


    Earned if you are a paying Laracasts subscriber.

  • lifer-token Created with Sketch.


    Earned if you have a lifetime subscription to Laracasts.

  • lara-evanghelist 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 50
302,180 XP
3 months ago
Activity icon

Replied to 500 Server Error With Guzzle On Lumen

A 500 HTTP code is a generic server error so without details it's too difficult to help you as it could be anything. Can you look through your webserver and laravel logs and provide more details so we can help you

3 months ago
Activity icon

Replied to Timetable Algorithm

Do you have any existing related code you can share. Key things are you model relationships and the controller actions involved in what your trying to do.

3 months ago
Activity icon

Replied to Timetable Algorithm

Going to need much more info on what you've tried what's not working, etc

Maybe have a look at


Activity icon

Replied to Is It Possible To Destroy The Current Token In Laravel Passport And Regenerate A New One?

You could manually revoke the tokens?

$tokens = auth()->user()-tokens;
foreach($tokens as $token) {
Activity icon

Replied to Load Balancer Breaks SSO

Do you have any details of the 500 error from your logs?

4 months ago
Activity icon

Commented on An Alternative To Magic Numbers

Magic numbers are one of the worst contributors to unmaintainable code and they seem so innocuous at first. You still have a magic number in the test of 2100. I would change to adding the two constants e.g,


I would also advise avoiding using constants sequentially e.g read=1, write=2,admin=3. Because read and write added dont equal admin. Use base2 so 1, 2, 4, 8. Etc instead to reduce the possibility of overlap.

Activity icon

Replied to Package Dev. Append Js/html Contents To <body>

First off, probably not going to get too much direct help from Jeff on the forums so I wouldn't at him directly.

Your question is quite broad so you're unlikely to get good advice so let's break it down to smaller questions

how do we append that library to the end of body tag

Can you not just add this to your blade template?

Activity icon

Replied to Laravel Mail Working Locally But Not On Server

You need to identify if the issue is mailgun or your code. Follow the setup from below


And try sending a mailable through tinker. If it works it's your code, otherwise it's your server/network setup.

If it's your network( which I suspect from it works in localhost), from the command line of your server (not your pc) try telnet smtp.mailgun.org 25 replacing the detials with your setup. If this errors you have a network issue that we cant really help with ;(

Activity icon

Replied to Complex Eloquent Morphs

Did you try the fork in the issue you linked to? Not trying to be unhelpful but for something complex like your requirement it's better to not reinvent he wheel

Activity icon

Replied to Autoload Psr-4 In Composer.json

psr-4 is not a laravel thing its a php thing. The link below gives good detail but essentially your mapping a namespace to a folder in your filesystem


Each package, includinglaravel, uses this to ensure your classes can be found in the filesystem.

For you service provider you are now telling laravel the namespace of the provider to load... the autoloader then translates that to the physical file.

A good example is that laravel had the App namespace mapped to the app folder (notice upper/lowercase)

Activity icon

Replied to Route() Vs Url() Vs Action() In Blade

Route() allows you to use named routes so if you change a route using named routes you only need to change route definition whereas url() calls would all need updated


Action gives a url from a controller action.

Have a look at this for more details


My preference route() but it's just that. Choose one that works for you and usd it consistently

Activity icon

Replied to Complex Eloquent Morphs

This seems like quite a common requirement for a RBAC system. Have you looked at a existing package like this?


If so what was missing?

Activity icon

Replied to .env

You probably need to put this in your AppServiceProvider boot method nstead of bootstrap/app.php so the framework has loaded


To be honest changing the app.php ain't a good idea in general

Activity icon

Replied to Encoding Ids

If you ids are being encoded then you should just use the encoded values in blade/vue components. The frontend shouldnt be aware of the decoded value as anything client side cannot be trusted

Activity icon

Replied to How To Detach (many To Many ) From Resources Route

You could create a PermissionGroupController with standard rest actions and the do something like

public function destroy(Group $group) {

Then in your routes have

Route::delete('group/{group}/permission', '[email protected]'


Activity icon

Replied to .env

Have you tried?

php artisan clear
php artisan config:clear

If your using telescope this might help


Activity icon

Replied to An Approach To 'guest Checkout' ?

@lunah - from the additional context you have all the information needed to create a user in your users table even for guests (bar randomly generating a password).

I would urge you to take a ride in a paying visitor to your site. Assuming I am a guest and I buy some content but then lose it, how do I get it back? If you sent them a link to the content what prevents them sharing the link with friends losing you potential revenue?

What I would consider is when a guest buys something you very clearly state here is the download link but it's a one time download unless you want register (and implement a say to expire the link)... if you do you can download as much as you want but we need to verify your account. Then you can use the built in functionality


At worst you'd been clear to guests at best you get a higher rate of registered users that you can then engage with and are more likely to return

Activity icon

Replied to JSON API Spec

@futurefuture - good luck. Hopefully you grow to embrace the standard

Activity icon

Replied to Deleting Users Passport Token On Logout.

It is worth considering how either of the logout methods myself and @bobbybouwmann mentioned are invoked. AFAIK it's when the user hits the logout route only.

How do you handle token revelation if the user doesn't logout but times out.

The password grant helps here as tokens are time limited

4 months ago
Activity icon

Replied to Access Root State Or $auth From Module Getters In Vuex

This covered in the Vuex docs

In your modules actions, getters rootstate is the available as the third function arguement

    sumWithRootCount (state, getters, rootState) {
      return state.count + rootState.count

You can then use dot notation if you have multiple nested vuex modules e.g. rootstate.modulea.moduleb.count

Make sure to install the vuex devtools as it helps you visualise you vuex store. Saved me days of console.log debugging

Activity icon

Replied to JSON API Spec

The main positive I found from JSON-API was that it's a standard so rather than having to explain a custom API i had chosen to customers I could say its JSON-API compliant and point then at the spec :-)

It also means if a API client has a JSON-API package available they can use this rather than writing their own bespoke code.

This was a good read on the subject (and other great blog posts)


Activity icon

Replied to Get Mime Message From Mailable

You can get access to the underlying SwiftMailer instance before it is sent.


You can then use something like $message->toString() to get the message contents. Have a look at the docs for the available swift mailer options

However I would look at why you cant use the standard mechanisms as this sound a bit clunky and likely to be a support nightmare and buggy long term.

Activity icon

Replied to An Approach To 'guest Checkout' ?

All of your options seem sensible with pros and cons as you've described. One consideration would be that you are planning on storing a guest users email address to correlate guest users orders together.

As a guest I probably dont want to give you this information (otherwise they would probably register) I just want to go to checkout, put in my card details, delivery details, etc so my order is processed. If I come back to buy again I dont care about my previous orders.

You could then have a single user (maybe named guest) that cant be logged into but could be used for your user_id foreign key in orders or make it nullable but then you cant use native database protection that you normally get for things like cascading deletes.

The other option would be to have 2 order tables. One for registered users and another for guest purchases.

I would move your purchase routes outside of the auth middleware rather than having custom middleware for guest/ authenticated users.

Activity icon

Replied to Laravel & VueJS Naming Conventions For Variables

I would recommend following the laravel coding style and although not shown if you look in the framework code it uses camelCase. If you follow the eloquent conventions you will really simplify your code base as you dont need to override the sensible defaults. This will still allow you to use _ in your db fields but a standard JS/PHP case.

One thing I would avoid at all costs is kebab-case as you cant do object->kebab-case in javascript and have to use object[kebab-case] instead

Activity icon

Replied to Deleting Users Passport Token On Logout.

Passport is very versatile so there are many ways to handle token based authentication. From your code I assume you using personal access tokens. If this is appropriate really depends on what your doing from frontend to backend. Access tokens tend to compliment traditional authentication rather than replace it. E.g. user logs in, generates an access token that they can then use for 3rd parties to query the API which dont get removed unless the token is compromised then its revoked manually and a new one reissued(see Gitlab docs for a good example of PATs).

However your workflow sounds like your using this as a primary authentication method.

If so you probably want to look at password grant instead.

Activity icon

Replied to Switching Over To A One Time Code For Password Resets

I haven't seen any packages specifically this but I think laravel can support this with some tweaking High level steps are

  1. Add/amend your user table migration to store the OTP and mobile number
  2. Create a OTP and save it to the database when user request reset
  3. Create a custom notification that uses sms which sends the generated OTP
  4. Redirect to a view to enter the OTP when it arrives
  5. If valid OTP (look at the guard section of the first link) then proceed to reset password view

I would try starting simple and see if you can get the workflow to work with a static OTP e.g. 1234 to save having to send a random number in a text and if that works then it's easy to generate a random otp and send the SMS.

One gotcha would be to make sure you rate limit access to route that sends the SMS to prevent using up a lot of your credits. E.g. max 3 requests a day.

Good luck as your going to have to tinker a fair bit to get it working

Activity icon

Replied to Best Practice For Web Route When Attaching In Many-to-many Relationship

I would do something like user/{user_id}/role and a dedicated UserRoleController with basic rest actions similar in structure to Adam Wathans Cruddy by Design from Laracon 2017


Activity icon

Replied to Deleting Users Passport Token On Logout.

You could try hooking into the logout event Illuminate\Auth\Events\Logout. Theres a bit of an example here


The logout event has a user property so you can get access to this in your listener with $event->user (based on linked example) so you can revoke the tokens.

4 months ago
Activity icon

Replied to What Is The Best Practice For Building Seperate Login For User And Admin In Laravel 5.7 +

I would extract your presentation layer, e.g. login form from what that user can do. Have a look at


It shows how to have 2 similar user models but with differences.

Activity icon

Replied to How To Send Email After Register In Laravel?

@IRANKHOSRAVI - This depends entirely on whether you have read, understood and implemented the solution correctly. Can you try and if it doesn't work describe what that problem is. E.g. I get this error when I do

Activity icon

Replied to Store Time Intervals In Database

If you are storing a frequency I would just store it in seconds as an integer, e.g. 86400 = daily. You can then do maths on it