2 Commits

Author SHA1 Message Date
Clément
a5a03737a9 finished api no auth 2025-06-03 14:46:58 +02:00
Clément
2c4aeb4704 to squeeze 2025-06-03 14:10:35 +02:00
98 changed files with 1576 additions and 840 deletions

View File

@@ -10,31 +10,3 @@
- `storage` => logs, cache - `storage` => logs, cache
- `tests` => tests de l'app (automatisés) - `tests` => tests de l'app (automatisés)
- `vendor` => le dossier de composer (on n'y touche pas) - `vendor` => le dossier de composer (on n'y touche pas)
# Commandes PHP Artisan (Docker)
- Créer une migration => `php artisan make:migration create_nom_table`
- migration => `php artisan migrate:fresh`
- seeder => `php artisan db:seed --class=NomSeeder`
php artisan make:model Categorie --migration -a
php artisan make:model billet_categorie -m
```sql
use laravel_db;
INSERT INTO billet_categorie (id, billet_id, categorie_id, created_at, updated_at)
VALUES
(1, 1, 1, NULL, NULL),
(2, 1, 2, NULL, NULL),
(3, 1, 10, NULL, NULL),
(4, 2, 3, NULL, NULL),
(5, 3, 9, NULL, NULL),
(6, 4, 1, NULL, NULL),
(7, 4, 4, NULL, NULL),
(8, 5, 5, NULL, NULL),
(9, 6, 7, NULL, NULL),
(10, 7, 1, NULL, NULL),
(11, 8, 10, NULL, NULL),
(12, 9, 6, NULL, NULL),
(13, 10, 8, NULL, NULL);
```

0
laravel/.buildcomplete Normal file → Executable file
View File

0
laravel/.editorconfig Normal file → Executable file
View File

0
laravel/.env.example Normal file → Executable file
View File

0
laravel/.gitattributes vendored Normal file → Executable file
View File

0
laravel/.gitignore vendored Normal file → Executable file
View File

0
laravel/.spdx-laravel.spdx Normal file → Executable file
View File

0
laravel/README.md Normal file → Executable file
View File

View File

@@ -2,10 +2,9 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use App\Http\Requests\StoreBilletRequest;
use App\Http\Requests\UpdateBilletRequest;
use App\Models\Billet; use App\Models\Billet;
use App\Http\Resources\BilletResource;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
class BilletController extends Controller class BilletController extends Controller
@@ -15,28 +14,22 @@ class BilletController extends Controller
*/ */
public function index() public function index()
{ {
Log::info("coucou"); //Return all posts in json format
try { try {
$billets = Billet::all(); return BilletResource::collection(Billet::with('commentaires')->get());
} catch (\Illuminate\Database\QueryException $e) { }
Log::channel('projectError')->error('Erreur d\'accès à la base de données'); catch (\Illuminate\Database\QueryException $e){
return view('errors.unavailable'); Log::channel('projectError')->error('Erreur accès base de données');
return response()->json([
'message' => 'Ressource indinponible.'
],500);
} }
return view('index', compact('billets'));
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
//
} }
/** /**
* Store a newly created resource in storage. * Store a newly created resource in storage.
*/ */
public function store(StoreBilletRequest $request) public function store(Request $request)
{ {
// //
} }
@@ -46,23 +39,21 @@ class BilletController extends Controller
*/ */
public function show(Billet $billet) public function show(Billet $billet)
{ {
// try{
$commentaires = $billet->commentaires; return new BilletResource($billet);
return view('vBillet', compact('billet', 'commentaires')); }
} catch (\Illuminate\Database\QueryException $e){
Log::channel('projectError')->error('Erreur accès base de données');
/** return response()->json([
* Show the form for editing the specified resource. 'message' => 'Ressource indinponible.'
*/ ],500);
public function edit(Billet $billet) }
{
//
} }
/** /**
* Update the specified resource in storage. * Update the specified resource in storage.
*/ */
public function update(UpdateBilletRequest $request, Billet $billet) public function update(Request $request, Billet $billet)
{ {
// //
} }

View File

@@ -1,66 +0,0 @@
<?php
namespace App\Http\Controllers;
use App\Http\Requests\StoreCategorieRequest;
use App\Http\Requests\UpdateCategorieRequest;
use App\Models\Categorie;
class CategorieController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
//
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*/
public function store(StoreCategorieRequest $request)
{
//
}
/**
* Display the specified resource.
*/
public function show(Categorie $categorie)
{
//
}
/**
* Show the form for editing the specified resource.
*/
public function edit(Categorie $categorie)
{
//
}
/**
* Update the specified resource in storage.
*/
public function update(UpdateCategorieRequest $request, Categorie $categorie)
{
//
}
/**
* Remove the specified resource from storage.
*/
public function destroy(Categorie $categorie)
{
//
}
}

View File

@@ -2,9 +2,10 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use App\Http\Requests\StoreCommentaireRequest; use App\Http\Requests\CommentaireRequest;
use App\Http\Requests\UpdateCommentaireRequest;
use App\Models\Commentaire; use App\Models\Commentaire;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;
class CommentaireController extends Controller class CommentaireController extends Controller
{ {
@@ -16,21 +17,23 @@ class CommentaireController extends Controller
// //
} }
/**
* Show the form for creating a new resource.
*/
public function create()
{
//
}
/** /**
* Store a newly created resource in storage. * Store a newly created resource in storage.
*/ */
public function store(StoreCommentaireRequest $request) public function store(CommentaireRequest $request)
{ {
// //
try {
$commentaire = Commentaire::create($request->all());
return response()->json($commentaire,201);
} }
catch(\Illuminate\Database\QueryException $e){
Log::channel('projectError')->error('Erreur accès base de données\n'.$e->getMessage());
return response()->json([
'message' => 'Ressource indisponible.'
],500);
}
}
/** /**
* Display the specified resource. * Display the specified resource.
@@ -40,18 +43,10 @@ class CommentaireController extends Controller
// //
} }
/**
* Show the form for editing the specified resource.
*/
public function edit(Commentaire $commentaire)
{
//
}
/** /**
* Update the specified resource in storage. * Update the specified resource in storage.
*/ */
public function update(UpdateCommentaireRequest $request, Commentaire $commentaire) public function update(Request $request, Commentaire $commentaire)
{ {
// //
} }

0
laravel/app/Http/Controllers/Controller.php Normal file → Executable file
View File

View File

@@ -1,25 +0,0 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class TestFormController extends Controller
{
//Contrôleur pour la découverte des formulaires.
//Méthode getInfo() : pour afficher le formulaire au client (Méthode HTTP : GET).
//Méthode postInfo() : le client soumet son formulaire (Méthode HTTP : POST).
public function getInfo() {
//Le client demande l'affichage du formulaire.
//La vue monFormulaire est retournée.
return view('monFormulaire');
}
public function postInfo(Request $request){
//On ne crée pas de vue spécifique pour l'affichage d'un message après envoi du formulaire.
//On se contente d'afficher ce qui a été saisi dans la zone de texte du formulaire,
//grâce à l'objet "Request" passé en paramètre.
return 'Le message saisi dans la zone de texte est : ' .$request->input('message');
}
}

View File

