> ## Documentation Index
> Fetch the complete documentation index at: https://inertiajs-vi.tuantq.online/llms.txt
> Use this file to discover all available pages before exploring further.

# Response

<Warning>Đây là tài liệu Inertia.js v1, phiên bản không còn được duy trì tích cực. Vui lòng tham khảo [tài liệu v3](/v3/getting-started/index).</Warning>

## Tạo response

Tạo một response Inertia rất đơn giản. Để bắt đầu, hãy gọi phương thức `Inertia::render()` trong controller hoặc route, truyền vào tên của [page component JavaScript](/v1/the-basics/pages) mà bạn muốn render cùng với mọi props (dữ liệu) dành cho trang.

Trong ví dụ bên dưới, chúng ta sẽ truyền một prop duy nhất (`event`) chứa bốn thuộc tính (`id`, `title`, `start_date` và `description`) cho page component `Event/Show`.

```php theme={null}
use Inertia\Inertia;

class EventsController extends Controller
{
    public function show(Event $event)
    {
        return Inertia::render('Event/Show', [
            'event' => $event->only(
                'id',
                'title',
                'start_date',
                'description'
            ),
        ]);

        // Alternatively, you can use the inertia() helper...
        return inertia('Event/Show', [
            'event' => $event->only(
                'id',
                'title',
                'start_date',
                'description'
            ),
        ]);
    }
}
```

```html theme={null}
<meta name="twitter:title" content="{{ $page['props']['event']->title }}">
```

```php theme={null}
return Inertia::render('Event', ['event' => $event])
    ->withViewData(['meta' => $event->meta]);
```

```html theme={null}
<meta name="description" content="{{ $meta }}">
```

***

## Tài liệu chính thức

Bài dịch này được đối chiếu từ [tài liệu Inertia.js v1 chính thức](https://inertiajs.com/docs/v1/the-basics/responses). Nếu có khác biệt do phiên bản hoặc cập nhật mới, hãy ưu tiên tài liệu chính thức làm nguồn tham chiếu.
