PHPCS pass + some refactor

This commit is contained in:
Jérémy Munsch 2022-04-19 16:07:27 +02:00
parent 5bd0004152
commit aa29234e55
No known key found for this signature in database
GPG key ID: 18361AF3BFEC0FEC
67 changed files with 2319 additions and 2294 deletions

View file

@ -40,60 +40,60 @@ class DeleteMediaArchive extends Command
*/
public function handle()
{
$this->info('Vous allez supprimer définitivement tous les médias (et leurs fichiers) qui ont été supprimés (en soft delete).');
$this->info('Vous allez supprimer définitivement tous les médias (et leurs fichiers) qui ont été supprimés (en soft delete).');
$choice = $this->choice('Etes-vous sûr de vouloir lancer ce traitement ?' , ['y', 'n'], 'y');
$choice = $this->choice('Etes-vous sûr de vouloir lancer ce traitement ?', ['y', 'n'], 'y');
if($choice != "y"){
$this->error('Choix incorrect');
die();
}
if ($choice != "y") {
$this->error('Choix incorrect');
die();
}
$sujets = Sujet::where('sujet_dam', 1)->get();
$sujets = Sujet::where('sujet_dam', 1)->get();
$this->line("");
$this->line("Liste des sujets disponibles");
$this->line("----------------------------");
foreach ($sujets as $key => $sujet) {
$this->line("[".$sujet->codeSujet."] ". $sujet->libelle);
}
$this->line("[0] Tous les sujets");
$this->line("");
$this->line("Liste des sujets disponibles");
$this->line("----------------------------");
foreach ($sujets as $key => $sujet) {
$this->line("[" . $sujet->codeSujet . "] " . $sujet->libelle);
}
$this->line("[0] Tous les sujets");
$sujetId = $this->ask('Pour quel sujet de média souhaitez vous executer le traitement ?' );
$sujetId = $this->ask('Pour quel sujet de média souhaitez vous executer le traitement ?');
if($sujetId == ""){
$this->error('Id de sujet incorrect');
die();
}
if ($sujetId == "") {
$this->error('Id de sujet incorrect');
die();
}
if($sujetId == 0){
$medias = Media::onlyTrashed()->with('Sujet.formats')->get();
}else{
$medias = Media::onlyTrashed()->where('sujet_id', $sujetId)->with('Sujet.formats')->get();
}
if ($sujetId == 0) {
$medias = Media::onlyTrashed()->with('Sujet.formats')->get();
} else {
$medias = Media::onlyTrashed()->where('sujet_id', $sujetId)->with('Sujet.formats')->get();
}
if($medias->count() == 0){
$this->error('Aucun média a supprimer');
die();
}
if ($medias->count() == 0) {
$this->error('Aucun média a supprimer');
die();
}
$this->info($medias->count().' média(s) trouvé(s) - Début du traitement');
$bar = $this->output->createProgressBar(count($medias));
$bar->start();
$this->info($medias->count() . ' média(s) trouvé(s) - Début du traitement');
$bar = $this->output->createProgressBar(count($medias));
$bar->start();
foreach ($medias as $media) {
// supprime les fichiers médias stockés sur disque
$files = Storage::files($media->folder."/");
$filepath = preg_quote($media->folder.$media->uid, '/');
$matchingFiles = preg_grep('/^'.$filepath.'/', $files);
Storage::delete($matchingFiles);
// supprime le media en bdd
$media->forceDelete();
$bar->advance();
}
foreach ($medias as $media) {
// supprime les fichiers médias stockés sur disque
$files = Storage::files($media->folder . "/");
$filepath = preg_quote($media->folder . $media->uid, '/');
$matchingFiles = preg_grep('/^' . $filepath . '/', $files);
Storage::delete($matchingFiles);
// supprime le media en bdd
$media->forceDelete();
$bar->advance();
}
$bar->finish();
$this->line("");
$this->info('Fin du traitement');
$bar->finish();
$this->line("");
$this->info('Fin du traitement');
}
}

View file

