feat: implement basic API
with authorization and validation
This commit is contained in:
parent
b033262bd7
commit
6fbeedd50c
21 changed files with 599 additions and 10 deletions
|
|
@ -5,7 +5,9 @@ namespace App\Models;
|
|||
use Filament\Forms\Components\RichEditor\FileAttachmentProviders\SpatieMediaLibraryFileAttachmentProvider;
|
||||
use Filament\Forms\Components\RichEditor\Models\Concerns\InteractsWithRichContent;
|
||||
use Filament\Forms\Components\RichEditor\Models\Contracts\HasRichContent;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Str;
|
||||
use Spatie\MediaLibrary\HasMedia;
|
||||
use Spatie\MediaLibrary\InteractsWithMedia;
|
||||
|
||||
|
|
@ -17,7 +19,7 @@ class Entry extends Model implements HasRichContent, HasMedia
|
|||
|
||||
{
|
||||
|
||||
use InteractsWithMedia, InteractsWithRichContent;
|
||||
use InteractsWithMedia, InteractsWithRichContent, HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'title',
|
||||
|
|
@ -43,4 +45,14 @@ class Entry extends Model implements HasRichContent, HasMedia
|
|||
);
|
||||
}
|
||||
|
||||
protected static function boot()
|
||||
{
|
||||
parent::boot();
|
||||
|
||||
static::creating(function ($entry) {
|
||||
if (empty($entry->slug)) {
|
||||
$entry->slug = Str::slug($entry->title);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,11 +13,12 @@ use Illuminate\Notifications\Notifiable;
|
|||
use Illuminate\Support\Facades\Log as FacadesLog;
|
||||
use Illuminate\Support\Str;
|
||||
use Laravel\Fortify\TwoFactorAuthenticatable;
|
||||
use Laravel\Sanctum\HasApiTokens;
|
||||
|
||||
class User extends Authenticatable implements FilamentUser
|
||||
{
|
||||
/** @use HasFactory<\Database\Factories\UserFactory> */
|
||||
use HasFactory, Notifiable, TwoFactorAuthenticatable;
|
||||
use HasFactory, Notifiable, TwoFactorAuthenticatable, HasApiTokens;
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue