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
298,430 XP
26 Jul
1 month ago

D9705996 left a reply on 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

22 Jul
2 months ago

D9705996 left a reply on 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.

19 Jul
2 months ago

D9705996 left a reply on Timetable Algorithm

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

Maybe have a look at


D9705996 left a reply on 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) {

D9705996 left a reply on Load Balancer Breaks SSO

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

12 Jul
2 months ago

D9705996 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.

D9705996 left a reply on 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?

D9705996 left a reply on 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 ;(

D9705996 left a reply on 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

D9705996 left a reply on 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)

D9705996 left a reply on 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

D9705996 left a reply on 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?

D9705996 left a reply on .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

D9705996 left a reply on 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

D9705996 left a reply on 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]'


D9705996 left a reply on .env

Have you tried?

php artisan clear
php artisan config:clear

If your using telescope this might help


D9705996 left a reply on 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

D9705996 left a reply on JSON API Spec

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

D9705996 left a reply on 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

11 Jul
2 months ago

D9705996 left a reply on 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

D9705996 left a reply on 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)


D9705996 left a reply on 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.

D9705996 left a reply on 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.

D9705996 left a reply on 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

D9705996 left a reply on 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.

D9705996 left a reply on 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

D9705996 left a reply on 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


D9705996 left a reply on 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.

21 Jun
3 months ago

D9705996 left a reply on 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.

D9705996 left a reply on 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

D9705996 left a reply on 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

13 Mar
6 months ago

D9705996 left a reply on Laravel Nova, No Hint Path Defined For [menu]

Not sure if will help but theres a github issue that sounds similar that has been solved


Might give you some pointers

D9705996 left a reply on Eloquent Log

You could use a custom monolog handler as described in this in depth tutorial


12 Mar
6 months ago

D9705996 left a reply on Real World Deploy (like Ubuntu) Recommend Folders Premission

@SOS99 - I change the owner to root so only the root user has write access as your application code should not be able to be changed by the user running the web server. I choose root as I have this account heavily locked down and only accessible via sudo so all commands are logged.

Thd larzvel documentation gives good high level setup requirements but would impractical or even impossible to document every possible setup and is assumed that you have sufficient webserver admin skills to be able to do this. There is also the option of laravel forge.

If you think the docs need further details you could always create a pull request on thd github repository


D9705996 left a reply on Eloquent Log

Its not clear from your question exactly what you need but if you are looking to log the eloquent queries your application is running, possibly for debugging you should look at telescope


09 Mar
6 months ago

D9705996 left a reply on Real World Deploy (like Ubuntu) Recommend Folders Premission

The equired permissions are covered in the documentation.


I would setup the owner of the files/directories as root and your webserver as the group and set file permissions to 0640 and directories as 0750

E.g. from your project root

chown root.apache * -R 
find -type d -exec chmod 750 {} \;
find -type f -exdc chmod 640 {} \;

This will setup the majority of thd permission but then for the directories that need webserver write like storage

chmod 660 storage -R

You just need to change user/groups to match your engine setup

08 Mar
6 months ago

D9705996 left a reply on Authentication With Gitlab Api Using Laravel Socialite

Do you see anything useful in the logs from gitlab? (Not sure if you will be able to if your using hosted gitlab)

If you spin up your own gitlab instance does it work or hell troubleshoot. Fyi gitlab install is really easy


D9705996 left a reply on How To Set Login FORM Alert Message

@BEKASKAKI - Awesome. Glad you got your issue sorted. Could you please mark the discussion as solved

D9705996 left a reply on Connection Could Not Be Established With Host Mailtrap.io

Fro your server can you connect to port 2525 on mailtrap?

telnet mailtrap.io 2525

If you get an error then your issues network related


D9705996 left a reply on Payments With Stripe/paypal

@MUSA11971 - although their is a warning you can still use for one off payments

D9705996 left a reply on What Graps Package Is Good For Laravel And Vuejs ?

@PRINCEOO7 - Just be aware if you are using for commercial use you need a licence for highcharts

D9705996 left a reply on How Do I Apply Date('H:i:s', $this_array)??

You need to ensure you are passing the data from your backend to you frontend in the format chart.js expects. Have a tinker with console.log in you front end to see what's going wrong

D9705996 left a reply on What Graps Package Is Good For Laravel And Vuejs ?

Have a look at this package that allows many different chart providers, like highcharts


Depending on your use case you might want to use


You might be able to tell I'm a highcharts fanboy

D9705996 left a reply on Payments With Stripe/paypal

You should use cashier with the braintree driver as it supports PayPal. Stripe & cashier doesn't support paypal


D9705996 left a reply on Retrieve A Polymorphic Relationship With Vue.js

You should just be able to use your relationship function name with with function


D9705996 left a reply on How Do I Apply Date('H:i:s', $this_array)??

You should be able to use eloquent casting on your model to set the format to what you want

protected $casts = [
    'time' => 'datetime:H:i:s',


D9705996 left a reply on What Is The Meaning Of Some Code In Laravel 5.8

__ is a function for translation


The other functions are global helpers


The laravel documentation is awesome and the best place to look in the 1st instance if your stuck

D9705996 left a reply on Custom Password Reset Api In Laravel 5.7

Any reason you are not using the out of the box password reset functionality?


D9705996 left a reply on Securely Handling Client_secret Passport

Have a look at this blog for a general idea on securing the passport secrets


What I would do is add a middleware that injects your secrets into the request so they are never stored client side.

D9705996 left a reply on How To Set Login FORM Alert Message

You should validate your request as per the documentation to include an error if the user is inactive. You can then add something like @if ($errors->has('active')) in your blade template


You might want to use a middleware to respond with errors if the user isnt active go save code duplication.