@ -5,7 +5,6 @@ namespace App\Console\Commands;
use App\Models\Societe;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Facades\File;
use App\Models\Article;
use App\Models\Marque;
use App\Models\Sujet;
@ -13,12 +12,11 @@ use App\Models\Typemedia;
use App\Models\Typevue;
use App\Models\Site;
use App\Models\Variante;
use App\Models\Media;
use App\Http\Traits\MediaTools;
class ImportArcadiaFiles extends Command
{
use MediaTools;
use MediaTools;
/**
* The name and signature of the console command.
@ -51,170 +49,181 @@ class ImportArcadiaFiles extends Command
*/
public function handle()
{
$this->info('Démarrage du traitement');
$files = Storage::disk('arcadia')->files();
$bar = $this->output->createProgressBar(count($files)-1);
$bar->start();
$this->info('Démarrage du traitement');
$files = Storage::disk('arcadia')->files();
$bar = $this->output->createProgressBar(count($files) - 1);
$bar->start();
// ---- Pour chaque fichier
foreach ($files as $filename) {
// ---- Pour chaque fichier
foreach ($files as $filename) {
if ($filename == ".gitignore") {
continue;
}
if($filename == ".gitignore") continue;
// ---- Récupération du contenu
$files = Storage::disk('arcadia')->get($filename);
$fileContent = simplexml_load_string($files);
// ---- Récupération du contenu
$files = Storage::disk('arcadia')->get($filename);
$fileContent = simplexml_load_string($files);
// ---- traitement du fichier
if(substr($filename, 0, 11) == "DAM_ARTICLE"){
foreach ($fileContent->dam as $row) {
$record = Article::where('noArt', $row->noArt)->first();
if($record){ // Update record
$record->libCcial = $row->libCcial;
$record->codMarq = $row->codMarq;
$record->libMarq = $row->libMarq;
$record->codFamVte = $row->codFamVte;
$record->libFamVte = $row->libFamVte;
$record->codGencodAdm = $row->codGencodAdm;
$record->codGencodSymb = $row->codGencodSymb;
$record->codGencodPds = $row->codGencodPds;
$record->utilisableGroupe = $row->utilisableGroupe;
$record->save();
}else{ // Insert new record
$record = new Article();
$record->noArt = $row->noArt;
$record->libCcial = $row->libCcial;
$record->codMarq = $row->codMarq;
$record->libMarq = $row->libMarq;
$record->codFamVte = $row->codFamVte;
$record->libFamVte = $row->libFamVte;
$record->codGencodAdm = $row->codGencodAdm;
$record->codGencodSymb = $row->codGencodSymb;
$record->codGencodPds = $row->codGencodPds;
// ---- traitement du fichier
if (substr($filename, 0, 11) == "DAM_ARTICLE") {
foreach ($fileContent->dam as $row) {
$record = Article::where('noArt', $row->noArt)->first();
if ($record) {
// Update record
$record->libCcial = $row->libCcial;
$record->codMarq = $row->codMarq;
$record->libMarq = $row->libMarq;
$record->codFamVte = $row->codFamVte;
$record->libFamVte = $row->libFamVte;
$record->codGencodAdm = $row->codGencodAdm;
$record->codGencodSymb = $row->codGencodSymb;
$record->codGencodPds = $row->codGencodPds;
$record->utilisableGroupe = $row->utilisableGroupe;
$record->save();
}
}
$record->save();
} else {
// Insert new record
$record = new Article();
$record->noArt = $row->noArt;
$record->libCcial = $row->libCcial;
$record->codMarq = $row->codMarq;
$record->libMarq = $row->libMarq;
$record->codFamVte = $row->codFamVte;
$record->libFamVte = $row->libFamVte;
$record->codGencodAdm = $row->codGencodAdm;
$record->codGencodSymb = $row->codGencodSymb;
$record->codGencodPds = $row->codGencodPds;
$record->utilisableGroupe = $row->utilisableGroupe;
$record->save();
}//end if
}//end foreach
// ---- Suppression du fichier
Storage::disk('arcadia')->delete($filename);
// ---- Suppression du fichier
Storage::disk('arcadia')->delete($filename);
} elseif (substr($filename, 0, 10) == "DAM_MARQUE") {
foreach ($fileContent->dam as $row) {
$record = Marque::where('codMarq', $row->codMarq)->first();
if ($record) {
// Update record
$record->libMarq = $row->libMarq;
$record->save();
} else {
// Insert new record
$record = new Marque();
$record->codMarq = $row->codMarq;
$record->libMarq = $row->libMarq;
$record->save();
}
}
}elseif (substr($filename, 0, 10) == "DAM_MARQUE") {
foreach ($fileContent->dam as $row) {
$record = Marque::where('codMarq', $row->codMarq)->first();
if($record){ // Update record
$record->libMarq = $row->libMarq;
$record->save();
}else{ // Insert new record
$record = new Marque();
$record->codMarq = $row->codMarq;
$record->libMarq = $row->libMarq;
$record->save();
}
}
// ---- Suppression du fichier
Storage::disk('arcadia')->delete($filename);
} elseif (substr($filename, 0, 15) == "DAM_MEDIA_SUJET") {
foreach ($fileContent->mediaSujet as $row) {
$record = Sujet::where('codeSujet', $row->code)->first();
if ($record) {
// Update record
$record->libelle = $row->libelle;
$record->save();
} else {
// Insert new record
$record = new Sujet();
$record->codeSujet = $row->code;
$record->libelle = $row->libelle;
$record->save();
}
}
// ---- Suppression du fichier
Storage::disk('arcadia')->delete($filename);
// ---- Suppression du fichier
Storage::disk('arcadia')->delete($filename);
} elseif (substr($filename, 0, 20) == "DAM_MEDIA_TYPE_MEDIA") {
foreach ($fileContent->mediatypemedia as $row) {
$record = Typemedia::where('codeTypemedia', $row->code)->first();
if ($record) {
// Update record
$record->libelle = $row->libelle;
$record->save();
} else {
// Insert new record
$record = new Typemedia();
$record->codeTypemedia = $row->code;
$record->libelle = $row->libelle;
$record->save();
}
}
}elseif (substr($filename, 0, 15) == "DAM_MEDIA_SUJET") {
foreach ($fileContent->mediaSujet as $row) {
$record = Sujet::where('codeSujet', $row->code)->first();
if($record){ // Update record
$record->libelle = $row->libelle;
$record->save();
}else{ // Insert new record
$record = new Sujet();
$record->codeSujet = $row->code;
$record->libelle = $row->libelle;
$record->save();
}
}
// ---- Suppression du fichier
Storage::disk('arcadia')->delete($filename);
} elseif (substr($filename, 0, 17) == "DAM_MEDIA_TYPEVUE") {
foreach ($fileContent->mediatypesvue as $row) {
$record = Typevue::where('codeTypevue', $row->code)->first();
if ($record) {
// Update record
$record->libelle = $row->libelle;
$record->sujet_id = $row->sujet_id->mediasujet->code;
$record->save();
} else {
// Insert new record
$record = new Typevue();
$record->codeTypevue = $row->code;
$record->libelle = $row->libelle;
$record->sujet_id = $row->sujet_id->mediasujet->code;
$record->save();
}
}
// ---- Suppression du fichier
Storage::disk('arcadia')->delete($filename);
// ---- Suppression du fichier
Storage::disk('arcadia')->delete($filename);
} elseif (substr($filename, 0, 18) == "DAM_MEDIA_VARIANTE") {
foreach ($fileContent->mediavariante as $row) {
$record = Variante::where('codeVariante', $row->code)->first();
if ($record) {
// Update record
$record->libelle = $row->libelle;
$record->sujet_id = $row->sujet_id->children()[0]->code;
$record->typevue_id = $row->CodeTypeVue->mediatypesvue->code;
$record->save();
} else {
// Insert new record
$record = new Variante();
$record->codeVariante = $row->code;
$record->libelle = $row->libelle;
$record->sujet_id = $row->sujet_id->children()[0]->code;
$record->typevue_id = $row->CodeTypeVue->mediatypesvue->code;
$record->save();
}
}
}elseif (substr($filename, 0, 20) == "DAM_MEDIA_TYPE_MEDIA") {
foreach ($fileContent->mediatypemedia as $row) {
$record = Typemedia::where('codeTypemedia', $row->code)->first();
if($record){ // Update record
$record->libelle = $row->libelle;
$record->save();
}else{ // Insert new record
$record = new Typemedia();
$record->codeTypemedia = $row->code;
$record->libelle = $row->libelle;
$record->save();
}
}
// ---- Suppression du fichier
Storage::disk('arcadia')->delete($filename);
} elseif (substr($filename, 0, 20) == "DAM_SITE_PROD_GROUPE") {
foreach ($fileContent->SITE_PROD_GRP as $row) {
$record = Site::where('id', $row->code)->first();
if ($record) {
// Update record
$record->libelle = $row->libelle;
$record->save();
} else {
// Insert new record
$record = new Site();
$record->id = $row->code;
$record->libelle = $row->libelle;
$record->save();
}
}
// ---- Suppression du fichier
Storage::disk('arcadia')->delete($filename);
}elseif (substr($filename, 0, 17) == "DAM_MEDIA_TYPEVUE") {
foreach ($fileContent->mediatypesvue as $row) {
$record = Typevue::where('codeTypevue', $row->code)->first();
if($record){ // Update record
$record->libelle = $row->libelle;
$record->sujet_id = $row->sujet_id->mediasujet->code;
$record->save();
}else{ // Insert new record
$record = new Typevue();
$record->codeTypevue = $row->code;
$record->libelle = $row->libelle;
$record->sujet_id = $row->sujet_id->mediasujet->code;
$record->save();
}
}
// ---- Suppression du fichier
Storage::disk('arcadia')->delete($filename);
}elseif (substr($filename, 0, 18) == "DAM_MEDIA_VARIANTE") {
foreach ($fileContent->mediavariante as $row) {
$record = Variante::where('codeVariante', $row->code)->first();
if($record){ // Update record
$record->libelle = $row->libelle;
$record->sujet_id = $row->sujet_id->children()[0]->code;
$record->typevue_id = $row->CodeTypeVue->mediatypesvue->code;
$record->save();
}else{ // Insert new record
$record = new Variante();
$record->codeVariante = $row->code;
$record->libelle = $row->libelle;
$record->sujet_id = $row->sujet_id->children()[0]->code;
$record->typevue_id = $row->CodeTypeVue->mediatypesvue->code;
$record->save();
}
}
// ---- Suppression du fichier
Storage::disk('arcadia')->delete($filename);
}elseif (substr($filename, 0, 20) == "DAM_SITE_PROD_GROUPE") {
foreach ($fileContent->SITE_PROD_GRP as $row) {
$record = Site::where('id', $row->code)->first();
if($record){ // Update record
$record->libelle = $row->libelle;
$record->save();
}else{ // Insert new record
$record = new Site();
$record->id = $row->code;
$record->libelle = $row->libelle;
$record->save();
}
}
// ---- Suppression du fichier
Storage::disk('arcadia')->delete($filename);
}elseif (substr($filename, 0, 11) == "DAM_SOCIETE") {
foreach ($fileContent->dam as $row) {
// ---- Suppression du fichier
Storage::disk('arcadia')->delete($filename);
} elseif (substr($filename, 0, 11) == "DAM_SOCIETE") {
foreach ($fileContent->dam as $row) {
$record = Societe::where('id', $row->codSociete)->first();
if($record){ // Update record
if ($record) {
// Update record
$record->libelle = $row->nomSociete;
$record->save();
}else{ // Insert new record
$record = new Societe();
$record->id = $row->codSociete;
} else {
// Insert new record
$record = new Societe();
$record->id = $row->codSociete;
$record->libelle = $row->nomSociete;
$record->save();
}
@ -222,12 +231,12 @@ class ImportArcadiaFiles extends Command
// ---- Suppression du fichier
Storage::disk('arcadia')->delete($filename);
}
$bar->advance();
}
}//end if
$bar->advance();
}//end foreach
$bar->finish();
$this->line("");
$this->info('Fin du traitement');
$bar->finish();
$this->line("");
$this->info('Fin du traitement');
}
}

View file

@ -53,29 +53,30 @@ class ImportMedia extends Command
$this->line("-> Import du fichier DAM_MEDIA_VISUEL");
// ---- Traitement de l'import des XML Visuel
foreach ($files as $filename) {
$path = explode("/", $filename);
$path = explode("/", $filename);
$filename = $path[count($path) - 1];
// ---- Récupération du contenu
$oneFile = Storage::disk('arcadia')->get($filename);
$oneFile = Storage::disk('arcadia')->get($filename);
$fileContent = simplexml_load_string($oneFile);
// ---- traitement du fichier
$bar = $this->output->createProgressBar(count($fileContent->MEDIA_VISUEL)-1);
$bar = $this->output->createProgressBar(count($fileContent->MEDIA_VISUEL) - 1);
$bar->start();
foreach ($fileContent->MEDIA_VISUEL as $row) {
$record = Media::where('arcadia_id', $row->code)->first();
if (!$record) { // Insert new record
$record = new Media();
if (!$record) {
// Insert new record
$record = new Media();
$record->arcadia_id = $row->code;
if ($row->extension != "") {
$record->extension = $row->extension->typeFichier->libExtension;
}
$record->libelle = $row->libelle;
$record->largeur = $row->nbPxLargeur;
$record->libelle = $row->libelle;
$record->largeur = $row->nbPxLargeur;
$record->largeur_mm = $row->largeurMm;
$record->hauteur = $row->nbPxHauteur;
$record->hauteur = $row->nbPxHauteur;
$record->hauteur_mm = $row->hauteurMm;
$record->resolution = $row->pppLargeur;
if ($row->version != "") {
@ -93,94 +94,93 @@ class ImportMedia extends Command
$record->typevue_id = $row->codeTypeVue;
}
$record->commentaire = $row->commentaire;
$record->sujet_id = $row->codeSujet;
$record->sujet_id = $row->codeSujet;
if ($row->langue != "") {
$record->langue_id = $row->langue;
}
if ($row->copyright != "") {
$record->copyright_id = $row->copyright;
}else{
} else {
$record->copyright_id = 3;
}
if ($row->codeVariante != "") {
$record->variante_id = $row->codeVariante;
}
if ($row->dateCreation != "") {
$row->dateCreation = substr($row->dateCreation, 0, 10);
$date = explode("/", $row->dateCreation);
$row->dateCreation = substr($row->dateCreation, 0, 10);
$date = explode("/", $row->dateCreation);
$record->created_at = $date[2] . '-' . $date[1] . '-' . $date[0];
}
if ($row->dateModification != "") {
$row->dateModification = substr($row->dateModification, 0, 10);
$date = explode("/", $row->dateModification);
$record->updated_at = $date[2] . '-' . $date[1] . '-' . $date[0];
$date = explode("/", $row->dateModification);
$record->updated_at = $date[2] . '-' . $date[1] . '-' . $date[0];
}
if ($row->datePublication != "") {
$row->datePublication = substr($row->datePublication, 0, 10);
$date = explode("/", $row->datePublication);
$date = explode("/", $row->datePublication);
$record->published_at = $date[2] . '-' . $date[1] . '-' . $date[0];
}
$record->statut = config('services.statut.public_etendu');
// Affectation d'un dossier et d'un uid
$destinationPath = $this->get_mediaFolder() . "/";
$record->folder = $destinationPath;
$record->uid = sprintf('%04x%04x-%04x-%04x-%04x-%04x%04x%04x', mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0x0fff) | 0x4000, mt_rand(0, 0x3fff) | 0x8000, mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff));
$destinationPath = $this->getMediaFolder() . "/";
$record->folder = $destinationPath;
$record->uid = sprintf('%04x%04x-%04x-%04x-%04x-%04x%04x%04x', mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0x0fff) | 0x4000, mt_rand(0, 0x3fff) | 0x8000, mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff));
$mediaFile = "/images/" . $record->arcadia_id . "." . $record->extension;
$mediaFile = "/images/" . $record->arcadia_id . "." . $record->extension;
$fileExists = Storage::disk('arcadia')->exists($mediaFile);
if ($fileExists) {
// déplacement du média et renommage du fichier
$file = Storage::disk('arcadia')->get($mediaFile);
$file = Storage::disk('arcadia')->get($mediaFile);
$full_path_source = Storage::disk('arcadia')->getDriver()->getAdapter()->applyPathPrefix($mediaFile);
$full_path_dest = Storage::disk('local')->getDriver()->getAdapter()->applyPathPrefix($destinationPath . $record->uid . '.' . $record->extension);
$full_path_dest = Storage::disk('local')->getDriver()->getAdapter()->applyPathPrefix($destinationPath . $record->uid . '.' . $record->extension);
File::move($full_path_source, $full_path_dest);
// calcul de la taille du média
$record->taille = $this->formatBytes($this->get_file_size($full_path_dest));
$record->taille = $this->formatBytes($this->getFileSize($full_path_dest));
} else {
// on applique une image par défaut
$record->extension = "jpg";
Storage::disk('local')->copy("assets/images/default.jpg", $destinationPath . $record->uid . '.' . $record->extension);
// calcul de la taille du média
$record->taille = $this->formatBytes($this->get_file_size("public/" . $destinationPath . $record->uid . '.' . $record->extension));
$record->taille = $this->formatBytes($this->getFileSize("public/" . $destinationPath . $record->uid . '.' . $record->extension));
}
$record->save();
// ---- Creation des vignettes de base
$this->create_sys_thumb($record);
$this->createSysThumb($record);
// ---- Creation des vignettes en lien avec le sujet du média
$this->create_thumb($record);
$this->createThumb($record);
} else {
$this->line("\nDAM_MEDIA_VISUEL : le media n°" . $row->code . " existe déjà en base");
}
}//end if
$bar->advance();
}
}//end foreach
$bar->finish();
// ---- Suppression du fichier
Storage::disk('arcadia')->delete($filename);
}
}//end foreach
// ---- Traitement de l'association media <-> article
$files = File::glob(storage_path('export_arcadia') . "/DAM_ASSO_ARTICLE_*.*");
$this->line("-> Import du fichier DAM_ASSO_ARTICLE");
foreach ($files as $filename) {
$path = explode("/", $filename);
$path = explode("/", $filename);
$filename = $path[count($path) - 1];
// ---- Récupération du contenu
$oneFile = Storage::disk('arcadia')->get($filename);
$oneFile = Storage::disk('arcadia')->get($filename);
$fileContent = simplexml_load_string($oneFile);
// ---- traitement du fichier
$bar = $this->output->createProgressBar(count($fileContent->mediaassoarticle)-1);
$bar = $this->output->createProgressBar(count($fileContent->mediaassoarticle) - 1);
$bar->start();
foreach ($fileContent->mediaassoarticle as $row) {
$record = Media::where('arcadia_id', $row->codeVisuel)->first();
@ -191,7 +191,7 @@ class ImportMedia extends Command
$record->articles()->syncWithoutDetaching($article->id);
// recherche un dossier lié à la marque de l'article
$marque_id = $article->codMarq;
$dossier = Dossier::whereHas("marques", function ($query) use ($marque_id) {
$dossier = Dossier::whereHas("marques", function ($query) use ($marque_id) {
$query->where("codMarq", $marque_id);
})->first();
@ -203,52 +203,52 @@ class ImportMedia extends Command
} else {
$marque = Marque::where('codMarq', '=', $marque_id)->first();
// On cree le dossier
$dossier = new Dossier();
$dossier->libelle = $marque->libMarq;
$dossier = new Dossier();
$dossier->libelle = $marque->libMarq;
$dossier->sujet_id = 1;
$dossier->system = 0;
$dossier->system = false;
$dossier->save();
$dossier->marques()->syncWithoutDetaching($marque_id);
$dossier->save();
$record->dossier_id = $dossier->id;
$record->save();
//$this->line("Liason media n°" . $row->codeVisuel . " à la marque n°" . $article->libMarq);
// $this->line("Liason media n°" . $row->codeVisuel . " à la marque n°" . $article->libMarq);
}
} else {
$this->line("\nDAM_ASSO_ARTICLE : le media n°" . $row->codeVisuel . " ne peut être lié à l'article n°" . $row->noArt);
}
}//end if
} else {
$this->line("\nDAM_ASSO_ARTICLE : le media n°" . $row->codeVisuel . " n'existe pas");
}
}//end if
$bar->advance();
}
}//end foreach
$bar->finish();
// ---- Suppression du fichier
Storage::disk('arcadia')->delete($filename);
}
}//end foreach
// ---- Traitement de l'association media <-> marque
$files = File::glob(storage_path('export_arcadia') . "/DAM_ASSO_MARQUE_*.*");
$this->line("-> Import du fichier DAM_ASSO_MARQUE");
foreach ($files as $filename) {
$path = explode("/", $filename);
$path = explode("/", $filename);
$filename = $path[count($path) - 1];
// ---- Récupération du contenu
$oneFile = Storage::disk('arcadia')->get($filename);
$oneFile = Storage::disk('arcadia')->get($filename);
$fileContent = simplexml_load_string($oneFile);
// ---- traitement du fichier
$bar = $this->output->createProgressBar(count($fileContent->mediaassomarque)-1);
$bar = $this->output->createProgressBar(count($fileContent->mediaassomarque) - 1);
$bar->start();
foreach ($fileContent->mediaassomarque as $row) {
$record = Media::where('arcadia_id', $row->codeVisuel)->first();
if ($record) {
if ($record->marques->contains($row->codMarq)){
if ($record->marques->contains($row->codMarq)) {
$this->line("\nDAM_ASSO_MARQUE : le media n°" . $row->codeVisuel . " est déjà associé à cette marque.");
}else{
} else {
// attache la marque au média
$record->marques()->attach($row->codMarq);
}
@ -261,21 +261,21 @@ class ImportMedia extends Command
// ---- Suppression du fichier
Storage::disk('arcadia')->delete($filename);
}
}//end foreach
// ---- Traitement de l'association media <-> societe
$files = File::glob(storage_path('export_arcadia') . "/DAM_ASSO_SOCIETE_*.*");
$this->line("-> Import du fichier DAM_ASSO_SOCIETE");
foreach ($files as $filename) {
$path = explode("/", $filename);
$path = explode("/", $filename);
$filename = $path[count($path) - 1];
// ---- Récupération du contenu
$oneFile = Storage::disk('arcadia')->get($filename);
$oneFile = Storage::disk('arcadia')->get($filename);
$fileContent = simplexml_load_string($oneFile);
// ---- traitement du fichier
$bar = $this->output->createProgressBar(count($fileContent->mediaassosociete)-1);
$bar = $this->output->createProgressBar(count($fileContent->mediaassosociete) - 1);
$bar->start();
foreach ($fileContent->mediaassosociete as $row) {
$record = Media::where('arcadia_id', $row->codeVisuel)->first();
@ -291,7 +291,7 @@ class ImportMedia extends Command
// ---- Suppression du fichier
Storage::disk('arcadia')->delete($filename);
}
}//end foreach
$this->line("");
$this->info('Fin du traitement');

View file

@ -1,11 +1,12 @@
<?php
/*
* Command Name: LDC Web Status Checker
* Description: Envoi des infos Serveur/Laravel vers LDC Web
* Version: 1.0
* Author: Vincent BRIDIER
* Author URI: vincent.bridier@ldc.fr
*/
* Command Name: LDC Web Status Checker
* Description: Envoi des infos Serveur/Laravel vers LDC Web
* Version: 1.0
* Author: Vincent BRIDIER
* Author URI: vincent.bridier@ldc.fr
*/
namespace App\Console\Commands;
@ -44,28 +45,28 @@ class LDCWebStatusChecker extends Command
*/
public function handle()
{
$data = [];
$data = [];
$data['uuid'] = env('PROJECT_UUID');
// Sitemap.xml ?
if (file_exists(public_path() . '/sitemap.xml')) {
$data['sitemap'] = 'true';
}else{
} else {
$data['sitemap'] = 'false';
}
// Robots.txt ?
if (file_exists(public_path() . '/robots.txt')) {
$data['robots'] = 'true';
}else{
} else {
$data['robots'] = 'false';
}
//Check logs
// Check logs
$data['logs'] = 0;
$patherror = storage_path('/logs');
$files = glob($patherror.'/*.log');
if(count($files) > 0){
$patherror = storage_path('/logs');
$files = glob($patherror . '/*.log');
if (count($files) > 0) {
foreach ($files as $file) {
$data['logs'] = $data['logs'] + filesize($file);
}
@ -74,8 +75,8 @@ class LDCWebStatusChecker extends Command
$data['code']['version'] = app()->version();
// Send by cURL
$url = 'https://ldc-web.ldc.fr/api/status-checker';
$ch = curl_init($url);
$url = 'https://ldc-web.ldc.fr/api/status-checker';
$ch = curl_init($url);
$payload = ['token' => 'CE8S52Qq7stf5k8frF4T', 'datas' => json_encode($data)];
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

View file

@ -3,16 +3,13 @@
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Storage;
use App\Models\Sujet;
use App\Models\Format;
use App\Models\Media;
use App\Http\Traits\MediaTools;
class RegenerateThumbnails extends Command
{
use MediaTools;
use MediaTools;
/**
* The name and signature of the console command.
@ -45,50 +42,51 @@ class RegenerateThumbnails extends Command
*/
public function handle()
{
$this->info('Vous allez regénérer toutes les miniatures des médias.');
$this->info('Vous allez regénérer toutes les miniatures des médias.');
$sujets = Sujet::where('sujet_dam', 1)->get();
$sujets = Sujet::where('sujet_dam', 1)->get();
$this->line("");
$this->line("Liste des sujets disponibles");
$this->line("----------------------------");
foreach ($sujets as $key => $sujet) {
$this->line("[".$sujet->codeSujet."] ". $sujet->libelle);
}
$this->line("[0] Tous les sujets");
$this->line("");
$this->line("Liste des sujets disponibles");
$this->line("----------------------------");
foreach ($sujets as $key => $sujet) {
$this->line("[" . $sujet->codeSujet . "] " . $sujet->libelle);
}
$this->line("[0] Tous les sujets");
$sujetId = $this->ask('Pour quel sujet de média souhaitez vous executer le traitement ?' );
$sujetId = $this->ask('Pour quel sujet de média souhaitez vous executer le traitement ?');
if($sujetId == ""){
$this->error('Id de sujet incorrect');
die();
}
if ($sujetId == "") {
$this->error('Id de sujet incorrect');
die();
}
if($sujetId == 0){
$medias = Media::where('typemedia_id', 1)->with('Sujet.formats')->get();
}else{
$medias = Media::where('sujet_id', $sujetId)->where('typemedia_id', 1)->with('Sujet.formats')->get();
}
if ($sujetId == 0) {
$medias = Media::where('typemedia_id', 1)->with('Sujet.formats')->get();
} else {
$medias = Media::where('sujet_id', $sujetId)->where('typemedia_id', 1)->with('Sujet.formats')->get();
}
if($medias->count() == 0){
$this->error('Aucun média n\'a été trouvé');
die();
}
if ($medias->count() == 0) {
$this->error('Aucun média n\'a été trouvé');
die();
}
$this->info($medias->count().' média(s) trouvé(s) - Début du traitement');
$bar = $this->output->createProgressBar(count($medias));
$bar->start();
$this->info($medias->count() . ' média(s) trouvé(s) - Début du traitement');
$bar = $this->output->createProgressBar(count($medias));
$bar->start();
foreach ($medias as $media) {
// ---- Creation des vignettes de base
$this->create_sys_thumb($media);
// ---- Creation des vignettes en lien avec le sujet du média
$this->create_thumb($media);
$bar->advance();
}
/** @var \App\Models\Media $media */
foreach ($medias as $media) {
// ---- Creation des vignettes de base
$this->createSysThumb($media);
// ---- Creation des vignettes en lien avec le sujet du média
$this->createThumb($media);
$bar->advance();
}
$bar->finish();
$this->line("");
$this->info('Fin du traitement');
$bar->finish();
$this->line("");
$this->info('Fin du traitement');
}
}

View file

@ -39,7 +39,7 @@ class SendMediasModificationsReport extends Command
public function handle()
{
$this->info('Running the Job, this could take some time.');
$job = new JobsSendMediasModificationsReport();
$job = new JobsSendMediasModificationsReport();
$job->console = $this;
$job->handle();
$this->info('Job completed');

View file

@ -38,8 +38,8 @@ class reindexElasticOneMedia extends Command
*/
public function handle()
{
$this->info('Reindexation du media '.$this->argument('media_id').' dans Elasticsearch...');
$media = Media::withTrashed()->find($this->argument('media_id'));
$this->info('Reindexation du media ' . $this->argument('media_id') . ' dans Elasticsearch...');
$media = Media::withTrashed()->find($this->argument('media_id'));
$esExist = Media::searchByQuery(array('match' => array('arcadia_id' => "$media->arcadia_id")));
if ($esExist->totalHits() > 0) {
$media->removeFromIndex();

View file

@ -2,7 +2,6 @@
namespace App\Console;
use App\Console\Commands\ArcadiaLinkCommand;
use App\Jobs\Arcadia\XmlArcadiaMediasIn;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;

View file

@ -33,7 +33,6 @@ class Handler extends ExceptionHandler
public function register()
{
$this->reportable(function (Throwable $e) {
//
});
}
}

View file

@ -12,7 +12,7 @@ class ArcadiaLinkController extends Controller
public function index(Request $request)
{
Auth::user()->authorizeRoles(config('roles.const.ADMIN'));
$dt = Carbon::now('Europe/Paris')->subMinutes(15)->toDateTimeString();
$dt = Carbon::now('Europe/Paris')->subMinutes(15)->toDateTimeString();
$ano = ArcadiaLink::where('created_at', '<', $dt)->orderBy('id', 'DESC')->get();
return view('arcadialink.index', ['ano' => $ano]);
}
@ -20,7 +20,7 @@ class ArcadiaLinkController extends Controller
public function delete(Request $request)
{
$id = $request->id;
$a = ArcadiaLink::find($id);
$a = ArcadiaLink::find($id);
$a->delete();
return redirect()->route('arcadialink.index');
}

View file

@ -3,68 +3,67 @@
namespace App\Http\Controllers;
use App\Models\Format;
use App\Models\Typevue;
use App\Models\Variante;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Mail;
use App\Models\Sujet;
use App\Models\Recherche;
use App\Models\User;
use App\Models\Dossier;
use App\Mail\contact;
use App\Mail\Contact;
use Illuminate\Http\Request;
class CommunController extends Controller
{
/**
* page d'accueil
*
* @return \Illuminate\Contracts\Support\Renderable
*/
public function index()
{
$user = Auth::user();
$sujets = $user->sujets;
$paniers = Auth::user()->paniersFavoris;
$recherches = Recherche::where('user_id', $user->id)
->with("sujet")
->limit(10)
->orderBy("created_at", "desc")
->get();
/**
* page d'accueil
*
* @return \Illuminate\Contracts\Support\Renderable
*/
public function index()
{
$user = Auth::user();
$sujets = $user->sujets;
$paniers = Auth::user()->paniersFavoris;
$recherches = Recherche::where('user_id', $user->id)
->with("sujet")
->limit(10)
->orderBy("created_at", "desc")
->get();
$dossiers = Dossier::whereHas("users", function($query) use ($user){
$query->where('user_id', $user->id);
})
->with("sujet")
->get();
return view('home')->with(['sujets'=> $sujets, 'recherches'=> $recherches, 'dossiers'=> $dossiers, 'paniers'=> $paniers]);
}
$dossiers = Dossier::whereHas("users", function ($query) use ($user) {
$query->where('user_id', $user->id);
})
->with("sujet")
->get();
return view('home')->with(['sujets' => $sujets, 'recherches' => $recherches, 'dossiers' => $dossiers, 'paniers' => $paniers]);
}
/**
* Envoi d'un message
*
*/
public function sendMessage(Request $request)
{
$type = $request->input('type');
$url = $request->input('url');
$message = $request->input('message');
/**
* Envoi d'un message
*
*/
public function sendMessage(Request $request)
{
$type = $request->input('type');
$url = $request->input('url');
$message = $request->input('message');
if (Auth::check()) {
$user = auth()->user();
Mail::to(env('MAIL_ADMIN_ADDRESS', "informatique.internet@ldc.fr"))->send(new contact($type, $url, $message, $user));
}
return json_encode(array('status' => "OK"));
}
if (Auth::check()) {
$user = auth()->user();
Mail::to(env('MAIL_ADMIN_ADDRESS', "informatique.internet@ldc.fr"))
->send(new Contact($type, $url, $message, $user));
}
return json_encode(array('status' => "OK"));
}
public function getDatasBySujet(Request $request) {
public function getDatasBySujet(Request $request)
{
$sujet_id = $request->sujet_id;
$sujet = Sujet::findOrFail($sujet_id);
$response['typesvue'] = $sujet->typeVues;
$response['typesvue'] = $sujet->typeVues;
$response['typesvariantes'] = $sujet->variantes;
$response['formats'] = array_merge(Format::withoutGlobalScope('App\Scopes\SystemScope')->where('system', 1)->get()->toArray(), $sujet->formats->toArray());
$response['formats'] = array_merge(Format::withoutGlobalScope('App\Scopes\SystemScope')->where('system', 1)->get()->toArray(), $sujet->formats->toArray());
return response()->json($response);
}

View file

@ -6,7 +6,6 @@ use App\Models\Dossier;
use App\Models\Sujet;
use App\Models\Marque;
use App\Models\Media;
use App\Models\Typevue;
use App\Models\Variante;
use App\Models\Format;
use Illuminate\Http\Request;
@ -22,8 +21,8 @@ class DossierController extends Controller
public function index()
{
Auth::user()->authorizeRoles(config('roles.const.ADMIN'));
$dossiers = Dossier::whereNull('parent_id')->where('system', 0)->orderBy('libelle', 'asc')->get();
$sujets = Sujet::where('sujet_dam', 1)->get();
$dossiers = Dossier::whereNull('parent_id')->where('system', false)->orderBy('libelle', 'asc')->get();
$sujets = Sujet::where('sujet_dam', 1)->get();
return view('dossiers.index')->with([
'dossiers' => $dossiers,
@ -40,13 +39,13 @@ class DossierController extends Controller
{
Auth::user()->authorizeRoles(config('roles.const.ADMIN'));
$marques = Marque::all();
$sujets = Sujet::where('sujet_dam', 1)->get();
$sujets = Sujet::where('sujet_dam', 1)->get();
return view('dossiers.create')->with(['marques' => $marques, 'sujets' => $sujets]);
}
public function createSub()
{
$dossiers = Dossier::whereNull('parent_id')->where('system', 0)->orderBy('libelle', 'asc')->get();
$dossiers = Dossier::whereNull('parent_id')->where('system', false)->orderBy('libelle', 'asc')->get();
return view('dossiers.create-sub')->with(['dossiers' => $dossiers]);
}
@ -71,14 +70,13 @@ class DossierController extends Controller
return redirect()->route('dossier.create');
} else {
// ---- Le dossier
$dossier = new Dossier();
$dossier->libelle = $request->libelle;
$dossier = new Dossier();
$dossier->libelle = $request->libelle;
$dossier->description = $request->description;
$dossier->is_private = $request->status;
$dossier->is_private = $request->status;
$dossier->sujet()->associate($request->sujet);
if ($dossier->save()) {
// ---- Les marques
$sMarques = $request->marques;
if ($sMarques != "") {
@ -94,7 +92,7 @@ class DossierController extends Controller
session()->flash('error', "Une erreur s'est produite, ajout impossible");
return redirect()->route('dossier.create');
}
}
}//end if
}
public function storeSub(Request $request)
@ -106,19 +104,19 @@ class DossierController extends Controller
'parent_id' => 'required',
]);
$dossierExist = Dossier::where('libelle', $request->libelle)->first();
$dossierExist = Dossier::where('libelle', $request->libelle)->first();
$parent_dossier = Dossier::findOrFail($request->parent_id);
if ($dossierExist) {
session()->flash('error', "Ce nom de dossier est déjà présent dans l'application pour ce sujet. Ajout impossible.");
return redirect()->route('dossier.create');
} else {
// ---- Le dossier
$dossier = new Dossier();
$dossier->libelle = $request->libelle;
$dossier = new Dossier();
$dossier->libelle = $request->libelle;
$dossier->description = $request->description;
$dossier->is_private = 0;
$dossier->parent_id = $request->parent_id;
$dossier->sujet_id = $parent_dossier->sujet_id;
$dossier->is_private = 0;
$dossier->parent_id = $request->parent_id;
$dossier->sujet_id = $parent_dossier->sujet_id;
if ($dossier->save()) {
session()->flash('message', "Le dossier a été enregistré");
@ -138,7 +136,6 @@ class DossierController extends Controller
*/
public function show(Dossier $dossier)
{
//
}
/**
@ -151,9 +148,9 @@ class DossierController extends Controller
{
Auth::user()->authorizeRoles(config('roles.const.ADMIN'));
$dossierMarques = $dossier->marques;
$marques = Marque::all();
$dossierSujets = $dossier->sujets;
$sujets = Sujet::where('sujet_dam', 1)->get();
$marques = Marque::all();
$dossierSujets = $dossier->sujets;
$sujets = Sujet::where('sujet_dam', 1)->get();
return view('dossiers.edit')->with(['dossier' => $dossier, 'dossierMarques' => $dossierMarques, 'marques' => $marques, 'sujets' => $sujets]);
}
@ -161,7 +158,7 @@ class DossierController extends Controller
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \App\Models\Dossier $dossier
* @param \App\Models\Dossier $dossier
* @return \Illuminate\Http\Response
*/
public function update(Request $request, Dossier $dossier)
@ -169,7 +166,6 @@ class DossierController extends Controller
Auth::user()->authorizeRoles(config('roles.const.ADMIN'));
if ($dossier->parent_id === null) {
$validatedData = $request->validate([
'libelle' => 'required',
'sujet' => 'required',
@ -182,14 +178,13 @@ class DossierController extends Controller
return redirect()->route('dossier.edit', ['dossier' => $dossier]);
} else {
// ---- Le dossier
$dossier->libelle = $request->libelle;
$dossier->libelle = $request->libelle;
$dossier->description = $request->description;
$dossier->is_private = $request->status;
$dossier->is_private = $request->status;
$dossier->sujet()->dissociate();
$dossier->sujet()->associate($request->sujet);
if ($dossier->save()) {
// ---- Les marques
$dossier->marques()->detach();
$sMarques = $request->marques;
@ -206,8 +201,8 @@ class DossierController extends Controller
session()->flash('error', "Une erreur s'est produite, enregistrement impossible");
return redirect()->route('dossier.edit');
}
}
}else{
}//end if
} else {
$validatedData = $request->validate([
'libelle' => 'required',
]);
@ -218,7 +213,7 @@ class DossierController extends Controller
return redirect()->route('dossier.edit', ['dossier' => $dossier]);
} else {
// ---- Le dossier
$dossier->libelle = $request->libelle;
$dossier->libelle = $request->libelle;
$dossier->description = $request->description;
if ($dossier->save()) {
@ -229,7 +224,7 @@ class DossierController extends Controller
return redirect()->route('dossier.edit');
}
}
}
}//end if
}
/**
@ -256,15 +251,15 @@ class DossierController extends Controller
public function loadFolder(Request $request)
{
$response = array();
$sujetId = $request->input('sujetId');
$sujetId = $request->input('sujetId');
$response['variantes'] = Variante::where('sujet_id', $sujetId)->get();
$FormatsSujet = Format::whereHas('sujets', function ($query) use ($sujetId) {
$FormatsSujet = Format::whereHas('sujets', function ($query) use ($sujetId) {
$query->where('sujet_id', $sujetId);
})->get();
$FormatsSystem = Format::withoutGlobalScope('App\Scopes\SystemScope')->where('system', 1)->get();
$FormatsSystem = Format::withoutGlobalScope('App\Scopes\SystemScope')->where('system', true)->get();
$response['formats'] = $FormatsSujet->merge($FormatsSystem);
if (Auth::user()->hasRole([config('roles.const.ADMIN'), config('roles.const.REDACTEUR')])) {
@ -287,28 +282,29 @@ class DossierController extends Controller
{
$response = array();
Auth::user()->authorizeRoles([config('roles.const.ADMIN'), config('roles.const.REDACTEUR')]);
$parent_id = $request->input('parent_id');
$libelle = $request->input('libelle');
$parent_id = $request->input('parent_id');
$libelle = $request->input('libelle');
$description = $request->input('description');
// ---- Le dossier
$dossier = new Dossier();
$dossier->libelle = htmlspecialchars($libelle);
$dossier = new Dossier();
$dossier->libelle = htmlspecialchars($libelle);
$dossier->description = $description;
$dossier->parent_id = $parent_id;
$dossier->parent_id = $parent_id;
$dossierParent = Dossier::where('id', $parent_id)->first();
if ($parent_id == 1 || $dossierParent->system == 1) { // dossier de dépôt
$dossier->system = 1;
if ($parent_id == 1 || $dossierParent->system) {
// dossier de dépôt
$dossier->system = true;
} else {
$dossier->system = 0;
$dossier->system = false;
}
$dossier->sujet_id = $dossierParent->sujet_id;
$dossier->save();
$response['folder_id'] = $dossier->id;
$response['system'] = $dossier->system;
$response['system'] = $dossier->system ? 1 : 0;
return json_encode($response);
}
@ -318,17 +314,17 @@ class DossierController extends Controller
*/
public function addDepotFolder(Request $request)
{
$response = array();
$parent_id = $request->input('parent_id');
$libelle = $request->input('libelle');
$response = array();
$parent_id = $request->input('parent_id');
$libelle = $request->input('libelle');
$description = $request->input('description');
// ---- Le dossier
$dossier = new Dossier();
$dossier->libelle = htmlspecialchars($libelle);
$dossier = new Dossier();
$dossier->libelle = htmlspecialchars($libelle);
$dossier->description = $description;
$dossier->parent_id = 1;
$dossier->system = 1;
$dossier->parent_id = 1;
$dossier->system = true;
$dossier->save();
$response['folder_id'] = $dossier->id;
@ -363,15 +359,14 @@ class DossierController extends Controller
{
Auth::user()->authorizeRoles([config('roles.const.ADMIN'), config('roles.const.REDACTEUR')]);
$dossier_id = $request->input('dossier_id');
$parent_id = $request->input('parent_id');
$sujet_id = $request->input('sujet_id');
$parent_id = $request->input('parent_id');
$sujet_id = $request->input('sujet_id');
// ---- Le dossier
$dossier = Dossier::where('id', $dossier_id)->first();
if ($dossier && !is_null($dossier->parent_id)) {
$dossier->parent_id = $parent_id;
if ($dossier->save()) {
Media::where('dossier_id', $dossier_id)->update(['sujet_id' => $sujet_id]);
@ -390,7 +385,7 @@ class DossierController extends Controller
{
Auth::user()->authorizeRoles([config('roles.const.ADMIN'), config('roles.const.REDACTEUR')]);
$dossier_id = $request->input('dossier_id');
$libelle = $request->input('libelle');
$libelle = $request->input('libelle');
// ---- Le dossier
$dossier = Dossier::where('id', $dossier_id)->first();
@ -409,7 +404,7 @@ class DossierController extends Controller
*/
public function getFolderProperty(Request $request)
{
$response = array();
$response = array();
$dossier_id = $request->input('dossier_id');
// ---- Le dossier
@ -426,14 +421,14 @@ class DossierController extends Controller
*/
public function saveFolderProperty(Request $request)
{
$dossier_id = $request->input('dossier_id');
$libelle = $request->input('libelle');
$dossier_id = $request->input('dossier_id');
$libelle = $request->input('libelle');
$description = $request->input('description');
// ---- Le dossier
$dossier = Dossier::where('id', $dossier_id)->first();
if ($dossier && !is_null($dossier->parent_id) && strlen($libelle) > 3) {
$dossier->libelle = $libelle;
$dossier->libelle = $libelle;
$dossier->description = $description;
$dossier->save();
}
@ -442,8 +437,8 @@ class DossierController extends Controller
public function loadFolders(Request $request)
{
$folders = array();
$user = Auth::user();
$folders = array();
$user = Auth::user();
$sujet_id = $request->sujet_id;
$dossierQuery = Dossier::where([
@ -460,7 +455,7 @@ class DossierController extends Controller
['sujet_id', '=', $sujet_id],
])->get();
} else {
$marques = $user->marques()->pluck("marque_id");
$marques = $user->marques()->pluck("marque_id");
$privateQuery = Dossier::where([
['is_private', '=', 1],
['sujet_id', '=', $sujet_id],
@ -473,8 +468,8 @@ class DossierController extends Controller
// Ajout du dépôt de fichier pour les admin
if ($user->hasRole(config('roles.const.ADMIN'))) {
$depotQuery = Dossier::whereNull('parent_id')
->where('system', 1)
$depotQuery = Dossier::whereNull('parent_id')
->where('system', true)
->orderBy('libelle', 'ASC')
->get();
$folders['data'] = $dossierQuery->merge($depotQuery);
@ -492,5 +487,4 @@ class DossierController extends Controller
return response()->json($folders);
}
}

File diff suppressed because it is too large Load diff

View file

@ -152,7 +152,7 @@ class PanierController extends Controller
/** @var \Illuminate\Database\Eloquent\Collection $formats */
$formats = Format::withoutGlobalScope('App\Scopes\SystemScope')
->where('system', 1)->get();
->where('system', true)->get();
return view('panier.show')->with([
'panier' => $panier,
'formats' => $formats,

View file

@ -17,11 +17,12 @@ class RecoveryController extends Controller
public function checkArcadiaId(Request $request)
{
$response = false;
$response = false;
$arcadia_id = $request->id;
$media = Media::onlyTrashed()->where('arcadia_id', '=', $arcadia_id)->first();
if ($media)
$media = Media::onlyTrashed()->where('arcadia_id', '=', $arcadia_id)->first();
if ($media) {
$response = true;
}
return json_encode($response);
}
}

View file

@ -1,7 +1,7 @@
<?php
namespace App\Http\Controllers;
use App\Http\Traits\ArcadiaLink;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Storage;
@ -11,45 +11,45 @@ use App\Models\Site;
use App\Models\Historique;
use App\Http\Traits\MediaTools;
class UploadController extends Controller
{
use MediaTools;
public function index(Request $request)
{
// ---- Vérification du token de sécurité
$token = $request->get('token');
if($token != env('TOKEN_DEPOT', "c8c4613a-236c-4b06-95f6-a9c9c6c18861")) { return abort(404);
if ($token != env('TOKEN_DEPOT', "c8c4613a-236c-4b06-95f6-a9c9c6c18861")) {
return abort(404);
}
$sites = Site::orderBy('libelle')->get();
return view('upload.show')->with(
[
'sites'=> $sites,
'sites' => $sites,
]
);
}
public function storeMedia(Request $request)
{
$uid = $request->input('uid');
$sujet_id = $request->input('sujet_id');
$dossier_id = $request->input('dossier_id');
$uid = $request->input('uid');
$sujet_id = $request->input('sujet_id');
$dossier_id = $request->input('dossier_id');
$replaceMediaId = $request->input('replaceMediaId');
if($dossier_id == 0) { $dossier_id = null;
if ($dossier_id == 0) {
$dossier_id = null;
}
$headers = $request->headers->all();
$headers = $request->headers->all();
$acceptFileTypes = array('gif','jpeg', 'jpg','png','mp4','mp3','psd','ai','svg','pdf');
if ($request->hasFile('files')) {
$filesa = [];
$file = $request->file('files');
$file = $request->file('files');
foreach($file as $files){
$is_last_chunk = false;
foreach ($file as $files) {
$is_last_chunk = false;
$is_chunked_upload = !empty($headers['content-range']);
if ($is_chunked_upload) {
if (preg_match('|(\d+)/(\d+)|', $headers['content-range'][0], $range)) {
@ -59,29 +59,30 @@ class UploadController extends Controller
}
}
$extension = strtolower($files->getClientOriginalExtension());
$originalName = str_replace(".".$extension, "", $files->getClientOriginalName());
if (!in_array($extension, $acceptFileTypes)) { return array("false");
$extension = strtolower($files->getClientOriginalExtension());
$originalName = str_replace("." . $extension, "", $files->getClientOriginalName());
if (!in_array($extension, $acceptFileTypes)) {
return array("false");
}
if($is_chunked_upload) {
$filename = $uid."_".$range[1].".".$extension;
}else{
$filename = $uid.'.'.$extension;
if ($is_chunked_upload) {
$filename = $uid . "_" . $range[1] . "." . $extension;
} else {
$filename = $uid . '.' . $extension;
}
$uploadPath = public_path() . '/uploads/';
$files->move($uploadPath, $filename);
// si c'est le dernier morceux d'un fichier
if($is_last_chunk) {
if($dossier = opendir($uploadPath)) {
if ($is_last_chunk) {
if ($dossier = opendir($uploadPath)) {
$dirFiles = array();
// on compile tous les chunk du fichier
while(false !== ($fichier = readdir($dossier))){
if($fichier != '.' && $fichier != '..' ) {
if(strpos($fichier, $uid) !== false) {
$dirFiles[$fichier] = str_replace(".".$extension, "", str_replace($uid."_", "", $fichier));
while (false !== ($fichier = readdir($dossier))) {
if ($fichier != '.' && $fichier != '..') {
if (strpos($fichier, $uid) !== false) {
$dirFiles[$fichier] = str_replace("." . $extension, "", str_replace($uid . "_", "", $fichier));
}
}
}
@ -90,134 +91,131 @@ class UploadController extends Controller
asort($dirFiles, SORT_NUMERIC);
// on les assemble dans un fichier final
$filename = $uid . '.' . $extension;
foreach($dirFiles as $key => $fichier) {
$file = fopen($uploadPath.$key, 'rb');
$buff = fread($file, filesize($uploadPath.$key));
foreach ($dirFiles as $key => $fichier) {
$file = fopen($uploadPath . $key, 'rb');
$buff = fread($file, filesize($uploadPath . $key));
fclose($file);
$final = fopen($uploadPath.$filename, 'a');
$final = fopen($uploadPath . $filename, 'a');
$write = fwrite($final, $buff);
fclose($final);
unlink($uploadPath.$key);
unlink($uploadPath . $key);
}
}
}
}//end if
}//end if
// si c'est le dernier morceau d'un fichier ou que c'est un envoi simple
if($is_last_chunk || !$is_chunked_upload ) {
$destinationPath = $this->get_mediaFolder()."/";
if ($is_last_chunk || !$is_chunked_upload) {
$destinationPath = $this->getMediaFolder() . "/";
// si on upload un média pour remplacer un fichier par un autre
if($replaceMediaId != 0) {
if ($replaceMediaId != 0) {
// on récupère le média à modifier
$media= Media::where('id', $replaceMediaId)->first();
/** @var \App\Models\Media|null */
$media = Media::where('id', $replaceMediaId)->first();
// On déplace le fichier dans le répertoire des médias
Storage::move("uploads/".$filename, $destinationPath.$filename);
Storage::move("uploads/" . $filename, $destinationPath . $filename);
// supprime les fichiers médias stockés sur disque
$filesfF= Storage::files($media->folder."/");
$filepath = preg_quote($media->folder.$media->uid, '/');
$matchingFiles = preg_grep('/^'.$filepath.'/', $filesfF);
$filesfF = Storage::files($media->folder . "/");
$filepath = preg_quote($media->folder . $media->uid, '/');
$matchingFiles = preg_grep('/^' . $filepath . '/', $filesfF);
Storage::delete($matchingFiles);
$media->isDefault = 0;
$media->save();
}else{
} else {
// On déplace le fichier dans le répertoire des médias
Storage::move("uploads/".$filename, $destinationPath.$filename);
Storage::move("uploads/" . $filename, $destinationPath . $filename);
// on créé un média en bdd
$media = new Media();
$media = new Media();
$media->dossier_id = $dossier_id;
$media->sujet_id = $sujet_id;
$media->sujet_id = $sujet_id;
// Par défaut FR
$media->langue_id = 1;
// Par défaut propriété de la marque
$media->copyright_id = 3;
}
}//end if
$media->extension = $extension;
$media->folder = $destinationPath;
if($replaceMediaId == 0) {
$media->libelle = mb_substr($originalName, 0, 50, "UTF-8");
$media->created_by= Auth::user()->id;
$media->folder = $destinationPath;
if ($replaceMediaId == 0) {
$media->libelle = mb_substr($originalName, 0, 50, "UTF-8");
$media->created_by = Auth::user()->id;
}
$media->uid = $uid;
$media->taille = $this->formatBytes($this->get_file_size($destinationPath.$filename));
$media->uid = $uid;
$media->taille = $this->formatBytes($this->getFileSize($destinationPath . $filename));
switch ($extension) {
// Photo (1)
case 'gif':
case 'jpeg':
case 'jpg':
case 'png':
case 'ai':
case 'pdf':
case 'psd':
$media->typemedia_id = 1;
$im = new \imagick($destinationPath.$filename);
case 'gif':
case 'jpeg':
case 'jpg':
case 'png':
case 'ai':
case 'pdf':
case 'psd':
$media->typemedia_id = 1;
$im = new \imagick($destinationPath . $filename);
if(in_array($extension, array("pdf", "ai", "psd", "gif")) ) {
$im->setIteratorIndex(0);
}
if (in_array($extension, array("pdf", "ai", "psd", "gif"))) {
$im->setIteratorIndex(0);
}
$resolutions = $im->getImageResolution();
$media->resolution = round($resolutions['x'] * 2.54);
$imageprops = $im->getImageGeometry();
$media->largeur = $imageprops['width'];
$media->hauteur = $imageprops['height'];
$resolutions = $im->getImageResolution();
$media->resolution = round($resolutions['x'] * 2.54);
$imageprops = $im->getImageGeometry();
$media->largeur = $imageprops['width'];
$media->hauteur = $imageprops['height'];
if($media->resolution != 0) {
$media->largeur_mm = ceil(($media->largeur * 2.54 / $media->resolution)*10);
$media->hauteur_mm = ceil(($media->hauteur * 2.54 / $media->resolution)*10);
}else{
$media->largeur_mm = "";
$media->hauteur_mm = "";
}
$media->save();
$im->destroy();
if ($media->resolution != 0) {
$media->largeur_mm = ceil(($media->largeur * 2.54 / $media->resolution) * 10);
$media->hauteur_mm = ceil(($media->hauteur * 2.54 / $media->resolution) * 10);
} else {
$media->largeur_mm = "";
$media->hauteur_mm = "";
}
$media->save();
$im->destroy();
// ---- Creation des vignettes de base
$this->create_sys_thumb($media);
// ---- Creation des vignettes en lien avec le sujet du média
if(isset($sujet_id) ) {
$this->create_thumb($media);
}
break;
// ---- Creation des vignettes de base
$this->createSysThumb($media);
// ---- Creation des vignettes en lien avec le sujet du média
if (isset($sujet_id)) {
$this->createThumb($media);
}
break;
// Illustration/Vectorielle (2)
case 'svg':
$media->typemedia_id = 2;
$media->save();
break;
case 'svg':
$media->typemedia_id = 2;
$media->save();
break;
// Vidéo (3)
case 'mp4':
$media->typemedia_id =3 ;
$getID3 = new \getID3;
if($fileInfo = $getID3->analyze($destinationPath.$filename)) {
$media->largeur = $fileInfo['video']['resolution_x'];
$media->hauteur = $fileInfo['video']['resolution_y'];
$media->duree = $fileInfo['playtime_string'];
}
$media->save();
break;
case 'mp4':
$media->typemedia_id = 3;
$getID3 = new \getID3();
if ($fileInfo = $getID3->analyze($destinationPath . $filename)) {
$media->largeur = $fileInfo['video']['resolution_x'];
$media->hauteur = $fileInfo['video']['resolution_y'];
$media->duree = $fileInfo['playtime_string'];
}
$media->save();
break;
// Audio (4)
case 'mp3':
$media->typemedia_id = 4;
$getID3 = new \getID3;
if($fileInfo = $getID3->analyze($destinationPath.$filename)) {
$media->duree= $fileInfo['playtime_string'];
}
$media->save();
break;
}
case 'mp3':
$media->typemedia_id = 4;
$getID3 = new \getID3();
if ($fileInfo = $getID3->analyze($destinationPath . $filename)) {
$media->duree = $fileInfo['playtime_string'];
}
$media->save();
break;
}//end switch
$id = $media->id;
$id = $media->id;
$media = Media::find($id);
// ---- Index dans Elasticsearch
$media = Media::where('id', $media->id)->first();
@ -225,45 +223,46 @@ class UploadController extends Controller
// ---- Historique des actions
$historique = new historique();
if($user = Auth::user()) {
if ($user = Auth::user()) {
$historique->user_id = $user->id;
}
$historique->media_id = $media->id;
if($replaceMediaId == 0) {
$historique->type = "Création";
if ($replaceMediaId == 0) {
$historique->type = "Création";
$historique->description = "Média ajouté";
}else{
$historique->type = "Modification";
} else {
$historique->type = "Modification";
$historique->description = "Le média a été remplacé";
}
$historique->save();
$filest = array();
$filest['name'] = $filename;
$filest['uid'] = $uid;
$filest['libelle'] = $media->libelle;
$filest['id'] = $media->id;
$filest['folder'] = $media->folder;
$filest['extension'] = $media->extension;
$filest = array();
$filest['name'] = $filename;
$filest['uid'] = $uid;
$filest['libelle'] = $media->libelle;
$filest['id'] = $media->id;
$filest['folder'] = $media->folder;
$filest['extension'] = $media->extension;
$filest['typemedia_id'] = $media->typemedia_id;
$filesa['files'][]=$filest;
}
}
return $filesa;
}
$filesa['files'][] = $filest;
}//end if
}//end foreach
return $filesa;
}//end if
}
public function storeMediaV2(Request $request)
{
$uid = $request->input('uid');
$sujet_id = $request->input('sujet_id');
$dossier_id = $request->input('dossier_id');
$uid = $request->input('uid');
$sujet_id = $request->input('sujet_id');
$dossier_id = $request->input('dossier_id');
$replaceMediaId = $request->input('replaceMediaId');
if($dossier_id == 0) { $dossier_id = null;
if ($dossier_id == 0) {
$dossier_id = null;
}
$filesa = [];
$filesa = [];
$acceptFileTypes = array('gif','jpeg', 'jpg','png','mp4','mp3','psd','ai','svg','pdf');
if (!$uid) {
@ -272,12 +271,14 @@ class UploadController extends Controller
$file = $request->file('files');
if (!empty($file)) {
$extension = strtolower($file->getClientOriginalExtension());
$originalName = str_replace(".".$extension, "", $file->getClientOriginalName());
if (!in_array($extension, $acceptFileTypes)) { return array("false");
$extension = strtolower($file->getClientOriginalExtension());
$originalName = str_replace("." . $extension, "", $file->getClientOriginalName());
if (!in_array($extension, $acceptFileTypes)) {
return array("false");
}
if (!in_array($extension, $acceptFileTypes)) { return array("error" => "Ce type de fichier n'est pas accepté.");
if (!in_array($extension, $acceptFileTypes)) {
return array("error" => "Ce type de fichier n'est pas accepté.");
}
// check the error status
@ -287,7 +288,7 @@ class UploadController extends Controller
// init the destination file (format <filename.ext>.part<#chunk>
// the file is stored in a temporary directory
if(isset($request->resumableIdentifier) && trim($request->resumableIdentifier)!='') {
if (isset($request->resumableIdentifier) && trim($request->resumableIdentifier) != '') {
$temp_dir = 'uploads/' . $request->resumableIdentifier;
}
$dest_file = $temp_dir . '/' . $request->resumableFilename . '.part' . $request->resumableChunkNumber;
@ -299,123 +300,121 @@ class UploadController extends Controller
// move the temporary file
if (!move_uploaded_file($file->getPathname(), $dest_file)) {
Log::error('Error saving (move_uploaded_file) chunk ' . $request->resumableChunkNumber.' for file ' . $request->resumableFilename);
Log::error('Error saving (move_uploaded_file) chunk ' . $request->resumableChunkNumber . ' for file ' . $request->resumableFilename);
} else {
$filename = $uid . '.' . $extension;
// check if all the parts present, and create the final destination file
$isLast = $this->createFileFromChunks($temp_dir, $request->resumableFilename, $request->resumableChunkSize, $request->resumableTotalSize, $request->resumableTotalChunks, $filename);
if ($isLast) {
$destinationPath = $this->get_mediaFolder()."/";
$destinationPath = $this->getMediaFolder() . "/";
// si on upload un média pour remplacer un fichier par un autre
if($replaceMediaId != 0) {
if ($replaceMediaId != 0) {
// on récupère le média à modifier
$media= Media::where('id', $replaceMediaId)->first();
/** @var \App\Models\Media|null $media */
$media = Media::where('id', $replaceMediaId)->first();
// On déplace le fichier dans le répertoire des médias
Storage::move("uploads/".$filename, $destinationPath.$filename);
Storage::move("uploads/" . $filename, $destinationPath . $filename);
// supprime les fichiers médias stockés sur disque
$filesfF= Storage::files($media->folder."/");
$filepath = preg_quote($media->folder.$media->uid, '/');
$matchingFiles = preg_grep('/^'.$filepath.'/', $filesfF);
$filesfF = Storage::files($media->folder . "/");
$filepath = preg_quote($media->folder . $media->uid, '/');
$matchingFiles = preg_grep('/^' . $filepath . '/', $filesfF);
Storage::delete($matchingFiles);
$media->isDefault = 0;
$media->save();
}else{
} else {
// On déplace le fichier dans le répertoire des médias
Storage::move("uploads/".$filename, $destinationPath.$filename);
Storage::move("uploads/" . $filename, $destinationPath . $filename);
// on créé un média en bdd
$media = new Media();
$media = new Media();
$media->dossier_id = $dossier_id;
$media->sujet_id = $sujet_id;
$media->sujet_id = $sujet_id;
// Par défaut FR
$media->langue_id = 1;
// Par défaut propriété de la marque
$media->copyright_id = 3;
}
}//end if
$media->extension = $extension;
$media->folder = $destinationPath;
if($replaceMediaId == 0) {
$media->libelle = mb_substr($originalName, 0, 50, "UTF-8");
$media->created_by= Auth::user()->id;
$media->folder = $destinationPath;
if ($replaceMediaId == 0) {
$media->libelle = mb_substr($originalName, 0, 50, "UTF-8");
$media->created_by = Auth::user()->id;
}
$media->uid = $uid;
$media->taille = $this->formatBytes($this->get_file_size($destinationPath.$filename));
$media->uid = $uid;
$media->taille = $this->formatBytes($this->getFileSize($destinationPath . $filename));
switch ($extension) {
// Photo (1)
case 'gif':
case 'jpeg':
case 'jpg':
case 'png':
case 'ai':
case 'pdf':
case 'psd':
$media->typemedia_id = 1;
$im = new \imagick($destinationPath . $filename);
//$im = new \imagick(realpath($destinationPath.$filename));
case 'gif':
case 'jpeg':
case 'jpg':
case 'png':
case 'ai':
case 'pdf':
case 'psd':
$media->typemedia_id = 1;
$im = new \imagick($destinationPath . $filename);
// $im = new \imagick(realpath($destinationPath.$filename));
if (in_array($extension, array("pdf", "ai", "psd", "gif"))) {
$im->setIteratorIndex(0);
}
if(in_array($extension, array("pdf", "ai", "psd", "gif")) ) {
$im->setIteratorIndex(0);
}
$resolutions = $im->getImageResolution();
$media->resolution = round($resolutions['x'] * 2.54);
$imageprops = $im->getImageGeometry();
$media->largeur = $imageprops['width'];
$media->hauteur = $imageprops['height'];
$resolutions = $im->getImageResolution();
$media->resolution = round($resolutions['x'] * 2.54);
$imageprops = $im->getImageGeometry();
$media->largeur = $imageprops['width'];
$media->hauteur = $imageprops['height'];
if ($media->resolution != 0) {
$media->largeur_mm = ceil(($media->largeur * 2.54 / $media->resolution) * 10);
$media->hauteur_mm = ceil(($media->hauteur * 2.54 / $media->resolution) * 10);
} else {
$media->largeur_mm = "";
$media->hauteur_mm = "";
}
$media->save();
$im->destroy();
if($media->resolution != 0) {
$media->largeur_mm = ceil(($media->largeur * 2.54 / $media->resolution)*10);
$media->hauteur_mm = ceil(($media->hauteur * 2.54 / $media->resolution)*10);
}else{
$media->largeur_mm = "";
$media->hauteur_mm = "";
}
$media->save();
$im->destroy();
// ---- Creation des vignettes de base
$this->create_sys_thumb($media);
// ---- Creation des vignettes en lien avec le sujet du média
if(isset($sujet_id) ) {
$this->create_thumb($media);
}
break;
// ---- Creation des vignettes de base
$this->createSysThumb($media);
// ---- Creation des vignettes en lien avec le sujet du média
if (isset($sujet_id)) {
$this->createThumb($media);
}
break;
// Illustration/Vectorielle (2)
case 'svg':
$media->typemedia_id = 2;
$media->save();
break;
case 'svg':
$media->typemedia_id = 2;
$media->save();
break;
// Vidéo (3)
case 'mp4':
$media->typemedia_id =3 ;
$getID3 = new \getID3;
if($fileInfo = $getID3->analyze($destinationPath.$filename)) {
$media->largeur = $fileInfo['video']['resolution_x'];
$media->hauteur = $fileInfo['video']['resolution_y'];
$media->duree = $fileInfo['playtime_string'];
}
$media->save();
break;
case 'mp4':
$media->typemedia_id = 3;
$getID3 = new \getID3();
if ($fileInfo = $getID3->analyze($destinationPath . $filename)) {
$media->largeur = $fileInfo['video']['resolution_x'];
$media->hauteur = $fileInfo['video']['resolution_y'];
$media->duree = $fileInfo['playtime_string'];
}
$media->save();
break;
// Audio (4)
case 'mp3':
$media->typemedia_id = 4;
$getID3 = new \getID3;
if($fileInfo = $getID3->analyze($destinationPath.$filename)) {
$media->duree= $fileInfo['playtime_string'];
}
$media->save();
break;
}
case 'mp3':
$media->typemedia_id = 4;
$getID3 = new \getID3();
if ($fileInfo = $getID3->analyze($destinationPath . $filename)) {
$media->duree = $fileInfo['playtime_string'];
}
$media->save();
break;
}//end switch
$id = $media->id;
$id = $media->id;
$media = Media::find($id);
// ---- Index dans Elasticsearch
$media = Media::where('id', $media->id)->first();
@ -423,23 +422,23 @@ class UploadController extends Controller
// ---- Historique des actions
$historique = new historique();
if($user = Auth::user()) {
if ($user = Auth::user()) {
$historique->user_id = $user->id;
}
$historique->media_id = $media->id;
if($replaceMediaId == 0) {
$historique->type = "Création";
if ($replaceMediaId == 0) {
$historique->type = "Création";
$historique->description = "Média ajouté";
}else{
$historique->type = "Modification";
} else {
$historique->type = "Modification";
$historique->description = "Le média a été remplacé";
}
$historique->save();
return response()->json($media);
}
}
}
}//end if
}//end if
}//end if
}
/**
@ -450,27 +449,27 @@ class UploadController extends Controller
* @param string $fileName - the original file name
* @param string $chunkSize - each chunk size (in bytes)
* @param string $totalSize - original file size (in bytes)
* @return bool
* @return boolean
*/
private function createFileFromChunks($temp_dir, $fileName, $chunkSize, $totalSize, $total_files, $finalName)
{
// count all the parts of this file
$total_files_on_server_size = 0;
$temp_total = 0;
foreach(scandir($temp_dir) as $file) {
$temp_total = $total_files_on_server_size;
$tempfilesize = filesize($temp_dir.'/'.$file);
$temp_total = 0;
foreach (scandir($temp_dir) as $file) {
$temp_total = $total_files_on_server_size;
$tempfilesize = filesize($temp_dir . '/' . $file);
$total_files_on_server_size = $temp_total + $tempfilesize;
}
// check that all the parts are present
// If the Size of all the chunks on the server is equal to the size of the file uploaded.
if ($total_files_on_server_size >= $totalSize) {
// create the final destination file
if (($fp = fopen('uploads/'.$finalName, 'w')) !== false) {
for ($i=1; $i<=$total_files; $i++) {
fwrite($fp, file_get_contents($temp_dir.'/'.$fileName.'.part'.$i));
//Log::info('writing chunk '.$i);
if (($fp = fopen('uploads/' . $finalName, 'w')) !== false) {
for ($i = 1; $i <= $total_files; $i++) {
fwrite($fp, file_get_contents($temp_dir . '/' . $fileName . '.part' . $i));
// Log::info('writing chunk '.$i);
}
fclose($fp);
} else {
@ -480,13 +479,13 @@ class UploadController extends Controller
// rename the temporary directory (to avoid access from other
// concurrent chunks uploads) and than delete it
if (rename($temp_dir, $temp_dir.'_UNUSED')) {
$this->rrmdir($temp_dir.'_UNUSED');
if (rename($temp_dir, $temp_dir . '_UNUSED')) {
$this->rrmdir($temp_dir . '_UNUSED');
} else {
$this->rrmdir($temp_dir);
}
return true;
}
}//end if
return false;
}

View file

@ -204,7 +204,7 @@ class UserController extends Controller
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \App\Models\User $user
* @param \App\Models\User $user
* @return \Illuminate\Http\Response
*/
public function update(Request $request, User $user)
@ -257,7 +257,7 @@ class UserController extends Controller
* Remove the specified resource from storage.
*
* @param \App\Http\Requests\DestroyUserRequest $request
* @param \App\Models\User $user
* @param \App\Models\User $user
* @return \Illuminate\Http\Response
*/
public function destroy(DestroyUserRequest $request, User $user)

View file

@ -9,7 +9,7 @@ class Authenticate extends Middleware
/**
* Get the path the user should be redirected to when they are not authenticated.
*
* @param \Illuminate\Http\Request $request
* @param \Illuminate\Http\Request $request
* @return string|null
*/
protected function redirectTo($request)

View file

@ -8,21 +8,24 @@ use DOMDocument;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Storage;
trait ArcadiaLink {
trait ArcadiaLink
{
public static function checkRequiredValues($media)
{
$required = ['sujet_id', 'typemedia_id', 'typevue_id', 'variante_id', 'langue_id', 'version'];
foreach ($required as $v)
if ($media->$v === NULL)
foreach ($required as $v) {
if ($media->$v === null) {
return false;
}
}
return true;
}
public static function create($media)
{
if (!self::checkRequiredValues($media))
if (!self::checkRequiredValues($media)) {
return;
}
$media->isLocked = 1;
$media->save();
@ -31,11 +34,13 @@ trait ArcadiaLink {
public static function update($media)
{
if ($media->arcadia_id === NULL)
if ($media->arcadia_id === null) {
return;
}
if (!self::checkRequiredValues($media))
if (!self::checkRequiredValues($media)) {
return;
}
$media->isLocked = 1;
$media->save();
@ -44,11 +49,13 @@ trait ArcadiaLink {
public static function delete($media)
{
if ($media->arcadia_id === NULL)
if ($media->arcadia_id === null) {
return;
}
if (!self::checkRequiredValues($media))
if (!self::checkRequiredValues($media)) {
return;
}
$media->isLocked = 1;
$media->save();
@ -57,11 +64,13 @@ trait ArcadiaLink {
public static function reactivate($media)
{
if ($media->arcadia_id === NULL)
if ($media->arcadia_id === null) {
return;
}
if (!self::checkRequiredValues($media))
if (!self::checkRequiredValues($media)) {
return;
}
$media->isLocked = 1;
$media->save();
@ -78,8 +87,8 @@ trait ArcadiaLink {
private static function compress($uid, $media)
{
try {
$zip_file = storage_path('arcadia_link/send') ."/$media->id-$uid.zip";
$zip = new \ZipArchive();
$zip_file = storage_path('arcadia_link/send') . "/$media->id-$uid.zip";
$zip = new \ZipArchive();
$zip->open($zip_file, \ZipArchive::CREATE | \ZipArchive::OVERWRITE);
$zip->addFile(storage_path('arcadia_link/send') . "/$uid.xml", 'media.xml');
$zip->addFile(public_path() . "/$media->folder$media->uid.$media->extension", "$media->uid.$media->extension");
@ -88,78 +97,77 @@ trait ArcadiaLink {
unlink(storage_path('arcadia_link/send') . "/$uid.xml");
// On insert dans la table de supervision
$s = new \App\Models\ArcadiaLink();
$s = new \App\Models\ArcadiaLink();
$s->media_id = $media->id;
if ($media->arcadia_id !== NULL) {
if ($media->arcadia_id !== null) {
$s->arcadia_id = $media->arcadia_id;
}
$s->filename = "$media->id-$uid.zip";
$s->save();
} catch (Exception $e) {
//echo "Exception : " . $e;
// echo "Exception : " . $e;
// TODO : Envoi mail Log
Log::emergency("Erreur création .zip : $e (Traits/ArcadiaLink)");
}
}//end try
}
private static function getXML($media, $mouvement)
{
$refKey = self::getRefKey($media);
$refKey = self::getRefKey($media);
$formats = self::getFormats();
$dom = new DOMDocument('1.0','UTF-8');
$dom = new DOMDocument('1.0', 'UTF-8');
$dom->formatOutput = true;
$root = $dom->createElement('MEDIA_VISUEL');
$dom->appendChild($root);
$root->appendChild($dom->createElement('codeArcadia'))->appendChild($dom->createCDATASection( "$media->arcadia_id"));
$root->appendChild($dom->createElement('code_DAM'))->appendChild($dom->createCDATASection( "$media->id"));
$root->appendChild( $dom->createElement('TypeMouvement'))->appendChild($dom->createCDATASection( "$mouvement"));
$root->appendChild($dom->createElement('codeArcadia'))->appendChild($dom->createCDATASection("$media->arcadia_id"));
$root->appendChild($dom->createElement('code_DAM'))->appendChild($dom->createCDATASection("$media->id"));
$root->appendChild($dom->createElement('TypeMouvement'))->appendChild($dom->createCDATASection("$mouvement"));
$cleRef = $root->appendChild( $dom->createElement('cle_Referentiel'));
$cleRef = $root->appendChild($dom->createElement('cle_Referentiel'));
foreach ($refKey as $k) {
if ($media->sujet_id === 1) {
$cleRef->appendChild($dom->createElement('id'))->appendChild($dom->createCDATASection("$k->noArt"));
}elseif ($media->sujet_id === 2) {
} elseif ($media->sujet_id === 2) {
$cleRef->appendChild($dom->createElement('id'))->appendChild($dom->createCDATASection("$k->codMarq"));
}elseif ($media->sujet_id === 4) {
} elseif ($media->sujet_id === 4) {
$cleRef->appendChild($dom->createElement('id'))->appendChild($dom->createCDATASection("$k->id"));
}
}
$root->appendChild( $dom->createElement('libExtension'))->appendChild($dom->createCDATASection( "$media->extension"));
$root->appendChild( $dom->createElement('nbPxLargeur'))->appendChild($dom->createCDATASection( "$media->largeur"));
$root->appendChild( $dom->createElement('largeurMm'))->appendChild($dom->createCDATASection( "$media->largeur_mm"));
$root->appendChild( $dom->createElement('nbPxHauteur'))->appendChild($dom->createCDATASection( "$media->hauteur"));
$root->appendChild( $dom->createElement('hauteurMm'))->appendChild($dom->createCDATASection( "$media->hauteur_mm"));
$root->appendChild( $dom->createElement('pppLargeur'))->appendChild($dom->createCDATASection( "$media->resolution"));
$root->appendChild( $dom->createElement('version'))->appendChild($dom->createCDATASection( "$media->version"));
$root->appendChild( $dom->createElement('codeTypeMedia'))->appendChild($dom->createCDATASection( "$media->typemedia_id"));
$root->appendChild( $dom->createElement('codeTypeVue'))->appendChild($dom->createCDATASection( "$media->typevue_id"));
$root->appendChild( $dom->createElement('commentaire'))->appendChild($dom->createCDATASection( "$media->commentaire"));
$root->appendChild( $dom->createElement('codeSujet'))->appendChild($dom->createCDATASection( "$media->sujet_id"));
$root->appendChild( $dom->createElement('langue'))->appendChild($dom->createCDATASection( "$media->langue_id"));
$root->appendChild( $dom->createElement('copyright'))->appendChild($dom->createCDATASection( "$media->copyright_id"));
$root->appendChild( $dom->createElement('codeVariante'))->appendChild($dom->createCDATASection( "$media->variante_id"));
$root->appendChild( $dom->createElement('dateCreation'))->appendChild($dom->createCDATASection( "$media->created_at"));
$root->appendChild( $dom->createElement('dateModification'))->appendChild($dom->createCDATASection( "$media->updated_at"));
$root->appendChild( $dom->createElement('datePublication'))->appendChild($dom->createCDATASection( "$media->published_at"));
$root->appendChild( $dom->createElement('libelle'))->appendChild($dom->createCDATASection( "$media->libelle"));
$root->appendChild( $dom->createElement('NomFichier'))->appendChild($dom->createCDATASection( "$media->uid.$media->extension"));
$root->appendChild($dom->createElement('libExtension'))->appendChild($dom->createCDATASection("$media->extension"));
$root->appendChild($dom->createElement('nbPxLargeur'))->appendChild($dom->createCDATASection("$media->largeur"));
$root->appendChild($dom->createElement('largeurMm'))->appendChild($dom->createCDATASection("$media->largeur_mm"));
$root->appendChild($dom->createElement('nbPxHauteur'))->appendChild($dom->createCDATASection("$media->hauteur"));
$root->appendChild($dom->createElement('hauteurMm'))->appendChild($dom->createCDATASection("$media->hauteur_mm"));
$root->appendChild($dom->createElement('pppLargeur'))->appendChild($dom->createCDATASection("$media->resolution"));
$root->appendChild($dom->createElement('version'))->appendChild($dom->createCDATASection("$media->version"));
$root->appendChild($dom->createElement('codeTypeMedia'))->appendChild($dom->createCDATASection("$media->typemedia_id"));
$root->appendChild($dom->createElement('codeTypeVue'))->appendChild($dom->createCDATASection("$media->typevue_id"));
$root->appendChild($dom->createElement('commentaire'))->appendChild($dom->createCDATASection("$media->commentaire"));
$root->appendChild($dom->createElement('codeSujet'))->appendChild($dom->createCDATASection("$media->sujet_id"));
$root->appendChild($dom->createElement('langue'))->appendChild($dom->createCDATASection("$media->langue_id"));
$root->appendChild($dom->createElement('copyright'))->appendChild($dom->createCDATASection("$media->copyright_id"));
$root->appendChild($dom->createElement('codeVariante'))->appendChild($dom->createCDATASection("$media->variante_id"));
$root->appendChild($dom->createElement('dateCreation'))->appendChild($dom->createCDATASection("$media->created_at"));
$root->appendChild($dom->createElement('dateModification'))->appendChild($dom->createCDATASection("$media->updated_at"));
$root->appendChild($dom->createElement('datePublication'))->appendChild($dom->createCDATASection("$media->published_at"));
$root->appendChild($dom->createElement('libelle'))->appendChild($dom->createCDATASection("$media->libelle"));
$root->appendChild($dom->createElement('NomFichier'))->appendChild($dom->createCDATASection("$media->uid.$media->extension"));
$mediaFormat = $root->appendChild( $dom->createElement('formats'));
$mediaFormat = $root->appendChild($dom->createElement('formats'));
foreach ($formats as $k) {
$format = $mediaFormat->appendChild( $dom->createElement('format'));
$format->appendChild( $dom->createElement('id'))->appendChild($dom->createCDATASection( $k['id']));
$format->appendChild( $dom->createElement('libelle'))->appendChild($dom->createCDATASection( $k['libelle']));
$format->appendChild( $dom->createElement('extension'))->appendChild($dom->createCDATASection("$media->extension"));
$format->appendChild( $dom->createElement('largeur'))->appendChild($dom->createCDATASection( $k['largeur']));
$format->appendChild( $dom->createElement('hauteur'))->appendChild($dom->createCDATASection( $k['hauteur']));
$format->appendChild( $dom->createElement('lien'))->appendChild($dom->createCDATASection(env('APP_URL') . "/$media->folder$media->uid" . "_" . $k['libelle'] . ".$media->extension"));
$format = $mediaFormat->appendChild($dom->createElement('format'));
$format->appendChild($dom->createElement('id'))->appendChild($dom->createCDATASection($k['id']));
$format->appendChild($dom->createElement('libelle'))->appendChild($dom->createCDATASection($k['libelle']));
$format->appendChild($dom->createElement('extension'))->appendChild($dom->createCDATASection("$media->extension"));
$format->appendChild($dom->createElement('largeur'))->appendChild($dom->createCDATASection($k['largeur']));
$format->appendChild($dom->createElement('hauteur'))->appendChild($dom->createCDATASection($k['hauteur']));
$format->appendChild($dom->createElement('lien'))->appendChild($dom->createCDATASection(env('APP_URL') . "/$media->folder$media->uid" . "_" . $k['libelle'] . ".$media->extension"));
}
return $dom->saveXML();
@ -167,7 +175,7 @@ trait ArcadiaLink {
public static function getRefKey($media)
{
switch ($media->sujet_id){
switch ($media->sujet_id) {
case 1:
return $media->articles()->get();
break;
@ -184,6 +192,7 @@ trait ArcadiaLink {
private static function getFormats()
{
return Format::withoutGlobalScope(SystemScope::class)->where('system', '=', '1')->get();
return Format::withoutGlobalScope(SystemScope::class)
->where('system', true)->get();
}
}

View file

@ -1,9 +1,11 @@
<?php
namespace App\Http\Traits;
use Elasticquent\ElasticquentTrait;
trait ElasticTrait {
trait ElasticTrait
{
use ElasticquentTrait;
/**
@ -11,16 +13,15 @@ trait ElasticTrait {
*
* Does this index exist?
*
* @return bool
* @return boolean
*/
public static function indexExists()
{
$instance = new static;
$client = $instance->getElasticSearchClient();
$index = array(
$instance = new static();
$client = $instance->getElasticSearchClient();
$index = array(
'index' => $instance->getIndexName(),
);
return $client->indices()->exists($index);
}
}

View file

@ -1,191 +1,209 @@
<?php
namespace App\Http\Traits;
use App\Models\Format;
use App\Models\Media;
use Illuminate\Support\Facades\Storage;
trait MediaTools {
trait MediaTools
{
public function getFileSize($file_path)
{
return $this->fixIntegerOverflow(filesize($file_path));
}
public function get_file_size($file_path) {
return $this->fix_integer_overflow(filesize($file_path));
}
/**
* Create thumbnail for a Media
*
* @param Media $media
* @return void
*/
public function createThumb(Media $media)
{
/** @var \Illuminate\Support\Collection<\App\Models\Format> $formats */
$formats = optional($media->sujet)->formats ?? collect();
$mediaPath = public_path("/{$media->folder}{$media->uid}.{$media->extension}");
$im = new \Imagick($mediaPath);
$im->setImageBackgroundColor('#ffffff');
$im->setImageAlphaChannel(\Imagick::ALPHACHANNEL_REMOVE);
$im->mergeImageLayers(\Imagick::LAYERMETHOD_FLATTEN);
$im->stripImage();
if (in_array($media->extension, array("pdf", "ai", "psd"))) {
$im->setIteratorIndex(0);
}
public function create_thumb($media) {
$formats = $media->sujet->formats;
$mediaPath = public_path()."/".$media->folder.$media->uid.".".$media->extension;
$im = new \Imagick($mediaPath);
$im->setImageBackgroundColor('#ffffff');
$im->setImageAlphaChannel(\Imagick::ALPHACHANNEL_REMOVE);
$im->mergeImageLayers(\Imagick::LAYERMETHOD_FLATTEN);
$im->stripImage();
if(in_array($media->extension, array("pdf", "ai", "psd")) ){
$im->setIteratorIndex(0);
}
foreach ($formats as $format) {
$fp = public_path("/{$media->folder}{$media->uid}_{$format->libelle}.{$format->extension}");
foreach ($formats as $format) {
$targetWidth = $format->largeur;
if ($format->hauteur == 0) {
$targetHeight = floor(($media->hauteur * $format->largeur) / $media->largeur);
} else {
$targetHeight = $format->hauteur;
}
$fp = public_path()."/".$media->folder.$media->uid.'_'.$format->libelle.'.'.$format->extension;
$targetWidth = $format->largeur;
if($format->hauteur == 0){
$targetHeight = floor(($media->hauteur*$format->largeur)/$media->largeur);
}else{
$targetHeight = $format->hauteur;
}
$im->setImageFormat($format->extension);
if ($media->largeur >= $targetWidth || $media->hauteur >= $targetHeight) {
$im->thumbnailImage($targetWidth, $targetHeight, true);
}
$im->writeImage($fp);
}
$im->destroy();
unset($im);
}
$im->setImageFormat($format->extension);
if($media->largeur >= $targetWidth || $media->hauteur >= $targetHeight){
$im->thumbnailImage($targetWidth, $targetHeight , true);
}
$im->writeImage($fp);
}
$im->destroy();
unset($im);
}
public function createSysThumb($media)
{
$mediaPath = public_path() . "/" . $media->folder . $media->uid . "." . $media->extension;
$im = new \Imagick();
$im->readImage($mediaPath);
public function create_sys_thumb($media) {
$mediaPath = public_path()."/".$media->folder.$media->uid.".".$media->extension;
$im = new \Imagick();
$im->readImage($mediaPath);
if (in_array($media->extension, array("pdf", "ai", "psd"))) {
$extension = "png";
$im->setIteratorIndex(0);
} else {
$extension = $media->extension;
}
if(in_array($media->extension, array("pdf", "ai", "psd")) ){
$extension = "png";
$im->setIteratorIndex(0);
}else{
$extension = $media->extension;
}
/* Handle CMJN - DOESN'T WORK
if ($im->getImageColorspace() === \Imagick::COLORSPACE_CMYK){
/*
Handle CMJN - DOESN'T WORK
if ($im->getImageColorspace() === \Imagick::COLORSPACE_CMYK){
$im->transformImageColorspace(\Imagick::COLORSPACE_RGB);
}*/
// create preview
// * create preview
$format = Format::withoutGlobalScope('App\Scopes\SystemScope')->where('libelle', '=', 'preview')->first();
$fp = public_path()."/".$media->folder.$media->uid.'_preview.'.$extension;
if($media->extension == "gif" ){
if($media->largeur >= $format->largeur || $media->hauteur >= $format->hauteur || $media->largeur == ""){
$im = $im->coalesceImages();
foreach ($im as $frame) {
$frame->thumbnailImage($format->largeur, $format->hauteur);
$frame->setImagePage($format->largeur, $format->hauteur, 0, 0);
}
$im = $im->deconstructImages();
}
$im->writeImages($fp, true);
}else{
if($media->largeur >= $format->largeur || $media->hauteur >= $format->hauteur || $media->largeur == ""){
$im->thumbnailImage($format->largeur, $format->hauteur , true);
}
$im->writeImage($fp);
}
$fp = public_path() . "/" . $media->folder . $media->uid . '_preview.' . $extension;
if ($media->extension == "gif") {
if ($media->largeur >= $format->largeur || $media->hauteur >= $format->hauteur || $media->largeur == "") {
$im = $im->coalesceImages();
foreach ($im as $frame) {
$frame->thumbnailImage($format->largeur, $format->hauteur);
$frame->setImagePage($format->largeur, $format->hauteur, 0, 0);
}
$im = $im->deconstructImages();
}
$im->writeImages($fp, true);
} else {
if ($media->largeur >= $format->largeur || $media->hauteur >= $format->hauteur || $media->largeur == "") {
$im->thumbnailImage($format->largeur, $format->hauteur, true);
}
$im->writeImage($fp);
}
// create thumb
// * create thumb
$format = Format::withoutGlobalScope('App\Scopes\SystemScope')->where('libelle', '=', 'thumb')->first();
if ($extension != "png"){
if ($extension != "png") {
$im->setImageBackgroundColor('#ffffff');
$im->setImageAlphaChannel(\Imagick::ALPHACHANNEL_REMOVE);
$im->mergeImageLayers(\Imagick::LAYERMETHOD_FLATTEN);
$im->stripImage();
}
$fp = public_path()."/".$media->folder.$media->uid.'_thumb.'.$extension;
$im->thumbnailImage($format->largeur, $format->hauteur , true);
$im->writeImage($fp);
$im->destroy();
$fp = public_path() . "/" . $media->folder . $media->uid . '_thumb.' . $extension;
$im->thumbnailImage($format->largeur, $format->hauteur, true);
$im->writeImage($fp);
$im->destroy();
unset($im);
}
}
public function get_mediaFolder() {
$mediaPath = "medias/";
$directories = Storage::allDirectories($mediaPath );
$selectedFolder = "";
public function getMediaFolder()
{
$mediaPath = "medias/";
$directories = Storage::allDirectories($mediaPath);
$selectedFolder = "";
// on obtient le dernier dossier créé
foreach ($directories as $key => $foldername) {
if($selectedFolder < $foldername){
$selectedFolder = $foldername;
}
}
// si on n'a pas de dossier, on le créé
if($selectedFolder == ""){
$selectedFolder = $mediaPath.uniqid();
Storage::makeDirectory($selectedFolder);
}else{
// on compte le nombre de fichier
$files = Storage::allFiles($selectedFolder);
// si on en a plus de 1000, on créé un nouveau dossier
if(count($files)> 1000){
$selectedFolder = $mediaPath.uniqid();
Storage::makeDirectory($selectedFolder);
}
}
return $selectedFolder;
}
// * on obtient le dernier dossier créé
foreach ($directories as $key => $foldername) {
if ($selectedFolder < $foldername) {
$selectedFolder = $foldername;
}
}
// * si on n'a pas de dossier, on le créé
if ($selectedFolder == "") {
$selectedFolder = $mediaPath . uniqid();
Storage::makeDirectory($selectedFolder);
} else {
// * on compte le nombre de fichier
$files = Storage::allFiles($selectedFolder);
// * si on en a plus de 1000, on créé un nouveau dossier
if (count($files) > 1000) {
$selectedFolder = $mediaPath . uniqid();
Storage::makeDirectory($selectedFolder);
}
}
return $selectedFolder;
}
public function fix_integer_overflow($size) {
if ($size < 0) {
$size += 2.0 * (PHP_INT_MAX + 1);
}
return $size;
}
public function fixIntegerOverflow($size)
{
if ($size < 0) {
$size += 2.0 * (PHP_INT_MAX + 1);
}
return $size;
}
public function formatBytes($octet, $precision = 2) {
// Array contenant les differents unités
$unite = array('octet','Ko','Mo','Go');
public function formatBytes($octet, $precision = 2)
{
// * Array contenant les differents unités
$unite = array('octet', 'Ko', 'Mo', 'Go');
if ($octet < 1000) // octet
{
return $octet.$unite[0];
}
else
{
if ($octet < 1000000) // ko
{
$ko = round($octet/1024,2);
return $ko.$unite[1];
}
else // Mo ou Go
{
if ($octet < 1000000000) // Mo
{
$mo = round($octet/(1024*1024),2);
return $mo.$unite[2];
}
else // Go
{
$go = round($octet/(1024*1024*1024),2);
return $go.$unite[3];
}
}
}
}
// * octet
if ($octet < 1000) {
return $octet . $unite[0];
} else {
if ($octet < 1000000) {
// * ko
$ko = round($octet / 1024, 2);
return $ko . $unite[1];
} else {
// * Mo ou Go
if ($octet < 1000000000) {
// * Mo
$mo = round($octet / (1024 * 1024), 2);
return $mo . $unite[2];
} else {
// * Go
$go = round($octet / (1024 * 1024 * 1024), 2);
return $go . $unite[3];
}
}
}
}
// ---- Renvoi le chemin attendu d'un média selon le format demandé
public function get_mediaPath($media, $format = "") {
// format spécifique
if($format->system == 0){
if(in_array($media->extension, array("gif", "jpeg", "jpg", "png", "pdf", "ai", "psd")) ){
return public_path()."/".$media->folder.$media->uid.'_'.$format->libelle.'.'.$format->extension;
}else{
return public_path()."/".$media->folder.$media->uid.'.'.$media->extension;
}
}
// format système (thumb et preview)
if($format->system == 1){
if(in_array($media->extension, array("gif", "jpeg", "jpg", "png")) ){
//gestion du cas de format qui fixe l'extension
if($format->extension != "") {
/**
* Renvoi le chemin attendu d'un média selon le format demandé
*
* @param \App\Models\Media $media
* @param \App\Models\Format $format
* @return string
* @throws \ErrorException If Format is not handled.
*/
public function getMediaPath(Media $media, Format $format): string
{
// * format spécifique
if ($format->system) {
if (in_array($media->extension, array("gif", "jpeg", "jpg", "png", "pdf", "ai", "psd"))) {
return public_path("/{$media->folder}{$media->uid}_{$format->libelle}.{$format->extension}");
}
return public_path("/{$media->folder}{$media->uid}.{$media->extension}");
}
// * format système (thumb et preview)
if ($format->system) {
if (in_array($media->extension, array("gif", "jpeg", "jpg", "png"))) {
// * Gestion du cas de format qui fixe l'extension
if ($format->extension != '') {
$file_extension = $format->extension;
} else {
$file_extension = $media->extension;
}
return public_path()."/".$media->folder.$media->uid.'_'.$format->libelle.'.'.$file_extension;
}elseif(in_array($media->extension, array("pdf", "ai", "psd"))){
return public_path()."/".$media->folder.$media->uid.'_'.$format->libelle.'.png';
}else{
return public_path()."/".$media->folder.$media->uid.'.'.$media->extension;
}
}
}
return public_path("/{$media->folder}{$media->uid}_{$format->libelle}.{$file_extension}");
} elseif (in_array($media->extension, array("pdf", "ai", "psd"))) {
return public_path("/{$media->folder}{$media->uid}_{$format->libelle}.png");
}
return public_path("/{$media->folder}.{$media->uid}.{$media->extension}");
}
throw new \ErrorException("Unhandled Format $format->id $format->libelle");
}
}

View file

@ -16,7 +16,10 @@ use Illuminate\Foundation\Bus\Dispatchable;
class SendMediasModificationsReport implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
use Dispatchable;
use InteractsWithQueue;
use Queueable;
use SerializesModels;
/**
* Create a new job instance.
@ -25,7 +28,6 @@ class SendMediasModificationsReport implements ShouldQueue
*/
public function __construct()
{
//
}
/**
@ -35,12 +37,12 @@ class SendMediasModificationsReport implements ShouldQueue
*/
public function handle()
{
//Gather Medias to report
//filtered by subject (2,4)
$now = Carbon::now();
// Gather Medias to report
// filtered by subject (2,4)
$now = Carbon::now();
$yesterday = $now->subDay(1);
$arSujets = [];
$onesujet = Sujet::find(2);
$arSujets = [];
$onesujet = Sujet::find(2);
array_push($arSujets, $onesujet->libelle);
$onesujet = Sujet::find(4);
array_push($arSujets, $onesujet->libelle);
@ -50,13 +52,13 @@ class SendMediasModificationsReport implements ShouldQueue
$medias = Media::whereDate('updated_at', '>=', $yesterday)
->whereIn('sujet_id', [2,4])
->get();
//send mail
// send mail
$toMailSetting = Setting::where('key', 'media_report_to_mail')->first();
if(empty($toMailSetting->value)) {
//pas d'envoi car pas de mail cible
if (empty($toMailSetting->value)) {
// pas d'envoi car pas de mail cible
} else {
$email = $toMailSetting->value;
Mail::to($email)->send(new SendMediaReportMail($medias,$yesterday,$sujets));
Mail::to($email)->send(new SendMediaReportMail($medias, $yesterday, $sujets));
}
}
}

View file

@ -66,13 +66,13 @@ class Utils
*/
private static function getAnonymizedStackTrace(\Throwable $e): string
{
$projectPath = \realpath(\sprintf('%s/../', \app_path()));
$traceStack = $e->getTrace();
$traceStr = '';
$projectPath = \realpath(\sprintf('%s/../', \app_path()));
$traceStack = $e->getTrace();
$traceStr = '';
$maxStackStage = 0;
foreach ($traceStack as $stackStage => $stack) {
$maxStackStage = $stackStage;
$traceStr .= \sprintf(
$traceStr .= \sprintf(
'#%s %s(%d): ',
$stackStage,
str_replace($projectPath, '', $stack['file'] ?? ''),
@ -91,7 +91,7 @@ class Utils
}
$traceStr .= ")\n";
}
}
}//end foreach
$maxStackStage++;
$traceStr .= "#$maxStackStage {main}";
return $traceStr;

View file

@ -5,16 +5,19 @@ namespace App\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Queue\ShouldQueue;
class contact extends Mailable
class Contact extends Mailable
{
use Queueable, SerializesModels;
use Queueable;
use SerializesModels;
public $type;
public $type;
public $url;
public $message;
public $user;
public $user;
/**
* Create a new message instance.
@ -23,10 +26,10 @@ class contact extends Mailable
*/
public function __construct($type, $url, $message, $user)
{
$this->type = $type;
$this->url = $url;
$this->message = $message;
$this->user = $user;
$this->type = $type;
$this->url = $url;
$this->message = $message;
$this->user = $user;
}
/**
@ -36,7 +39,7 @@ class contact extends Mailable
*/
public function build()
{
return $this->from('dam@ldc.fr', 'DAM')
return $this->from('dam@ldc.fr', 'DAM')
->subject('Message d\'un utilisateur')
->view('mails.contact')
->with(['type' => $this->type, 'url' => $this->url, 'messagetxt' => $this->message, 'user' => $this->user]);

View file

@ -6,22 +6,22 @@ use Carbon\Carbon;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Queue\ShouldQueue;
class SendMediaReportMail extends Mailable
{
use Queueable, SerializesModels;
use Queueable;
use SerializesModels;
/**
* Create a new message instance.
*
* @return void
*/
public function __construct($medias,$yesterday,$sujets)
public function __construct($medias, $yesterday, $sujets)
{
$this->medias = $medias;
$this->medias = $medias;
$this->yesterday = $yesterday;
$this->sujets = $sujets;
$this->sujets = $sujets;
}
/**
@ -36,6 +36,6 @@ class SendMediaReportMail extends Mailable
$yesterday = $this->yesterday;
$sujets = $this->sujets;
return $this->subject("Rapport d'activité DAM - " . $now->formatLocalized('%d %B %Y à %H:%M'))->view('mails.send-media-report', compact('medias','yesterday','sujets'));
return $this->subject("Rapport d'activité DAM - " . $now->formatLocalized('%d %B %Y à %H:%M'))->view('mails.send-media-report', compact('medias', 'yesterday', 'sujets'));
}
}

View file

@ -6,11 +6,11 @@ use Illuminate\Database\Eloquent\Model;
class Article extends Model
{
/**
* The medias that belong to the article.
*/
public function medias()
{
return $this->belongsToMany('App\Models\Media', 'medias_articles', 'article_id', 'media_id');
}
/**
* The medias that belong to the article.
*/
public function medias()
{
return $this->belongsToMany('App\Models\Media', 'medias_articles', 'article_id', 'media_id');
}
}

View file

@ -6,10 +6,10 @@ use Illuminate\Database\Eloquent\Model;
class Copyright extends Model
{
/**
* The primary key associated with the table.
*
* @var string
*/
protected $primaryKey = 'copyright_id';
/**
* The primary key associated with the table.
*
* @var string
*/
protected $primaryKey = 'copyright_id';
}

View file

@ -6,18 +6,18 @@ use Illuminate\Database\Eloquent\Model;
class Etiquette extends Model
{
/**
* The primary key associated with the table.
*
* @var string
*/
protected $primaryKey = 'etiquette_id';
/**
* The primary key associated with the table.
*
* @var string
*/
protected $primaryKey = 'etiquette_id';
/**
* Get the medias for the etiquette.
*/
public function medias()
{
return $this->hasMany('App\Models\Media');
}
/**
* Get the medias for the etiquette.
*/
public function medias()
{
return $this->hasMany('App\Models\Media');
}
}

View file

@ -2,30 +2,26 @@
namespace App\Models;
use App\Scopes\SystemScope;
use Illuminate\Database\Eloquent\Model;
class Format extends Model
{
/**
* The "booting" method of the model.
/**
* The attributes that should be cast.
*
* @return void
* @var array
*/
protected static function boot()
protected $casts = [
'largeur' => 'int',
'hauteur' => 'int',
'system' => 'bool',
];
/**
* The sujet that belong to the format.
*/
public function sujets()
{
parent::boot();
//static::addGlobalScope(new SystemScope);
return $this->belongsToMany('App\Models\Sujet', 'sujets_formats', 'format_id', 'sujet_id');
}
/**
* The sujet that belong to the format.
*/
public function sujets()
{
return $this->belongsToMany('App\Models\Sujet', 'sujets_formats', 'format_id', 'sujet_id');
}
}

View file

@ -6,5 +6,4 @@ use Illuminate\Database\Eloquent\Model;
class FormatRestriction extends Model
{
//
}

View file

@ -8,19 +8,19 @@ class Historique extends Model
{
public $timestamps = false;
/**
* Get the user that owns the historique.
*/
public function user()
{
return $this->belongsTo('App\Models\User', 'user_id');
}
/**
* Get the user that owns the historique.
*/
public function user()
{
return $this->belongsTo('App\Models\User', 'user_id');
}
/**
* Get the media that owns the historique.
*/
public function media()
{
return $this->belongsTo('App\Models\Media', 'media_id');
}
/**
* Get the media that owns the historique.
*/
public function media()
{
return $this->belongsTo('App\Models\Media', 'media_id');
}
}

View file

@ -6,10 +6,10 @@ use Illuminate\Database\Eloquent\Model;
class Langue extends Model
{
/**
* The primary key associated with the table.
*
* @var string
*/
protected $primaryKey = 'langue_id';
/**
* The primary key associated with the table.
*
* @var string
*/
protected $primaryKey = 'langue_id';
}

View file

@ -6,36 +6,34 @@ use Illuminate\Database\Eloquent\Model;
class Marque extends Model
{
/**
/**
* The primary key associated with the table.
*
* @var string
*/
protected $primaryKey = 'codMarq';
/**
* The users that belong to the marque.
*/
public function users()
{
return $this->belongsToMany('App\Models\User', 'marques_users', 'marque_id', 'user_id');
}
/**
* The users that belong to the marque.
*/
public function users()
{
return $this->belongsToMany('App\Models\User', 'marques_users', 'marque_id', 'user_id');
}
/**
* The dossier that belong to the marque.
*/
public function dossiers()
{
return $this->belongsToMany('App\Models\Dossier', 'marques_dossier', 'marque_id', 'dossier_id');
}
/**
* The medias that belong to the marques.
*/
public function medias()
{
return $this->belongsToMany('App\Models\Media', 'medias_marques', 'marque_id', 'media_id');
}
* The dossier that belong to the marque.
*/
public function dossiers()
{
return $this->belongsToMany('App\Models\Dossier', 'marques_dossier', 'marque_id', 'dossier_id');
}
/**
* The medias that belong to the marques.
*/
public function medias()
{
return $this->belongsToMany('App\Models\Media', 'medias_marques', 'marque_id', 'media_id');
}
}

View file

@ -4,7 +4,6 @@ namespace App\Models;
use App\Http\Traits\ElasticTrait;
use App\Models\User;
use DateTimeInterface;
use Elasticquent\ElasticquentTrait;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

View file

@ -6,21 +6,19 @@ use Illuminate\Database\Eloquent\Model;
class Recherche extends Model
{
/**
* Get the sujet that owns the recherche.
*/
public function sujet()
{
return $this->belongsTo('App\Models\Sujet', 'sujet_id');
}
/**
* Get the sujet that owns the recherche.
*/
public function sujet()
{
return $this->belongsTo('App\Models\Sujet', 'sujet_id');
}
/**
* Get the user that owns the recherche.
*/
public function user()
{
return $this->belongsTo('App\Models\User', 'id');
}
/**
* Get the user that owns the recherche.
*/
public function user()
{
return $this->belongsTo('App\Models\User', 'id');
}
}

View file

@ -6,5 +6,4 @@ use Illuminate\Database\Eloquent\Model;
class Setting extends Model
{
//
}

View file

@ -6,5 +6,4 @@ use Illuminate\Database\Eloquent\Model;
class Site extends Model
{
}

View file

@ -6,11 +6,11 @@ use Illuminate\Database\Eloquent\Model;
class Societe extends Model
{
/**
* The medias that belong to the societes.
*/
public function medias()
{
return $this->belongsToMany('App\Models\Media', 'medias_societes', 'societe_id', 'media_id');
}
/**
* The medias that belong to the societes.
*/
public function medias()
{
return $this->belongsToMany('App\Models\Media', 'medias_societes', 'societe_id', 'media_id');
}
}

View file

@ -6,67 +6,66 @@ use Illuminate\Database\Eloquent\Model;
class Sujet extends Model
{
/**
* The primary key associated with the table.
*
* @var string
*/
protected $primaryKey = 'codeSujet';
/**
* The primary key associated with the table.
*
* @var string
*/
protected $primaryKey = 'codeSujet';
/**
* The users that belong to the sujet.
*/
public function users()
{
return $this->belongsToMany('App\Models\User', 'sujets_users', 'sujet_id', 'user_id');
}
/**
* The users that belong to the sujet.
*/
public function users()
{
return $this->belongsToMany('App\Models\User', 'sujets_users', 'sujet_id', 'user_id');
}
/**
/**
* Get the dossier for the sujet.
*/
public function dossiers()
{
return $this->hasMany('App\Models\Dossier');
}
public function dossiers()
{
return $this->hasMany('App\Models\Dossier');
}
/**
* Get the variantes for the sujet.
*/
public function variantes()
{
return $this->hasMany('App\Models\Variante', 'sujet_id', 'codeSujet');
}
/**
* Get the variantes for the sujet.
*/
public function variantes()
{
return $this->hasMany('App\Models\Variante', 'sujet_id', 'codeSujet');
}
/**
* Get the typeVue for the sujet.
*/
public function typeVues()
{
return $this->hasMany('App\Models\Typevue', 'sujet_id', 'codeSujet');
}
/**
* Get the typeVue for the sujet.
*/
public function typeVues()
{
return $this->hasMany('App\Models\Typevue', 'sujet_id', 'codeSujet');
}
/**
/**
* Get the medias for the sujet.
*/
public function medias()
{
return $this->hasMany('App\Models\Media');
}
public function medias()
{
return $this->hasMany('App\Models\Media');
}
/**
* The formats that belong to the sujet.
*/
public function formats()
{
return $this->belongsToMany('App\Models\Format', 'sujets_formats', 'sujet_id', 'format_id');
}
/**
* The formats that belong to the sujet.
*/
public function formats()
{
return $this->belongsToMany('App\Models\Format', 'sujets_formats', 'sujet_id', 'format_id');
}
/**
* Get the recherches for the sujet.
*/
public function recherches()
{
return $this->hasMany('App\Models\Recherche');
}
/**
* Get the recherches for the sujet.
*/
public function recherches()
{
return $this->hasMany('App\Models\Recherche');
}
}

View file

@ -6,14 +6,12 @@ use Illuminate\Database\Eloquent\Model;
class Tag extends Model
{
public $timestamps = false;
/**
* The media that belong to the tags.
*/
public function medias()
{
return $this->belongsToMany('App\Models\Media', 'medias_tags', 'tag_id', 'media_id');
}
public $timestamps = false;
/**
* The media that belong to the tags.
*/
public function medias()
{
return $this->belongsToMany('App\Models\Media', 'medias_tags', 'tag_id', 'media_id');
}
}

View file

@ -6,20 +6,20 @@ use Illuminate\Database\Eloquent\Model;
class Typemedia extends Model
{
protected $table = "typemedias";
protected $table = "typemedias";
/**
* The primary key associated with the table.
*
* @var string
*/
protected $primaryKey = 'codeTypemedia';
/**
* The primary key associated with the table.
*
* @var string
*/
protected $primaryKey = 'codeTypemedia';
/**
* Get the media for the Typemedia.
*/
public function medias()
{
return $this->hasMany('App\Models\Media');
}
/**
* Get the media for the Typemedia.
*/
public function medias()
{
return $this->hasMany('App\Models\Media');
}
}

View file

@ -6,22 +6,22 @@ use Illuminate\Database\Eloquent\Model;
class Typevue extends Model
{
/**
* The primary key associated with the table.
*
* @var string
*/
protected $primaryKey = 'codeTypevue';
/**
* The primary key associated with the table.
*
* @var string
*/
protected $primaryKey = 'codeTypevue';
/**
* Get the variantes for the Typevue.
*/
public function variantes()
{
return $this->hasMany('App\Models\Variante');
}
/**
* Get the variantes for the Typevue.
*/
public function variantes()
{
return $this->hasMany('App\Models\Variante');
}
/**
/**
* Get the sujet that owns the Typevue.
*/
public function sujet()
@ -29,11 +29,11 @@ class Typevue extends Model
return $this->belongsTo('App\Models\Sujet', 'sujet_id');
}
/**
* Get the medias for the Typevue.
*/
public function medias()
{
return $this->hasMany('App\Models\Media');
}
/**
* Get the medias for the Typevue.
*/
public function medias()
{
return $this->hasMany('App\Models\Media');
}
}

View file

@ -6,15 +6,14 @@ use Illuminate\Database\Eloquent\Model;
class Variante extends Model
{
/**
* The primary key associated with the table.
*
* @var string
*/
protected $primaryKey = 'codeVariante';
/**
* The primary key associated with the table.
*
* @var string
*/
protected $primaryKey = 'codeVariante';
/**
/**
* Get the sujet that owns the variante.
*/
public function sujet()
@ -22,11 +21,11 @@ class Variante extends Model
return $this->belongsTo('App\Models\Sujet', 'sujet_id');
}
/**
* Get the typeVue that owns the variante.
*/
public function typeVue()
{
return $this->belongsTo('App\Models\Typevue', 'typevue_id');
}
/**
* Get the typeVue that owns the variante.
*/
public function typeVue()
{
return $this->belongsTo('App\Models\Typevue', 'typevue_id');
}
}

View file

@ -1,4 +1,5 @@
<?php
namespace App\Scopes;
use Adldap\Query\Builder;
@ -25,4 +26,4 @@ class OpenLdapScope implements ScopeInterface
'givenName',
]);
}
}
}

View file

@ -1,4 +1,5 @@
<?php
namespace App\Scopes;
use Illuminate\Database\Eloquent\Scope;
@ -10,12 +11,12 @@ class SystemScope implements Scope
/**
* Apply the scope to a given Eloquent query builder.
*
* @param \Illuminate\Database\Eloquent\Builder $builder
* @param \Illuminate\Database\Eloquent\Model $model
* @param \Illuminate\Database\Eloquent\Builder $builder
* @param \Illuminate\Database\Eloquent\Model $model
* @return void
*/
public function apply(Builder $builder, Model $model)
{
$builder->where('system', 0);
$builder->where('system', false);
}
}
}

View file

@ -3,53 +3,53 @@
return [
/*
|--------------------------------------------------------------------------
| Application Name
|--------------------------------------------------------------------------
|
| This value is the name of your application. This value is used when the
| framework needs to place the application's name in a notification or
| any other location as required by the application or its packages.
|
|--------------------------------------------------------------------------
| Application Name
|--------------------------------------------------------------------------
|
| This value is the name of your application. This value is used when the
| framework needs to place the application's name in a notification or
| any other location as required by the application or its packages.
|
*/
'name' => env('APP_NAME', 'Laravel'),
/*
|--------------------------------------------------------------------------
| Application Environment
|--------------------------------------------------------------------------
|
| This value determines the "environment" your application is currently
| running in. This may determine how you prefer to configure various
| services the application utilizes. Set this in your ".env" file.
|
|--------------------------------------------------------------------------
| Application Environment
|--------------------------------------------------------------------------
|
| This value determines the "environment" your application is currently
| running in. This may determine how you prefer to configure various
| services the application utilizes. Set this in your ".env" file.
|
*/
'env' => env('APP_ENV', 'production'),
/*
|--------------------------------------------------------------------------
| Application Debug Mode
|--------------------------------------------------------------------------
|
| When your application is in debug mode, detailed error messages with
| stack traces will be shown on every error that occurs within your
| application. If disabled, a simple generic error page is shown.
|
|--------------------------------------------------------------------------
| Application Debug Mode
|--------------------------------------------------------------------------
|
| When your application is in debug mode, detailed error messages with
| stack traces will be shown on every error that occurs within your
| application. If disabled, a simple generic error page is shown.
|
*/
'debug' => (bool) env('APP_DEBUG', false),
'debug' => (bool)env('APP_DEBUG', false),
/*
|--------------------------------------------------------------------------
| Application URL
|--------------------------------------------------------------------------
|
| This URL is used by the console to properly generate URLs when using
| the Artisan command line tool. You should set this to the root of
| your application so that it is used when running Artisan tasks.
|
|--------------------------------------------------------------------------
| Application URL
|--------------------------------------------------------------------------
|
| This URL is used by the console to properly generate URLs when using
| the Artisan command line tool. You should set this to the root of
| your application so that it is used when running Artisan tasks.
|
*/
'url' => env('APP_URL', 'http://localhost'),
@ -57,66 +57,66 @@ return [
'asset_url' => env('ASSET_URL', null),
/*
|--------------------------------------------------------------------------
| Application Timezone
|--------------------------------------------------------------------------
|
| Here you may specify the default timezone for your application, which
| will be used by the PHP date and date-time functions. We have gone
| ahead and set this to a sensible default for you out of the box.
|
|--------------------------------------------------------------------------
| Application Timezone
|--------------------------------------------------------------------------
|
| Here you may specify the default timezone for your application, which
| will be used by the PHP date and date-time functions. We have gone
| ahead and set this to a sensible default for you out of the box.
|
*/
'timezone' => 'Europe/Paris',
/*
|--------------------------------------------------------------------------
| Application Locale Configuration
|--------------------------------------------------------------------------
|
| The application locale determines the default locale that will be used
| by the translation service provider. You are free to set this value
| to any of the locales which will be supported by the application.
|
|--------------------------------------------------------------------------
| Application Locale Configuration
|--------------------------------------------------------------------------
|
| The application locale determines the default locale that will be used
| by the translation service provider. You are free to set this value
| to any of the locales which will be supported by the application.
|
*/
'locale' => 'fr',
/*
|--------------------------------------------------------------------------
| Application Fallback Locale
|--------------------------------------------------------------------------
|
| The fallback locale determines the locale to use when the current one
| is not available. You may change the value to correspond to any of
| the language folders that are provided through your application.
|
|--------------------------------------------------------------------------
| Application Fallback Locale
|--------------------------------------------------------------------------
|
| The fallback locale determines the locale to use when the current one
| is not available. You may change the value to correspond to any of
| the language folders that are provided through your application.
|
*/
'fallback_locale' => 'en',
/*
|--------------------------------------------------------------------------
| Faker Locale
|--------------------------------------------------------------------------
|
| This locale will be used by the Faker PHP library when generating fake
| data for your database seeds. For example, this will be used to get
| localized telephone numbers, street address information and more.
|
|--------------------------------------------------------------------------
| Faker Locale
|--------------------------------------------------------------------------
|
| This locale will be used by the Faker PHP library when generating fake
| data for your database seeds. For example, this will be used to get
| localized telephone numbers, street address information and more.
|
*/
'faker_locale' => 'en_US',
/*
|--------------------------------------------------------------------------
| Encryption Key
|--------------------------------------------------------------------------
|
| This key is used by the Illuminate encrypter service and should be set
| to a random, 32 character string, otherwise these encrypted strings
| will not be safe. Please do this before deploying an application!
|
|--------------------------------------------------------------------------
| Encryption Key
|--------------------------------------------------------------------------
|
| This key is used by the Illuminate encrypter service and should be set
| to a random, 32 character string, otherwise these encrypted strings
| will not be safe. Please do this before deploying an application!
|
*/
'key' => env('APP_KEY'),
@ -124,14 +124,14 @@ return [
'cipher' => 'AES-256-CBC',
/*
|--------------------------------------------------------------------------
| Autoloaded Service Providers
|--------------------------------------------------------------------------
|
| The service providers listed here will be automatically loaded on the
| request to your application. Feel free to add your own services to
| this array to grant expanded functionality to your applications.
|
|--------------------------------------------------------------------------
| Autoloaded Service Providers
|--------------------------------------------------------------------------
|
| The service providers listed here will be automatically loaded on the
| request to your application. Feel free to add your own services to
| this array to grant expanded functionality to your applications.
|
*/
'providers' => [
@ -161,12 +161,12 @@ return [
Illuminate\Translation\TranslationServiceProvider::class,
Illuminate\Validation\ValidationServiceProvider::class,
Illuminate\View\ViewServiceProvider::class,
Collective\Html\HtmlServiceProvider::class,
Collective\Html\HtmlServiceProvider::class,
/*
* Package Service Providers...
*/
Elasticquent\ElasticquentServiceProvider::class,
Elasticquent\ElasticquentServiceProvider::class,
/*
* Application Service Providers...
*/
@ -179,14 +179,14 @@ return [
],
/*
|--------------------------------------------------------------------------
| Class Aliases
|--------------------------------------------------------------------------
|
| This array of class aliases will be registered when this application
| is started. However, feel free to register as many as you wish as
| the aliases are "lazy" loaded so they don't hinder performance.
|
|--------------------------------------------------------------------------
| Class Aliases
|--------------------------------------------------------------------------
|
| This array of class aliases will be registered when this application
| is started. However, feel free to register as many as you wish as
| the aliases are "lazy" loaded so they don't hinder performance.
|
*/
'aliases' => [
@ -230,10 +230,10 @@ return [
'URL' => Illuminate\Support\Facades\URL::class,
'Validator' => Illuminate\Support\Facades\Validator::class,
'View' => Illuminate\Support\Facades\View::class,
'Adldap' => Adldap\Laravel\Facades\Adldap::class,
'Form' => Collective\Html\FormFacade::class,
'Html' => Collective\Html\HtmlFacade::class,
'Es' => Elasticquent\ElasticquentElasticsearchFacade::class,
'Adldap' => Adldap\Laravel\Facades\Adldap::class,
'Form' => Collective\Html\FormFacade::class,
'Html' => Collective\Html\HtmlFacade::class,
'Es' => Elasticquent\ElasticquentElasticsearchFacade::class,
],
];

View file

@ -3,14 +3,14 @@
return [
/*
|--------------------------------------------------------------------------
| Authentication Defaults
|--------------------------------------------------------------------------
|
| This option controls the default authentication "guard" and password
| reset options for your application. You may change these defaults
| as required, but they're a perfect start for most applications.
|
|--------------------------------------------------------------------------
| Authentication Defaults
|--------------------------------------------------------------------------
|
| This option controls the default authentication "guard" and password
| reset options for your application. You may change these defaults
| as required, but they're a perfect start for most applications.
|
*/
'defaults' => [
@ -19,20 +19,20 @@ return [
],
/*
|--------------------------------------------------------------------------
| Authentication Guards
|--------------------------------------------------------------------------
|
| Next, you may define every authentication guard for your application.
| Of course, a great default configuration has been defined for you
| here which uses session storage and the Eloquent user provider.
|
| All authentication drivers have a user provider. This defines how the
| users are actually retrieved out of your database or other storage
| mechanisms used by this application to persist your user's data.
|
| Supported: "session", "token"
|
|--------------------------------------------------------------------------
| Authentication Guards
|--------------------------------------------------------------------------
|
| Next, you may define every authentication guard for your application.
| Of course, a great default configuration has been defined for you
| here which uses session storage and the Eloquent user provider.
|
| All authentication drivers have a user provider. This defines how the
| users are actually retrieved out of your database or other storage
| mechanisms used by this application to persist your user's data.
|
| Supported: "session", "token"
|
*/
'guards' => [
@ -43,20 +43,20 @@ return [
],
/*
|--------------------------------------------------------------------------
| User Providers
|--------------------------------------------------------------------------
|
| All authentication drivers have a user provider. This defines how the
| users are actually retrieved out of your database or other storage
| mechanisms used by this application to persist your user's data.
|
| If you have multiple user tables or models you may configure multiple
| sources which represent each model / table. These sources may then
| be assigned to any extra authentication guards you have defined.
|
| Supported: "session"
|
|--------------------------------------------------------------------------
| User Providers
|--------------------------------------------------------------------------
|
| All authentication drivers have a user provider. This defines how the
| users are actually retrieved out of your database or other storage
| mechanisms used by this application to persist your user's data.
|
| If you have multiple user tables or models you may configure multiple
| sources which represent each model / table. These sources may then
| be assigned to any extra authentication guards you have defined.
|
| Supported: "session"
|
*/
'providers' => [
@ -66,24 +66,24 @@ return [
],
// 'users' => [
// 'driver' => 'database',
// 'table' => 'users',
// 'driver' => 'database',
// 'table' => 'users',
// ],
],
/*
|--------------------------------------------------------------------------
| Resetting Passwords
|--------------------------------------------------------------------------
|
| You may specify multiple password reset configurations if you have more
| than one user table or model in the application and you want to have
| separate password reset settings based on the specific user types.
|
| The expire time is the number of minutes that each reset token will be
| considered valid. This security feature keeps tokens short-lived so
| they have less time to be guessed. You may change this as needed.
|
|--------------------------------------------------------------------------
| Resetting Passwords
|--------------------------------------------------------------------------
|
| You may specify multiple password reset configurations if you have more
| than one user table or model in the application and you want to have
| separate password reset settings based on the specific user types.
|
| The expire time is the number of minutes that each reset token will be
| considered valid. This security feature keeps tokens short-lived so
| they have less time to be guessed. You may change this as needed.
|
*/
'passwords' => [
@ -96,14 +96,14 @@ return [
],
/*
|--------------------------------------------------------------------------
| Password Confirmation Timeout
|--------------------------------------------------------------------------
|
| Here you may define the amount of seconds before a password confirmation
| times out and the user is prompted to re-enter their password via the
| confirmation screen. By default, the timeout lasts for three hours.
|
|--------------------------------------------------------------------------
| Password Confirmation Timeout
|--------------------------------------------------------------------------
|
| Here you may define the amount of seconds before a password confirmation
| times out and the user is prompted to re-enter their password via the
| confirmation screen. By default, the timeout lasts for three hours.
|
*/
'password_timeout' => 10800,

View file

@ -3,29 +3,29 @@
return [
/*
|--------------------------------------------------------------------------
| Default Broadcaster
|--------------------------------------------------------------------------
|
| This option controls the default broadcaster that will be used by the
| framework when an event needs to be broadcast. You may set this to
| any of the connections defined in the "connections" array below.
|
| Supported: "pusher", "ably", "redis", "log", "null"
|
|--------------------------------------------------------------------------
| Default Broadcaster
|--------------------------------------------------------------------------
|
| This option controls the default broadcaster that will be used by the
| framework when an event needs to be broadcast. You may set this to
| any of the connections defined in the "connections" array below.
|
| Supported: "pusher", "ably", "redis", "log", "null"
|
*/
'default' => env('BROADCAST_DRIVER', 'null'),
/*
|--------------------------------------------------------------------------
| Broadcast Connections
|--------------------------------------------------------------------------
|
| Here you may define all of the broadcast connections that will be used
| to broadcast events to other systems or over websockets. Samples of
| each available type of connection are provided inside this array.
|
|--------------------------------------------------------------------------
| Broadcast Connections
|--------------------------------------------------------------------------
|
| Here you may define all of the broadcast connections that will be used
| to broadcast events to other systems or over websockets. Samples of
| each available type of connection are provided inside this array.
|
*/
'connections' => [

View file

@ -5,30 +5,30 @@ use Illuminate\Support\Str;
return [
/*
|--------------------------------------------------------------------------
| Default Cache Store
|--------------------------------------------------------------------------
|
| This option controls the default cache connection that gets used while
| using this caching library. This connection is used when another is
| not explicitly specified when executing a given caching function.
|
|--------------------------------------------------------------------------
| Default Cache Store
|--------------------------------------------------------------------------
|
| This option controls the default cache connection that gets used while
| using this caching library. This connection is used when another is
| not explicitly specified when executing a given caching function.
|
*/
'default' => env('CACHE_DRIVER', 'file'),
/*
|--------------------------------------------------------------------------
| Cache Stores
|--------------------------------------------------------------------------
|
| Here you may define all of the cache "stores" for your application as
| well as their drivers. You may even define multiple stores for the
| same cache driver to group types of items stored in your caches.
|
| Supported drivers: "apc", "array", "database", "file",
| "memcached", "redis", "dynamodb", "octane", "null"
|
|--------------------------------------------------------------------------
| Cache Stores
|--------------------------------------------------------------------------
|
| Here you may define all of the cache "stores" for your application as
| well as their drivers. You may even define multiple stores for the
| same cache driver to group types of items stored in your caches.
|
| Supported drivers: "apc", "array", "database", "file",
| "memcached", "redis", "dynamodb", "octane", "null"
|
*/
'stores' => [
@ -93,16 +93,16 @@ return [
],
/*
|--------------------------------------------------------------------------
| Cache Key Prefix
|--------------------------------------------------------------------------
|
| When utilizing a RAM based store such as APC or Memcached, there might
| be other applications utilizing the same cache. So, we'll specify a
| value to get prefixed to all our keys so we can avoid collisions.
|
|--------------------------------------------------------------------------
| Cache Key Prefix
|--------------------------------------------------------------------------
|
| When utilizing a RAM based store such as APC or Memcached, there might
| be other applications utilizing the same cache. So, we'll specify a
| value to get prefixed to all our keys so we can avoid collisions.
|
*/
'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache'),
'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_') . '_cache'),
];

View file

@ -3,16 +3,16 @@
return [
/*
|--------------------------------------------------------------------------
| Cross-Origin Resource Sharing (CORS) Configuration
|--------------------------------------------------------------------------
|
| Here you may configure your settings for cross-origin resource sharing
| or "CORS". This determines what cross-origin operations may execute
| in web browsers. You are free to adjust these settings as needed.
|
| To learn more: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
|
|--------------------------------------------------------------------------
| Cross-Origin Resource Sharing (CORS) Configuration
|--------------------------------------------------------------------------
|
| Here you may configure your settings for cross-origin resource sharing
| or "CORS". This determines what cross-origin operations may execute
| in web browsers. You are free to adjust these settings as needed.
|
| To learn more: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
|
*/
'paths' => ['api/*', 'sanctum/csrf-cookie'],

View file

@ -3,32 +3,32 @@
return [
/*
|--------------------------------------------------------------------------
| Default Database Connection Name
|--------------------------------------------------------------------------
|
| Here you may specify which of the database connections below you wish
| to use as your default connection for all database work. Of course
| you may use many connections at once using the Database library.
|
|--------------------------------------------------------------------------
| Default Database Connection Name
|--------------------------------------------------------------------------
|
| Here you may specify which of the database connections below you wish
| to use as your default connection for all database work. Of course
| you may use many connections at once using the Database library.
|
*/
'default' => env('DB_CONNECTION', 'mysql'),
/*
|--------------------------------------------------------------------------
| Database Connections
|--------------------------------------------------------------------------
|
| Here are each of the database connections setup for your application.
| Of course, examples of configuring each database platform that is
| supported by Laravel is shown below to make development simple.
|
|
| All database work in Laravel is done through the PHP PDO facilities
| so make sure you have the driver for your particular database of
| choice installed on your machine before you begin development.
|
|--------------------------------------------------------------------------
| Database Connections
|--------------------------------------------------------------------------
|
| Here are each of the database connections setup for your application.
| Of course, examples of configuring each database platform that is
| supported by Laravel is shown below to make development simple.
|
|
| All database work in Laravel is done through the PHP PDO facilities
| so make sure you have the driver for your particular database of
| choice installed on your machine before you begin development.
|
*/
'connections' => [
@ -88,27 +88,27 @@ return [
],
/*
|--------------------------------------------------------------------------
| Migration Repository Table
|--------------------------------------------------------------------------
|
| This table keeps track of all the migrations that have already run for
| your application. Using this information, we can determine which of
| the migrations on disk haven't actually been run in the database.
|
|--------------------------------------------------------------------------
| Migration Repository Table
|--------------------------------------------------------------------------
|
| This table keeps track of all the migrations that have already run for
| your application. Using this information, we can determine which of
| the migrations on disk haven't actually been run in the database.
|
*/
'migrations' => 'migrations',
/*
|--------------------------------------------------------------------------
| Redis Databases
|--------------------------------------------------------------------------
|
| Redis is an open source, fast, and advanced key-value store that also
| provides a richer body of commands than a typical key-value system
| such as APC or Memcached. Laravel makes it easy to dig right in.
|
|--------------------------------------------------------------------------
| Redis Databases
|--------------------------------------------------------------------------
|
| Redis is an open source, fast, and advanced key-value store that also
| provides a richer body of commands than a typical key-value system
| such as APC or Memcached. Laravel makes it easy to dig right in.
|
*/
'redis' => [

View file

@ -3,14 +3,14 @@
return array(
/*
|--------------------------------------------------------------------------
| Custom Elasticsearch Client Configuration
|--------------------------------------------------------------------------
|
| This array will be passed to the Elasticsearch client.
| See configuration options here:
|
| http://www.elasticsearch.org/guide/en/elasticsearch/client/php-api/current/_configuration.html
|--------------------------------------------------------------------------
| Custom Elasticsearch Client Configuration
|--------------------------------------------------------------------------
|
| This array will be passed to the Elasticsearch client.
| See configuration options here:
|
| http://www.elasticsearch.org/guide/en/elasticsearch/client/php-api/current/_configuration.html
*/
'config' => [
@ -19,12 +19,12 @@ return array(
],
/*
|--------------------------------------------------------------------------
| Default Index Name
|--------------------------------------------------------------------------
|
| This is the index name that Elasticquent will use for all
| Elasticquent models.
|--------------------------------------------------------------------------
| Default Index Name
|--------------------------------------------------------------------------
|
| This is the index name that Elasticquent will use for all
| Elasticquent models.
*/
'default_index' => 'dam_index',

View file

@ -3,29 +3,29 @@
return [
/*
|--------------------------------------------------------------------------
| Default Filesystem Disk
|--------------------------------------------------------------------------
|
| Here you may specify the default filesystem disk that should be used
| by the framework. The "local" disk, as well as a variety of cloud
| based disks are available to your application. Just store away!
|
|--------------------------------------------------------------------------
| Default Filesystem Disk
|--------------------------------------------------------------------------
|
| Here you may specify the default filesystem disk that should be used
| by the framework. The "local" disk, as well as a variety of cloud
| based disks are available to your application. Just store away!
|
*/
'default' => env('FILESYSTEM_DRIVER', 'local'),
/*
|--------------------------------------------------------------------------
| Filesystem Disks
|--------------------------------------------------------------------------
|
| Here you may configure as many filesystem "disks" as you wish, and you
| may even configure multiple disks of the same driver. Defaults have
| been setup for each driver as an example of the required options.
|
| Supported Drivers: "local", "ftp", "sftp", "s3"
|
|--------------------------------------------------------------------------
| Filesystem Disks
|--------------------------------------------------------------------------
|
| Here you may configure as many filesystem "disks" as you wish, and you
| may even configure multiple disks of the same driver. Defaults have
| been setup for each driver as an example of the required options.
|
| Supported Drivers: "local", "ftp", "sftp", "s3"
|
*/
'disks' => [
@ -38,14 +38,14 @@ return [
'public' => [
'driver' => 'local',
'root' => storage_path('app/public'),
'url' => env('APP_URL').'/storage',
'url' => env('APP_URL') . '/storage',
'visibility' => 'public',
],
'arcadia' => [
'driver' => 'local',
'root' => storage_path('export_arcadia'),
],
'arcadia' => [
'driver' => 'local',
'root' => storage_path('export_arcadia'),
],
'arcadia_link_s' => [
'driver' => 'local',
@ -69,14 +69,14 @@ return [
],
/*
|--------------------------------------------------------------------------
| Symbolic Links
|--------------------------------------------------------------------------
|
| Here you may configure the symbolic links that will be created when the
| `storage:link` Artisan command is executed. The array keys should be
| the locations of the links and the values should be their targets.
|
|--------------------------------------------------------------------------
| Symbolic Links
|--------------------------------------------------------------------------
|
| Here you may configure the symbolic links that will be created when the
| `storage:link` Artisan command is executed. The array keys should be
| the locations of the links and the values should be their targets.
|
*/
'links' => [

View file

@ -3,29 +3,29 @@
return [
/*
|--------------------------------------------------------------------------
| Default Hash Driver
|--------------------------------------------------------------------------
|
| This option controls the default hash driver that will be used to hash
| passwords for your application. By default, the bcrypt algorithm is
| used; however, you remain free to modify this option if you wish.
|
| Supported: "bcrypt", "argon", "argon2id"
|
|--------------------------------------------------------------------------
| Default Hash Driver
|--------------------------------------------------------------------------
|
| This option controls the default hash driver that will be used to hash
| passwords for your application. By default, the bcrypt algorithm is
| used; however, you remain free to modify this option if you wish.
|
| Supported: "bcrypt", "argon", "argon2id"
|
*/
'driver' => 'bcrypt',
/*
|--------------------------------------------------------------------------
| Bcrypt Options
|--------------------------------------------------------------------------
|
| Here you may specify the configuration options that should be used when
| passwords are hashed using the Bcrypt algorithm. This will allow you
| to control the amount of time it takes to hash the given password.
|
|--------------------------------------------------------------------------
| Bcrypt Options
|--------------------------------------------------------------------------
|
| Here you may specify the configuration options that should be used when
| passwords are hashed using the Bcrypt algorithm. This will allow you
| to control the amount of time it takes to hash the given password.
|
*/
'bcrypt' => [
@ -33,14 +33,14 @@ return [
],
/*
|--------------------------------------------------------------------------
| Argon Options
|--------------------------------------------------------------------------
|
| Here you may specify the configuration options that should be used when
| passwords are hashed using the Argon algorithm. These will allow you
| to control the amount of time it takes to hash the given password.
|
|--------------------------------------------------------------------------
| Argon Options
|--------------------------------------------------------------------------
|
| Here you may specify the configuration options that should be used when
| passwords are hashed using the Argon algorithm. These will allow you
| to control the amount of time it takes to hash the given password.
|
*/
'argon' => [

View file

@ -3,32 +3,32 @@
return [
/*
|--------------------------------------------------------------------------
| Logging
|--------------------------------------------------------------------------
|
| This option enables logging all LDAP operations on all configured
| connections such as bind requests and CRUD operations.
|
| Log entries will be created in your default logging stack.
|
| This option is extremely helpful for debugging connectivity issues.
|
|--------------------------------------------------------------------------
| Logging
|--------------------------------------------------------------------------
|
| This option enables logging all LDAP operations on all configured
| connections such as bind requests and CRUD operations.
|
| Log entries will be created in your default logging stack.
|
| This option is extremely helpful for debugging connectivity issues.
|
*/
'logging' => env('LDAP_LOGGING', true),
/*
|--------------------------------------------------------------------------
| Connections
|--------------------------------------------------------------------------
|
| This array stores the connections that are added to Adldap. You can add
| as many connections as you like.
|
| The key is the name of the connection you wish to use and the value is
| an array of configuration settings.
|
|--------------------------------------------------------------------------
| Connections
|--------------------------------------------------------------------------
|
| This array stores the connections that are added to Adldap. You can add
| as many connections as you like.
|
| The key is the name of the connection you wish to use and the value is
| an array of configuration settings.
|
*/
'connections' => [
@ -36,199 +36,199 @@ return [
'default' => [
/*
|--------------------------------------------------------------------------
| Auto Connect
|--------------------------------------------------------------------------
|
| If auto connect is true, Adldap will try to automatically connect to
| your LDAP server in your configuration. This allows you to assume
| connectivity rather than having to connect manually
| in your application.
|
| If this is set to false, you **must** connect manually before running
| LDAP operations. Otherwise, you will receive exceptions.
|
|--------------------------------------------------------------------------
| Auto Connect
|--------------------------------------------------------------------------
|
| If auto connect is true, Adldap will try to automatically connect to
| your LDAP server in your configuration. This allows you to assume
| connectivity rather than having to connect manually
| in your application.
|
| If this is set to false, you **must** connect manually before running
| LDAP operations. Otherwise, you will receive exceptions.
|
*/
'auto_connect' => env('LDAP_AUTO_CONNECT', true),
/*
|--------------------------------------------------------------------------
| Connection
|--------------------------------------------------------------------------
|
| The connection class to use to run raw LDAP operations on.
|
| Custom connection classes must implement:
|
| Adldap\Connections\ConnectionInterface
|
|--------------------------------------------------------------------------
| Connection
|--------------------------------------------------------------------------
|
| The connection class to use to run raw LDAP operations on.
|
| Custom connection classes must implement:
|
| Adldap\Connections\ConnectionInterface
|
*/
'connection' => Adldap\Connections\Ldap::class,
/*
|--------------------------------------------------------------------------
| Connection Settings
|--------------------------------------------------------------------------
|
| This connection settings array is directly passed into the Adldap constructor.
|
| Feel free to add or remove settings you don't need.
|
|--------------------------------------------------------------------------
| Connection Settings
|--------------------------------------------------------------------------
|
| This connection settings array is directly passed into the Adldap constructor.
|
| Feel free to add or remove settings you don't need.
|
*/
'settings' => [
/*
|--------------------------------------------------------------------------
| Schema
|--------------------------------------------------------------------------
|
| The schema class to use for retrieving attributes and generating models.
|
| You can also set this option to `null` to use the default schema class.
|
| For OpenLDAP, you must use the schema:
|
| Adldap\Schemas\OpenLDAP::class
|
| For FreeIPA, you must use the schema:
|
| Adldap\Schemas\FreeIPA::class
|
| Custom schema classes must implement Adldap\Schemas\SchemaInterface
|
|--------------------------------------------------------------------------
| Schema
|--------------------------------------------------------------------------
|
| The schema class to use for retrieving attributes and generating models.
|
| You can also set this option to `null` to use the default schema class.
|
| For OpenLDAP, you must use the schema:
|
| Adldap\Schemas\OpenLDAP::class
|
| For FreeIPA, you must use the schema:
|
| Adldap\Schemas\FreeIPA::class
|
| Custom schema classes must implement Adldap\Schemas\SchemaInterface
|
*/
'schema' => Adldap\Schemas\OpenLDAP::class,
/*
|--------------------------------------------------------------------------
| Account Prefix
|--------------------------------------------------------------------------
|
| The account prefix option is the prefix of your user accounts in LDAP directory.
|
| This string is prepended to all authenticating users usernames.
|
|--------------------------------------------------------------------------
| Account Prefix
|--------------------------------------------------------------------------
|
| The account prefix option is the prefix of your user accounts in LDAP directory.
|
| This string is prepended to all authenticating users usernames.
|
*/
'account_prefix' => env('LDAP_ACCOUNT_PREFIX'),
/*
|--------------------------------------------------------------------------
| Account Suffix
|--------------------------------------------------------------------------
|
| The account suffix option is the suffix of your user accounts in your LDAP directory.
|
| This string is appended to all authenticating users usernames.
|
|--------------------------------------------------------------------------
| Account Suffix
|--------------------------------------------------------------------------
|
| The account suffix option is the suffix of your user accounts in your LDAP directory.
|
| This string is appended to all authenticating users usernames.
|
*/
'account_suffix' => env('LDAP_ACCOUNT_SUFFIX'),
/*
|--------------------------------------------------------------------------
| Domain Controllers
|--------------------------------------------------------------------------
|
| The domain controllers option is an array of servers located on your
| network that serve Active Directory. You can insert as many servers or
| as little as you'd like depending on your forest (with the
| minimum of one of course).
|
| These can be IP addresses of your server(s), or the host name.
|
|--------------------------------------------------------------------------
| Domain Controllers
|--------------------------------------------------------------------------
|
| The domain controllers option is an array of servers located on your
| network that serve Active Directory. You can insert as many servers or
| as little as you'd like depending on your forest (with the
| minimum of one of course).
|
| These can be IP addresses of your server(s), or the host name.
|
*/
'hosts' => explode(' ', env('LDAP_HOSTS')),
/*
|--------------------------------------------------------------------------
| Port
|--------------------------------------------------------------------------
|
| The port option is used for authenticating and binding to your LDAP server.
|
|--------------------------------------------------------------------------
| Port
|--------------------------------------------------------------------------
|
| The port option is used for authenticating and binding to your LDAP server.
|
*/
'port' => env('LDAP_PORT', 636),
/*
|--------------------------------------------------------------------------
| Timeout
|--------------------------------------------------------------------------
|
| The timeout option allows you to configure the amount of time in
| seconds that your application waits until a response
| is received from your LDAP server.
|
|--------------------------------------------------------------------------
| Timeout
|--------------------------------------------------------------------------
|
| The timeout option allows you to configure the amount of time in
| seconds that your application waits until a response
| is received from your LDAP server.
|
*/
'timeout' => env('LDAP_TIMEOUT', 5),
/*
|--------------------------------------------------------------------------
| Base Distinguished Name
|--------------------------------------------------------------------------
|
| The base distinguished name is the base distinguished name you'd
| like to perform query operations on. An example base DN would be:
|
| dc=corp,dc=acme,dc=org
|
| A correct base DN is required for any query results to be returned.
|
|--------------------------------------------------------------------------
| Base Distinguished Name
|--------------------------------------------------------------------------
|
| The base distinguished name is the base distinguished name you'd
| like to perform query operations on. An example base DN would be:
|
| dc=corp,dc=acme,dc=org
|
| A correct base DN is required for any query results to be returned.
|
*/
'base_dn' => env('LDAP_BASE_DN'),
/*
|--------------------------------------------------------------------------
| LDAP Username & Password
|--------------------------------------------------------------------------
|
| When connecting to your LDAP server, a username and password is required
| to be able to query and run operations on your server(s). You can
| use any user account that has these permissions. This account
| does not need to be a domain administrator unless you
| require changing and resetting user passwords.
|
|--------------------------------------------------------------------------
| LDAP Username & Password
|--------------------------------------------------------------------------
|
| When connecting to your LDAP server, a username and password is required
| to be able to query and run operations on your server(s). You can
| use any user account that has these permissions. This account
| does not need to be a domain administrator unless you
| require changing and resetting user passwords.
|
*/
'username' => env('LDAP_USERNAME'),
'password' => env('LDAP_PASSWORD'),
/*
|--------------------------------------------------------------------------
| Follow Referrals
|--------------------------------------------------------------------------
|
| The follow referrals option is a boolean to tell active directory
| to follow a referral to another server on your network if the
| server queried knows the information your asking for exists,
| but does not yet contain a copy of it locally.
|
| This option is defaulted to false.
|
|--------------------------------------------------------------------------
| Follow Referrals
|--------------------------------------------------------------------------
|
| The follow referrals option is a boolean to tell active directory
| to follow a referral to another server on your network if the
| server queried knows the information your asking for exists,
| but does not yet contain a copy of it locally.
|
| This option is defaulted to false.
|
*/
'follow_referrals' => false,
/*
|--------------------------------------------------------------------------
| SSL & TLS
|--------------------------------------------------------------------------
|
| If you need to be able to change user passwords on your server, then an
| SSL or TLS connection is required. All other operations are allowed
| on unsecured protocols.
|
| One of these options are definitely recommended if you
| have the ability to connect to your server securely.
|
|--------------------------------------------------------------------------
| SSL & TLS
|--------------------------------------------------------------------------
|
| If you need to be able to change user passwords on your server, then an
| SSL or TLS connection is required. All other operations are allowed
| on unsecured protocols.
|
| One of these options are definitely recommended if you
| have the ability to connect to your server securely.
|
*/
'use_ssl' => env('LDAP_USE_SSL', true),

View file

@ -3,90 +3,88 @@
return [
/*
|--------------------------------------------------------------------------
| Connection
|--------------------------------------------------------------------------
|
| The LDAP connection to use for Laravel authentication.
|
| You must specify connections in your `config/ldap.php` configuration file.
|
|--------------------------------------------------------------------------
| Connection
|--------------------------------------------------------------------------
|
| The LDAP connection to use for Laravel authentication.
|
| You must specify connections in your `config/ldap.php` configuration file.
|
*/
'connection' => env('LDAP_CONNECTION', 'default'),
/*
|--------------------------------------------------------------------------
| Provider
|--------------------------------------------------------------------------
|
| The LDAP authentication provider to use depending
| if you require database synchronization.
|
| For synchronizing LDAP users to your local applications database, use the provider:
|
| Adldap\Laravel\Auth\DatabaseUserProvider::class
|
| Otherwise, if you just require LDAP authentication, use the provider:
|
| Adldap\Laravel\Auth\NoDatabaseUserProvider::class
|
|--------------------------------------------------------------------------
| Provider
|--------------------------------------------------------------------------
|
| The LDAP authentication provider to use depending
| if you require database synchronization.
|
| For synchronizing LDAP users to your local applications database, use the provider:
|
| Adldap\Laravel\Auth\DatabaseUserProvider::class
|
| Otherwise, if you just require LDAP authentication, use the provider:
|
| Adldap\Laravel\Auth\NoDatabaseUserProvider::class
|
*/
'provider' => Adldap\Laravel\Auth\DatabaseUserProvider::class,
/*
|--------------------------------------------------------------------------
| Model
|--------------------------------------------------------------------------
|
| The model to utilize for authentication and importing.
|
| This option is only applicable to the DatabaseUserProvider.
|
|--------------------------------------------------------------------------
| Model
|--------------------------------------------------------------------------
|
| The model to utilize for authentication and importing.
|
| This option is only applicable to the DatabaseUserProvider.
|
*/
'model' => App\Models\User::class,
/*
|--------------------------------------------------------------------------
| Rules
|--------------------------------------------------------------------------
|
| Rules allow you to control user authentication requests depending on scenarios.
|
| You can create your own rules and insert them here.
|
| All rules must extend from the following class:
|
| Adldap\Laravel\Validation\Rules\Rule
|
|--------------------------------------------------------------------------
| Rules
|--------------------------------------------------------------------------
|
| Rules allow you to control user authentication requests depending on scenarios.
|
| You can create your own rules and insert them here.
|
| All rules must extend from the following class:
|
| Adldap\Laravel\Validation\Rules\Rule
|
*/
'rules' => [
// Denys deleted users from authenticating.
Adldap\Laravel\Validation\Rules\DenyTrashed::class,
// Allows only manually imported users to authenticate.
Adldap\Laravel\Validation\Rules\OnlyImported::class,
],
/*
|--------------------------------------------------------------------------
| Scopes
|--------------------------------------------------------------------------
|
| Scopes allow you to restrict the LDAP query that locates
| users upon import and authentication.
|
| All scopes must implement the following interface:
|
| Adldap\Laravel\Scopes\ScopeInterface
|
|--------------------------------------------------------------------------
| Scopes
|--------------------------------------------------------------------------
|
| Scopes allow you to restrict the LDAP query that locates
| users upon import and authentication.
|
| All scopes must implement the following interface:
|
| Adldap\Laravel\Scopes\ScopeInterface
|
*/
'scopes' => [
@ -94,7 +92,6 @@ return [
// Only allows users with a user principal name to authenticate.
// Suitable when using ActiveDirectory.
// Adldap\Laravel\Scopes\UpnScope::class,
// Only allows users with a uid to authenticate.
// Suitable when using OpenLDAP.
Adldap\Laravel\Scopes\UidScope::class,
@ -104,31 +101,31 @@ return [
'identifiers' => [
/*
|--------------------------------------------------------------------------
| LDAP
|--------------------------------------------------------------------------
|
| Locate Users By:
|
| This value is the users attribute you would like to locate LDAP
| users by in your directory.
|
| For example, using the default configuration below, if you're
| authenticating users with an email address, your LDAP server
| will be queried for a user with the a `userprincipalname`
| equal to the entered email address.
|
| Bind Users By:
|
| This value is the users attribute you would
| like to use to bind to your LDAP server.
|
| For example, when a user is located by the above attribute,
| the users attribute you specify below will be used as
| the 'username' to bind to your LDAP server.
|
| This is usually their distinguished name.
|
|--------------------------------------------------------------------------
| LDAP
|--------------------------------------------------------------------------
|
| Locate Users By:
|
| This value is the users attribute you would like to locate LDAP
| users by in your directory.
|
| For example, using the default configuration below, if you're
| authenticating users with an email address, your LDAP server
| will be queried for a user with the a `userprincipalname`
| equal to the entered email address.
|
| Bind Users By:
|
| This value is the users attribute you would
| like to use to bind to your LDAP server.
|
| For example, when a user is located by the above attribute,
| the users attribute you specify below will be used as
| the 'username' to bind to your LDAP server.
|
| This is usually their distinguished name.
|
*/
'ldap' => [
@ -142,33 +139,33 @@ return [
'database' => [
/*
|--------------------------------------------------------------------------
| GUID Column
|--------------------------------------------------------------------------
|
| The value of this option is the database column that will contain the
| LDAP users global identifier. This column does not need to be added
| to the sync attributes below. It is synchronized automatically.
|
| This option is only applicable to the DatabaseUserProvider.
|
|--------------------------------------------------------------------------
| GUID Column
|--------------------------------------------------------------------------
|
| The value of this option is the database column that will contain the
| LDAP users global identifier. This column does not need to be added
| to the sync attributes below. It is synchronized automatically.
|
| This option is only applicable to the DatabaseUserProvider.
|
*/
'guid_column' => 'objectguid',
/*
|--------------------------------------------------------------------------
| Username Column
|--------------------------------------------------------------------------
|
| The value of this option is the database column that contains your
| users login username.
|
| This column must be added to your sync attributes below to be
| properly synchronized.
|
| This option is only applicable to the DatabaseUserProvider.
|
|--------------------------------------------------------------------------
| Username Column
|--------------------------------------------------------------------------
|
| The value of this option is the database column that contains your
| users login username.
|
| This column must be added to your sync attributes below to be
| properly synchronized.
|
| This option is only applicable to the DatabaseUserProvider.
|
*/
'username_column' => 'matricule',
@ -176,29 +173,29 @@ return [
],
/*
|--------------------------------------------------------------------------
| Windows Authentication Middleware (SSO)
|--------------------------------------------------------------------------
|
| Local Users By:
|
| This value is the users attribute you would like to locate LDAP
| users by in your directory.
|
| For example, if 'samaccountname' is the value, then your LDAP server is
| queried for a user with the 'samaccountname' equal to the value of
| $_SERVER['AUTH_USER'].
|
| If a user is found, they are imported (if using the DatabaseUserProvider)
| into your local database, then logged in.
|
| Server Key:
|
| This value represents the 'key' of the $_SERVER
| array to pull the users account name from.
|
| For example, $_SERVER['AUTH_USER'].
|
|--------------------------------------------------------------------------
| Windows Authentication Middleware (SSO)
|--------------------------------------------------------------------------
|
| Local Users By:
|
| This value is the users attribute you would like to locate LDAP
| users by in your directory.
|
| For example, if 'samaccountname' is the value, then your LDAP server is
| queried for a user with the 'samaccountname' equal to the value of
| $_SERVER['AUTH_USER'].
|
| If a user is found, they are imported (if using the DatabaseUserProvider)
| into your local database, then logged in.
|
| Server Key:
|
| This value represents the 'key' of the $_SERVER
| array to pull the users account name from.
|
| For example, $_SERVER['AUTH_USER'].
|
*/
'windows' => [
@ -214,39 +211,39 @@ return [
'passwords' => [
/*
|--------------------------------------------------------------------------
| Password Sync
|--------------------------------------------------------------------------
|
| The password sync option allows you to automatically synchronize users
| LDAP passwords to your local database. These passwords are hashed
| natively by Laravel using the Hash::make() method.
|
| Enabling this option would also allow users to login to their accounts
| using the password last used when an LDAP connection was present.
|
| If this option is disabled, the local database account is applied a
| random 16 character hashed password upon first login, and will
| lose access to this account upon loss of LDAP connectivity.
|
| This option is only applicable to the DatabaseUserProvider.
|
|--------------------------------------------------------------------------
| Password Sync
|--------------------------------------------------------------------------
|
| The password sync option allows you to automatically synchronize users
| LDAP passwords to your local database. These passwords are hashed
| natively by Laravel using the Hash::make() method.
|
| Enabling this option would also allow users to login to their accounts
| using the password last used when an LDAP connection was present.
|
| If this option is disabled, the local database account is applied a
| random 16 character hashed password upon first login, and will
| lose access to this account upon loss of LDAP connectivity.
|
| This option is only applicable to the DatabaseUserProvider.
|
*/
'sync' => env('LDAP_PASSWORD_SYNC', false),
/*
|--------------------------------------------------------------------------
| Column
|--------------------------------------------------------------------------
|
| This is the column of your users database table
| that is used to store passwords.
|
| Set this to `null` if you do not have a password column.
|
| This option is only applicable to the DatabaseUserProvider.
|
|--------------------------------------------------------------------------
| Column
|--------------------------------------------------------------------------
|
| This is the column of your users database table
| that is used to store passwords.
|
| Set this to `null` if you do not have a password column.
|
| This option is only applicable to the DatabaseUserProvider.
|
*/
'column' => 'password',
@ -254,37 +251,37 @@ return [
],
/*
|--------------------------------------------------------------------------
| Login Fallback
|--------------------------------------------------------------------------
|
| The login fallback option allows you to login as a user located in the
| local database if active directory authentication fails.
|
| Set this to true if you would like to enable it.
|
| This option is only applicable to the DatabaseUserProvider.
|
|--------------------------------------------------------------------------
| Login Fallback
|--------------------------------------------------------------------------
|
| The login fallback option allows you to login as a user located in the
| local database if active directory authentication fails.
|
| Set this to true if you would like to enable it.
|
| This option is only applicable to the DatabaseUserProvider.
|
*/
'login_fallback' => env('LDAP_LOGIN_FALLBACK', true),
/*
|--------------------------------------------------------------------------
| Sync Attributes
|--------------------------------------------------------------------------
|
| Attributes specified here will be added / replaced on the user model
| upon login, automatically synchronizing and keeping the attributes
| up to date.
|
| The array key represents the users Laravel model key, and
| the value represents the users LDAP attribute.
|
| You **must** include the users login attribute here.
|
| This option is only applicable to the DatabaseUserProvider.
|
|--------------------------------------------------------------------------
| Sync Attributes
|--------------------------------------------------------------------------
|
| Attributes specified here will be added / replaced on the user model
| upon login, automatically synchronizing and keeping the attributes
| up to date.
|
| The array key represents the users Laravel model key, and
| the value represents the users LDAP attribute.
|
| You **must** include the users login attribute here.
|
| This option is only applicable to the DatabaseUserProvider.
|
*/
'sync_attributes' => [
@ -296,23 +293,23 @@ return [
],
/*
|--------------------------------------------------------------------------
| Logging
|--------------------------------------------------------------------------
|
| User authentication attempts will be logged using Laravel's
| default logger if this setting is enabled.
|
| No credentials are logged, only usernames.
|
| This is usually stored in the '/storage/logs' directory
| in the root of your application.
|
| This option is useful for debugging as well as auditing.
|
| You can freely remove any events you would not like to log below,
| as well as use your own listeners if you would prefer.
|
|--------------------------------------------------------------------------
| Logging
|--------------------------------------------------------------------------
|
| User authentication attempts will be logged using Laravel's
| default logger if this setting is enabled.
|
| No credentials are logged, only usernames.
|
| This is usually stored in the '/storage/logs' directory
| in the root of your application.
|
| This option is useful for debugging as well as auditing.
|
| You can freely remove any events you would not like to log below,
| as well as use your own listeners if you would prefer.
|
*/
'logging' => [

View file

@ -7,44 +7,44 @@ use Monolog\Handler\SyslogUdpHandler;
return [
/*
|--------------------------------------------------------------------------
| Default Log Channel
|--------------------------------------------------------------------------
|
| This option defines the default log channel that gets used when writing
| messages to the logs. The name specified in this option should match
| one of the channels defined in the "channels" configuration array.
|
|--------------------------------------------------------------------------
| Default Log Channel
|--------------------------------------------------------------------------
|
| This option defines the default log channel that gets used when writing
| messages to the logs. The name specified in this option should match
| one of the channels defined in the "channels" configuration array.
|
*/
'default' => env('LOG_CHANNEL', 'stack'),
/*
|--------------------------------------------------------------------------
| Deprecations Log Channel
|--------------------------------------------------------------------------
|
| This option controls the log channel that should be used to log warnings
| regarding deprecated PHP and library features. This allows you to get
| your application ready for upcoming major versions of dependencies.
|
|--------------------------------------------------------------------------
| Deprecations Log Channel
|--------------------------------------------------------------------------
|
| This option controls the log channel that should be used to log warnings
| regarding deprecated PHP and library features. This allows you to get
| your application ready for upcoming major versions of dependencies.
|
*/
'deprecations' => env('LOG_DEPRECATIONS_CHANNEL', 'null'),
/*
|--------------------------------------------------------------------------
| Log Channels
|--------------------------------------------------------------------------
|
| Here you may configure the log channels for your application. Out of
| the box, Laravel uses the Monolog PHP logging library. This gives
| you a variety of powerful log handlers / formatters to utilize.
|
| Available Drivers: "single", "daily", "slack", "syslog",
| "errorlog", "monolog",
| "custom", "stack"
|
|--------------------------------------------------------------------------
| Log Channels
|--------------------------------------------------------------------------
|
| Here you may configure the log channels for your application. Out of
| the box, Laravel uses the Monolog PHP logging library. This gives
| you a variety of powerful log handlers / formatters to utilize.
|
| Available Drivers: "single", "daily", "slack", "syslog",
| "errorlog", "monolog",
| "custom", "stack"
|
*/
'channels' => [

View file

@ -3,29 +3,29 @@
return [
/*
|--------------------------------------------------------------------------
| Default Queue Connection Name
|--------------------------------------------------------------------------
|
| Laravel's queue API supports an assortment of back-ends via a single
| API, giving you convenient access to each back-end using the same
| syntax for every one. Here you may define a default connection.
|
|--------------------------------------------------------------------------
| Default Queue Connection Name
|--------------------------------------------------------------------------
|
| Laravel's queue API supports an assortment of back-ends via a single
| API, giving you convenient access to each back-end using the same
| syntax for every one. Here you may define a default connection.
|
*/
'default' => env('QUEUE_CONNECTION', 'sync'),
/*
|--------------------------------------------------------------------------
| Queue Connections
|--------------------------------------------------------------------------
|
| Here you may configure the connection information for each server that
| is used by your application. A default configuration has been added
| for each back-end shipped with Laravel. You are free to add more.
|
| Drivers: "sync", "database", "beanstalkd", "sqs", "redis", "null"
|
|--------------------------------------------------------------------------
| Queue Connections
|--------------------------------------------------------------------------
|
| Here you may configure the connection information for each server that
| is used by your application. A default configuration has been added
| for each back-end shipped with Laravel. You are free to add more.
|
| Drivers: "sync", "database", "beanstalkd", "sqs", "redis", "null"
|
*/
'connections' => [
@ -73,14 +73,14 @@ return [
],
/*
|--------------------------------------------------------------------------
| Failed Queue Jobs
|--------------------------------------------------------------------------
|
| These options configure the behavior of failed queue job logging so you
| can control which database and table are used to store the jobs that
| have failed. You may change them to any database / table you wish.
|
|--------------------------------------------------------------------------
| Failed Queue Jobs
|--------------------------------------------------------------------------
|
| These options configure the behavior of failed queue job logging so you
| can control which database and table are used to store the jobs that
| have failed. You may change them to any database / table you wish.
|
*/
'failed' => [

View file

@ -3,14 +3,14 @@
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 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(
@ -20,41 +20,41 @@ return [
))),
/*
|--------------------------------------------------------------------------
| 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.
|
|--------------------------------------------------------------------------
| 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. If this value is null, personal access tokens do
| not expire. This won't tweak the lifetime of first-party sessions.
|
|--------------------------------------------------------------------------
| Expiration Minutes
|--------------------------------------------------------------------------
|
| This value controls the number of minutes until an issued token will be
| considered expired. If this value is null, personal access tokens do
| not expire. This won't tweak the lifetime of first-party sessions.
|
*/
'expiration' => null,
/*
|--------------------------------------------------------------------------
| 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.
|
|--------------------------------------------------------------------------
| 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' => [

View file

@ -3,15 +3,15 @@
return [
/*
|--------------------------------------------------------------------------
| Third Party Services
|--------------------------------------------------------------------------
|
| This file is for storing the credentials for third party services such
| as Mailgun, Postmark, AWS and more. This file provides the de facto
| default location for this type of information, allowing packages
| to have a conventional place to find your various credentials.
|
|--------------------------------------------------------------------------
| Third Party Services
|--------------------------------------------------------------------------
|
| This file is for storing the credentials for third party services such
| as Mailgun, Postmark, AWS and more. This file provides the de facto
| default location for this type of information, allowing packages
| to have a conventional place to find your various credentials.
|
*/
'mailgun' => [

View file

@ -5,30 +5,30 @@ use Illuminate\Support\Str;
return [
/*
|--------------------------------------------------------------------------
| Default Session Driver
|--------------------------------------------------------------------------
|
| This option controls the default session "driver" that will be used on
| requests. By default, we will use the lightweight native driver but
| you may specify any of the other wonderful drivers provided here.
|
| Supported: "file", "cookie", "database", "apc",
| "memcached", "redis", "dynamodb", "array"
|
|--------------------------------------------------------------------------
| Default Session Driver
|--------------------------------------------------------------------------
|
| This option controls the default session "driver" that will be used on
| requests. By default, we will use the lightweight native driver but
| you may specify any of the other wonderful drivers provided here.
|
| Supported: "file", "cookie", "database", "apc",
| "memcached", "redis", "dynamodb", "array"
|
*/
'driver' => env('SESSION_DRIVER', 'file'),
/*
|--------------------------------------------------------------------------
| Session Lifetime
|--------------------------------------------------------------------------
|
| Here you may specify the number of minutes that you wish the session
| to be allowed to remain idle before it expires. If you want them
| to immediately expire on the browser closing, set that option.
|
|--------------------------------------------------------------------------
| Session Lifetime
|--------------------------------------------------------------------------
|
| Here you may specify the number of minutes that you wish the session
| to be allowed to remain idle before it expires. If you want them
| to immediately expire on the browser closing, set that option.
|
*/
'lifetime' => env('SESSION_LIFETIME', 120),
@ -36,164 +36,164 @@ return [
'expire_on_close' => false,
/*
|--------------------------------------------------------------------------
| Session Encryption
|--------------------------------------------------------------------------
|
| This option allows you to easily specify that all of your session data
| should be encrypted before it is stored. All encryption will be run
| automatically by Laravel and you can use the Session like normal.
|
|--------------------------------------------------------------------------
| Session Encryption
|--------------------------------------------------------------------------
|
| This option allows you to easily specify that all of your session data
| should be encrypted before it is stored. All encryption will be run
| automatically by Laravel and you can use the Session like normal.
|
*/
'encrypt' => false,
/*
|--------------------------------------------------------------------------
| Session File Location
|--------------------------------------------------------------------------
|
| When using the native session driver, we need a location where session
| files may be stored. A default has been set for you but a different
| location may be specified. This is only needed for file sessions.
|
|--------------------------------------------------------------------------
| Session File Location
|--------------------------------------------------------------------------
|
| When using the native session driver, we need a location where session
| files may be stored. A default has been set for you but a different
| location may be specified. This is only needed for file sessions.
|
*/
'files' => storage_path('framework/sessions'),
/*
|--------------------------------------------------------------------------
| Session Database Connection
|--------------------------------------------------------------------------
|
| When using the "database" or "redis" session drivers, you may specify a
| connection that should be used to manage these sessions. This should
| correspond to a connection in your database configuration options.
|
|--------------------------------------------------------------------------
| Session Database Connection
|--------------------------------------------------------------------------
|
| When using the "database" or "redis" session drivers, you may specify a
| connection that should be used to manage these sessions. This should
| correspond to a connection in your database configuration options.
|
*/
'connection' => env('SESSION_CONNECTION', null),
/*
|--------------------------------------------------------------------------
| Session Database Table
|--------------------------------------------------------------------------
|
| When using the "database" session driver, you may specify the table we
| should use to manage the sessions. Of course, a sensible default is
| provided for you; however, you are free to change this as needed.
|
|--------------------------------------------------------------------------
| Session Database Table
|--------------------------------------------------------------------------
|
| When using the "database" session driver, you may specify the table we
| should use to manage the sessions. Of course, a sensible default is
| provided for you; however, you are free to change this as needed.
|
*/
'table' => 'sessions',
/*
|--------------------------------------------------------------------------
| Session Cache Store
|--------------------------------------------------------------------------
|
| While using one of the framework's cache driven session backends you may
| list a cache store that should be used for these sessions. This value
| must match with one of the application's configured cache "stores".
|
| Affects: "apc", "dynamodb", "memcached", "redis"
|
|--------------------------------------------------------------------------
| Session Cache Store
|--------------------------------------------------------------------------
|
| While using one of the framework's cache driven session backends you may
| list a cache store that should be used for these sessions. This value
| must match with one of the application's configured cache "stores".
|
| Affects: "apc", "dynamodb", "memcached", "redis"
|
*/
'store' => env('SESSION_STORE', null),
/*
|--------------------------------------------------------------------------
| Session Sweeping Lottery
|--------------------------------------------------------------------------
|
| Some session drivers must manually sweep their storage location to get
| rid of old sessions from storage. Here are the chances that it will
| happen on a given request. By default, the odds are 2 out of 100.
|
|--------------------------------------------------------------------------
| Session Sweeping Lottery
|--------------------------------------------------------------------------
|
| Some session drivers must manually sweep their storage location to get
| rid of old sessions from storage. Here are the chances that it will
| happen on a given request. By default, the odds are 2 out of 100.
|
*/
'lottery' => [2, 100],
/*
|--------------------------------------------------------------------------
| Session Cookie Name
|--------------------------------------------------------------------------
|
| Here you may change the name of the cookie used to identify a session
| instance by ID. The name specified here will get used every time a
| new session cookie is created by the framework for every driver.
|
|--------------------------------------------------------------------------
| Session Cookie Name
|--------------------------------------------------------------------------
|
| Here you may change the name of the cookie used to identify a session
| instance by ID. The name specified here will get used every time a
| new session cookie is created by the framework for every driver.
|
*/
'cookie' => env(
'SESSION_COOKIE',
Str::slug(env('APP_NAME', 'laravel'), '_').'_session'
Str::slug(env('APP_NAME', 'laravel'), '_') . '_session'
),
/*
|--------------------------------------------------------------------------
| Session Cookie Path
|--------------------------------------------------------------------------
|
| The session cookie path determines the path for which the cookie will
| be regarded as available. Typically, this will be the root path of
| your application but you are free to change this when necessary.
|
|--------------------------------------------------------------------------
| Session Cookie Path
|--------------------------------------------------------------------------
|
| The session cookie path determines the path for which the cookie will
| be regarded as available. Typically, this will be the root path of
| your application but you are free to change this when necessary.
|
*/
'path' => '/',
/*
|--------------------------------------------------------------------------
| Session Cookie Domain
|--------------------------------------------------------------------------
|
| Here you may change the domain of the cookie used to identify a session
| in your application. This will determine which domains the cookie is
| available to in your application. A sensible default has been set.
|
|--------------------------------------------------------------------------
| Session Cookie Domain
|--------------------------------------------------------------------------
|
| Here you may change the domain of the cookie used to identify a session
| in your application. This will determine which domains the cookie is
| available to in your application. A sensible default has been set.
|
*/
'domain' => env('SESSION_DOMAIN', null),
/*
|--------------------------------------------------------------------------
| HTTPS Only Cookies
|--------------------------------------------------------------------------
|
| By setting this option to true, session cookies will only be sent back
| to the server if the browser has a HTTPS connection. This will keep
| the cookie from being sent to you when it can't be done securely.
|
|--------------------------------------------------------------------------
| HTTPS Only Cookies
|--------------------------------------------------------------------------
|
| By setting this option to true, session cookies will only be sent back
| to the server if the browser has a HTTPS connection. This will keep
| the cookie from being sent to you when it can't be done securely.
|
*/
'secure' => env('SESSION_SECURE_COOKIE'),
/*
|--------------------------------------------------------------------------
| HTTP Access Only
|--------------------------------------------------------------------------
|
| Setting this value to true will prevent JavaScript from accessing the
| value of the cookie and the cookie will only be accessible through
| the HTTP protocol. You are free to modify this option if needed.
|
|--------------------------------------------------------------------------
| HTTP Access Only
|--------------------------------------------------------------------------
|
| Setting this value to true will prevent JavaScript from accessing the
| value of the cookie and the cookie will only be accessible through
| the HTTP protocol. You are free to modify this option if needed.
|
*/
'http_only' => true,
/*
|--------------------------------------------------------------------------
| Same-Site Cookies
|--------------------------------------------------------------------------
|
| This option determines how your cookies behave when cross-site requests
| take place, and can be used to mitigate CSRF attacks. By default, we
| will set this value to "lax" since this is a secure default value.
|
| Supported: "lax", "strict", "none", null
|
|--------------------------------------------------------------------------
| Same-Site Cookies
|--------------------------------------------------------------------------
|
| This option determines how your cookies behave when cross-site requests
| take place, and can be used to mitigate CSRF attacks. By default, we
| will set this value to "lax" since this is a secure default value.
|
| Supported: "lax", "strict", "none", null
|
*/
'same_site' => 'lax',

View file

@ -3,14 +3,14 @@
return [
/*
|--------------------------------------------------------------------------
| View Storage Paths
|--------------------------------------------------------------------------
|
| Most templating systems load templates from disk. Here you may specify
| an array of paths that should be checked for your views. Of course
| the usual Laravel view path has already been registered for you.
|
|--------------------------------------------------------------------------
| View Storage Paths
|--------------------------------------------------------------------------
|
| Most templating systems load templates from disk. Here you may specify
| an array of paths that should be checked for your views. Of course
| the usual Laravel view path has already been registered for you.
|
*/
'paths' => [
@ -18,14 +18,14 @@ return [
],
/*
|--------------------------------------------------------------------------
| Compiled View Path
|--------------------------------------------------------------------------
|
| This option determines where all the compiled Blade templates will be
| stored for your application. Typically, this is within the storage
| directory. However, as usual, you are free to change this value.
|
|--------------------------------------------------------------------------
| Compiled View Path
|--------------------------------------------------------------------------
|
| This option determines where all the compiled Blade templates will be
| stored for your application. Typically, this is within the storage
| directory. However, as usual, you are free to change this value.
|
*/
'compiled' => env(

View file

@ -18,7 +18,8 @@ class UserFactory extends Factory
'name' => $this->faker->name(),
'email' => $this->faker->unique()->safeEmail(),
'email_verified_at' => now(),
'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password
'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi',
// password
'remember_token' => Str::random(10),
];
}

View file

@ -1,7 +1,6 @@
<?php
// TODO: Faire le tri des routes.
use App\Http\Controllers\ArcadiaLinkController;
use App\Http\Controllers\CommunController;
use App\Http\Controllers\DossierController;

View file

@ -13,7 +13,7 @@ trait CreatesApplication
*/
public function createApplication()
{
$app = require __DIR__.'/../bootstrap/app.php';
$app = require __DIR__ . '/../bootstrap/app.php';
$app->make(Kernel::class)->bootstrap();

View file

@ -3,7 +3,6 @@
namespace Tests\Feature;
use Tests\TestCase;
use Illuminate\Foundation\Testing\RefreshDatabase;
class ExampleTest extends TestCase
{
@ -12,7 +11,7 @@ class ExampleTest extends TestCase
*
* @return void
*/
public function test_example()
public function testExample()
{
$response = $this->get('/');

View file

@ -3,7 +3,6 @@
namespace Tests\Unit;
use Tests\TestCase;
use Illuminate\Foundation\Testing\RefreshDatabase;
class ExampleTest extends TestCase
{
@ -12,7 +11,7 @@ class ExampleTest extends TestCase
*
* @return void
*/
public function test_example()
public function testExample()
{
$this->assertTrue(true);
}