Compare commits
1 Commits
sampleblog
...
relation_1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dad50e035f |
0
laravel/.buildcomplete
Executable file → Normal file
0
laravel/.buildcomplete
Executable file → Normal file
0
laravel/.editorconfig
Executable file → Normal file
0
laravel/.editorconfig
Executable file → Normal file
0
laravel/.env.example
Executable file → Normal file
0
laravel/.env.example
Executable file → Normal file
0
laravel/.gitattributes
vendored
Executable file → Normal file
0
laravel/.gitattributes
vendored
Executable file → Normal file
0
laravel/.gitignore
vendored
Executable file → Normal file
0
laravel/.gitignore
vendored
Executable file → Normal file
0
laravel/.spdx-laravel.spdx
Executable file → Normal file
0
laravel/.spdx-laravel.spdx
Executable file → Normal file
0
laravel/README.md
Executable file → Normal file
0
laravel/README.md
Executable file → Normal file
@@ -2,10 +2,9 @@
|
||||
|
||||
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
|
||||
{
|
||||
@@ -14,22 +13,22 @@ class BilletController extends Controller
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//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);
|
||||
}
|
||||
$billets = Billet::all();
|
||||
return view('index', compact('billets'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request)
|
||||
public function store(StoreBilletRequest $request)
|
||||
{
|
||||
//
|
||||
}
|
||||
@@ -39,21 +38,23 @@ class BilletController extends Controller
|
||||
*/
|
||||
public function show(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);
|
||||
}
|
||||
//
|
||||
$commentaires = $billet->commentaires;
|
||||
return view('vBillet', compact('billet', 'commentaires'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit(Billet $billet)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request, Billet $billet)
|
||||
public function update(UpdateBilletRequest $request, Billet $billet)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
@@ -2,10 +2,9 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Http\Requests\CommentaireRequest;
|
||||
use App\Http\Requests\StoreCommentaireRequest;
|
||||
use App\Http\Requests\UpdateCommentaireRequest;
|
||||
use App\Models\Commentaire;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class CommentaireController extends Controller
|
||||
{
|
||||
@@ -17,23 +16,21 @@ class CommentaireController extends Controller
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(CommentaireRequest $request)
|
||||
{
|
||||
//
|
||||
try {
|
||||
$commentaire = Commentaire::create($request->all());
|
||||
return response()->json($commentaire,201);
|
||||
public function store(StoreCommentaireRequest $request)
|
||||
{
|
||||
//
|
||||
}
|
||||
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.
|
||||
@@ -43,10 +40,18 @@ class CommentaireController extends Controller
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit(Commentaire $commentaire)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request, Commentaire $commentaire)
|
||||
public function update(UpdateCommentaireRequest $request, Commentaire $commentaire)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
0
laravel/app/Http/Controllers/Controller.php
Executable file → Normal file
0
laravel/app/Http/Controllers/Controller.php
Executable file → Normal file
@@ -1,40 +0,0 @@
|
||||
<?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
Executable file → Normal file
0
laravel/app/Http/Requests/StoreBilletRequest.php
Executable file → Normal file
28
laravel/app/Http/Requests/StoreCommentaireRequest.php
Normal file
28
laravel/app/Http/Requests/StoreCommentaireRequest.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?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
Executable file → Normal file
0
laravel/app/Http/Requests/UpdateBilletRequest.php
Executable file → Normal file
28
laravel/app/Http/Requests/UpdateCommentaireRequest.php
Normal file
28
laravel/app/Http/Requests/UpdateCommentaireRequest.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?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 [
|
||||
//
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
<?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),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
<?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,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,59 +1,25 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
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
|
||||
{
|
||||
/** @use HasFactory<\Database\Factories\BilletFactory> */
|
||||
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'
|
||||
protected $fillable = [
|
||||
'BIL_DATE',
|
||||
'BIL_TITRE',
|
||||
'BIL_CONTENU',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
|
||||
public function billet_categories()
|
||||
{
|
||||
return $this->hasMany(BilletCategorie::class);
|
||||
}
|
||||
|
||||
public function commentaires()
|
||||
{
|
||||
return $this->hasMany(Commentaire::class);
|
||||
}
|
||||
public function commentaires()
|
||||
{
|
||||
return $this->hasMany(Commentaire::class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
<?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');
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
<?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'
|
||||
];
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
<?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'
|
||||
];
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
<?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');
|
||||
}
|
||||
}
|
||||
@@ -1,54 +1,26 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
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
|
||||
{
|
||||
protected $table = 'commentaires';
|
||||
/** @use HasFactory<\Database\Factories\CommentaireFactory> */
|
||||
use HasFactory;
|
||||
|
||||
protected $casts = [
|
||||
'COM_DATE' => 'datetime',
|
||||
'billet_id' => 'int'
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'COM_DATE',
|
||||
'COM_AUTEUR',
|
||||
'COM_CONTENU',
|
||||
'billet_id'
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'id',
|
||||
protected $fillable = [
|
||||
'COM_DATE',
|
||||
'COM_AUTEUR',
|
||||
'COM_CONTENU',
|
||||
'billet_id',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'billet_id'
|
||||
];
|
||||
|
||||
public function billet()
|
||||
{
|
||||
return $this->belongsTo(Billet::class);
|
||||
}
|
||||
public function billet()
|
||||
{
|
||||
return $this->belongsTo(Billet::class, 'billet_id');
|
||||
}
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
<?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'
|
||||
];
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
<?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'
|
||||
];
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
<?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
Executable file → Normal file
75
laravel/app/Models/User.php
Executable file → Normal file
@@ -1,49 +1,48 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
// use Illuminate\Contracts\Auth\MustVerifyEmail;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
|
||||
/**
|
||||
* 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
|
||||
class User extends Authenticatable
|
||||
{
|
||||
use HasFactory;
|
||||
/** @use HasFactory<\Database\Factories\UserFactory> */
|
||||
use HasFactory, Notifiable;
|
||||
|
||||
protected $table = 'users';
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var list<string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'email',
|
||||
'password',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'email_verified_at' => 'datetime'
|
||||
];
|
||||
/**
|
||||
* The attributes that should be hidden for serialization.
|
||||
*
|
||||
* @var list<string>
|
||||
*/
|
||||
protected $hidden = [
|
||||
'password',
|
||||
'remember_token',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'password',
|
||||
'remember_token'
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'email',
|
||||
'email_verified_at',
|
||||
'password',
|
||||
'remember_token'
|
||||
];
|
||||
/**
|
||||
* Get the attributes that should be cast.
|
||||
*
|
||||
* @return array<string, string>
|
||||
*/
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'email_verified_at' => 'datetime',
|
||||
'password' => 'hashed',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
0
laravel/app/Policies/BilletPolicy.php
Executable file → Normal file
0
laravel/app/Policies/BilletPolicy.php
Executable file → Normal file
66
laravel/app/Policies/CommentairePolicy.php
Normal file
66
laravel/app/Policies/CommentairePolicy.php
Normal file
@@ -0,0 +1,66 @@
|
||||
<?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
Executable file → Normal file
0
laravel/app/Providers/AppServiceProvider.php
Executable file → Normal file
8
laravel/bootstrap/app.php
Executable file → Normal file
8
laravel/bootstrap/app.php
Executable file → Normal file
@@ -3,12 +3,10 @@
|
||||
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',
|
||||
)
|
||||
@@ -16,9 +14,5 @@ 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();
|
||||
|
||||
0
laravel/bootstrap/cache/.gitignore
vendored
Executable file → Normal file
0
laravel/bootstrap/cache/.gitignore
vendored
Executable file → Normal file
0
laravel/bootstrap/providers.php
Executable file → Normal file
0
laravel/bootstrap/providers.php
Executable file → Normal file
4
laravel/composer.json
Executable file → Normal file
4
laravel/composer.json
Executable file → Normal file
@@ -8,7 +8,6 @@
|
||||
"require": {
|
||||
"php": "^8.2",
|
||||
"laravel/framework": "^12.0",
|
||||
"laravel/sanctum": "^4.0",
|
||||
"laravel/tinker": "^2.10.1"
|
||||
},
|
||||
"require-dev": {
|
||||
@@ -18,8 +17,7 @@
|
||||
"laravel/sail": "^1.41",
|
||||
"mockery/mockery": "^1.6",
|
||||
"nunomaduro/collision": "^8.6",
|
||||
"phpunit/phpunit": "^11.5.3",
|
||||
"reliese/laravel": "^1.4"
|
||||
"phpunit/phpunit": "^11.5.3"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
|
||||
332
laravel/composer.lock
generated
Executable file → Normal file
332
laravel/composer.lock
generated
Executable file → Normal file
@@ -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": "cc1f42d2dd2bf6629798006e6a8a4606",
|
||||
"content-hash": "88970a0117c062eed55fa8728fc43833",
|
||||
"packages": [
|
||||
{
|
||||
"name": "brick/math",
|
||||
@@ -1328,70 +1328,6 @@
|
||||
},
|
||||
"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",
|
||||
@@ -5851,160 +5787,6 @@
|
||||
}
|
||||
],
|
||||
"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",
|
||||
@@ -7181,118 +6963,6 @@
|
||||
],
|
||||
"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",
|
||||
|
||||
0
laravel/config/app.php
Executable file → Normal file
0
laravel/config/app.php
Executable file → Normal file
0
laravel/config/auth.php
Executable file → Normal file
0
laravel/config/auth.php
Executable file → Normal file
0
laravel/config/cache.php
Executable file → Normal file
0
laravel/config/cache.php
Executable file → Normal file
0
laravel/config/database.php
Executable file → Normal file
0
laravel/config/database.php
Executable file → Normal file
0
laravel/config/filesystems.php
Executable file → Normal file
0
laravel/config/filesystems.php
Executable file → Normal file
0
laravel/config/logging.php
Executable file → Normal file
0
laravel/config/logging.php
Executable file → Normal file
0
laravel/config/mail.php
Executable file → Normal file
0
laravel/config/mail.php
Executable file → Normal file
@@ -1,534 +0,0 @@
|
||||
<?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
Executable file → Normal file
0
laravel/config/queue.php
Executable file → Normal file
@@ -1,84 +0,0 @@
|
||||
<?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
Executable file → Normal file
0
laravel/config/services.php
Executable file → Normal file
0
laravel/config/session.php
Executable file → Normal file
0
laravel/config/session.php
Executable file → Normal file
0
laravel/database/.gitignore
vendored
Executable file → Normal file
0
laravel/database/.gitignore
vendored
Executable file → Normal file
0
laravel/database/factories/BilletFactory.php
Executable file → Normal file
0
laravel/database/factories/BilletFactory.php
Executable file → Normal file
29
laravel/database/factories/CommentaireFactory.php
Normal file
29
laravel/database/factories/CommentaireFactory.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?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
Executable file → Normal file
0
laravel/database/factories/UserFactory.php
Executable file → Normal file
0
laravel/database/migrations/0001_01_01_000000_create_users_table.php
Executable file → Normal file
0
laravel/database/migrations/0001_01_01_000000_create_users_table.php
Executable file → Normal file
0
laravel/database/migrations/0001_01_01_000001_create_cache_table.php
Executable file → Normal file
0
laravel/database/migrations/0001_01_01_000001_create_cache_table.php
Executable file → Normal file
0
laravel/database/migrations/0001_01_01_000002_create_jobs_table.php
Executable file → Normal file
0
laravel/database/migrations/0001_01_01_000002_create_jobs_table.php
Executable file → Normal file
@@ -0,0 +1,36 @@
|
||||
<?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');
|
||||
}
|
||||
};
|
||||
@@ -1,33 +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('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
Executable file → Normal file
0
laravel/database/seeders/BilletSeeder.php
Executable file → Normal file
20
laravel/database/seeders/CommentaireSeeder.php
Normal file
20
laravel/database/seeders/CommentaireSeeder.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?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
Executable file → Normal file
0
laravel/database/seeders/DatabaseSeeder.php
Executable file → Normal file
0
laravel/licenses/laravel-12.0.3.txt
Executable file → Normal file
0
laravel/licenses/laravel-12.0.3.txt
Executable file → Normal file
0
laravel/package.json
Executable file → Normal file
0
laravel/package.json
Executable file → Normal file
0
laravel/phpunit.xml
Executable file → Normal file
0
laravel/phpunit.xml
Executable file → Normal file
0
laravel/public/.htaccess
Executable file → Normal file
0
laravel/public/.htaccess
Executable file → Normal file
0
laravel/public/favicon.ico
Executable file → Normal file
0
laravel/public/favicon.ico
Executable file → Normal file
0
laravel/public/index.php
Executable file → Normal file
0
laravel/public/index.php
Executable file → Normal file
0
laravel/public/robots.txt
Executable file → Normal file
0
laravel/public/robots.txt
Executable file → Normal file
8
laravel/public/style.css
Executable file → Normal file
8
laravel/public/style.css
Executable file → Normal file
@@ -40,3 +40,11 @@ h1 {
|
||||
#txtCommentaire {
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
#titreReponses {
|
||||
font-size: 100%;
|
||||
}
|
||||
|
||||
#txtCommentaire {
|
||||
width: 50%;
|
||||
}
|
||||
0
laravel/resources/css/app.css
Executable file → Normal file
0
laravel/resources/css/app.css
Executable file → Normal file
0
laravel/resources/js/app.js
Executable file → Normal file
0
laravel/resources/js/app.js
Executable file → Normal file
0
laravel/resources/js/bootstrap.js
vendored
Executable file → Normal file
0
laravel/resources/js/bootstrap.js
vendored
Executable file → Normal file
40
laravel/resources/views/index.blade.php
Executable file → Normal file
40
laravel/resources/views/index.blade.php
Executable file → Normal file
@@ -1,31 +1,13 @@
|
||||
<!doctype html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="stylesheet" href="style.css" />
|
||||
<title>Mon Blog</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="global">
|
||||
@extends('layout')
|
||||
@section('contenu')
|
||||
@foreach($billets as $billet)
|
||||
<article>
|
||||
<header>
|
||||
<a href="index.php"><h1 id="titreBlog">Mon Blog</h1></a>
|
||||
<p>Je vous souhaite la bienvenue sur ce modeste blog.</p>
|
||||
<a href="{{ route('billets.show', $billet->id) }}"><h1 class="titreBillet">{{ $billet->BIL_TITRE }}</h1></a>
|
||||
<time>{{ $billet->BIL_DATE }}</time>
|
||||
</header>
|
||||
<div id="contenu">
|
||||
@foreach($billets as $billet)
|
||||
<article>
|
||||
<header>
|
||||
<h1 class="titreBillet">{{ $billet->BIL_TITRE }}</h1>
|
||||
<time>{{ $billet->BIL_DATE }}</time>
|
||||
</header>
|
||||
<p>{{ $billet->BIL_CONTENU }}</p>
|
||||
</article>
|
||||
<hr />
|
||||
@endforeach
|
||||
</div> <!-- #contenu -->
|
||||
<footer id="piedBlog">
|
||||
Blog réalisé avec PHP, HTML5 et CSS.
|
||||
</footer>
|
||||
</div> <!-- #global -->
|
||||
</body>
|
||||
</html>
|
||||
<p>{{ $billet->BIL_CONTENU }}</p>
|
||||
</article>
|
||||
<hr />
|
||||
@endforeach
|
||||
@endsection
|
||||
23
laravel/resources/views/layout.blade.php
Normal file
23
laravel/resources/views/layout.blade.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<!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>
|
||||
24
laravel/resources/views/vBillet.blade.php
Normal file
24
laravel/resources/views/vBillet.blade.php
Normal file
@@ -0,0 +1,24 @@
|
||||
@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
Executable file → Normal file
0
laravel/resources/views/welcome.blade.php
Executable file → Normal file
@@ -1,13 +0,0 @@
|
||||
<?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
Executable file → Normal file
0
laravel/routes/console.php
Executable file → Normal file
2
laravel/routes/web.php
Executable file → Normal file
2
laravel/routes/web.php
Executable file → Normal file
@@ -6,3 +6,5 @@ use Illuminate\Support\Facades\Route;
|
||||
Route::get('/', function () {
|
||||
return view('welcome');
|
||||
});
|
||||
|
||||
Route::resource('billets', BilletController::class);
|
||||
|
||||
0
laravel/storage/app/.gitignore
vendored
Executable file → Normal file
0
laravel/storage/app/.gitignore
vendored
Executable file → Normal file
0
laravel/storage/app/private/.gitignore
vendored
Executable file → Normal file
0
laravel/storage/app/private/.gitignore
vendored
Executable file → Normal file
0
laravel/storage/app/public/.gitignore
vendored
Executable file → Normal file
0
laravel/storage/app/public/.gitignore
vendored
Executable file → Normal file
0
laravel/storage/framework/.gitignore
vendored
Executable file → Normal file
0
laravel/storage/framework/.gitignore
vendored
Executable file → Normal file
0
laravel/storage/framework/cache/.gitignore
vendored
Executable file → Normal file
0
laravel/storage/framework/cache/.gitignore
vendored
Executable file → Normal file
0
laravel/storage/framework/cache/data/.gitignore
vendored
Executable file → Normal file
0
laravel/storage/framework/cache/data/.gitignore
vendored
Executable file → Normal file
0
laravel/storage/framework/sessions/.gitignore
vendored
Executable file → Normal file
0
laravel/storage/framework/sessions/.gitignore
vendored
Executable file → Normal file
0
laravel/storage/framework/testing/.gitignore
vendored
Executable file → Normal file
0
laravel/storage/framework/testing/.gitignore
vendored
Executable file → Normal file
0
laravel/storage/framework/views/.gitignore
vendored
Executable file → Normal file
0
laravel/storage/framework/views/.gitignore
vendored
Executable file → Normal file
0
laravel/storage/logs/.gitignore
vendored
Executable file → Normal file
0
laravel/storage/logs/.gitignore
vendored
Executable file → Normal file
0
laravel/tests/Feature/ExampleTest.php
Executable file → Normal file
0
laravel/tests/Feature/ExampleTest.php
Executable file → Normal file
0
laravel/tests/TestCase.php
Executable file → Normal file
0
laravel/tests/TestCase.php
Executable file → Normal file
0
laravel/tests/Unit/ExampleTest.php
Executable file → Normal file
0
laravel/tests/Unit/ExampleTest.php
Executable file → Normal file
0
laravel/vite.config.js
Executable file → Normal file
0
laravel/vite.config.js
Executable file → Normal file
Reference in New Issue
Block a user