Initial api service;

Clean code;
This commit is contained in:
c.girardi
2024-02-21 17:58:41 +01:00
parent cd9c380b58
commit f56a6e820c
7 changed files with 139 additions and 30 deletions

View File

@@ -0,0 +1,42 @@
<?php
namespace App\Http\Controllers\Api;
use App\Http\Controllers\Controller;
use App\Models\Word;
use Illuminate\Http\Request;
class WordsController extends Controller
{
public function __construct()
{
$this->middleware('auth:sanctum');
}
/**
* Display a listing of the resource.
*/
public function index()
{
$words = Word::all();
return response()->json([
'status' => true,
'words' => $words
]);
}
/**
* Display the specified resource.
*/
public function show(Word $word)
{
return response()->json([
'status' => true,
'words' => $word
]);
}
}