@@ -0,0 +1,40 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Http\Exceptions\HttpResponseException;
use Illuminate\Contracts\Validation\Validator;
class CommentaireRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
'COM_DATE' => ['required', 'date'],
'COM_AUTEUR' => ['required', 'string', 'max:100'],
'COM_CONTENU' => ['required', 'string', 'max:200'],
'billet_id' => ['required', 'integer'],
];
}
public function failedValidation(Validator $validator){
throw new HttpResponseException(response()->json([
'success' => false,
'message' => 'Validation errors',
'data' => $validator->errors()
]));
}
}

0
laravel/app/Http/Requests/StoreBilletRequest.php Normal file → Executable file
View File

View File

@@ -1,28 +0,0 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class StoreCategorieRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return false;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
//
];
}
}

View File

@@ -1,28 +0,0 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class StoreCommentaireRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return false;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
//
];
}
}

0
laravel/app/Http/Requests/UpdateBilletRequest.php Normal file → Executable file
View File

View File

@@ -1,28 +0,0 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class UpdateCategorieRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return false;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
//
];
}
}

View File

@@ -1,28 +0,0 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class UpdateCommentaireRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return false;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
//
];
}
}

View File

@@ -0,0 +1,25 @@
<?php
namespace App\Http\Resources;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
class BilletResource extends JsonResource
{
/**
* Transform the resource into an array.
*
* @return array<string, mixed>
*/
public function toArray(Request $request): array
{
//return parent::toArray($request);
return [
'Date' => $this->BIL_DATE,
'Titre' => $this->BIL_TITRE,
'Contenu' => $this->BIL_CONTENU,
'Commentaires' => CommentaireResource::collection($this->commentaires),
];
}
}

View File

@@ -0,0 +1,24 @@
<?php
namespace App\Http\Resources;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
class CommentaireResource extends JsonResource
{
/**
* Transform the resource into an array.
*
* @return array<string, mixed>
*/
public function toArray(Request $request): array
{
//return parent::toArray($request);
return [
'Date' => $this->COM_DATE,
'Auteur' => $this->COM_AUTEUR,
'Contenu' => $this->COM_CONTENU,
];
}
}

View File

@@ -1,30 +1,59 @@
<?php <?php
/**
* Created by Reliese Model.
*/
namespace App\Models; namespace App\Models;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
/**
* Class Billet
*
* @property int $id
* @property Carbon $BIL_DATE
* @property string $BIL_TITRE
* @property string $BIL_CONTENU
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
*
* @property Collection|BilletCategorie[] $billet_categories
* @property Collection|Commentaire[] $commentaires
*
* @package App\Models
*/
class Billet extends Model class Billet extends Model
{ {
/** @use HasFactory<\Database\Factories\BilletFactory> */
use HasFactory; use HasFactory;
protected $table = 'billets';
protected $fillable = [ protected $casts = [
'BIL_DATE', 'BIL_DATE' => 'datetime'
'BIL_TITRE', ];
'BIL_CONTENU',
'created_at', protected $fillable = [
'updated_at', 'BIL_DATE',
'BIL_TITRE',
'BIL_CONTENU'
];
protected $hidden = [
'id',
'created_at',
'updated_at'
]; ];
public function commentaires() public function billet_categories()
{ {
return $this->hasMany(Commentaire::class); return $this->hasMany(BilletCategorie::class);
} }
public function categories() public function commentaires()
{ {
return $this->belongsToMany(Categorie::class); return $this->hasMany(Commentaire::class);
} }
} }

View File

@@ -0,0 +1,49 @@
<?php
/**
* Created by Reliese Model.
*/
namespace App\Models;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model;
/**
* Class BilletCategorie
*
* @property int $id
* @property int $billet_id
* @property int $categorie_id
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
*
* @property Billet $billet
* @property Category $category
*
* @package App\Models
*/
class BilletCategorie extends Model
{
protected $table = 'billet_categorie';
protected $casts = [
'billet_id' => 'int',
'categorie_id' => 'int'
];
protected $fillable = [
'billet_id',
'categorie_id'
];
public function billet()
{
return $this->belongsTo(Billet::class);
}
public function category()
{
return $this->belongsTo(Category::class, 'categorie_id');
}
}

35
laravel/app/Models/Cache.php Executable file
View File

@@ -0,0 +1,35 @@
<?php
/**
* Created by Reliese Model.
*/
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
/**
* Class Cache
*
* @property string $key
* @property string $value
* @property int $expiration
*
* @package App\Models
*/
class Cache extends Model
{
protected $table = 'cache';
protected $primaryKey = 'key';
public $incrementing = false;
public $timestamps = false;
protected $casts = [
'expiration' => 'int'
];
protected $fillable = [
'value',
'expiration'
];
}

View File

@@ -0,0 +1,35 @@
<?php
/**
* Created by Reliese Model.
*/
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
/**
* Class CacheLock
*
* @property string $key
* @property string $owner
* @property int $expiration
*
* @package App\Models
*/
class CacheLock extends Model
{
protected $table = 'cache_locks';
protected $primaryKey = 'key';
public $incrementing = false;
public $timestamps = false;
protected $casts = [
'expiration' => 'int'
];
protected $fillable = [
'owner',
'expiration'
];
}

View File

@@ -1,17 +0,0 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Categorie extends Model
{
/** @use HasFactory<\Database\Factories\CategorieFactory> */
use HasFactory;
public function billets()
{
return $this->belongsToMany(Billet::class);
}
}

View File

@@ -0,0 +1,37 @@
<?php
/**
* Created by Reliese Model.
*/
namespace App\Models;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Model;
/**
* Class Category
*
* @property int $id
* @property string $CAT_NOM
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
*
* @property Collection|BilletCategorie[] $billet_categories
*
* @package App\Models
*/
class Category extends Model
{
protected $table = 'categories';
protected $fillable = [
'CAT_NOM'
];
public function billet_categories()
{
return $this->hasMany(BilletCategorie::class, 'categorie_id');
}
}

View File

@@ -1,26 +1,54 @@
<?php <?php
/**
* Created by Reliese Model.
*/
namespace App\Models; namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory; use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
/**
* Class Commentaire
*
* @property int $id
* @property Carbon $COM_DATE
* @property string $COM_AUTEUR
* @property string $COM_CONTENU
* @property int $billet_id
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
*
* @property Billet $billet
*
* @package App\Models
*/
class Commentaire extends Model class Commentaire extends Model
{ {
/** @use HasFactory<\Database\Factories\CommentaireFactory> */ protected $table = 'commentaires';
use HasFactory;
protected $fillable = [ protected $casts = [
'COM_DATE', 'COM_DATE' => 'datetime',
'COM_AUTEUR', 'billet_id' => 'int'
'COM_CONTENU', ];
'billet_id',
protected $fillable = [
'COM_DATE',
'COM_AUTEUR',
'COM_CONTENU',
'billet_id'
];
protected $hidden = [
'id',
'created_at', 'created_at',
'updated_at', 'updated_at',
'billet_id'
]; ];
public function billet() public function billet()
{ {
return $this->belongsTo(Billet::class, 'billet_id'); return $this->belongsTo(Billet::class);
} }
} }

