This commit is contained in:
梁朝伟
2024-11-13 19:23:49 +08:00
commit 7f3db2ed48
461 changed files with 276684 additions and 0 deletions

29
app/Models/Media.php Normal file
View File

@@ -0,0 +1,29 @@
<?php
namespace App\Models;
use Spatie\MediaLibrary\MediaCollections\Models\Media as SpatieMedia;
class Media extends SpatieMedia
{
protected $guarded = ['id'];
protected $table = 'app_media';
public function replaceUseKey($key): self
{
self::delete();
return $this->model
->addMediaFromDisk($key, 'public')
->usingFileName($key)
->toMediaCollection($this->collection_name);
}
protected function casts()
{
return [
'created_at' => 'datetime:Y-m-d H:i:s',
'updated_at' => 'datetime:Y-m-d H:i:s',
];
}
}

48
app/Models/User.php Normal file
View File

@@ -0,0 +1,48 @@
<?php
namespace App\Models;
// use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
class User extends Authenticatable
{
use HasFactory;
use Notifiable;
/**
* The attributes that are mass assignable.
*
* @var array<int, string>
*/
protected $fillable = [
'name',
'email',
'password',
];
/**
* The attributes that should be hidden for serialization.
*
* @var array<int, string>
*/
protected $hidden = [
'password',
'remember_token',
];
/**
* Get the attributes that should be cast.
*
* @return array<string, string>
*/
protected function casts(): array
{
return [
'email_verified_at' => 'datetime',
'password' => 'hashed',
];
}
}