Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
dbarzin committed Jul 10, 2021
1 parent 71c210c commit f02a68d
Show file tree
Hide file tree
Showing 458 changed files with 418,471 additions and 0 deletions.
41 changes: 41 additions & 0 deletions app/Console/Kernel.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php

namespace App\Console;

use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;

class Kernel extends ConsoleKernel
{
/**
* The Artisan commands provided by your application.
*
* @var array
*/
protected $commands = [
//
];

/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
// $schedule->command('inspire')->hourly();
}

/**
* Register the commands for the application.
*
* @return void
*/
protected function commands()
{
$this->load(__DIR__.'/Commands');

include base_path('routes/console.php');
}
}
43 changes: 43 additions & 0 deletions app/Control.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?php

namespace App;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;

class Control extends Model
{

public static $searchable = [
'name',
'clause',
'objective',
'attributes',
'model'
];

protected $dates = [
'created_at',
'updated_at',
'deleted_at',
];

protected $fillable = [
];

// return the domain associated to this Control
public function domain(int $id)
{
return Domain::find($id);
}

// check if there is a measuremetn associated with this control

public function isActive(int $id)
{
return DB::table('measurements')
->where('control_id', $id)
->whereNull('realisation_date')
->exists();
}
}
11 changes: 11 additions & 0 deletions app/Document.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Document extends Model
{
//

}
24 changes: 24 additions & 0 deletions app/Domain.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Domain extends Model
{
//
public static $searchable = [
'title',
'description',
];

protected $dates = [
'created_at',
'updated_at',
'deleted_at',
];

protected $fillable = [
];

}
55 changes: 55 additions & 0 deletions app/Exceptions/Handler.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?php

namespace App\Exceptions;

use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Throwable;

class Handler extends ExceptionHandler
{
/**
* A list of the exception types that are not reported.
*
* @var array
*/
protected $dontReport = [
//
];

/**
* A list of the inputs that are never flashed for validation exceptions.
*
* @var array
*/
protected $dontFlash = [
'password',
'password_confirmation',
];

/**
* Report or log an exception.
*
* @param \Throwable $exception
* @return void
*
* @throws \Exception
*/
public function report(Throwable $exception)
{
parent::report($exception);
}

/**
* Render an exception into an HTTP response.
*
* @param \Illuminate\Http\Request $request
* @param \Throwable $exception
* @return \Symfony\Component\HttpFoundation\Response
*
* @throws \Throwable
*/
public function render($request, Throwable $exception)
{
return parent::render($request, $exception);
}
}
91 changes: 91 additions & 0 deletions app/Exports/ControlsExport.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
<?php

namespace App\Exports;

use App\Control;

use Illuminate\Support\Facades\DB;
use Maatwebsite\Excel\Concerns\FromCollection;
use Maatwebsite\Excel\Concerns\FromQuery;
use Maatwebsite\Excel\Concerns\WithMapping;
use Maatwebsite\Excel\Concerns\WithStyles;
use Maatwebsite\Excel\Concerns\WithHeadings;
use Maatwebsite\Excel\Concerns\WithColumnWidths;

use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;

class ControlsExport implements FromQuery, WithMapping, WithHeadings, WithStyles, WithColumnWidths
{
public function headings(): array
{
return [
'Clause',
'Nom',
'Objctif',
'Attributs',
'Modèle',
'Indicateur',
'Plan d\'action',
'Responsable',
'Périodicité'
];
}

public function styles(Worksheet $sheet)
{
return [
// Style the first row as bold text.
1 => ['font' => ['bold' => true],
'alignment' => [
'wrapText' => true,
'vertical' => 'top'
],
]
];
}

public function columnWidths(): array
{
return [
'A' => 10, // Clause
'B' => 30, // Nom
'C' => 50, // Objectif
'D' => 50, // Attibuts
'E' => 50, // Modele
'F' => 50, // Indicateur
'G' => 50, // Plan d'action
'H' => 20, // Responsable
'I' => 20 // Period
];
}

/**
* @var Control $control
*/
public function map($control): array
{
return [
[
$control->clause,
$control->name,
$control->objective,
$control->attributes,
$control->model,
$control->indicator,
$control->action_plan,
$control->owner,
$control->periodicity
]
];
}

/**
* @return \Illuminate\Support\Collection
*/
public function query()
{
// return Domain::all();
return DB::table('controls')->orderBy("clause");
}

}
64 changes: 64 additions & 0 deletions app/Exports/DomainsExport.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<?php

namespace App\Exports;

use App\Domain;

use Illuminate\Support\Facades\DB;
use Maatwebsite\Excel\Concerns\FromCollection;
use Maatwebsite\Excel\Concerns\FromQuery;
use Maatwebsite\Excel\Concerns\WithMapping;
use Maatwebsite\Excel\Concerns\WithStyles;
use Maatwebsite\Excel\Concerns\WithHeadings;
use Maatwebsite\Excel\Concerns\WithColumnWidths;
use Maatwebsite\Excel\Concerns\ShouldAutoSize;

use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;

class DomainsExport implements FromQuery, WithMapping, WithHeadings, WithStyles, WithColumnWidths, ShouldAutoSize
{
public function headings(): array
{
return [
'#',
'Description'
];
}

public function styles(Worksheet $sheet)
{
return [
// Style the first row as bold text.
1 => ['font' => ['bold' => true]]
];
}

public function columnWidths(): array
{
return [
'A' => 5,
'B' => 50,
];
}

/**
* @var Domain $domain
*/
public function map($domain): array
{
return [
[
$domain->title, $domain->description
]
];
}

/**
* @return \Illuminate\Support\Collection
*/
public function query()
{
// return Domain::all();
return DB::table('domains')->orderBy("id");
}
}
Loading

0 comments on commit f02a68d

Please sign in to comment.