<?php

use App\Models\Article;
use Illuminate\Http\Request;
use App\Models\ArticleCategorie;
use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

// Article
Route::get('/articles','App\Http\Controllers\ArticleController@index');

Route::post('/articles','App\Http\Controllers\ArticleController@search');
Route::post('/articles/sort','App\Http\Controllers\ArticleController@getArticles');

Route::post('/articles/store', 'App\Http\Controllers\ArticleController@store');
Route::post('/articles/{article}','App\Http\Controllers\ArticleController@updateImage');

Route::delete('/articles/{article}','App\Http\Controllers\ArticleController@destroy');

Route::put('/articles/{article}','App\Http\Controllers\ArticleController@update');

//Categorie
Route::post('/categories','App\Http\Controllers\CategorieController@store');
Route::post('/categories/{category}','App\Http\Controllers\CategorieController@updateImage');

Route::get('/categories','App\Http\Controllers\CategorieController@index');

Route::delete('/categories/{category}','App\Http\Controllers\CategorieController@destroy');

Route::put('/categories/{category}','App\Http\Controllers\CategorieController@update');

// Authentication

Route::post('/register','App\Http\Controllers\AuthenticationController@register');

Route::post('/login','App\Http\Controllers\AuthenticationController@login');