'Find model using uuid in laravel7

It sounds like trivial but I have been searching for a while and I didn't find a suitable answer!! How to get a model using uuid inside my controller? I have tried find and where('uuid', $uuid) but it always gets a null value!

Code

public function index()
{
    $uuid = '90236239-5f28-4d74-948e-eb6c921b323c';
    return User::where('uuid', $uuid)->first();

Part of the model

use tcCore\Traits\UuidTrait;

class Userextends BaseModel
{

    use UuidTrait;

    protected $casts = [
         'uuid' => EfficientUuid::class,
    ];
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source