# Mini-projet 02 — API Articles CRUD

## Stack
- Laravel 11 · SQLite · Route::apiResource

## Setup rapide

```bash
composer create-project laravel/laravel .
echo "DB_CONNECTION=sqlite" >> .env
touch database/database.sqlite
php artisan make:model Article -mrc
php artisan migrate
php artisan serve
```

## Endpoints

| Méthode | URL | Action |
|---------|-----|--------|
| GET | /api/articles | index |
| POST | /api/articles | store |
| GET | /api/articles/{id} | show |
| PUT | /api/articles/{id} | update |
| DELETE | /api/articles/{id} | destroy |

## Modèle Article

```php
// app/Models/Article.php
protected $fillable = ['title', 'body', 'status', 'published_at'];
protected $casts = ['published_at' => 'datetime'];
```

## Migration

```php
Schema::create('articles', function (Blueprint $table) {
    $table->id();
    $table->string('title');
    $table->longText('body');
    $table->enum('status', ['draft', 'published'])->default('draft');
    $table->timestamp('published_at')->nullable();
    $table->timestamps();
});
```