42
laravel/app/Models/Job.php Executable file
View File

@@ -0,0 +1,42 @@
<?php
/**
* Created by Reliese Model.
*/
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
/**
* Class Job
*
* @property int $id
* @property string $queue
* @property string $payload
* @property int $attempts
* @property int|null $reserved_at
* @property int $available_at
* @property int $created_at
*
* @package App\Models
*/
class Job extends Model
{
protected $table = 'jobs';
public $timestamps = false;
protected $casts = [
'attempts' => 'int',
'reserved_at' => 'int',
'available_at' => 'int'
];
protected $fillable = [
'queue',
'payload',
'attempts',
'reserved_at',
'available_at'
];
}

51
laravel/app/Models/JobBatch.php Executable file
View File

@@ -0,0 +1,51 @@
<?php
/**
* Created by Reliese Model.
*/
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
/**
* Class JobBatch
*
* @property string $id
* @property string $name
* @property int $total_jobs
* @property int $pending_jobs
* @property int $failed_jobs
* @property string $failed_job_ids
* @property string|null $options
* @property int|null $cancelled_at
* @property int $created_at
* @property int|null $finished_at
*
* @package App\Models
*/
class JobBatch extends Model
{
protected $table = 'job_batches';
public $incrementing = false;
public $timestamps = false;
protected $casts = [
'total_jobs' => 'int',
'pending_jobs' => 'int',
'failed_jobs' => 'int',
'cancelled_at' => 'int',
'finished_at' => 'int'
];
protected $fillable = [
'name',
'total_jobs',
'pending_jobs',
'failed_jobs',
'failed_job_ids',
'options',
'cancelled_at',
'finished_at'
];
}

41
laravel/app/Models/Session.php Executable file
View File

@@ -0,0 +1,41 @@
<?php
/**
* Created by Reliese Model.
*/
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
/**
* Class Session
*
* @property string $id
* @property int|null $user_id
* @property string|null $ip_address
* @property string|null $user_agent
* @property string $payload
* @property int $last_activity
*
* @package App\Models
*/
class Session extends Model
{
protected $table = 'sessions';
public $incrementing = false;
public $timestamps = false;
protected $casts = [
'user_id' => 'int',
'last_activity' => 'int'
];
protected $fillable = [
'user_id',
'ip_address',
'user_agent',
'payload',
'last_activity'
];
}

75
laravel/app/Models/User.php Normal file → Executable file
View File

@@ -1,48 +1,49 @@
<?php <?php
/**
* Created by Reliese Model.
*/
namespace App\Models; namespace App\Models;
// use Illuminate\Contracts\Auth\MustVerifyEmail; use Carbon\Carbon;
use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable; use Illuminate\Database\Eloquent\Model;
use Illuminate\Notifications\Notifiable;
class User extends Authenticatable /**
* Class User
*
* @property int $id
* @property string $name
* @property string $email
* @property Carbon|null $email_verified_at
* @property string $password
* @property string|null $remember_token
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
*
* @package App\Models
*/
class User extends Model
{ {
/** @use HasFactory<\Database\Factories\UserFactory> */ use HasFactory;
use HasFactory, Notifiable;
/** protected $table = 'users';
* The attributes that are mass assignable.
*
* @var list<string>
*/
protected $fillable = [
'name',
'email',
'password',
];
/** protected $casts = [
* The attributes that should be hidden for serialization. 'email_verified_at' => 'datetime'
* ];
* @var list<string>
*/
protected $hidden = [
'password',
'remember_token',
];
/** protected $hidden = [
* Get the attributes that should be cast. 'password',
* 'remember_token'
* @return array<string, string> ];
*/
protected function casts(): array protected $fillable = [
{ 'name',
return [ 'email',
'email_verified_at' => 'datetime', 'email_verified_at',
'password' => 'hashed', 'password',
]; 'remember_token'
} ];
} }

View File

@@ -1,12 +0,0 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class billet_categorie extends Model
{
/** @use HasFactory<\Database\Factories\BilletCategorieFactory> */
use HasFactory;
}

0
laravel/app/Policies/BilletPolicy.php Normal file → Executable file
View File

View File

@@ -1,66 +0,0 @@
<?php
namespace App\Policies;
use App\Models\Categorie;
use App\Models\User;
use Illuminate\Auth\Access\Response;
class CategoriePolicy
{
/**
* Determine whether the user can view any models.
*/
public function viewAny(User $user): bool
{
return false;
}
/**
* Determine whether the user can view the model.
*/
public function view(User $user, Categorie $categorie): bool
{
return false;
}
/**
* Determine whether the user can create models.
*/
public function create(User $user): bool
{
return false;
}
/**
* Determine whether the user can update the model.
*/
public function update(User $user, Categorie $categorie): bool
{
return false;
}
/**
* Determine whether the user can delete the model.
*/
public function delete(User $user, Categorie $categorie): bool
{
return false;
}
/**
* Determine whether the user can restore the model.
*/
public function restore(User $user, Categorie $categorie): bool
{
return false;
}
/**
* Determine whether the user can permanently delete the model.
*/
public function forceDelete(User $user, Categorie $categorie): bool
{
return false;
}
}

View File

@@ -1,66 +0,0 @@
<?php
namespace App\Policies;
use App\Models\Commentaire;
use App\Models\User;
use Illuminate\Auth\Access\Response;
class CommentairePolicy
{
/**
* Determine whether the user can view any models.
*/
public function viewAny(User $user): bool
{
return false;
}
/**
* Determine whether the user can view the model.
*/
public function view(User $user, Commentaire $commentaire): bool
{
return false;
}
/**
* Determine whether the user can create models.
*/
public function create(User $user): bool
{
return false;
}
/**
* Determine whether the user can update the model.
*/
public function update(User $user, Commentaire $commentaire): bool
{
return false;
}
/**
* Determine whether the user can delete the model.
*/
public function delete(User $user, Commentaire $commentaire): bool
{
return false;
}
/**
* Determine whether the user can restore the model.
*/
public function restore(User $user, Commentaire $commentaire): bool
{
return false;
}
/**
* Determine whether the user can permanently delete the model.
*/
public function forceDelete(User $user, Commentaire $commentaire): bool
{
return false;
}
}

0
laravel/app/Providers/AppServiceProvider.php Normal file → Executable file
View File

8
laravel/bootstrap/app.php Normal file → Executable file
View File

@@ -3,10 +3,12 @@
use Illuminate\Foundation\Application; use Illuminate\Foundation\Application;
use Illuminate\Foundation\Configuration\Exceptions; use Illuminate\Foundation\Configuration\Exceptions;
use Illuminate\Foundation\Configuration\Middleware; use Illuminate\Foundation\Configuration\Middleware;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
return Application::configure(basePath: dirname(__DIR__)) return Application::configure(basePath: dirname(__DIR__))
->withRouting( ->withRouting(
web: __DIR__.'/../routes/web.php', web: __DIR__.'/../routes/web.php',
api: __DIR__.'/../routes/api.php',
commands: __DIR__.'/../routes/console.php', commands: __DIR__.'/../routes/console.php',
health: '/up', health: '/up',
) )
@@ -14,5 +16,9 @@ return Application::configure(basePath: dirname(__DIR__))
// //
}) })
->withExceptions(function (Exceptions $exceptions) { ->withExceptions(function (Exceptions $exceptions) {
// $exceptions->renderable(function (NotFoundHttpException $e){
return response()->json([
'message' => 'Ressource non trouvée.'
],404);
});
})->create(); })->create();

