diff --git a/laravel/.buildcomplete b/laravel/.buildcomplete old mode 100644 new mode 100755 diff --git a/laravel/.editorconfig b/laravel/.editorconfig old mode 100644 new mode 100755 diff --git a/laravel/.env.example b/laravel/.env.example old mode 100644 new mode 100755 diff --git a/laravel/.gitattributes b/laravel/.gitattributes old mode 100644 new mode 100755 diff --git a/laravel/.gitignore b/laravel/.gitignore old mode 100644 new mode 100755 diff --git a/laravel/.spdx-laravel.spdx b/laravel/.spdx-laravel.spdx old mode 100644 new mode 100755 diff --git a/laravel/README.md b/laravel/README.md old mode 100644 new mode 100755 diff --git a/laravel/app/Http/Controllers/BilletController.php b/laravel/app/Http/Controllers/BilletController.php index 14c1ccc..700bfde 100644 --- a/laravel/app/Http/Controllers/BilletController.php +++ b/laravel/app/Http/Controllers/BilletController.php @@ -2,9 +2,10 @@ namespace App\Http\Controllers; -use App\Http\Requests\StoreBilletRequest; -use App\Http\Requests\UpdateBilletRequest; use App\Models\Billet; +use App\Http\Resources\BilletResource; +use Illuminate\Http\Request; +use Illuminate\Support\Facades\Log; class BilletController extends Controller { @@ -13,22 +14,22 @@ class BilletController extends Controller */ public function index() { - $billets = Billet::all(); - return view('index', compact('billets')); - } - - /** - * Show the form for creating a new resource. - */ - public function create() - { - // + //Return all posts in json format + try { + return BilletResource::collection(Billet::with('commentaires')->get()); + } + catch (\Illuminate\Database\QueryException $e){ + Log::channel('projectError')->error('Erreur accès base de données'); + return response()->json([ + 'message' => 'Ressource indinponible.' + ],500); + } } /** * Store a newly created resource in storage. */ - public function store(StoreBilletRequest $request) + public function store(Request $request) { // } @@ -38,21 +39,21 @@ class BilletController extends Controller */ public function show(Billet $billet) { - // - } - - /** - * Show the form for editing the specified resource. - */ - public function edit(Billet $billet) - { - // + try{ + return new BilletResource($billet); + } + catch (\Illuminate\Database\QueryException $e){ + Log::channel('projectError')->error('Erreur accès base de données'); + return response()->json([ + 'message' => 'Ressource indinponible.' + ],500); + } } /** * Update the specified resource in storage. */ - public function update(UpdateBilletRequest $request, Billet $billet) + public function update(Request $request, Billet $billet) { // } diff --git a/laravel/app/Http/Controllers/CommentaireController.php b/laravel/app/Http/Controllers/CommentaireController.php new file mode 100644 index 0000000..7414b1e --- /dev/null +++ b/laravel/app/Http/Controllers/CommentaireController.php @@ -0,0 +1,60 @@ +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. + */ + public function show(Commentaire $commentaire) + { + // + } + + /** + * Update the specified resource in storage. + */ + public function update(Request $request, Commentaire $commentaire) + { + // + } + + /** + * Remove the specified resource from storage. + */ + public function destroy(Commentaire $commentaire) + { + // + } +} diff --git a/laravel/app/Http/Controllers/Controller.php b/laravel/app/Http/Controllers/Controller.php old mode 100644 new mode 100755 diff --git a/laravel/app/Http/Requests/StoreBilletRequest.php b/laravel/app/Http/Requests/StoreBilletRequest.php old mode 100644 new mode 100755 diff --git a/laravel/app/Http/Requests/UpdateBilletRequest.php b/laravel/app/Http/Requests/UpdateBilletRequest.php old mode 100644 new mode 100755 diff --git a/laravel/app/Http/Resources/BilletResource.php b/laravel/app/Http/Resources/BilletResource.php new file mode 100644 index 0000000..7cfddde --- /dev/null +++ b/laravel/app/Http/Resources/BilletResource.php @@ -0,0 +1,25 @@ + + */ + 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), + ]; + } +} \ No newline at end of file diff --git a/laravel/app/Http/Resources/CommentaireResource.php b/laravel/app/Http/Resources/CommentaireResource.php new file mode 100644 index 0000000..ee46a28 --- /dev/null +++ b/laravel/app/Http/Resources/CommentaireResource.php @@ -0,0 +1,24 @@ + + */ + public function toArray(Request $request): array + { + //return parent::toArray($request); + return [ + 'Date' => $this->COM_DATE, + 'Auteur' => $this->COM_AUTEUR, + 'Contenu' => $this->COM_CONTENU, + ]; + } +} \ No newline at end of file diff --git a/laravel/app/Models/Billet.php b/laravel/app/Models/Billet.php index 80e78a2..aa5c84e 100644 --- a/laravel/app/Models/Billet.php +++ b/laravel/app/Models/Billet.php @@ -1,12 +1,57 @@ */ - use HasFactory; + protected $table = 'billets'; + + protected $casts = [ + 'BIL_DATE' => 'datetime' + ]; + + protected $fillable = [ + 'BIL_DATE', + 'BIL_TITRE', + 'BIL_CONTENU' + ]; + + protected $hidden = [ + 'id', + 'created_at', + 'updated_at' + ]; + + public function billet_categories() + { + return $this->hasMany(BilletCategorie::class); + } + + public function commentaires() + { + return $this->hasMany(Commentaire::class); + } } diff --git a/laravel/app/Models/BilletCategorie.php b/laravel/app/Models/BilletCategorie.php new file mode 100644 index 0000000..b1dad26 --- /dev/null +++ b/laravel/app/Models/BilletCategorie.php @@ -0,0 +1,49 @@ + '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'); + } +} diff --git a/laravel/app/Models/Cache.php b/laravel/app/Models/Cache.php new file mode 100755 index 0000000..7966886 --- /dev/null +++ b/laravel/app/Models/Cache.php @@ -0,0 +1,35 @@ + 'int' + ]; + + protected $fillable = [ + 'value', + 'expiration' + ]; +} diff --git a/laravel/app/Models/CacheLock.php b/laravel/app/Models/CacheLock.php new file mode 100755 index 0000000..bd4f747 --- /dev/null +++ b/laravel/app/Models/CacheLock.php @@ -0,0 +1,35 @@ + 'int' + ]; + + protected $fillable = [ + 'owner', + 'expiration' + ]; +} diff --git a/laravel/app/Models/Category.php b/laravel/app/Models/Category.php new file mode 100644 index 0000000..245db35 --- /dev/null +++ b/laravel/app/Models/Category.php @@ -0,0 +1,37 @@ +hasMany(BilletCategorie::class, 'categorie_id'); + } +} diff --git a/laravel/app/Models/Commentaire.php b/laravel/app/Models/Commentaire.php new file mode 100644 index 0000000..4612681 --- /dev/null +++ b/laravel/app/Models/Commentaire.php @@ -0,0 +1,54 @@ + 'datetime', + 'billet_id' => 'int' + ]; + + protected $fillable = [ + 'COM_DATE', + 'COM_AUTEUR', + 'COM_CONTENU', + 'billet_id' + ]; + + protected $hidden = [ + 'id', + 'created_at', + 'updated_at', + 'billet_id' + ]; + + public function billet() + { + return $this->belongsTo(Billet::class); + } +} diff --git a/laravel/app/Models/Job.php b/laravel/app/Models/Job.php new file mode 100755 index 0000000..e35aa68 --- /dev/null +++ b/laravel/app/Models/Job.php @@ -0,0 +1,42 @@ + 'int', + 'reserved_at' => 'int', + 'available_at' => 'int' + ]; + + protected $fillable = [ + 'queue', + 'payload', + 'attempts', + 'reserved_at', + 'available_at' + ]; +} diff --git a/laravel/app/Models/JobBatch.php b/laravel/app/Models/JobBatch.php new file mode 100755 index 0000000..46645b0 --- /dev/null +++ b/laravel/app/Models/JobBatch.php @@ -0,0 +1,51 @@ + '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' + ]; +} diff --git a/laravel/app/Models/Session.php b/laravel/app/Models/Session.php new file mode 100755 index 0000000..f8e6c1e --- /dev/null +++ b/laravel/app/Models/Session.php @@ -0,0 +1,41 @@ + 'int', + 'last_activity' => 'int' + ]; + + protected $fillable = [ + 'user_id', + 'ip_address', + 'user_agent', + 'payload', + 'last_activity' + ]; +} diff --git a/laravel/app/Models/User.php b/laravel/app/Models/User.php old mode 100644 new mode 100755 index 749c7b7..de84ccd --- a/laravel/app/Models/User.php +++ b/laravel/app/Models/User.php @@ -1,48 +1,46 @@ */ - use HasFactory, Notifiable; + protected $table = 'users'; - /** - * The attributes that are mass assignable. - * - * @var list - */ - protected $fillable = [ - 'name', - 'email', - 'password', - ]; + protected $casts = [ + 'email_verified_at' => 'datetime' + ]; - /** - * The attributes that should be hidden for serialization. - * - * @var list - */ - protected $hidden = [ - 'password', - 'remember_token', - ]; + protected $hidden = [ + 'password', + 'remember_token' + ]; - /** - * Get the attributes that should be cast. - * - * @return array - */ - protected function casts(): array - { - return [ - 'email_verified_at' => 'datetime', - 'password' => 'hashed', - ]; - } + protected $fillable = [ + 'name', + 'email', + 'email_verified_at', + 'password', + 'remember_token' + ]; } diff --git a/laravel/app/Policies/BilletPolicy.php b/laravel/app/Policies/BilletPolicy.php old mode 100644 new mode 100755 diff --git a/laravel/app/Providers/AppServiceProvider.php b/laravel/app/Providers/AppServiceProvider.php old mode 100644 new mode 100755 diff --git a/laravel/bootstrap/app.php b/laravel/bootstrap/app.php old mode 100644 new mode 100755 index 7b162da..fba7852 --- a/laravel/bootstrap/app.php +++ b/laravel/bootstrap/app.php @@ -3,10 +3,12 @@ use Illuminate\Foundation\Application; use Illuminate\Foundation\Configuration\Exceptions; use Illuminate\Foundation\Configuration\Middleware; +use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; return Application::configure(basePath: dirname(__DIR__)) ->withRouting( web: __DIR__.'/../routes/web.php', + api: __DIR__.'/../routes/api.php', commands: __DIR__.'/../routes/console.php', health: '/up', ) @@ -14,5 +16,9 @@ return Application::configure(basePath: dirname(__DIR__)) // }) ->withExceptions(function (Exceptions $exceptions) { - // + $exceptions->renderable(function (NotFoundHttpException $e){ + return response()->json([ + 'message' => 'Ressource non trouvée.' + ],404); + }); })->create(); diff --git a/laravel/bootstrap/cache/.gitignore b/laravel/bootstrap/cache/.gitignore old mode 100644 new mode 100755 diff --git a/laravel/bootstrap/providers.php b/laravel/bootstrap/providers.php old mode 100644 new mode 100755 diff --git a/laravel/composer.json b/laravel/composer.json old mode 100644 new mode 100755 index 9c446ae..18363c2 --- a/laravel/composer.json +++ b/laravel/composer.json @@ -8,6 +8,7 @@ "require": { "php": "^8.2", "laravel/framework": "^12.0", + "laravel/sanctum": "^4.0", "laravel/tinker": "^2.10.1" }, "require-dev": { @@ -17,7 +18,8 @@ "laravel/sail": "^1.41", "mockery/mockery": "^1.6", "nunomaduro/collision": "^8.6", - "phpunit/phpunit": "^11.5.3" + "phpunit/phpunit": "^11.5.3", + "reliese/laravel": "^1.4" }, "autoload": { "psr-4": { diff --git a/laravel/composer.lock b/laravel/composer.lock old mode 100644 new mode 100755 index ec57d52..252c8a9 --- a/laravel/composer.lock +++ b/laravel/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "88970a0117c062eed55fa8728fc43833", + "content-hash": "cc1f42d2dd2bf6629798006e6a8a4606", "packages": [ { "name": "brick/math", @@ -1328,6 +1328,70 @@ }, "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", "version": "v2.0.4", @@ -5787,6 +5851,160 @@ } ], "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", "version": "v1.24.1", @@ -6963,6 +7181,118 @@ ], "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", "version": "3.0.2", diff --git a/laravel/config/app.php b/laravel/config/app.php old mode 100644 new mode 100755 diff --git a/laravel/config/auth.php b/laravel/config/auth.php old mode 100644 new mode 100755 diff --git a/laravel/config/cache.php b/laravel/config/cache.php old mode 100644 new mode 100755 diff --git a/laravel/config/database.php b/laravel/config/database.php old mode 100644 new mode 100755 diff --git a/laravel/config/filesystems.php b/laravel/config/filesystems.php old mode 100644 new mode 100755 diff --git a/laravel/config/logging.php b/laravel/config/logging.php old mode 100644 new mode 100755 diff --git a/laravel/config/mail.php b/laravel/config/mail.php old mode 100644 new mode 100755 diff --git a/laravel/config/models.php b/laravel/config/models.php new file mode 100755 index 0000000..2f2688d --- /dev/null +++ b/laravel/config/models.php @@ -0,0 +1,534 @@ + [ + + /* + |-------------------------------------------------------------------------- + | 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, +// ] +// ] +// ], +// ], +]; diff --git a/laravel/config/queue.php b/laravel/config/queue.php old mode 100644 new mode 100755 diff --git a/laravel/config/sanctum.php b/laravel/config/sanctum.php new file mode 100755 index 0000000..44527d6 --- /dev/null +++ b/laravel/config/sanctum.php @@ -0,0 +1,84 @@ + 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, + ], + +]; diff --git a/laravel/config/services.php b/laravel/config/services.php old mode 100644 new mode 100755 diff --git a/laravel/config/session.php b/laravel/config/session.php old mode 100644 new mode 100755 diff --git a/laravel/database/.gitignore b/laravel/database/.gitignore old mode 100644 new mode 100755 diff --git a/laravel/database/factories/BilletFactory.php b/laravel/database/factories/BilletFactory.php old mode 100644 new mode 100755 diff --git a/laravel/database/factories/UserFactory.php b/laravel/database/factories/UserFactory.php old mode 100644 new mode 100755 diff --git a/laravel/database/migrations/0001_01_01_000000_create_users_table.php b/laravel/database/migrations/0001_01_01_000000_create_users_table.php old mode 100644 new mode 100755 diff --git a/laravel/database/migrations/0001_01_01_000001_create_cache_table.php b/laravel/database/migrations/0001_01_01_000001_create_cache_table.php old mode 100644 new mode 100755 diff --git a/laravel/database/migrations/0001_01_01_000002_create_jobs_table.php b/laravel/database/migrations/0001_01_01_000002_create_jobs_table.php old mode 100644 new mode 100755 diff --git a/laravel/database/migrations/2025_04_12_110216_create_billets_table.php b/laravel/database/migrations/2025_04_12_110216_create_billets_table.php old mode 100644 new mode 100755 diff --git a/laravel/database/migrations/2025_05_20_211018_create_personal_access_tokens_table.php b/laravel/database/migrations/2025_05_20_211018_create_personal_access_tokens_table.php new file mode 100755 index 0000000..e828ad8 --- /dev/null +++ b/laravel/database/migrations/2025_05_20_211018_create_personal_access_tokens_table.php @@ -0,0 +1,33 @@ +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'); + } +}; diff --git a/laravel/database/seeders/BilletSeeder.php b/laravel/database/seeders/BilletSeeder.php old mode 100644 new mode 100755 diff --git a/laravel/database/seeders/DatabaseSeeder.php b/laravel/database/seeders/DatabaseSeeder.php old mode 100644 new mode 100755 diff --git a/laravel/licenses/laravel-12.0.3.txt b/laravel/licenses/laravel-12.0.3.txt old mode 100644 new mode 100755 diff --git a/laravel/package.json b/laravel/package.json old mode 100644 new mode 100755 diff --git a/laravel/phpunit.xml b/laravel/phpunit.xml old mode 100644 new mode 100755 diff --git a/laravel/public/.htaccess b/laravel/public/.htaccess old mode 100644 new mode 100755 diff --git a/laravel/public/favicon.ico b/laravel/public/favicon.ico old mode 100644 new mode 100755 diff --git a/laravel/public/index.php b/laravel/public/index.php old mode 100644 new mode 100755 diff --git a/laravel/public/robots.txt b/laravel/public/robots.txt old mode 100644 new mode 100755 diff --git a/laravel/public/style.css b/laravel/public/style.css old mode 100644 new mode 100755 diff --git a/laravel/resources/css/app.css b/laravel/resources/css/app.css old mode 100644 new mode 100755 diff --git a/laravel/resources/js/app.js b/laravel/resources/js/app.js old mode 100644 new mode 100755 diff --git a/laravel/resources/js/bootstrap.js b/laravel/resources/js/bootstrap.js old mode 100644 new mode 100755 diff --git a/laravel/resources/views/index.blade.php b/laravel/resources/views/index.blade.php old mode 100644 new mode 100755 diff --git a/laravel/resources/views/welcome.blade.php b/laravel/resources/views/welcome.blade.php old mode 100644 new mode 100755 diff --git a/laravel/routes/api.php b/laravel/routes/api.php new file mode 100755 index 0000000..6f2b85b --- /dev/null +++ b/laravel/routes/api.php @@ -0,0 +1,13 @@ +user(); +})->middleware('auth:sanctum'); + +Route::apiResource('billets', BilletController::class); +Route::post('/commentaires',[CommentaireController::class,"store"]); \ No newline at end of file diff --git a/laravel/routes/console.php b/laravel/routes/console.php old mode 100644 new mode 100755 diff --git a/laravel/routes/web.php b/laravel/routes/web.php old mode 100644 new mode 100755 index 5dad9e4..68505d7 --- a/laravel/routes/web.php +++ b/laravel/routes/web.php @@ -6,5 +6,3 @@ use Illuminate\Support\Facades\Route; Route::get('/', function () { return view('welcome'); }); - -Route::resource('billets', BilletController::class); diff --git a/laravel/storage/app/.gitignore b/laravel/storage/app/.gitignore old mode 100644 new mode 100755 diff --git a/laravel/storage/app/private/.gitignore b/laravel/storage/app/private/.gitignore old mode 100644 new mode 100755 diff --git a/laravel/storage/app/public/.gitignore b/laravel/storage/app/public/.gitignore old mode 100644 new mode 100755 diff --git a/laravel/storage/framework/.gitignore b/laravel/storage/framework/.gitignore old mode 100644 new mode 100755 diff --git a/laravel/storage/framework/cache/.gitignore b/laravel/storage/framework/cache/.gitignore old mode 100644 new mode 100755 diff --git a/laravel/storage/framework/cache/data/.gitignore b/laravel/storage/framework/cache/data/.gitignore old mode 100644 new mode 100755 diff --git a/laravel/storage/framework/sessions/.gitignore b/laravel/storage/framework/sessions/.gitignore old mode 100644 new mode 100755 diff --git a/laravel/storage/framework/testing/.gitignore b/laravel/storage/framework/testing/.gitignore old mode 100644 new mode 100755 diff --git a/laravel/storage/framework/views/.gitignore b/laravel/storage/framework/views/.gitignore old mode 100644 new mode 100755 diff --git a/laravel/storage/logs/.gitignore b/laravel/storage/logs/.gitignore old mode 100644 new mode 100755 diff --git a/laravel/tests/Feature/ExampleTest.php b/laravel/tests/Feature/ExampleTest.php old mode 100644 new mode 100755 diff --git a/laravel/tests/TestCase.php b/laravel/tests/TestCase.php old mode 100644 new mode 100755 diff --git a/laravel/tests/Unit/ExampleTest.php b/laravel/tests/Unit/ExampleTest.php old mode 100644 new mode 100755 diff --git a/laravel/vite.config.js b/laravel/vite.config.js old mode 100644 new mode 100755