Member Since 2 Years Ago

Experience Points

2,260 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 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.


    Earned if you are a paying Laracasts subscriber.

  • lifer Created with Sketch.


    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 2
7,740 XP
3 weeks ago
Activity icon

Started a new Conversation Randomly Happening Query Exception

Hello everyone,

Recently, I have faced a weird problem. I am building a SPA application. Sometimes, query exception happens for specific endpoint just by reloading.

In the handler.php

            else if($exception instanceof QueryException){
                $exception = FlattenException::create($exception);
                return response()->prettyApi([
                    'message' => config('app.env') == 'local'?$exception->getMessage():'Query Exception Occurred',

I research and found that if I reload the page randomly generate this error because all config becomes default. For example database=forge username=forge but in the env all configuration is set properly.

This error occurs randomly if I reload the page consecutively but sometime without reloading.

It is mentionable that caching config solves this issue.

1 month ago
Activity icon

Replied to Unique Rule Is Not Working Properly

@michaloravec thank you for your reply and it worked. Could you give me laravel doc reference for validation using Rule object and thier available methods.

Activity icon

Replied to Unique Rule Is Not Working Properly

@bobbybouwmann thanks for your reply. An unique validation what normally does is, it checks the table name, couloumn name.

When only table name and column name is provided then in the database the value is checked for the provided column to the appropriate table(provided table in the unique rule)

Normally I would use unique:roles,name to check name field in the roles coloumn. But the problem is this time I have to check another field guard_name. Then I googled and found out There is another way to validate multiple field. The link is provided below:

https://stackoverflow.com/questions/50349775/laravel-unique-validation-on-multiple-columns So I followed the instruction.

Activity icon

Replied to Unique Rule Is Not Working Properly

In the RoleRequest:

	$name = request('name');
	$guard_name = request('type');

	$rules = [
            'name' => ['required', 'max:191,', Rule::unique('roles')->where(function ($q) use ($name, $guard_name) {
                return $q->where('name', $name)->where('guard_name', $guard_name);
            'permission_id' => 'required|array',
            'permission_id.*' => 'integer',
            'type' => 'integer'

        if ($this->getMethod() == "PATCH") {
            $roleId = $this->route('role')->id;
            $rules['name'] =  ['required', 'max:191,', Rule::unique('roles')->where(function ($q) use ($name, $guard_name, $roleId) {
                   return $q->where('name', $name)->where('guard_name', $guard_name)->where('id', $roleId);

Expected behavior: Role should avoid validation to the table roles column name and given guard name and id. When I create data it does not show any problem.

Activity icon

Started a new Conversation Unique Rule Is Not Working Properly

Hello everyone,

I am trying to validate the following way. But this is not working. Showing name already present. But should not it make an exception for the given name, guard_name and id

$rules['name'] =  ['required', 'max:191,', Rule::unique('roles')->where(function ($q) use ($name, $guard_name, $roleId) {
     return $q->where('name', $name)->where('guard_name', $guard_name)->where('id', $roleId);

3 months ago
Activity icon

Awarded Best Reply on Getting Null Value Of $event In Hadle Method Of Laravel Event

Sorry my mistake. I have found my problem.My problem is in the event class. In the constructor I did not assign $now to the public property.


namespace App\Events;

use Carbon\Carbon;
use Illuminate\Broadcasting\Channel;
use Illuminate\Queue\SerializesModels;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Broadcasting\PresenceChannel;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;

class CountHourlyProduction
    use Dispatchable, InteractsWithSockets, SerializesModels;

    public $now,$lastHour;

     * Create a new event instance.
     * @return void
    public function __construct()
        $this->now = now('Asia/Dhaka');
        $this->lastHour = new Carbon('last hour', 'Asia/Dhaka');


     * Get the channels the event should broadcast on.
     * @return \Illuminate\Broadcasting\Channel|array
    public function broadcastOn()
        return new PrivateChannel('channel-name');

Activity icon

Replied to Auth()->user() Returns Null For Laravel Sanctum

@bobbybouwmann thanks for your reply. Auth::guard('web')->logout(); does not work for me. I checked in the browser cookie storage. The cookie still exists after performing the action. And I checked by running auth()->user() under the auth:sanctum middleware and giving me the result.

Activity icon

Started a new Conversation Auth()->user() Returns Null For Laravel Sanctum

Hello everyone,

I am using laravel 7 and Sanctum. My problem is auth()->user() always returns null. auth()->user() is giving result only if user is logged in and under the auth:sanctum middleware otherwise returns null. If user not null then giving 401 error which is expected.

auth()->logout() also not working. Currently for logging out I am removing all the token for that particular user.

Is it expected behavior or I am doing something wrong.

I am using sanctum for SPA with laravel not as a separate project. So I don't need to think about cors problem.