0
laravel/bootstrap/cache/.gitignore vendored Normal file → Executable file
View File

0
laravel/bootstrap/providers.php Normal file → Executable file
View File

4
laravel/composer.json Normal file → Executable file
View File

@@ -8,6 +8,7 @@
"require": { "require": {
"php": "^8.2", "php": "^8.2",
"laravel/framework": "^12.0", "laravel/framework": "^12.0",
"laravel/sanctum": "^4.0",
"laravel/tinker": "^2.10.1" "laravel/tinker": "^2.10.1"
}, },
"require-dev": { "require-dev": {
@@ -17,7 +18,8 @@
"laravel/sail": "^1.41", "laravel/sail": "^1.41",
"mockery/mockery": "^1.6", "mockery/mockery": "^1.6",
"nunomaduro/collision": "^8.6", "nunomaduro/collision": "^8.6",
"phpunit/phpunit": "^11.5.3" "phpunit/phpunit": "^11.5.3",
"reliese/laravel": "^1.4"
}, },
"autoload": { "autoload": {
"psr-4": { "psr-4": {

332
laravel/composer.lock generated Normal file → Executable file
View File

@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "88970a0117c062eed55fa8728fc43833", "content-hash": "cc1f42d2dd2bf6629798006e6a8a4606",
"packages": [ "packages": [
{ {
"name": "brick/math", "name": "brick/math",
@@ -1328,6 +1328,70 @@
}, },
"time": "2025-02-11T13:34:40+00:00" "time": "2025-02-11T13:34:40+00:00"
}, },
{
"name": "laravel/sanctum",
"version": "v4.1.1",
"source": {
"type": "git",
"url": "https://github.com/laravel/sanctum.git",
"reference": "a360a6a1fd2400ead4eb9b6a9c1bb272939194f5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laravel/sanctum/zipball/a360a6a1fd2400ead4eb9b6a9c1bb272939194f5",
"reference": "a360a6a1fd2400ead4eb9b6a9c1bb272939194f5",
"shasum": ""
},
"require": {
"ext-json": "*",
"illuminate/console": "^11.0|^12.0",
"illuminate/contracts": "^11.0|^12.0",
"illuminate/database": "^11.0|^12.0",
"illuminate/support": "^11.0|^12.0",
"php": "^8.2",
"symfony/console": "^7.0"
},
"require-dev": {
"mockery/mockery": "^1.6",
"orchestra/testbench": "^9.0|^10.0",
"phpstan/phpstan": "^1.10",
"phpunit/phpunit": "^11.3"
},
"type": "library",
"extra": {
"laravel": {
"providers": [
"Laravel\\Sanctum\\SanctumServiceProvider"
]
}
},
"autoload": {
"psr-4": {
"Laravel\\Sanctum\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Taylor Otwell",
"email": "taylor@laravel.com"
}
],
"description": "Laravel Sanctum provides a featherweight authentication system for SPAs and simple APIs.",
"keywords": [
"auth",
"laravel",
"sanctum"
],
"support": {
"issues": "https://github.com/laravel/sanctum/issues",
"source": "https://github.com/laravel/sanctum"
},
"time": "2025-04-23T13:03:38+00:00"
},
{ {
"name": "laravel/serializable-closure", "name": "laravel/serializable-closure",
"version": "v2.0.4", "version": "v2.0.4",
@@ -5787,6 +5851,160 @@
} }
], ],
"packages-dev": [ "packages-dev": [
{
"name": "doctrine/dbal",
"version": "4.2.3",
"source": {
"type": "git",
"url": "https://github.com/doctrine/dbal.git",
"reference": "33d2d7fe1269b2301640c44cf2896ea607b30e3e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/dbal/zipball/33d2d7fe1269b2301640c44cf2896ea607b30e3e",
"reference": "33d2d7fe1269b2301640c44cf2896ea607b30e3e",
"shasum": ""
},
"require": {
"doctrine/deprecations": "^0.5.3|^1",
"php": "^8.1",
"psr/cache": "^1|^2|^3",
"psr/log": "^1|^2|^3"
},
"require-dev": {
"doctrine/coding-standard": "12.0.0",
"fig/log-test": "^1",
"jetbrains/phpstorm-stubs": "2023.2",
"phpstan/phpstan": "2.1.1",
"phpstan/phpstan-phpunit": "2.0.3",
"phpstan/phpstan-strict-rules": "^2",
"phpunit/phpunit": "10.5.39",
"slevomat/coding-standard": "8.13.1",
"squizlabs/php_codesniffer": "3.10.2",
"symfony/cache": "^6.3.8|^7.0",
"symfony/console": "^5.4|^6.3|^7.0"
},
"suggest": {
"symfony/console": "For helpful console commands such as SQL execution and import of files."
},
"type": "library",
"autoload": {
"psr-4": {
"Doctrine\\DBAL\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Guilherme Blanco",
"email": "guilhermeblanco@gmail.com"
},
{
"name": "Roman Borschel",
"email": "roman@code-factory.org"
},
{
"name": "Benjamin Eberlei",
"email": "kontakt@beberlei.de"
},
{
"name": "Jonathan Wage",
"email": "jonwage@gmail.com"
}
],
"description": "Powerful PHP database abstraction layer (DBAL) with many features for database schema introspection and management.",
"homepage": "https://www.doctrine-project.org/projects/dbal.html",
"keywords": [
"abstraction",
"database",
"db2",
"dbal",
"mariadb",
"mssql",
"mysql",
"oci8",
"oracle",
"pdo",
"pgsql",
"postgresql",
"queryobject",
"sasql",
"sql",
"sqlite",
"sqlserver",
"sqlsrv"
],
"support": {
"issues": "https://github.com/doctrine/dbal/issues",
"source": "https://github.com/doctrine/dbal/tree/4.2.3"
},
"funding": [
{
"url": "https://www.doctrine-project.org/sponsorship.html",
"type": "custom"
},
{
"url": "https://www.patreon.com/phpdoctrine",
"type": "patreon"
},
{
"url": "https://tidelift.com/funding/github/packagist/doctrine%2Fdbal",
"type": "tidelift"
}
],
"time": "2025-03-07T18:29:05+00:00"
},
{
"name": "doctrine/deprecations",
"version": "1.1.5",
"source": {
"type": "git",
"url": "https://github.com/doctrine/deprecations.git",
"reference": "459c2f5dd3d6a4633d3b5f46ee2b1c40f57d3f38"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/deprecations/zipball/459c2f5dd3d6a4633d3b5f46ee2b1c40f57d3f38",
"reference": "459c2f5dd3d6a4633d3b5f46ee2b1c40f57d3f38",
"shasum": ""
},
"require": {
"php": "^7.1 || ^8.0"
},
"conflict": {
"phpunit/phpunit": "<=7.5 || >=13"
},
"require-dev": {
"doctrine/coding-standard": "^9 || ^12 || ^13",
"phpstan/phpstan": "1.4.10 || 2.1.11",
"phpstan/phpstan-phpunit": "^1.0 || ^2",
"phpunit/phpunit": "^7.5 || ^8.5 || ^9.6 || ^10.5 || ^11.5 || ^12",
"psr/log": "^1 || ^2 || ^3"
},
"suggest": {
"psr/log": "Allows logging deprecations via PSR-3 logger implementation"
},
"type": "library",
"autoload": {
"psr-4": {
"Doctrine\\Deprecations\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "A small layer on top of trigger_error(E_USER_DEPRECATED) or PSR-3 logging with options to disable all deprecations or selectively for packages.",
"homepage": "https://www.doctrine-project.org/",
"support": {
"issues": "https://github.com/doctrine/deprecations/issues",
"source": "https://github.com/doctrine/deprecations/tree/1.1.5"
},
"time": "2025-04-07T20:06:18+00:00"
},
{ {
"name": "fakerphp/faker", "name": "fakerphp/faker",
"version": "v1.24.1", "version": "v1.24.1",
@@ -6963,6 +7181,118 @@
], ],
"time": "2025-04-08T07:59:11+00:00" "time": "2025-04-08T07:59:11+00:00"
}, },
{
"name": "psr/cache",
"version": "3.0.0",
"source": {
"type": "git",
"url": "https://github.com/php-fig/cache.git",
"reference": "aa5030cfa5405eccfdcb1083ce040c2cb8d253bf"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/cache/zipball/aa5030cfa5405eccfdcb1083ce040c2cb8d253bf",
"reference": "aa5030cfa5405eccfdcb1083ce040c2cb8d253bf",
"shasum": ""
},
"require": {
"php": ">=8.0.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Psr\\Cache\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "https://www.php-fig.org/"
}
],
"description": "Common interface for caching libraries",
"keywords": [
"cache",
"psr",
"psr-6"
],
"support": {
"source": "https://github.com/php-fig/cache/tree/3.0.0"
},
"time": "2021-02-03T23:26:27+00:00"
},
{
"name": "reliese/laravel",
"version": "v1.4.0",
"source": {
"type": "git",
"url": "https://github.com/reliese/laravel.git",
"reference": "2181113d420cae67ec68b6bbe6f325900856d6b9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/reliese/laravel/zipball/2181113d420cae67ec68b6bbe6f325900856d6b9",
"reference": "2181113d420cae67ec68b6bbe6f325900856d6b9",
"shasum": ""
},
"require": {
"doctrine/dbal": ">=2.5",
"illuminate/console": ">=5.1",
"illuminate/contracts": ">=5.1",
"illuminate/database": ">=5.1",
"illuminate/filesystem": ">=5.1",
"illuminate/support": ">=5.1",
"php": "^7.3|^8.0"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"mockery/mockery": ">=1.4",
"phpunit/phpunit": "^9"
},
"type": "library",
"extra": {
"laravel": {
"providers": [
"Reliese\\Coders\\CodersServiceProvider"
]
}
},
"autoload": {
"psr-4": {
"Reliese\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Cristian Llanos",
"email": "cristianllanos@outlook.com"
}
],
"description": "Reliese Components for Laravel Framework code generation.",
"homepage": "http://cristianllanos.com",
"keywords": [
"laravel",
"reliese"
],
"support": {
"issues": "https://github.com/reliese/laravel/issues",
"source": "https://github.com/reliese/laravel"
},
"time": "2025-03-20T16:16:48+00:00"
},
{ {
"name": "sebastian/cli-parser", "name": "sebastian/cli-parser",
"version": "3.0.2", "version": "3.0.2",

0
laravel/config/app.php Normal file → Executable file
View File

0
laravel/config/auth.php Normal file → Executable file
View File

0
laravel/config/cache.php Normal file → Executable file
View File

0
laravel/config/database.php Normal file → Executable file
View File

0
laravel/config/filesystems.php Normal file → Executable file
View File

6
laravel/config/logging.php Normal file → Executable file
View File

@@ -127,12 +127,6 @@ return [
'path' => storage_path('logs/laravel.log'), 'path' => storage_path('logs/laravel.log'),
], ],
"projectError" => [
'driver' => 'single',
'path' => storage_path('logs/project.log'),
'level' => 'error',
],
], ],
]; ];

