Skip to main content

Black Friday 2025! Only until December 1st: coupon FRIDAY25 for 40% off Yearly/Lifetime membership!

Read more here

caneara/tipsea

13 stars
2 code files
View caneara/tipsea on GitHub

app/Casts/HashCast.php

Open in GitHub
use Illuminate\Support\Facades\Hash;
use Illuminate\Contracts\Database\Eloquent\CastsInboundAttributes;
 
class HashCast implements CastsInboundAttributes
{
public function set($model, string $key, $value, array $attributes) : string | null
{
return $value ? Hash::make($value) : $value;
}
}

app/Models/User.php

Open in GitHub
use App\Types\Model;
use App\Casts\HashCast;
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
use Illuminate\Contracts\Auth\MustVerifyEmail as MustVerifyEmailContract;
use Illuminate\Contracts\Auth\Access\Authorizable as AuthorizableContract;
use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract;
 
class User extends Model implements AuthenticatableContract, AuthorizableContract, CanResetPasswordContract, MustVerifyEmailContract
{
//
protected $casts = [
'id' => 'integer',
'type' => UserType::class,
'name' => 'string',
'handle' => 'string',
'email' => 'string',
'password' => HashCast::class,
'biography' => 'string',
'website' => 'string',
'donate' => 'string',
'twitter' => 'string',
'github' => 'string',
'linkedin' => 'string',
'youtube' => 'string',
'facebook' => 'string',
'avatar' => 'string',
'metrics' => 'array',
'settings' => 'array',
'integration' => 'encrypted:array',
'remember_token' => 'string',
'email_verified_at' => 'datetime',
];
//
}

We'd Love Your Feedback

Tell us what you like or what we can improve

Feel free to share anything you like or dislike about this page or the platform in general.