| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 | 
							- <?php
 
- use Illuminate\Http\Request;
 
- use Illuminate\Support\Facades\Route;
 
- use App\Http\Resources\UserResource;
 
- use App\Http\Resources\GameResource;
 
- use App\Http\Resources\CommentResource;
 
- use App\Http\Resources\CriticResource;
 
- use App\Http\Resources\Game_genreResource;
 
- use App\Http\Resources\GenreResource;
 
- use App\Http\Resources\ReviewResource;
 
- use App\Http\Resources\SpecializationResource;
 
- use App\Models\User;
 
- use App\Models\Game;
 
- use App\Models\Comment;
 
- use App\Models\Critic;
 
- use App\Models\Game_genre;
 
- use App\Models\Genre;
 
- use App\Models\Review;
 
- use App\Models\Specialization;
 
- /*
 
- |--------------------------------------------------------------------------
 
- | 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!
 
- |
 
- */
 
- Route::middleware('auth:api')->get('/user', function (Request $request) {
 
-     return $request->user();
 
- });
 
- Route::get('/user/{id}', function (string $id) { return new UserResource(User::findOrFail($id)); });
 
- Route::get('/users', function () { return UserResource::collection(User::all()); });
 
- Route::get('/game/{id}', function (string $id) { return new GameResource(Game::findOrFail($id)); });
 
- Route::get('/games', function () { return GameResource::collection(Game::all()); });
 
- Route::get('/comment/{id}', function (string $id) { return new CommentResource(Comment::findOrFail($id)); });
 
- Route::get('/comments', function () { return CommentResource::collection(Comment::all()); });
 
- Route::get('/critic/{id}', function (string $id) { return new CriticResource(Critic::findOrFail($id)); });
 
- Route::get('/critics', function () { return CriticResource::collection(Critic::all()); });
 
- Route::get('/game_genre/{id}', function (string $id) { return new Game_genreResource(Game_genre::findOrFail($id)); });
 
- Route::get('/game_genres', function () { return Game_genreResource::collection(Game_genre::all()); });
 
- Route::get('/genre/{id}', function (string $id) { return new GenreResource(Genre::findOrFail($id)); });
 
- Route::get('/genres', function () { return GenreResource::collection(Genre::all()); });
 
- Route::get('/review/{id}', function (string $id) { return new ReviewResource(Review::findOrFail($id)); });
 
- Route::get('/reviews', function () { return ReviewResource::collection(Review::all()); });
 
- Route::get('/specialization/{id}', function (string $id) { return new SpecializationResource(Specialization::findOrFail($id)); });
 
- Route::get('/specializations', function () { return SpecializationResource::collection(Specialization::all()); });
 
 
  |