0
laravel/config/mail.php Normal file → Executable file
View File

534
laravel/config/models.php Executable file
View File

@@ -0,0 +1,534 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Configurations
|--------------------------------------------------------------------------
|
| In this section you may define the default configuration for each model
| that will be generated from any database.
|
*/
'*' => [
/*
|--------------------------------------------------------------------------
| Model Files Location
|--------------------------------------------------------------------------
|
| We need a location to store your new generated files. All files will be
| placed within this directory. When you turn on base files, they will
| be placed within a Base directory inside this location.
|
*/
'path' => app_path('Models'),
/*
|--------------------------------------------------------------------------
| Model Namespace
|--------------------------------------------------------------------------
|
| Every generated model will belong to this namespace. It is suggested
| that this namespace should follow PSR-4 convention and be very
| similar to the path of your models defined above.
|
*/
'namespace' => 'App\Models',
/*
|--------------------------------------------------------------------------
| Parent Class
|--------------------------------------------------------------------------
|
| All Eloquent models should inherit from Eloquent Model class. However,
| you can define a custom Eloquent model that suits your needs.
| As an example one custom model has been added for you which
| will allow you to create custom database castings.
|
*/
'parent' => Illuminate\Database\Eloquent\Model::class,
/*
|--------------------------------------------------------------------------
| Traits
|--------------------------------------------------------------------------
|
| Sometimes you may want to append certain traits to all your models.
| If that is what you need, you may list them bellow.
| As an example we have a BitBooleans trait which will treat MySQL bit
| data type as booleans. You might probably not need it, but it is
| an example of how you can customize your models.
|
*/
'use' => [
// Reliese\Database\Eloquent\BitBooleans::class,
// Reliese\Database\Eloquent\BlamableBehavior::class,
],
/*
|--------------------------------------------------------------------------
| Model Connection
|--------------------------------------------------------------------------
|
| If you wish your models had appended the connection from which they
| were generated, you should set this value to true and your
| models will have the connection property filled.
|
*/
'connection' => false,
/*
|--------------------------------------------------------------------------
| Timestamps
|--------------------------------------------------------------------------
|
| If your tables have CREATED_AT and UPDATED_AT timestamps you may
| enable them and your models will fill their values as needed.
| You can also specify which fields should be treated as timestamps
| in case you don't follow the naming convention Eloquent uses.
| If your table doesn't have these fields, timestamps will be
| disabled for your model.
|
*/
'timestamps' => true,
// 'timestamps' => [
// 'enabled' => true,
// 'fields' => [
// 'CREATED_AT' => 'created_at',
// 'UPDATED_AT' => 'updated_at',
// ]
// ],
/*
|--------------------------------------------------------------------------
| Soft Deletes
|--------------------------------------------------------------------------
|
| If your tables support soft deletes with a DELETED_AT attribute,
| you can enable them here. You can also specify which field
| should be treated as a soft delete attribute in case you
| don't follow the naming convention Eloquent uses.
| If your table doesn't have this field, soft deletes will be
| disabled for your model.
|
*/
'soft_deletes' => true,
// 'soft_deletes' => [
// 'enabled' => true,
// 'field' => 'deleted_at',
// ],
/*
|--------------------------------------------------------------------------
| Date Format
|--------------------------------------------------------------------------
|
| Here you may define your models' date format. The following format
| is the default format Eloquent uses. You won't see it in your
| models unless you change it to a more convenient value.
|
*/
'date_format' => 'Y-m-d H:i:s',
/*
|--------------------------------------------------------------------------
| Pagination
|--------------------------------------------------------------------------
|
| Here you may define how many models Eloquent should display when
| paginating them. The default number is 15, so you might not
| see this number in your models unless you change it.
|
*/
'per_page' => 15,
/*
|--------------------------------------------------------------------------
| Base Files
|--------------------------------------------------------------------------
|
| By default, your models will be generated in your models path, but
| when you generate them again they will be replaced by new ones.
| You may want to customize your models and, at the same time, be
| able to generate them as your tables change. For that, you
| can enable base files. These files will be replaced whenever
| you generate them, but your customized files will not be touched.
|
*/
'base_files' => false,
/*
|--------------------------------------------------------------------------
| Snake Attributes
|--------------------------------------------------------------------------
|
| Eloquent treats your model attributes as snake cased attributes, but
| if you have camel-cased fields in your database you can disable
| that behaviour and use camel case attributes in your models.
|
*/
'snake_attributes' => true,
/*
|--------------------------------------------------------------------------
| Indent options
|--------------------------------------------------------------------------
|
| As default indention is done with tabs, but you can change it by setting
| this to the amount of spaces you that you want to use for indentation.
| Usually you will use 4 spaces instead of tabs.
|
*/
'indent_with_space' => 0,
/*
|--------------------------------------------------------------------------
| Qualified Table Names
|--------------------------------------------------------------------------
|
| If some of your tables have cross-database relationships (probably in
| MySQL), you can make sure your models take into account their
| respective database schema.
|
| Can Either be NULL, FALSE or TRUE
| TRUE: Schema name will be prepended on the table
| FALSE:Table name will be set without schema name.
| NULL: Table name will follow laravel pattern,
| i.e. if class name(plural) matches table name, then table name will not be added
*/
'qualified_tables' => false,
/*
|--------------------------------------------------------------------------
| Hidden Attributes
|--------------------------------------------------------------------------
|
| When casting your models into arrays or json, the need to hide some
| attributes sometimes arise. If your tables have some fields you
| want to hide, you can define them bellow.
| Some fields were defined for you.
|
*/
'hidden' => [
'*secret*', '*password', '*token',
],
/*
|--------------------------------------------------------------------------
| Mass Assignment Guarded Attributes
|--------------------------------------------------------------------------
|
| You may want to protect some fields from mass assignment. You can
| define them bellow. Some fields were defined for you.
| Your fillable attributes will be those which are not in the list
| excluding your models' primary keys.
|
*/
'guarded' => [
// 'created_by', 'updated_by'
],
/*
|--------------------------------------------------------------------------
| Casts
|--------------------------------------------------------------------------
|
| You may want to specify which of your table fields should be cast as
| something other than a string. For instance, you may want a
| text field be cast as an array or and object.
|
| You may define column patterns which will be cast using the value
| assigned. We have defined some fields for you. Feel free to
| modify them to fit your needs.
|
*/
'casts' => [
'*_json' => 'json',
],
/*
|--------------------------------------------------------------------------
| Excluded Tables
|--------------------------------------------------------------------------
|
| When performing the generation of models you may want to skip some of
| them, because you don't want a model for them or any other reason.
| You can define those tables bellow. The migrations table was
| filled for you, since you may not want a model for it.
|
*/
'except' => [
'migrations',
'failed_jobs',
'password_resets',
'personal_access_tokens',
'password_reset_tokens',
],
/*
|--------------------------------------------------------------------------
| Specified Tables
|--------------------------------------------------------------------------
|
| You can specify specific tables. This will generate the models only
| for selected tables, ignoring the rest.
|
*/
'only' => [
// 'users',
],
/*
|--------------------------------------------------------------------------
| Table Prefix
|--------------------------------------------------------------------------
|
| If you have a prefix on your table names but don't want it in the model
| and relation names, specify it here.
|
*/
'table_prefix' => '',
/*
|--------------------------------------------------------------------------
| Lower table name before doing studly
|--------------------------------------------------------------------------
|
| If tables names are capitalised using studly produces incorrect name
| this can help fix it ie TABLE_NAME now becomes TableName
|
*/
'lower_table_name_first' => false,
/*
|--------------------------------------------------------------------------
| Model Names
|--------------------------------------------------------------------------
|
| By default the generator will create models with names that match your tables.
| However, if you wish to manually override the naming, you can specify a mapping
| here between table and model names.
|
| Example:
| A table called 'billing_invoices' will generate a model called `BillingInvoice`,
| but you'd prefer it to generate a model called 'Invoice'. Therefore, you'd add
| the following array key and value:
| 'billing_invoices' => 'Invoice',
*/
'model_names' => [
],
/*
|--------------------------------------------------------------------------
| Relation Name Strategy
|--------------------------------------------------------------------------
|
| How the relations should be named in your models.
|
| 'related' Use the related table as the relation name.
| (post.author --> user.id)
generates Post::user() and User::posts()
|
| 'foreign_key' Use the foreign key as the relation name.
| This can help to provide more meaningful relationship names, and avoids naming conflicts
| if you have more than one relationship between two tables.
| (post.author_id --> user.id)
| generates Post::author() and User::posts_where_author()
| (post.editor_id --> user.id)
| generates Post::editor() and User::posts_where_editor()
| ID suffixes can be omitted from foreign keys.
| (post.author --> user.id)
| (post.editor --> user.id)
| generates the same as above.
| Where the foreign key matches the related table name, it behaves as per the 'related' strategy.
| (post.user_id --> user.id)
| generates Post::user() and User::posts()
*/
'relation_name_strategy' => 'related',
// 'relation_name_strategy' => 'foreign_key',
/*
|--------------------------------------------------------------------------
| Determines need or not to generate constants with properties names like
|
| ...
| const AGE = 'age';
| const USER_NAME = 'user_name';
| ...
|
| that later can be used in QueryBuilder like
|
| ...
| $builder->select([User::USER_NAME])->where(User::AGE, '<=', 18);
| ...
|
| that helps to avoid typos in strings when typing field names and allows to use
| code competition with available model's field names.
*/
'with_property_constants' => false,
/*
|--------------------------------------------------------------------------
| Optionally includes a full list of columns in the base generated models,
| which can be used to avoid making calls like
|
| ...
| \Illuminate\Support\Facades\Schema::getColumnListing
| ...
|
| which can be slow, especially for large tables.
*/
'with_column_list' => false,
/*
|--------------------------------------------------------------------------
| Disable Pluralization Name
|--------------------------------------------------------------------------
|
| You can disable pluralization tables and relations
|
*/
'pluralize' => true,
/*
|--------------------------------------------------------------------------
| Disable Pluralization Except For Certain Tables
|--------------------------------------------------------------------------
|
| You can enable pluralization for certain tables
|
*/
'override_pluralize_for' => [
],
/*
|--------------------------------------------------------------------------
| Move $hidden property to base files
|--------------------------------------------------------------------------
| When base_files is true you can set hidden_in_base_files to true
| if you want the $hidden to be generated in base files
|
*/
'hidden_in_base_files' => false,
/*
|--------------------------------------------------------------------------
| Move $fillable property to base files
|--------------------------------------------------------------------------
| When base_files is true you can set fillable_in_base_files to true
| if you want the $fillable to be generated in base files
|
*/
'fillable_in_base_files' => false,
/*
|--------------------------------------------------------------------------
| Generate return types for relation methods.
|--------------------------------------------------------------------------
| When enable_return_types is set to true, return type declarations are added
| to all generated relation methods for your models.
|
| NOTE: This requires PHP 7.0 or later.
|
*/
'enable_return_types' => false,
],
/*
|--------------------------------------------------------------------------
| Database Specifics
|--------------------------------------------------------------------------
|
| In this section you may define the default configuration for each model
| that will be generated from a specific database. You can also nest
| table specific configurations.
| These values will override those defined in the section above.
|
*/
// 'shop' => [
// 'path' => app_path(),
// 'namespace' => 'App',
// 'snake_attributes' => false,
// 'qualified_tables' => true,
// 'use' => [
// Reliese\Database\Eloquent\BitBooleans::class,
// ],
// 'except' => ['migrations'],
// 'only' => ['users'],
// // Table Specifics Bellow:
// 'user' => [
// // Don't use any default trait
// 'use' => [],
// ]
// ],
/*
|--------------------------------------------------------------------------
| Connection Specifics
|--------------------------------------------------------------------------
|
| In this section you may define the default configuration for each model
| that will be generated from a specific connection. You can also nest
| database and table specific configurations.
|
| You may wish to use connection specific config for setting a parent
| model with a read only setup, or enforcing a different set of rules
| for a connection, e.g. using snake_case naming over CamelCase naming.
|
| This supports nesting with the following key configuration values, in
| reverse precedence order (i.e. the last one found becomes the value).
|
| connections.{connection_name}.property
| connections.{connection_name}.{database_name}.property
| connections.{connection_name}.{table_name}.property
| connections.{connection_name}.{database_name}.{table_name}.property
|
| These values will override those defined in the section above.
|
*/
// 'connections' => [
// 'read_only_external' => [
// 'parent' => \App\Models\ReadOnlyModel::class,
// 'connection' => true,
// 'users' => [
// 'connection' => false,
// ],
// 'my_other_database' => [
// 'password_resets' => [
// 'connection' => false,
// ]
// ]
// ],
// ],
];

