mirror of
https://github.com/ArthurDanjou/artdanj-api.git
synced 2026-01-14 20:19:26 +01:00
21 lines
618 B
TypeScript
21 lines
618 B
TypeScript
import {HttpContextContract} from "@ioc:Adonis/Core/HttpContext";
|
|
import GoldenMessage from "../../Models/GoldenMessage";
|
|
import StoreValidator from "../../Validators/goldenmessages/StoreValidator";
|
|
|
|
export default class GoldenMessagesController {
|
|
|
|
public async index () {
|
|
return GoldenMessage.query().orderBy('created_at', 'desc')
|
|
}
|
|
|
|
public async store ({request}: HttpContextContract) {
|
|
const data = await request.validate(StoreValidator)
|
|
return await GoldenMessage.create(data)
|
|
}
|
|
|
|
public async show ({params}: HttpContextContract) {
|
|
return await GoldenMessage.findOrFail(params.id)
|
|
}
|
|
|
|
}
|