Hello,
Yes Sanctum is an authentication system, with my external app I can do what i want, create XML or JSON collection...
I have a controller API for each model and a resource too.
I have things like this for the moment :
class CepageController extends BaseController
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
$cepages = Cepage::all();
return $this->sendResponse(CepageResource::collection($cepages), 'Cépages trouvés.');
}
ur link
/**
* Store a newly created resource in storage.
*
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$input = $request->all();
$validator = Validator::make($input, [
'id' => 'required',
'libelle' => 'required',
'abrege' => 'required',
]);
if ($validator->fails()) {
return $this->sendError($validator->errors());
}
try {
$cepage = Cepage::create($input);
return $this->sendResponse(new CepageResource($cepage), 'Cépage créé.');
} catch (\Exception $e) {
return $this->sendError('Cépage non créé.', ['error' => $e]);
}
}
I will take a look to your link. But how I call the API with a JSON collection and after doing an update or store int he API model ?
Regards