0
laravel/config/queue.php Normal file → Executable file
View File

84
laravel/config/sanctum.php Executable file
View File

@@ -0,0 +1,84 @@
<?php
use Laravel\Sanctum\Sanctum;
return [
/*
|--------------------------------------------------------------------------
| Stateful Domains
|--------------------------------------------------------------------------
|
| Requests from the following domains / hosts will receive stateful API
| authentication cookies. Typically, these should include your local
| and production domains which access your API via a frontend SPA.
|
*/
'stateful' => explode(',', env('SANCTUM_STATEFUL_DOMAINS', sprintf(
'%s%s',
'localhost,localhost:3000,127.0.0.1,127.0.0.1:8000,::1',
Sanctum::currentApplicationUrlWithPort(),
// Sanctum::currentRequestHost(),
))),
/*
|--------------------------------------------------------------------------
| Sanctum Guards
|--------------------------------------------------------------------------
|
| This array contains the authentication guards that will be checked when
| Sanctum is trying to authenticate a request. If none of these guards
| are able to authenticate the request, Sanctum will use the bearer
| token that's present on an incoming request for authentication.
|
*/
'guard' => ['web'],
/*
|--------------------------------------------------------------------------
| Expiration Minutes
|--------------------------------------------------------------------------
|
| This value controls the number of minutes until an issued token will be
| considered expired. This will override any values set in the token's
| "expires_at" attribute, but first-party sessions are not affected.
|
*/
'expiration' => null,
/*
|--------------------------------------------------------------------------
| Token Prefix
|--------------------------------------------------------------------------
|
| Sanctum can prefix new tokens in order to take advantage of numerous
| security scanning initiatives maintained by open source platforms
| that notify developers if they commit tokens into repositories.
|
| See: https://docs.github.com/en/code-security/secret-scanning/about-secret-scanning
|
*/
'token_prefix' => env('SANCTUM_TOKEN_PREFIX', ''),
/*
|--------------------------------------------------------------------------
| Sanctum Middleware
|--------------------------------------------------------------------------
|
| When authenticating your first-party SPA with Sanctum you may need to
| customize some of the middleware Sanctum uses while processing the
| request. You may change the middleware listed below as required.
|
*/
'middleware' => [
'authenticate_session' => Laravel\Sanctum\Http\Middleware\AuthenticateSession::class,
'encrypt_cookies' => Illuminate\Cookie\Middleware\EncryptCookies::class,
'validate_csrf_token' => Illuminate\Foundation\Http\Middleware\ValidateCsrfToken::class,
],
];

