mirror of
https://github.com/archtechx/laravel-tips.git
synced 2025-12-12 05:14:04 +00:00
initial commit
This commit is contained in:
commit
1beb9dd34c
281 changed files with 56773 additions and 0 deletions
42
app/Models/Author.php
Normal file
42
app/Models/Author.php
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
<?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;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue