-
app/Models/Author.php
Open in GitHubuse Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; class Author extends Model { use HasFactory; // protected $casts = ['is_active' => 'boolean']; }
-
app/Http/Controllers/AuthorController.php
Open in GitHubuse App\Models\Author; use Illuminate\Http\Request; class AuthorController extends Controller { // public function store(Request $request) { $request->validate([ 'name' => 'required', 'description' => 'required', 'is_active' => 'required', ]); return Author::create([ 'name' => $request->name, 'description' => $request->description, 'is_active' => $request->is_active, ]); } // }