Set up modern PHP MVC project structure for GetYourBand platform
- Implemented clean MVC architecture with Router, Controller, and Model base classes - Created database migrations for users, bands, bookings, reviews, and availability - Set up Tailwind CSS with yellow color scheme and modern design - Added Alpine.js for reactive JavaScript components - Configured Vite for asset building and hot module replacement - Created authentication and role-based middleware - Implemented helper functions and configuration system - Added comprehensive README with setup instructions - Configured Apache with proper rewrite rules and security headers - Set up Composer and npm package management with modern dependencies
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Core\Model;
|
||||
|
||||
class User extends Model
|
||||
{
|
||||
protected string $table = 'users';
|
||||
|
||||
protected array $fillable = [
|
||||
'email',
|
||||
'password',
|
||||
'name',
|
||||
'role',
|
||||
'verification_token',
|
||||
'email_verified_at',
|
||||
'is_active',
|
||||
];
|
||||
|
||||
public function findByEmail(string $email): ?array
|
||||
{
|
||||
return $this->first('email', $email);
|
||||
}
|
||||
|
||||
public function verifyEmail(string $token): bool
|
||||
{
|
||||
$user = $this->first('verification_token', $token);
|
||||
|
||||
if (!$user) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $this->update($user['id'], [
|
||||
'email_verified_at' => date('Y-m-d H:i:s'),
|
||||
'verification_token' => null,
|
||||
]);
|
||||
}
|
||||
|
||||
public static function hashPassword(string $password): string
|
||||
{
|
||||
return password_hash($password, PASSWORD_BCRYPT);
|
||||
}
|
||||
|
||||
public static function verifyPassword(string $password, string $hash): bool
|
||||
{
|
||||
return password_verify($password, $hash);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user