You've already forked Php-Template
added example model (#9)
All checks were successful
🧪✨ Tests Workflow / 🛡️ 🔒 Library Audit (push) Successful in 2m56s
🧪✨ Tests Workflow / 📝 ✨ Code Lint (push) Successful in 2m47s
🧪✨ Tests Workflow / 🛡️ 🔒 License Check (push) Successful in 2m55s
🧪✨ Tests Workflow / 🐙 🔍 Code Sniffer (push) Successful in 2m44s
🧪✨ Tests Workflow / 🧪 ✨ Database Migrations (push) Successful in 3m8s
🧪✨ Tests Workflow / 🧪 ✅ Unit Tests (push) Successful in 1m48s
All checks were successful
🧪✨ Tests Workflow / 🛡️ 🔒 Library Audit (push) Successful in 2m56s
🧪✨ Tests Workflow / 📝 ✨ Code Lint (push) Successful in 2m47s
🧪✨ Tests Workflow / 🛡️ 🔒 License Check (push) Successful in 2m55s
🧪✨ Tests Workflow / 🐙 🔍 Code Sniffer (push) Successful in 2m44s
🧪✨ Tests Workflow / 🧪 ✨ Database Migrations (push) Successful in 3m8s
🧪✨ Tests Workflow / 🧪 ✅ Unit Tests (push) Successful in 1m48s
Reviewed-on: #9 Co-authored-by: Ron Rise <ron@siteworxpro.com> Co-committed-by: Ron Rise <ron@siteworxpro.com>
This commit was merged in pull request #9.
This commit is contained in:
@@ -6,6 +6,12 @@ namespace Siteworxpro\App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model as ORM;
|
||||
|
||||
/**
|
||||
* Class Model
|
||||
*
|
||||
* @package Siteworxpro\App\Models
|
||||
*/
|
||||
abstract class Model extends ORM
|
||||
{
|
||||
protected $dateFormat = 'Y-m-d H:i:s';
|
||||
}
|
||||
|
||||
52
src/Models/User.php
Normal file
52
src/Models/User.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Siteworxpro\App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
|
||||
/**
|
||||
* Class User
|
||||
*
|
||||
* @property string $id
|
||||
* @property string $first_name
|
||||
* @property string $last_name
|
||||
* @property string $email
|
||||
* @property string $password
|
||||
* @property Carbon $created_at
|
||||
*
|
||||
* @property-read string $full_name
|
||||
* @property-read string $formatted_email
|
||||
*/
|
||||
class User extends Model
|
||||
{
|
||||
protected $casts = [
|
||||
'created_at' => 'datetime',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'password',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'first_name',
|
||||
'last_name',
|
||||
'email',
|
||||
'password',
|
||||
];
|
||||
|
||||
public function getFullNameAttribute(): string
|
||||
{
|
||||
return "$this->first_name $this->last_name";
|
||||
}
|
||||
|
||||
public function getFormattedEmailAttribute(): string
|
||||
{
|
||||
return sprintf(
|
||||
'%s <%s>',
|
||||
$this->getFullNameAttribute(),
|
||||
strtolower($this->email)
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user