1
0
Fork 0
mirror of https://github.com/archtechx/laravel-tips.git synced 2025-12-12 21:34:03 +00:00
laravel-tips/app/Models/Author.php
2021-04-06 18:27:18 +02:00

42 lines
810 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Schema\Blueprint;
use Orbit\Concerns\Orbital;
/**
* @property string $username
* @property string $avatar
* @property string $name Full name.
* @property-read string $profile_url
*/
class Author extends Model
{
use Orbital;
public $timestamps = false;
public static function schema(Blueprint $table)
{
$table->string('username')->primary();
$table->string('avatar');
$table->string('name');
}
public function getProfileUrlAttribute(): string
{
return 'https://twitter.com/' . $this->username;
}
public function getKeyName()
{
return 'username';
}
public function getIncrementing()
{
return false;
}
}