From: Louis Jeckel Date: Mon, 20 Apr 2020 12:26:09 +0000 (+0200) Subject: nova work, import capabilities, organization type, pdffile access count X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=3027b367aa058d629139a805bb70689f32bda61c;p=psq.git nova work, import capabilities, organization type, pdffile access count --- diff --git a/.idea/lettre-pharma.iml b/.idea/lettre-pharma.iml index 5ecb545..1bce1c6 100644 --- a/.idea/lettre-pharma.iml +++ b/.idea/lettre-pharma.iml @@ -8,6 +8,7 @@ + @@ -18,7 +19,10 @@ + + + @@ -30,6 +34,7 @@ + diff --git a/.idea/php.xml b/.idea/php.xml index 854870b..b4a0b9b 100644 --- a/.idea/php.xml +++ b/.idea/php.xml @@ -178,6 +178,11 @@ + + + + + diff --git a/app/AccessLog.php b/app/AccessLog.php index 7974728..a14b565 100644 --- a/app/AccessLog.php +++ b/app/AccessLog.php @@ -18,6 +18,8 @@ use Illuminate\Http\Request; */ class AccessLog extends Model { + use BelongsToPdfFile; + protected $guarded = []; @@ -29,17 +31,18 @@ class AccessLog extends Model return $this->belongsTo(User::class); } - /** * @param Request $request + * @param PdfFile|null $file */ - public static function log(Request $request): void + public static function log(Request $request, ?PdfFile $file = null): void { $entry = new self; $entry->ip = implode(', ', $request->ips()); $entry->user_id = Auth::check() ? Auth::user()->id : null; $entry->user_agent = $request->userAgent(); + $entry->file_id = $file ? $file->id : null; $entry->save(); diff --git a/app/BelongsToPdfFile.php b/app/BelongsToPdfFile.php index 3d47fd3..4be5069 100644 --- a/app/BelongsToPdfFile.php +++ b/app/BelongsToPdfFile.php @@ -6,7 +6,8 @@ namespace App; /** * Trait BelongsToPdfFile * @package App - * @property-read PdfFile $file + * @property PdfFile $file + * @property int $file_id */ trait BelongsToPdfFile { diff --git a/app/Http/Controllers/FlowpaperController.php b/app/Http/Controllers/FlowpaperController.php index 3dbfacb..b415b9c 100644 --- a/app/Http/Controllers/FlowpaperController.php +++ b/app/Http/Controllers/FlowpaperController.php @@ -23,7 +23,7 @@ class FlowpaperController extends Controller public function view(PdfFile $file, Request $request): View { $this->authorize('view', $file); - AccessLog::log($request); + AccessLog::log($request, $file); return $file->view(); } diff --git a/app/Imports/UsersImport.php b/app/Imports/UsersImport.php new file mode 100644 index 0000000..769f8e2 --- /dev/null +++ b/app/Imports/UsersImport.php @@ -0,0 +1,71 @@ +firstOrCreate([ + 'slug' => $row['type'] + ], [ + 'name' => $row['type'] + ]); + } + + + $org = Organization::query()->firstOrCreate([ + 'name' => Str::title($row['org']), + ], [ + 'type_id' => $type ? $type->id : null, + 'subscription_active' => false, + ]); + } + + + return new User([ + 'first_name' => Str::title($row['first_name']), + 'last_name' => Str::title($row['last_name']), + 'email' => Str::lower($row['email']), + 'position' => Str::title($row['position']), + 'organization_id' => $org ? $org->id : null, + 'address_line_1' => $row['address_line_1'], + 'postal_code' => $row['postal_code'], + 'city' => $row['city'], + 'phone' => $row['phone'], + 'password' => \Hash::make(Str::random()), + ]); + } + + public function rules(): array + { + return [ + '*.email' => 'email|required', + 'email' => 'email|required', + ]; + } + + +} diff --git a/app/Jobs/ProcessEmailBatch.php b/app/Jobs/ProcessEmailBatch.php index b92a373..083373e 100644 --- a/app/Jobs/ProcessEmailBatch.php +++ b/app/Jobs/ProcessEmailBatch.php @@ -102,6 +102,8 @@ class ProcessEmailBatch implements ShouldQueue 'current' => $count ]); + $this->batch->update(['sent_to', $users->pluck('email')]); + diff --git a/app/Nova/Actions/ImportUsers.php b/app/Nova/Actions/ImportUsers.php new file mode 100644 index 0000000..14a9538 --- /dev/null +++ b/app/Nova/Actions/ImportUsers.php @@ -0,0 +1,62 @@ +file); + return Action::message("Import réussi"); + } + + /** + * Get the fields available on the action. + * + * @return array + */ + public function fields() + { + return [ + File::make('File') + ->rules('required'), + ]; } +} diff --git a/app/Nova/Organization.php b/app/Nova/Organization.php index 5c15551..cbe5f28 100644 --- a/app/Nova/Organization.php +++ b/app/Nova/Organization.php @@ -3,6 +3,7 @@ namespace App\Nova; use Illuminate\Http\Request; +use Laravel\Nova\Fields\BelongsTo; use Laravel\Nova\Fields\Boolean; use Laravel\Nova\Fields\HasMany; use Laravel\Nova\Fields\ID; @@ -55,6 +56,7 @@ class Organization extends Resource ID::make()->sortable(), Text::make('Nom', 'name'), HasMany::make('Membres', 'members', User::class), + BelongsTo::make('Type', 'type', OrganizationType::class), Boolean::make('Abonnement actif', 'subscription_active') ]; diff --git a/app/Nova/OrganizationType.php b/app/Nova/OrganizationType.php new file mode 100644 index 0000000..bdb8af2 --- /dev/null +++ b/app/Nova/OrganizationType.php @@ -0,0 +1,97 @@ +sortable(), + Text::make('Nom', 'name'), + Text::make('Raccourci', 'slug')->nullable(), + HasMany::make('Organisations', 'organizations', Organization::class), + ]; + } + + /** + * Get the cards available for the request. + * + * @param \Illuminate\Http\Request $request + * @return array + */ + public function cards(Request $request) + { + return []; + } + + /** + * Get the filters available for the resource. + * + * @param \Illuminate\Http\Request $request + * @return array + */ + public function filters(Request $request) + { + return []; + } + + /** + * Get the lenses available for the resource. + * + * @param \Illuminate\Http\Request $request + * @return array + */ + public function lenses(Request $request) + { + return []; + } + + /** + * Get the actions available for the resource. + * + * @param \Illuminate\Http\Request $request + * @return array + */ + public function actions(Request $request) + { + return []; + } +} diff --git a/app/Nova/PdfFile.php b/app/Nova/PdfFile.php index e3301ac..f982191 100644 --- a/app/Nova/PdfFile.php +++ b/app/Nova/PdfFile.php @@ -3,7 +3,9 @@ namespace App\Nova; use Illuminate\Http\Request; +use Laravel\Nova\Fields\Boolean; use Laravel\Nova\Fields\ID; +use Laravel\Nova\Fields\Number; use Laravel\Nova\Fields\Text; use Laravel\Nova\Http\Requests\NovaRequest; @@ -46,7 +48,12 @@ class PdfFile extends Resource ID::make()->sortable(), Text::make('Titre', 'title'), Text::make('Slug')->readonly(), - Text::make('Nom du fichier', 'file_name'), + Boolean::make('Gratuit', 'free'), + Text::make('Lien', function(){ + return "Prévisualiser"; + })->asHtml()->readonly(), + Number::make('Nombre de visualisations', 'accessCount')->readonly(), + ]; } diff --git a/app/Nova/SearchableText.php b/app/Nova/SearchableText.php index 16c87ff..8fa5121 100644 --- a/app/Nova/SearchableText.php +++ b/app/Nova/SearchableText.php @@ -22,15 +22,8 @@ class SearchableText extends Resource */ public static $title = 'id'; - /** - * The columns that should be searched. - * - * @var array - */ - public static $search = [ - 'id', - ]; +public static $globallySearchable = false; /** diff --git a/app/Nova/TrackedLink.php b/app/Nova/TrackedLink.php index 737f115..a90593a 100644 --- a/app/Nova/TrackedLink.php +++ b/app/Nova/TrackedLink.php @@ -4,6 +4,8 @@ namespace App\Nova; use Illuminate\Http\Request; use Laravel\Nova\Fields\ID; +use Laravel\Nova\Fields\Number; +use Laravel\Nova\Fields\Text; use Laravel\Nova\Http\Requests\NovaRequest; class TrackedLink extends Resource @@ -20,7 +22,7 @@ class TrackedLink extends Resource * * @var string */ - public static $title = 'id'; + public static $title = 'title'; /** * The columns that should be searched. @@ -28,7 +30,7 @@ class TrackedLink extends Resource * @var array */ public static $search = [ - 'id', + 'title', ]; /** @@ -40,7 +42,12 @@ class TrackedLink extends Resource public function fields(Request $request) { return [ - ID::make()->sortable(), + + Text::make('Titre', 'title'), + Text::make('slug')->hideFromIndex(), + Text::make('Target')->hideFromIndex(), + Number::make('Clicks'), + ]; } diff --git a/app/Nova/User.php b/app/Nova/User.php index 17da525..e39c302 100644 --- a/app/Nova/User.php +++ b/app/Nova/User.php @@ -2,6 +2,7 @@ namespace App\Nova; +use App\Nova\Actions\ImportUsers; use Illuminate\Http\Request; use Laravel\Nova\Fields\BelongsTo; use Laravel\Nova\Fields\Boolean; @@ -126,6 +127,8 @@ class User extends Resource */ public function actions(Request $request) { - return []; + return [ + new ImportUsers, + ]; } } diff --git a/app/Organization.php b/app/Organization.php index 82b39f2..55fd1b2 100644 --- a/app/Organization.php +++ b/app/Organization.php @@ -4,6 +4,7 @@ namespace App; use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\HasMany; /** @@ -18,6 +19,8 @@ class Organization extends Model 'subscription_active' => 'boolean' ]; + protected $guarded = []; + /** * @return boolean @@ -44,4 +47,12 @@ class Organization extends Model return $this->hasMany(User::class); } + /** + * @return BelongsTo + */ + public function type(): BelongsTo + { + return $this->belongsTo(OrganizationType::class, 'type_id'); + } + } diff --git a/app/OrganizationType.php b/app/OrganizationType.php new file mode 100644 index 0000000..47c9161 --- /dev/null +++ b/app/OrganizationType.php @@ -0,0 +1,29 @@ +hasMany(Organization::class, 'type_id'); + } + + /** + * @return string + */ + public function __toString(): string + { + return 'name'; + } +} diff --git a/app/PdfFile.php b/app/PdfFile.php index ea86e69..c0ea27b 100644 --- a/app/PdfFile.php +++ b/app/PdfFile.php @@ -7,6 +7,7 @@ use A17\Twill\Models\Behaviors\Sortable; use A17\Twill\Models\Model as TwillModel; use App\Flowpaper\Pdf2Json; use Illuminate\Database\Eloquent\Builder; +use Illuminate\Database\Eloquent\Collection; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations; use Illuminate\Http\File; @@ -41,6 +42,8 @@ use Vaites\ApacheTika\Client as TikaClient; * @property string $coverUrl * @property string $directory * @property bool $is_free + * @property Collection $accessLogs + * @property-read int $accessCount * */ class PdfFile extends TwillModel implements Sortable @@ -171,6 +174,23 @@ class PdfFile extends TwillModel implements Sortable ); } + /** + * @return Relations\HasMany + */ + public function accessLogs(): Relations\HasMany + { + return $this->hasMany(AccessLog::class, 'file_id'); + } + + + /** + * @return int + */ + public function getAccessCountAttribute(): int + { + return $this->accessLogs()->count(); + } + /** * @return string diff --git a/app/Policies/PdfFilePolicy.php b/app/Policies/PdfFilePolicy.php index 1e96858..4166222 100644 --- a/app/Policies/PdfFilePolicy.php +++ b/app/Policies/PdfFilePolicy.php @@ -2,6 +2,8 @@ namespace App\Policies; +use A17\Twill\Models\User as TwillUser; +use App\Models\Admin; use App\PdfFile; use Illuminate\Auth\Access\HandlesAuthorization; use Illuminate\Auth\AuthenticationException; @@ -15,6 +17,8 @@ class PdfFilePolicy { use HandlesAuthorization; + + /** * Determine whether the user can view any models. * @@ -23,6 +27,9 @@ class PdfFilePolicy */ public function viewAny($user) { + if($user instanceof TwillUser) { + return true; + } } @@ -36,6 +43,10 @@ class PdfFilePolicy */ public function view($user = null, PdfFile $pdfFile) { + if($user instanceof TwillUser) { + return true; + } + if($pdfFile->is_free || ($user instanceof \App\User ? $user->isSubscribed : false)) { return true; } diff --git a/app/Providers/NovaServiceProvider.php b/app/Providers/NovaServiceProvider.php index 8a564a1..05d973d 100644 --- a/app/Providers/NovaServiceProvider.php +++ b/app/Providers/NovaServiceProvider.php @@ -3,6 +3,7 @@ namespace App\Providers; use A17\Twill\Models\User as TwillUser; +use Anaseqal\NovaImport\NovaImport; use Illuminate\Support\Facades\Gate; use Laravel\Nova\Cards\Help; use Laravel\Nova\Nova; @@ -77,6 +78,7 @@ class NovaServiceProvider extends NovaApplicationServiceProvider public function tools() { return [ + new NovaImport, ]; } diff --git a/app/User.php b/app/User.php index ba1976d..836da12 100644 --- a/app/User.php +++ b/app/User.php @@ -31,7 +31,17 @@ class User extends Authenticatable * @var array */ protected $fillable = [ - 'first_name', 'last_name', 'email', 'password', 'reg_complete' + 'first_name', + 'last_name', + 'email', + 'password', + 'reg_complete', + 'position', + 'organization_id', + 'address_line_1', + 'postal_code', + 'city', + 'phone', ]; /** @@ -60,7 +70,7 @@ class User extends Authenticatable 'first_name' => $this->first_name, 'last_name' => $this->last_name, 'position' => $this->position, - 'organization' => $this->organization->name, + 'organization' => $this->organization->name ?? null, ]; } diff --git a/composer.json b/composer.json index 0581218..26e9476 100644 --- a/composer.json +++ b/composer.json @@ -12,6 +12,7 @@ "ext-dom": "*", "ext-json": "*", "algolia/algoliasearch-client-php": "^2.6", + "anaseqal/nova-import": "^0.0.3", "area17/twill": "^2.0", "fideloper/proxy": "^4.2", "fruitcake/laravel-cors": "^1.0", diff --git a/composer.lock b/composer.lock index 9e5545e..81c15df 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "b53dc867ef2193fc1017ea0794762a36", + "content-hash": "170735a710a465a709486727eadb7f99", "packages": [ { "name": "algolia/algoliasearch-client-php", @@ -76,6 +76,48 @@ ], "time": "2020-03-09T09:11:44+00:00" }, + { + "name": "anaseqal/nova-import", + "version": "0.0.3", + "source": { + "type": "git", + "url": "https://github.com/anaseqal/nova-import.git", + "reference": "548fa4d39ea914b1a5ce82b388a9d1df1bdd857a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/anaseqal/nova-import/zipball/548fa4d39ea914b1a5ce82b388a9d1df1bdd857a", + "reference": "548fa4d39ea914b1a5ce82b388a9d1df1bdd857a", + "shasum": "" + }, + "require": { + "maatwebsite/excel": "*", + "php": ">=7.1.0" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "Anaseqal\\NovaImport\\ToolServiceProvider" + ] + } + }, + "autoload": { + "psr-4": { + "Anaseqal\\NovaImport\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "A Laravel Nova tool.", + "keywords": [ + "laravel", + "nova" + ], + "time": "2020-04-13T12:32:35+00:00" + }, { "name": "area17/twill", "version": "2.0.1", @@ -3108,6 +3150,73 @@ ], "time": "2016-08-17T00:36:58+00:00" }, + { + "name": "maatwebsite/excel", + "version": "3.1.19", + "source": { + "type": "git", + "url": "https://github.com/Maatwebsite/Laravel-Excel.git", + "reference": "96527a9ebc2e79e9a5fa7eaef7e23c9e9bcc587c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Maatwebsite/Laravel-Excel/zipball/96527a9ebc2e79e9a5fa7eaef7e23c9e9bcc587c", + "reference": "96527a9ebc2e79e9a5fa7eaef7e23c9e9bcc587c", + "shasum": "" + }, + "require": { + "ext-json": "*", + "illuminate/support": "5.5.*|5.6.*|5.7.*|5.8.*|^6.0|^7.0", + "php": "^7.0", + "phpoffice/phpspreadsheet": "^1.10" + }, + "require-dev": { + "mockery/mockery": "^1.1", + "orchestra/database": "^4.0", + "orchestra/testbench": "^4.0", + "phpunit/phpunit": "^8.0", + "predis/predis": "^1.1" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "Maatwebsite\\Excel\\ExcelServiceProvider" + ], + "aliases": { + "Excel": "Maatwebsite\\Excel\\Facades\\Excel" + } + } + }, + "autoload": { + "psr-4": { + "Maatwebsite\\Excel\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Patrick Brouwers", + "email": "patrick@maatwebsite.nl" + } + ], + "description": "Supercharged Excel exports and imports in Laravel", + "keywords": [ + "PHPExcel", + "batch", + "csv", + "excel", + "export", + "import", + "laravel", + "php", + "phpspreadsheet" + ], + "time": "2020-02-28T15:47:45+00:00" + }, { "name": "mailgun/mailgun-php", "version": "3.0.0", @@ -3164,6 +3273,170 @@ "description": "The Mailgun SDK provides methods for all API functions.", "time": "2019-09-13T20:14:46+00:00" }, + { + "name": "markbaker/complex", + "version": "1.4.8", + "source": { + "type": "git", + "url": "https://github.com/MarkBaker/PHPComplex.git", + "reference": "8eaa40cceec7bf0518187530b2e63871be661b72" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/MarkBaker/PHPComplex/zipball/8eaa40cceec7bf0518187530b2e63871be661b72", + "reference": "8eaa40cceec7bf0518187530b2e63871be661b72", + "shasum": "" + }, + "require": { + "php": "^5.6.0|^7.0.0" + }, + "require-dev": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.5.0", + "phpcompatibility/php-compatibility": "^9.0", + "phpdocumentor/phpdocumentor": "2.*", + "phploc/phploc": "2.*", + "phpmd/phpmd": "2.*", + "phpunit/phpunit": "^4.8.35|^5.4.0", + "sebastian/phpcpd": "2.*", + "squizlabs/php_codesniffer": "^3.4.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Complex\\": "classes/src/" + }, + "files": [ + "classes/src/functions/abs.php", + "classes/src/functions/acos.php", + "classes/src/functions/acosh.php", + "classes/src/functions/acot.php", + "classes/src/functions/acoth.php", + "classes/src/functions/acsc.php", + "classes/src/functions/acsch.php", + "classes/src/functions/argument.php", + "classes/src/functions/asec.php", + "classes/src/functions/asech.php", + "classes/src/functions/asin.php", + "classes/src/functions/asinh.php", + "classes/src/functions/atan.php", + "classes/src/functions/atanh.php", + "classes/src/functions/conjugate.php", + "classes/src/functions/cos.php", + "classes/src/functions/cosh.php", + "classes/src/functions/cot.php", + "classes/src/functions/coth.php", + "classes/src/functions/csc.php", + "classes/src/functions/csch.php", + "classes/src/functions/exp.php", + "classes/src/functions/inverse.php", + "classes/src/functions/ln.php", + "classes/src/functions/log2.php", + "classes/src/functions/log10.php", + "classes/src/functions/negative.php", + "classes/src/functions/pow.php", + "classes/src/functions/rho.php", + "classes/src/functions/sec.php", + "classes/src/functions/sech.php", + "classes/src/functions/sin.php", + "classes/src/functions/sinh.php", + "classes/src/functions/sqrt.php", + "classes/src/functions/tan.php", + "classes/src/functions/tanh.php", + "classes/src/functions/theta.php", + "classes/src/operations/add.php", + "classes/src/operations/subtract.php", + "classes/src/operations/multiply.php", + "classes/src/operations/divideby.php", + "classes/src/operations/divideinto.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mark Baker", + "email": "mark@lange.demon.co.uk" + } + ], + "description": "PHP Class for working with complex numbers", + "homepage": "https://github.com/MarkBaker/PHPComplex", + "keywords": [ + "complex", + "mathematics" + ], + "time": "2020-03-11T20:15:49+00:00" + }, + { + "name": "markbaker/matrix", + "version": "1.2.0", + "source": { + "type": "git", + "url": "https://github.com/MarkBaker/PHPMatrix.git", + "reference": "5348c5a67e3b75cd209d70103f916a93b1f1ed21" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/MarkBaker/PHPMatrix/zipball/5348c5a67e3b75cd209d70103f916a93b1f1ed21", + "reference": "5348c5a67e3b75cd209d70103f916a93b1f1ed21", + "shasum": "" + }, + "require": { + "php": "^5.6.0|^7.0.0" + }, + "require-dev": { + "dealerdirect/phpcodesniffer-composer-installer": "dev-master", + "phpcompatibility/php-compatibility": "dev-master", + "phploc/phploc": "^4", + "phpmd/phpmd": "dev-master", + "phpunit/phpunit": "^5.7", + "sebastian/phpcpd": "^3.0", + "squizlabs/php_codesniffer": "^3.0@dev" + }, + "type": "library", + "autoload": { + "psr-4": { + "Matrix\\": "classes/src/" + }, + "files": [ + "classes/src/functions/adjoint.php", + "classes/src/functions/antidiagonal.php", + "classes/src/functions/cofactors.php", + "classes/src/functions/determinant.php", + "classes/src/functions/diagonal.php", + "classes/src/functions/identity.php", + "classes/src/functions/inverse.php", + "classes/src/functions/minors.php", + "classes/src/functions/trace.php", + "classes/src/functions/transpose.php", + "classes/src/operations/add.php", + "classes/src/operations/directsum.php", + "classes/src/operations/subtract.php", + "classes/src/operations/multiply.php", + "classes/src/operations/divideby.php", + "classes/src/operations/divideinto.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mark Baker", + "email": "mark@lange.demon.co.uk" + } + ], + "description": "PHP Class for working with matrices", + "homepage": "https://github.com/MarkBaker/PHPMatrix", + "keywords": [ + "mathematics", + "matrix", + "vector" + ], + "time": "2019-10-06T11:29:25+00:00" + }, { "name": "matthewbdaly/laravel-azure-storage", "version": "1.3.8", @@ -4396,6 +4669,99 @@ ], "time": "2016-01-26T13:27:02+00:00" }, + { + "name": "phpoffice/phpspreadsheet", + "version": "1.11.0", + "source": { + "type": "git", + "url": "https://github.com/PHPOffice/PhpSpreadsheet.git", + "reference": "c2a205e82f9cf1cc9fab86b79e808d86dd680470" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPOffice/PhpSpreadsheet/zipball/c2a205e82f9cf1cc9fab86b79e808d86dd680470", + "reference": "c2a205e82f9cf1cc9fab86b79e808d86dd680470", + "shasum": "" + }, + "require": { + "ext-ctype": "*", + "ext-dom": "*", + "ext-fileinfo": "*", + "ext-gd": "*", + "ext-iconv": "*", + "ext-libxml": "*", + "ext-mbstring": "*", + "ext-simplexml": "*", + "ext-xml": "*", + "ext-xmlreader": "*", + "ext-xmlwriter": "*", + "ext-zip": "*", + "ext-zlib": "*", + "markbaker/complex": "^1.4", + "markbaker/matrix": "^1.2", + "php": "^7.1", + "psr/simple-cache": "^1.0" + }, + "require-dev": { + "dompdf/dompdf": "^0.8.3", + "friendsofphp/php-cs-fixer": "^2.16", + "jpgraph/jpgraph": "^4.0", + "mpdf/mpdf": "^8.0", + "phpcompatibility/php-compatibility": "^9.3", + "phpunit/phpunit": "^7.5", + "squizlabs/php_codesniffer": "^3.5", + "tecnickcom/tcpdf": "^6.3" + }, + "suggest": { + "dompdf/dompdf": "Option for rendering PDF with PDF Writer", + "jpgraph/jpgraph": "Option for rendering charts, or including charts with PDF or HTML Writers", + "mpdf/mpdf": "Option for rendering PDF with PDF Writer", + "tecnickcom/tcpdf": "Option for rendering PDF with PDF Writer" + }, + "type": "library", + "autoload": { + "psr-4": { + "PhpOffice\\PhpSpreadsheet\\": "src/PhpSpreadsheet" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Maarten Balliauw", + "homepage": "https://blog.maartenballiauw.be" + }, + { + "name": "Mark Baker", + "homepage": "https://markbakeruk.net" + }, + { + "name": "Franck Lefevre", + "homepage": "https://rootslabs.net" + }, + { + "name": "Erik Tilt" + }, + { + "name": "Adrien Crivelli" + } + ], + "description": "PHPSpreadsheet - Read, Create and Write Spreadsheet documents in PHP - Spreadsheet engine", + "homepage": "https://github.com/PHPOffice/PhpSpreadsheet", + "keywords": [ + "OpenXML", + "excel", + "gnumeric", + "ods", + "php", + "spreadsheet", + "xls", + "xlsx" + ], + "time": "2020-03-02T13:09:03+00:00" + }, { "name": "phpoption/phpoption", "version": "1.7.3", diff --git a/database/migrations/2020_04_20_104057_create_organization_types_table.php b/database/migrations/2020_04_20_104057_create_organization_types_table.php new file mode 100644 index 0000000..0b8806a --- /dev/null +++ b/database/migrations/2020_04_20_104057_create_organization_types_table.php @@ -0,0 +1,43 @@ +id(); + $table->string('name'); + $table->string('slug')->nullable(); + + }); + + + + Schema::table('organizations', function (Blueprint $table) { + $table->unsignedBigInteger('type_id')->nullable(); + $table->foreign('type_id')->references('id')->on('organization_types'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('organization_types'); + Schema::table('organizations', function (Blueprint $table) { + $table->dropColumn('type_id'); + }); + } +} diff --git a/database/migrations/2020_04_20_121532_add_file_col_to_access_logs.php b/database/migrations/2020_04_20_121532_add_file_col_to_access_logs.php new file mode 100644 index 0000000..89b4da2 --- /dev/null +++ b/database/migrations/2020_04_20_121532_add_file_col_to_access_logs.php @@ -0,0 +1,32 @@ +foreignId('file_id')->nullable()->constrained('pdf_files')->cascadeOnDelete(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('access_logs', function (Blueprint $table) { + $table->dropColumn('file_id'); + }); + } +}