0
laravel/config/services.php Normal file → Executable file
View File

0
laravel/config/session.php Normal file → Executable file
View File

0
laravel/database/.gitignore vendored Normal file → Executable file
View File

View File

@@ -1,23 +0,0 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\billet_categorie>
*/
class BilletCategorieFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
//
];
}
}

0
laravel/database/factories/BilletFactory.php Normal file → Executable file
View File

View File

@@ -1,24 +0,0 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Categorie>
*/
class CategorieFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
//
'CAT_NOM' => fake()->text(10),
];
}
}

View File

@@ -1,29 +0,0 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Commentaire>
*/
class CommentaireFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
//
'COM_DATE' => now(),
'COM_AUTEUR' => fake()->lastName(),
'COM_CONTENU' => fake()->text(200),
'billet_id' => fake()->numberBetween(1,10),
'created_at' => now(),
'updated_at' => now(),
];
}
}

0
laravel/database/factories/UserFactory.php Normal file → Executable file
View File

View File

View File

View File

View File

@@ -1,36 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('commentaires', function (Blueprint $table) {
$table->id();
$table->date('COM_DATE');
$table->text('COM_AUTEUR');
$table->text('COM_CONTENU');
$table->unsignedBigInteger('billet_id');
$table->foreign('billet_id')
->references('id')
->on('billets')
->onDelete('cascade')
->onUpdate('cascade');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('commentaires');
}
};

View File

@@ -1,28 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('categories', function (Blueprint $table) {
$table->id();
$table->text('CAT_NOM');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('categories');
}
};

View File

@@ -1,39 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('billet_categorie', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('billet_id');
$table->foreign('billet_id')
->references('id')
->on('billets')
->onDelete('cascade')
->onUpdate('cascade');
$table->unsignedBigInteger('categorie_id');
$table->foreign('categorie_id')
->references('id')
->on('categories')
->onDelete('cascade')
->onUpdate('cascade');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('billet_categories');
}
};

View File

@@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('personal_access_tokens', function (Blueprint $table) {
$table->id();
$table->morphs('tokenable');
$table->string('name');
$table->string('token', 64)->unique();
$table->text('abilities')->nullable();
$table->timestamp('last_used_at')->nullable();
$table->timestamp('expires_at')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('personal_access_tokens');
}
};

0
laravel/database/seeders/BilletSeeder.php Normal file → Executable file
View File

View File

@@ -1,19 +0,0 @@
<?php
namespace Database\Seeders;
use App\Models\Categorie;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
class CategorieSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
//
Categorie::factory(10)->create();
}
}

View File

@@ -1,20 +0,0 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
use App\Models\Commentaire;
class CommentaireSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
//
// Create 10 comments
Commentaire::factory(10)->create();
}
}

0
laravel/database/seeders/DatabaseSeeder.php Normal file → Executable file
View File

0
laravel/licenses/laravel-12.0.3.txt Normal file → Executable file
View File

0
laravel/package.json Normal file → Executable file
View File

0
laravel/phpunit.xml Normal file → Executable file
View File

0
laravel/public/.htaccess Normal file → Executable file
View File

0
laravel/public/favicon.ico Normal file → Executable file
View File

0
laravel/public/index.php Normal file → Executable file
View File

0
laravel/public/robots.txt Normal file → Executable file
View File

8
laravel/public/style.css Normal file → Executable file
View File

@@ -39,12 +39,4 @@ h1 {
#txtCommentaire { #txtCommentaire {
width: 50%; width: 50%;
}
#titreReponses {
font-size: 100%;
}
#txtCommentaire {
width: 50%;
} }

0
laravel/resources/css/app.css Normal file → Executable file
View File

0
laravel/resources/js/app.js Normal file → Executable file
View File

0
laravel/resources/js/bootstrap.js vendored Normal file → Executable file
View File

View File

@@ -1,4 +0,0 @@
@extends('layout')
@section('contenu')
<h2>La page demandée n'est pas disponible</h2>
@endsection

View File

@@ -1,4 +0,0 @@
@extends('layout')
@section('contenu')
<h2>La ressource demandée n'est pas disponible</h2>
@endsection

52
laravel/resources/views/index.blade.php Normal file → Executable file
View File

@@ -1,27 +1,31 @@
@extends('layout') <!doctype html>
@section('contenu') <html lang="fr">
@foreach($billets as $billet) <head>
<article> <meta charset="UTF-8" />
<link rel="stylesheet" href="style.css" />
<title>Mon Blog</title>
</head>
<body>
<div id="global">
<header> <header>
<a href="{{ route('billets.show', $billet->id) }}"><h1 class="titreBillet">{{ $billet->BIL_TITRE }}</h1></a> <a href="index.php"><h1 id="titreBlog">Mon Blog</h1></a>
<time>{{ $billet->BIL_DATE }}</time> <p>Je vous souhaite la bienvenue sur ce modeste blog.</p>
</header> </header>
<p> <div id="contenu">
Dans : @foreach($billets as $billet)
@php <article>
$counter = 0; <header>
@endphp <h1 class="titreBillet">{{ $billet->BIL_TITRE }}</h1>
@foreach($billet->categories as $categorie) <time>{{ $billet->BIL_DATE }}</time>
{{ $categorie->CAT_NOM }} </header>
@php <p>{{ $billet->BIL_CONTENU }}</p>
$counter++; </article>
@endphp <hr />
@if(count($billet->categories) > $counter)
/
@endif
@endforeach @endforeach
</p> </div> <!-- #contenu -->
<p>{{ $billet->BIL_CONTENU }}</p> <footer id="piedBlog">
</article> Blog réalisé avec PHP, HTML5 et CSS.
@endforeach </footer>
@endsection </div> <!-- #global -->
</body>
</html>

View File

@@ -1,23 +0,0 @@
<!doctype html>
<html lang="fr">
<head>
<meta charset="UTF-8" />
<!--link rel="stylesheet" href="style.css" /-->
<link rel="stylesheet" href="{{ URL::asset('style.css') }}" />
<title>Mon Blog</title>
</head>
<body>
<div id="global">
<header>
<a href="{{ route('billets.index') }}"><h1 id="titreBlog">Mon Blog</h1></a>
<p>Je vous souhaite la bienvenue sur ce modeste blog.</p>
</header>
<div id="contenu">
@yield('contenu')
</div> <!-- #contenu -->
<footer id="piedBlog">
Blog réalisé avec PHP, HTML5 et CSS.
</footer>
</div> <!-- #global -->
</body>
</html>

View File

@@ -1,10 +0,0 @@
@extends('layout')
@section('contenu')
<form action = "{{ url('testformulaire') }}" method="POST">
@csrf
<label for="message">Entrez votre message : </label>
<input type="text" name="message" id="message">
<input type="submit" value="Envoyer !">
</form>
@endsection

View File

@@ -1,24 +0,0 @@
@extends('layout')
@section('contenu')
<article>
<header>
<h1 class="titreBillet">{{ $billet->BIL_TITRE }}</h1>
<time>{{ $billet->BIL_DATE }}</time>
</header>
<p>{{ $billet->BIL_CONTENU }}</p>
</article>
<hr />
@if (count($commentaires) > 0)
<header>
<h1 id="titreReponses">Réponses à {{ $billet->BIL_TITRE }}</h1>
</header>
@foreach($commentaires as $commentaire)
<p>{{ $commentaire->COM_AUTEUR }} dit :</p>
<p>{{ $commentaire->COM_CONTENU }}</p>
@endforeach
@else
<header>
<h1 id="titreReponses">Il n'y a pas de réponse à ce billet.</h1>
</header>
@endif
@endsection

0
laravel/resources/views/welcome.blade.php Normal file → Executable file
View File

13
laravel/routes/api.php Executable file
View File

@@ -0,0 +1,13 @@
<?php
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
use App\Http\Controllers\BilletController;
use App\Http\Controllers\CommentaireController;
Route::get('/user', function (Request $request) {
return $request->user();
})->middleware('auth:sanctum');
Route::apiResource('billets', BilletController::class);
Route::post('/commentaires',[CommentaireController::class,"store"]);

0
laravel/routes/console.php Normal file → Executable file
View File

10
laravel/routes/web.php Normal file → Executable file
View File

@@ -2,11 +2,7 @@
use App\Http\Controllers\BilletController; use App\Http\Controllers\BilletController;
use Illuminate\Support\Facades\Route; use Illuminate\Support\Facades\Route;
use App\Http\Controllers\TestFormController;
Route::get('/', fn() => view('welcome')); Route::get('/', function () {
return view('welcome');
Route::resource('billets', BilletController::class); });
Route::get('testformulaire', [TestFormController::class, 'getInfo']);
Route::post('testformulaire', [TestFormController::class, 'postInfo']);

0
laravel/tests/Feature/ExampleTest.php Normal file → Executable file
View File

0
laravel/tests/TestCase.php Normal file → Executable file
View File

0
laravel/tests/Unit/ExampleTest.php Normal file → Executable file
View File

0
laravel/vite.config.js Normal file → Executable file
View File