Merge branch 'master' into 'production'

Master

See merge request Romulus21/portal!67
This commit is contained in:
Romain Delanoë
2020-09-09 10:47:22 +00:00
56 changed files with 1269 additions and 636 deletions

44
.env.example Normal file
View File

@@ -0,0 +1,44 @@
APP_NAME=Laravel
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost
LOG_CHANNEL=stack
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=laravel
DB_USERNAME=root
DB_PASSWORD=
BROADCAST_DRIVER=log
CACHE_DRIVER=file
QUEUE_CONNECTION=sync
SESSION_DRIVER=cookie
SESSION_LIFETIME=120
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=mt1
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"

View File

@@ -1,80 +1,70 @@
# This file is a template, and might need editing before it works on your project.
# Official framework image. Look for the different tagged releases at:
# https://hub.docker.com/r/library/php
image: php:latest
image: lorisleiva/laravel-docker:latest
# Pick zero or more services to be used on all builds.
# Only needed when using a docker container to run your tests in.
# Check out: http://docs.gitlab.com/ce/ci/docker/using_docker_images.html#what-is-a-service
services:
- mysql:latest
# https://github.com/lorisleiva/laravel-docker/blob/master/gitlab/.gitlab-ci.deployments.yml
variables:
MYSQL_DATABASE: "portal"
MYSQL_USER: "root"
MYSQL_PASSWORD: "app"
MYSQL_ROOT_PASSWORD: "secret"
.init_ssh: &init_ssh |
eval $(ssh-agent -s)
echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null
mkdir -p ~/.ssh
chmod 700 ~/.ssh
[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config
# This folder is cached between builds
# http://docs.gitlab.com/ce/ci/yaml/README.html#cache
# Replace the last line with the following lines if you'd rather
# leave StrictHostKeyChecking enabled (replace yourdomain.com):
#
# ssh-keyscan yourdomain.com >> ~/.ssh/known_hosts
# chmod 644 ~/.ssh/known_hosts
.change_file_permissions: &change_file_permissions |
find . -type f -not -path "./vendor/*" -exec chmod 664 {} \;
find . -type d -not -path "./vendor/*" -exec chmod 775 {} \;
composer:
stage: build
cache:
key: ${CI_COMMIT_REF_SLUG}-composer
paths:
- vendor/
- node_modules/
# This is a basic example for a gem or script which doesn't use
# services such as redis or postgres
before_script:
# Update packages
- apt-get update -yqq
# Prep for Node
- apt-get install gnupg -yqq
# Upgrade to Node 8
- curl -sL https://deb.nodesource.com/setup_8.x | bash -
# Install dependencies
- apt-get install git nodejs libcurl4-gnutls-dev libicu-dev libmcrypt-dev libvpx-dev libjpeg-dev libpng-dev libxpm-dev zlib1g-dev libfreetype6-dev libxml2-dev libexpat1-dev libbz2-dev libgmp3-dev libldap2-dev unixodbc-dev libpq-dev libsqlite3-dev libaspell-dev libsnmp-dev libpcre3-dev libtidy-dev -yqq
#- apt-get install php-mbstring php-curl php-json php-intl php-gd php-xml php-zip php-bz2 -yqq
- apt-get install mariadb-server -yqq
# Install php extensions
- docker-php-ext-install pdo pdo_mysql tokenizer xml pcntl curl json
# - docker-php-ext-install mbstring intl gd xml bz2 opcache pdo_mysql curl json zip
# Install php extensions
- docker-php-ext-install mbstring pdo_mysql curl json intl gd xml zip bz2 opcache
# Install & enable Xdebug for code coverage reports
- pecl install xdebug
- docker-php-ext-enable xdebug
# Install Composer and project dependencies.
- curl -sS https://getcomposer.org/installer | php
- php composer.phar install
# Install Node dependencies.
# comment this out if you don't have a node dependency
# - npm install
# Copy over testing configuration.
# Don't forget to set the database config in .env.testing correctly
# DB_HOST=mysql
# DB_DATABASE=project_name
# DB_USERNAME=root
# DB_PASSWORD=secret
- cp .env.testing .env
# Run npm build
# comment this out if you don't have a frontend build
# you can change this to to your frontend building script like
# npm run build
# - npm run dev
# Generate an application key. Re-cache.
- php artisan key:generate
- php artisan config:cache
# Run database migrations.
- php artisan migrate
# Run database seed
- php artisan db:seed
test:
script:
# run laravel tests
- php vendor/bin/phpunit --coverage-text --colors=never
# run frontend tests
# if you have any task for testing frontend
# set it in your package.json script
# comment this out if you don't have a frontend test
- npm test
- composer install --prefer-dist --no-ansi --no-interaction --no-progress --no-scripts
- cp .env.example .env
- php artisan key:generate
artifacts:
expire_in: 1 month
paths:
- vendor/
- .env
npm:
stage: build
cache:
key: ${CI_COMMIT_REF_SLUG}-npm
paths:
- node_modules/
script:
- npm install
- npm run production
artifacts:
expire_in: 1 month
paths:
- node_modules/
- public/css/
- public/js/
codestyle:
stage: test
dependencies: []
script:
- phpcs --standard=PSR2 --extensions=php --ignore=app/Support/helpers.php app
phpunit:
stage: test
dependencies:
- composer
script:
- mkdir storage/public
- mkdir storage/public/images
- mkdir storage/public/thumbnail
- chown -R $USER:www-data storage/
- chmod -R g+w storage/
- phpunit --coverage-text --colors=never

7
.idea/php.xml generated
View File

@@ -95,8 +95,6 @@
<path value="$PROJECT_DIR$/vendor/symfony/polyfill-ctype" />
<path value="$PROJECT_DIR$/vendor/psr/log" />
<path value="$PROJECT_DIR$/vendor/symfony/http-foundation" />
<path value="$PROJECT_DIR$/vendor/laminas/laminas-zendframework-bridge" />
<path value="$PROJECT_DIR$/vendor/laminas/laminas-diactoros" />
<path value="$PROJECT_DIR$/vendor/symfony/psr-http-message-bridge" />
<path value="$PROJECT_DIR$/vendor/league/oauth2-server" />
<path value="$PROJECT_DIR$/vendor/league/event" />
@@ -118,6 +116,11 @@
<path value="$PROJECT_DIR$/vendor/symfony/polyfill-php80" />
<path value="$PROJECT_DIR$/vendor/ramsey/collection" />
<path value="$PROJECT_DIR$/vendor/brick/math" />
<path value="$PROJECT_DIR$/vendor/jakub-onderka/php-console-color" />
<path value="$PROJECT_DIR$/vendor/jakub-onderka/php-console-highlighter" />
<path value="$PROJECT_DIR$/vendor/psr/http-client" />
<path value="$PROJECT_DIR$/vendor/league/mime-type-detection" />
<path value="$PROJECT_DIR$/vendor/graham-campbell/result-type" />
</include_path>
</component>
<component name="PhpProjectSharedConfiguration" php_language_level="7.2" />

5
.idea/portal.iml generated
View File

@@ -23,13 +23,12 @@
<excludeFolder url="file://$MODULE_DIR$/vendor/firebase/php-jwt" />
<excludeFolder url="file://$MODULE_DIR$/vendor/fruitcake/laravel-cors" />
<excludeFolder url="file://$MODULE_DIR$/vendor/fzaninotto/faker" />
<excludeFolder url="file://$MODULE_DIR$/vendor/graham-campbell/result-type" />
<excludeFolder url="file://$MODULE_DIR$/vendor/guzzlehttp/guzzle" />
<excludeFolder url="file://$MODULE_DIR$/vendor/guzzlehttp/promises" />
<excludeFolder url="file://$MODULE_DIR$/vendor/guzzlehttp/psr7" />
<excludeFolder url="file://$MODULE_DIR$/vendor/hamcrest/hamcrest-php" />
<excludeFolder url="file://$MODULE_DIR$/vendor/intervention/image" />
<excludeFolder url="file://$MODULE_DIR$/vendor/laminas/laminas-diactoros" />
<excludeFolder url="file://$MODULE_DIR$/vendor/laminas/laminas-zendframework-bridge" />
<excludeFolder url="file://$MODULE_DIR$/vendor/laravel/framework" />
<excludeFolder url="file://$MODULE_DIR$/vendor/laravel/passport" />
<excludeFolder url="file://$MODULE_DIR$/vendor/laravel/tinker" />
@@ -38,6 +37,7 @@
<excludeFolder url="file://$MODULE_DIR$/vendor/league/commonmark" />
<excludeFolder url="file://$MODULE_DIR$/vendor/league/event" />
<excludeFolder url="file://$MODULE_DIR$/vendor/league/flysystem" />
<excludeFolder url="file://$MODULE_DIR$/vendor/league/mime-type-detection" />
<excludeFolder url="file://$MODULE_DIR$/vendor/league/oauth2-server" />
<excludeFolder url="file://$MODULE_DIR$/vendor/mockery/mockery" />
<excludeFolder url="file://$MODULE_DIR$/vendor/monolog/monolog" />
@@ -65,6 +65,7 @@
<excludeFolder url="file://$MODULE_DIR$/vendor/phpunit/phpunit" />
<excludeFolder url="file://$MODULE_DIR$/vendor/psr/container" />
<excludeFolder url="file://$MODULE_DIR$/vendor/psr/event-dispatcher" />
<excludeFolder url="file://$MODULE_DIR$/vendor/psr/http-client" />
<excludeFolder url="file://$MODULE_DIR$/vendor/psr/http-factory" />
<excludeFolder url="file://$MODULE_DIR$/vendor/psr/http-message" />
<excludeFolder url="file://$MODULE_DIR$/vendor/psr/log" />

View File

@@ -4,7 +4,7 @@ namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use App\Providers\RouteServiceProvider;
use App\User;
use App\Models\User;
use Illuminate\Foundation\Auth\RegistersUsers;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Validator;
@@ -60,7 +60,7 @@ class RegisterController extends Controller
* Create a new user instance after a valid registration.
*
* @param array $data
* @return \App\User
* @return \App\Models\User
*/
protected function create(array $data)
{

View File

@@ -9,6 +9,6 @@ class AuthUserController extends Controller
{
public function show()
{
return New UserResource(auth()->user());
return new UserResource(auth()->user());
}
}

View File

@@ -77,7 +77,8 @@ class BookmarkController extends Controller
preg_match('/http/', $metas['favicon'], $matches);
if (empty($matches)) {
$metas['favicon'] = parse_url($url, PHP_URL_SCHEME).'://'.parse_url($url, PHP_URL_HOST).$metas['favicon'];
$url = parse_url($url, PHP_URL_SCHEME).'://'.parse_url($url, PHP_URL_HOST);
$metas['favicon'] = $url.$metas['favicon'];
}
//dd($metas['favicon'], $matches, !isset($matches[1]), empty($matches));
} else {

View File

@@ -4,7 +4,7 @@ namespace App\Http\Controllers;
use App\Http\Resources\Image as ImageResource;
use App\Models\Memo;
use App\User;
use App\Models\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\File;
use Intervention\Image\Facades\Image;

View File

@@ -18,6 +18,5 @@ class MeteoController extends Controller
$response = $promise->wait();
return $response->getBody()->getContents();
}
}

View File

@@ -63,7 +63,7 @@ class ToDoController extends Controller
{
$this->authorize('update', $toDoList);
($toDo->checked_at) ? $toDo->checked_at = NULL : $toDo->checked_at = now();
($toDo->checked_at) ? $toDo->checked_at = null : $toDo->checked_at = now();
$toDo->save();
return (new ToDoResource($toDo))

View File

@@ -2,12 +2,10 @@
namespace App\Http\Controllers;
use App\Mail\newUserInvitation;
use App\User;
use App\Jobs\SendMailNewUserJob;
use App\Models\User;
use App\Http\Resources\User as UserResource;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Mail;
use Illuminate\Support\Str;
use Symfony\Component\HttpFoundation\Response;
@@ -27,7 +25,7 @@ class UserController extends Controller
request()['password'] = Hash::make(Str::random(30));
$user = User::create($this->validateData());
Mail::to($user->email)->send(new newUserInvitation($user));
SendMailNewUserJob::dispatch($user);
return (new UserResource($user))
->response()
@@ -36,7 +34,7 @@ class UserController extends Controller
public function show(User $user)
{
return New UserResource($user);
return new UserResource($user);
}
private function validateData()

View File

@@ -0,0 +1,39 @@
<?php
namespace App\Jobs;
use App\Mail\NewUserInvitation;
use App\Models\User;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\Mail;
class SendMailNewUserJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
private $user;
/**
* Create a new job instance.
*
* @return void
*/
public function __construct(User $user)
{
$this->user = $user;
}
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
Mail::to($this->user->email)->send(new NewUserInvitation($this->user));
}
}

View File

@@ -2,13 +2,13 @@
namespace App\Mail;
use App\User;
use App\Models\User;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
class newUserInvitation extends Mailable
class NewUserInvitation extends Mailable
{
use Queueable, SerializesModels;

View File

@@ -2,7 +2,7 @@
namespace App\Models;
use App\User;
use App\Models\User;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\MorphMany;
use Illuminate\Database\Eloquent\Relations\MorphOne;

View File

@@ -2,7 +2,7 @@
namespace App\Models;
use App\User;
use App\Models\User;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;

View File

@@ -1,6 +1,6 @@
<?php
namespace App;
namespace App\Models;
use App\Models\Bookmark;
use App\Models\Event;

View File

@@ -3,7 +3,7 @@
namespace App\Policies;
use App\Models\Bookmark;
use App\User;
use App\Models\User;
use Illuminate\Auth\Access\HandlesAuthorization;
class BookmarkPolicy
@@ -13,7 +13,7 @@ class BookmarkPolicy
/**
* Determine whether the user can view any bookmarks.
*
* @param \App\User $user
* @param \App\Models\User $user
* @return mixed
*/
public function viewAny(User $user)
@@ -24,7 +24,7 @@ class BookmarkPolicy
/**
* Determine whether the user can view the bookmark.
*
* @param \App\User $user
* @param \App\Models\User $user
* @param \App\Models\Bookmark $bookmark
* @return mixed
*/
@@ -36,7 +36,7 @@ class BookmarkPolicy
/**
* Determine whether the user can create bookmarks.
*
* @param \App\User $user
* @param \App\Models\User $user
* @return mixed
*/
public function create(User $user)
@@ -47,7 +47,7 @@ class BookmarkPolicy
/**
* Determine whether the user can update the bookmark.
*
* @param \App\User $user
* @param \App\Models\User $user
* @param \App\Models\Bookmark $bookmark
* @return mixed
*/
@@ -59,7 +59,7 @@ class BookmarkPolicy
/**
* Determine whether the user can delete the bookmark.
*
* @param \App\User $user
* @param \App\Models\User $user
* @param \App\Models\Bookmark $bookmark
* @return mixed
*/
@@ -71,7 +71,7 @@ class BookmarkPolicy
/**
* Determine whether the user can restore the bookmark.
*
* @param \App\User $user
* @param \App\Models\User $user
* @param \App\Models\Bookmark $bookmark
* @return mixed
*/
@@ -83,7 +83,7 @@ class BookmarkPolicy
/**
* Determine whether the user can permanently delete the bookmark.
*
* @param \App\User $user
* @param \App\Models\User $user
* @param \App\Models\Bookmark $bookmark
* @return mixed
*/

View File

@@ -3,7 +3,7 @@
namespace App\Policies;
use App\Models\Memo;
use App\User;
use App\Models\User;
use Illuminate\Auth\Access\HandlesAuthorization;
class MemoPolicy
@@ -13,7 +13,7 @@ class MemoPolicy
/**
* Determine whether the user can view any memos.
*
* @param \App\User $user
* @param \App\Models\User $user
* @return mixed
*/
public function viewAny(User $user)
@@ -24,7 +24,7 @@ class MemoPolicy
/**
* Determine whether the user can view the memo.
*
* @param \App\User $user
* @param \App\Models\User $user
* @param \App\Models\Memo $memo
* @return mixed
*/
@@ -36,7 +36,7 @@ class MemoPolicy
/**
* Determine whether the user can create memos.
*
* @param \App\User $user
* @param \App\Models\User $user
* @return mixed
*/
public function create(User $user)
@@ -47,7 +47,7 @@ class MemoPolicy
/**
* Determine whether the user can update the memo.
*
* @param \App\User $user
* @param \App\Models\User $user
* @param \App\Models\Memo $memo
* @return mixed
*/
@@ -59,7 +59,7 @@ class MemoPolicy
/**
* Determine whether the user can delete the memo.
*
* @param \App\User $user
* @param \App\Models\User $user
* @param \App\Models\Memo $memo
* @return mixed
*/
@@ -71,7 +71,7 @@ class MemoPolicy
/**
* Determine whether the user can restore the memo.
*
* @param \App\User $user
* @param \App\Models\User $user
* @param \App\Models\Memo $memo
* @return mixed
*/
@@ -83,7 +83,7 @@ class MemoPolicy
/**
* Determine whether the user can permanently delete the memo.
*
* @param \App\User $user
* @param \App\Models\User $user
* @param \App\Models\Memo $memo
* @return mixed
*/

View File

@@ -3,7 +3,7 @@
namespace App\Policies;
use App\Models\ToDoList;
use App\User;
use App\Models\User;
use Illuminate\Auth\Access\HandlesAuthorization;
class ToDoListPolicy
@@ -13,7 +13,7 @@ class ToDoListPolicy
/**
* Determine whether the user can view any to do lists.
*
* @param \App\User $user
* @param \App\Models\User $user
* @return mixed
*/
public function viewAny(User $user)
@@ -24,7 +24,7 @@ class ToDoListPolicy
/**
* Determine whether the user can view the to do list.
*
* @param \App\User $user
* @param \App\Models\User $user
* @param \App\Models\ToDoList $toDoList
* @return mixed
*/
@@ -36,7 +36,7 @@ class ToDoListPolicy
/**
* Determine whether the user can create to do lists.
*
* @param \App\User $user
* @param \App\Models\User $user
* @return mixed
*/
public function create(User $user)
@@ -47,7 +47,7 @@ class ToDoListPolicy
/**
* Determine whether the user can update the to do list.
*
* @param \App\User $user
* @param \App\Models\User $user
* @param \App\Models\ToDoList $toDoList
* @return mixed
*/
@@ -59,7 +59,7 @@ class ToDoListPolicy
/**
* Determine whether the user can delete the to do list.
*
* @param \App\User $user
* @param \App\Models\User $user
* @param \App\Models\ToDoList $toDoList
* @return mixed
*/
@@ -71,7 +71,7 @@ class ToDoListPolicy
/**
* Determine whether the user can restore the to do list.
*
* @param \App\User $user
* @param \App\Models\User $user
* @param \App\Models\ToDoList $toDoList
* @return mixed
*/
@@ -83,7 +83,7 @@ class ToDoListPolicy
/**
* Determine whether the user can permanently delete the to do list.
*
* @param \App\User $user
* @param \App\Models\User $user
* @param \App\Models\ToDoList $toDoList
* @return mixed
*/

View File

@@ -2,7 +2,7 @@
namespace App\Policies;
use App\User;
use App\Models\User;
use Illuminate\Auth\Access\HandlesAuthorization;
class UserPolicy
@@ -12,7 +12,7 @@ class UserPolicy
/**
* Determine whether the user can view any models.
*
* @param \App\User $user
* @param \App\Models\User $user
* @return mixed
*/
public function viewAny(User $user)
@@ -23,8 +23,8 @@ class UserPolicy
/**
* Determine whether the user can view the model.
*
* @param \App\User $user
* @param \App\User $model
* @param \App\Models\User $user
* @param \App\Models\User $model
* @return mixed
*/
public function view(User $user, User $model)
@@ -35,7 +35,7 @@ class UserPolicy
/**
* Determine whether the user can create models.
*
* @param \App\User $user
* @param \App\Models\User $user
* @return mixed
*/
public function create(User $user)
@@ -46,8 +46,8 @@ class UserPolicy
/**
* Determine whether the user can update the model.
*
* @param \App\User $user
* @param \App\User $model
* @param \App\Models\User $user
* @param \App\Models\User $model
* @return mixed
*/
public function update(User $user, User $model)
@@ -58,8 +58,8 @@ class UserPolicy
/**
* Determine whether the user can delete the model.
*
* @param \App\User $user
* @param \App\User $model
* @param \App\Models\User $user
* @param \App\Models\User $model
* @return mixed
*/
public function delete(User $user, User $model)
@@ -70,8 +70,8 @@ class UserPolicy
/**
* Determine whether the user can restore the model.
*
* @param \App\User $user
* @param \App\User $model
* @param \App\Models\User $user
* @param \App\Models\User $model
* @return mixed
*/
public function restore(User $user, User $model)
@@ -82,8 +82,8 @@ class UserPolicy
/**
* Determine whether the user can permanently delete the model.
*
* @param \App\User $user
* @param \App\User $model
* @param \App\Models\User $user
* @param \App\Models\User $model
* @return mixed
*/
public function forceDelete(User $user, User $model)

View File

@@ -15,7 +15,7 @@ class AuthServiceProvider extends ServiceProvider
*/
protected $policies = [
// 'App\Model' => 'App\Policies\ModelPolicy',
'App\User' => 'App\Policies\UserPolicy',
'App\Models\User' => 'App\Policies\UserPolicy',
'App\Models\Memo' => 'App\Policies\MemoPolicy',
'App\Models\ToDoList' => 'App\Policies\ToDoListPolicy',
'App\Models\Bookmark' => 'App\Policies\BookmarkPolicy',

View File

@@ -11,18 +11,18 @@
"php": "^7.2.5",
"fideloper/proxy": "^4.2",
"fruitcake/laravel-cors": "^1.0",
"guzzlehttp/guzzle": "^6.5",
"guzzlehttp/guzzle": "^7.0.1",
"intervention/image": "^2.5",
"laravel/framework": "^7.0",
"laravel/passport": "^9.3",
"laravel/framework": "^8.0",
"laravel/passport": "^10.0",
"laravel/tinker": "^2.0",
"laravel/ui": "^2.0"
},
"require-dev": {
"facade/ignition": "^2.0",
"facade/ignition": "^2.3.6",
"fzaninotto/faker": "^1.9.1",
"mockery/mockery": "^1.3.1",
"nunomaduro/collision": "^4.1",
"nunomaduro/collision": "^5.0",
"phpunit/phpunit": "^8.5",
"spatie/laravel-web-tinker": "^1.7"
},

981
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -68,7 +68,7 @@ return [
'providers' => [
'users' => [
'driver' => 'eloquent',
'model' => App\User::class,
'model' => App\Models\User::class,
],
// 'users' => [

View File

@@ -7,7 +7,7 @@ use Faker\Generator as Faker;
$factory->define(Bookmark::class, function (Faker $faker) {
return [
'user_id' => factory(\App\User::class),
'user_id' => factory(\App\Models\User::class),
'name' => $faker->words(3, [false]),
'url' => $faker->url,
'favicon' => $faker->imageUrl(),

View File

@@ -7,7 +7,7 @@ use Faker\Generator as Faker;
$factory->define(\App\Models\Memo::class, function (Faker $faker) {
return [
'user_id' => factory(\App\User::class),
'user_id' => factory(\App\Models\User::class),
'name' => $faker->words(3, [false]),
'memo' => $faker->text($maxNbChars = 200),
];

View File

@@ -7,7 +7,7 @@ use Faker\Generator as Faker;
$factory->define(ToDoList::class, function (Faker $faker) {
return [
'user_id' => factory(\App\User::class),
'user_id' => factory(\App\Models\User::class),
'name' => $faker->words(3, [false]),
];
});

View File

@@ -2,7 +2,7 @@
/** @var \Illuminate\Database\Eloquent\Factory $factory */
use App\User;
use App\Models\User;
use Faker\Generator as Faker;
use Illuminate\Support\Str;

View File

@@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateJobsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('jobs', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('queue')->index();
$table->longText('payload');
$table->unsignedTinyInteger('attempts');
$table->unsignedInteger('reserved_at')->nullable();
$table->unsignedInteger('available_at');
$table->unsignedInteger('created_at');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('jobs');
}
}

View File

@@ -0,0 +1,19 @@
<table class="action" align="center" width="100%" cellpadding="0" cellspacing="0" role="presentation">
<tr>
<td align="center">
<table width="100%" border="0" cellpadding="0" cellspacing="0" role="presentation">
<tr>
<td align="center">
<table border="0" cellpadding="0" cellspacing="0" role="presentation">
<tr>
<td>
<a href="{{ $url }}" class="button button-{{ $color ?? 'primary' }}" target="_blank" rel="noopener">{{ $slot }}</a>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>

View File

@@ -0,0 +1,11 @@
<tr>
<td>
<table class="footer" align="center" width="570" cellpadding="0" cellspacing="0" role="presentation">
<tr>
<td class="content-cell" align="center">
{{ Illuminate\Mail\Markdown::parse($slot) }}
</td>
</tr>
</table>
</td>
</tr>

View File

@@ -0,0 +1,11 @@
<tr>
<td class="header">
<a href="{{ $url }}" style="display: inline-block;">
@if (trim($slot) === 'Laravel')
<img src="https://portal.bricooli.fr/img/logo.svg" class="logo" alt="Portal Bricooli Logo">
@else
{{ $slot }}
@endif
</a>
</td>
</tr>

View File

@@ -0,0 +1,54 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
<style>
@media only screen and (max-width: 600px) {
.inner-body {
width: 100% !important;
}
.footer {
width: 100% !important;
}
}
@media only screen and (max-width: 500px) {
.button {
width: 100% !important;
}
}
</style>
<table class="wrapper" width="100%" cellpadding="0" cellspacing="0" role="presentation">
<tr>
<td align="center">
<table class="content" width="100%" cellpadding="0" cellspacing="0" role="presentation">
{{ $header ?? '' }}
<!-- Email Body -->
<tr>
<td class="body" width="100%" cellpadding="0" cellspacing="0">
<table class="inner-body" align="center" width="570" cellpadding="0" cellspacing="0" role="presentation">
<!-- Body content -->
<tr>
<td class="content-cell">
{{ Illuminate\Mail\Markdown::parse($slot) }}
{{ $subcopy ?? '' }}
</td>
</tr>
</table>
</td>
</tr>
{{ $footer ?? '' }}
</table>
</td>
</tr>
</table>
</body>
</html>

View File

@@ -0,0 +1,27 @@
@component('mail::layout')
{{-- Header --}}
@slot('header')
@component('mail::header', ['url' => config('app.url')])
<img src="https://portal.bricooli.fr/img/logo.svg" class="logo" alt="Portal Bricooli Logo" style="box-sizing: border-box; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; position: relative; max-width: 100%; border: none; height: 75px; width: 75px;">
@endcomponent
@endslot
{{-- Body --}}
{{ $slot }}
{{-- Subcopy --}}
@isset($subcopy)
@slot('subcopy')
@component('mail::subcopy')
{{ $subcopy }}
@endcomponent
@endslot
@endisset
{{-- Footer --}}
@slot('footer')
@component('mail::footer')
© {{ date('Y') }} {{ config('app.name') }}. @lang('All rights reserved.')
@endcomponent
@endslot
@endcomponent

View File

@@ -0,0 +1,14 @@
<table class="panel" width="100%" cellpadding="0" cellspacing="0" role="presentation">
<tr>
<td class="panel-content">
<table width="100%" cellpadding="0" cellspacing="0" role="presentation">
<tr>
<td class="panel-item">
{{ Illuminate\Mail\Markdown::parse($slot) }}
</td>
</tr>
</table>
</td>
</tr>
</table>

View File

@@ -0,0 +1,7 @@
<table class="subcopy" width="100%" cellpadding="0" cellspacing="0" role="presentation">
<tr>
<td>
{{ Illuminate\Mail\Markdown::parse($slot) }}
</td>
</tr>
</table>

View File

@@ -0,0 +1,3 @@
<div class="table">
{{ Illuminate\Mail\Markdown::parse($slot) }}
</div>

View File

@@ -0,0 +1,289 @@
/* Base */
body,
body *:not(html):not(style):not(br):not(tr):not(code) {
box-sizing: border-box;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif,
'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';
position: relative;
}
body {
-webkit-text-size-adjust: none;
background-color: #ffffff;
color: #718096;
height: 100%;
line-height: 1.4;
margin: 0;
padding: 0;
width: 100% !important;
}
p,
ul,
ol,
blockquote {
line-height: 1.4;
text-align: left;
}
a {
color: #3869d4;
}
a img {
border: none;
}
/* Typography */
h1 {
color: #3d4852;
font-size: 18px;
font-weight: bold;
margin-top: 0;
text-align: left;
}
h2 {
font-size: 16px;
font-weight: bold;
margin-top: 0;
text-align: left;
}
h3 {
font-size: 14px;
font-weight: bold;
margin-top: 0;
text-align: left;
}
p {
font-size: 16px;
line-height: 1.5em;
margin-top: 0;
text-align: left;
}
p.sub {
font-size: 12px;
}
img {
max-width: 100%;
}
/* Layout */
.wrapper {
-premailer-cellpadding: 0;
-premailer-cellspacing: 0;
-premailer-width: 100%;
background-color: #edf2f7;
margin: 0;
padding: 0;
width: 100%;
}
.content {
-premailer-cellpadding: 0;
-premailer-cellspacing: 0;
-premailer-width: 100%;
margin: 0;
padding: 0;
width: 100%;
}
/* Header */
.header {
padding: 25px 0;
text-align: center;
}
.header a {
color: #3d4852;
font-size: 19px;
font-weight: bold;
text-decoration: none;
}
/* Logo */
.logo {
height: 75px;
width: 75px;
}
/* Body */
.body {
-premailer-cellpadding: 0;
-premailer-cellspacing: 0;
-premailer-width: 100%;
background-color: #edf2f7;
border-bottom: 1px solid #edf2f7;
border-top: 1px solid #edf2f7;
margin: 0;
padding: 0;
width: 100%;
}
.inner-body {
-premailer-cellpadding: 0;
-premailer-cellspacing: 0;
-premailer-width: 570px;
background-color: #ffffff;
border-color: #e8e5ef;
border-radius: 2px;
border-width: 1px;
box-shadow: 0 2px 0 rgba(0, 0, 150, 0.025), 2px 4px 0 rgba(0, 0, 150, 0.015);
margin: 0 auto;
padding: 0;
width: 570px;
}
/* Subcopy */
.subcopy {
border-top: 1px solid #e8e5ef;
margin-top: 25px;
padding-top: 25px;
}
.subcopy p {
font-size: 14px;
}
/* Footer */
.footer {
-premailer-cellpadding: 0;
-premailer-cellspacing: 0;
-premailer-width: 570px;
margin: 0 auto;
padding: 0;
text-align: center;
width: 570px;
}
.footer p {
color: #b0adc5;
font-size: 12px;
text-align: center;
}
.footer a {
color: #b0adc5;
text-decoration: underline;
}
/* Tables */
.table table {
-premailer-cellpadding: 0;
-premailer-cellspacing: 0;
-premailer-width: 100%;
margin: 30px auto;
width: 100%;
}
.table th {
border-bottom: 1px solid #edeff2;
margin: 0;
padding-bottom: 8px;
}
.table td {
color: #74787e;
font-size: 15px;
line-height: 18px;
margin: 0;
padding: 10px 0;
}
.content-cell {
max-width: 100vw;
padding: 32px;
}
/* Buttons */
.action {
-premailer-cellpadding: 0;
-premailer-cellspacing: 0;
-premailer-width: 100%;
margin: 30px auto;
padding: 0;
text-align: center;
width: 100%;
}
.button {
-webkit-text-size-adjust: none;
border-radius: 4px;
color: #fff;
display: inline-block;
overflow: hidden;
text-decoration: none;
}
.button-blue,
.button-primary {
background-color: #2d3748;
border-bottom: 8px solid #2d3748;
border-left: 18px solid #2d3748;
border-right: 18px solid #2d3748;
border-top: 8px solid #2d3748;
}
.button-green,
.button-success {
background-color: #48bb78;
border-bottom: 8px solid #48bb78;
border-left: 18px solid #48bb78;
border-right: 18px solid #48bb78;
border-top: 8px solid #48bb78;
}
.button-red,
.button-error {
background-color: #e53e3e;
border-bottom: 8px solid #e53e3e;
border-left: 18px solid #e53e3e;
border-right: 18px solid #e53e3e;
border-top: 8px solid #e53e3e;
}
/* Panels */
.panel {
border-left: #2d3748 solid 4px;
margin: 21px 0;
}
.panel-content {
background-color: #edf2f7;
color: #718096;
padding: 16px;
}
.panel-content p {
color: #718096;
}
.panel-item {
padding: 0;
}
.panel-item p:last-of-type {
margin-bottom: 0;
padding-bottom: 0;
}
/* Utilities */
.break-all {
word-break: break-all;
}

View File

@@ -0,0 +1 @@
{{ $slot }}: {{ $url }}

View File

@@ -0,0 +1 @@
{{ $slot }}

View File

@@ -0,0 +1 @@
[{{ $slot }}]({{ $url }})

View File

@@ -0,0 +1,9 @@
{!! strip_tags($header) !!}
{!! strip_tags($slot) !!}
@isset($subcopy)
{!! strip_tags($subcopy) !!}
@endisset
{!! strip_tags($footer) !!}

View File

@@ -0,0 +1,27 @@
@component('mail::layout')
{{-- Header --}}
@slot('header')
@component('mail::header', ['url' => config('app.url')])
{{ config('app.name') }}
@endcomponent
@endslot
{{-- Body --}}
{{ $slot }}
{{-- Subcopy --}}
@isset($subcopy)
@slot('subcopy')
@component('mail::subcopy')
{{ $subcopy }}
@endcomponent
@endslot
@endisset
{{-- Footer --}}
@slot('footer')
@component('mail::footer')
© {{ date('Y') }} {{ config('app.name') }}. @lang('All rights reserved.')
@endcomponent
@endslot
@endcomponent

View File

@@ -0,0 +1 @@
{{ $slot }}

View File

@@ -0,0 +1 @@
{{ $slot }}

View File

@@ -0,0 +1 @@
{{ $slot }}

View File

@@ -3,7 +3,7 @@
namespace Tests\Feature;
use App\Models\Bookmark;
use App\User;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Foundation\Testing\WithFaker;
use Tests\TestCase;
@@ -17,7 +17,7 @@ class BookmarkTest extends TestCase
{
$this->withoutExceptionHandling();
$this->actingAs($user = factory(\App\User::class)->create(), 'api');
$this->actingAs($user = factory(\App\Models\User::class)->create(), 'api');
$response = $this->post('/api/bookmarks', $this->data());
@@ -49,7 +49,7 @@ class BookmarkTest extends TestCase
/** @test */
public function bookmark_url_are_required()
{
$this->actingAs($user = factory(\App\User::class)->create(), 'api');
$this->actingAs($user = factory(\App\Models\User::class)->create(), 'api');
$response = $this->post('/api/bookmarks', array_merge($this->data(), ['url' => '']));
$response->assertSessionHasErrors('url');

View File

@@ -5,7 +5,7 @@ namespace Tests\Feature;
use App\Models\Event;
use App\Models\EventCategory;
use App\Models\Memo;
use App\User;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Foundation\Testing\WithFaker;
use Symfony\Component\HttpFoundation\Response;
@@ -50,7 +50,7 @@ class EventsTest extends TestCase
/** @test */
public function event_category_name_are_required()
{
$this->actingAs($user = factory(\App\User::class)->create(['role' => 2]), 'api');
$this->actingAs($user = factory(\App\Models\User::class)->create(['role' => 2]), 'api');
$response = $this->post('/api/events/categories', ['name' => '', 'description' => 'test name required']);
$response->assertSessionHasErrors('name');
@@ -257,7 +257,7 @@ class EventsTest extends TestCase
/** @test */
public function event_name_are_required()
{
$this->actingAs($user = factory(\App\User::class)->create(), 'api');
$this->actingAs($user = factory(\App\Models\User::class)->create(), 'api');
$response = $this->post('/api/events', array_merge($this->data(), ['name' => '']));
$response->assertSessionHasErrors('name');
@@ -267,7 +267,7 @@ class EventsTest extends TestCase
/** @test */
public function event_start_date_are_required()
{
$this->actingAs($user = factory(\App\User::class)->create(), 'api');
$this->actingAs($user = factory(\App\Models\User::class)->create(), 'api');
$response = $this->post('/api/events', array_merge($this->data(), ['start_date' => '']));
$response->assertSessionHasErrors('start_date');

View File

@@ -4,7 +4,7 @@ namespace Tests\Feature;
use App\Models\Image;
use App\Models\Memo;
use App\User;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Foundation\Testing\WithFaker;
use Illuminate\Http\UploadedFile;

View File

@@ -3,7 +3,7 @@
namespace Tests\Feature;
use App\Models\Memo;
use App\User;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Foundation\Testing\WithFaker;
use Symfony\Component\HttpFoundation\Response;
@@ -28,7 +28,7 @@ class MemosTest extends TestCase
{
$this->withoutExceptionHandling();
$this->actingAs($user = factory(\App\User::class)->create(), 'api');
$this->actingAs($user = factory(\App\Models\User::class)->create(), 'api');
$response = $this->post('/api/memos', $this->data());
@@ -52,7 +52,7 @@ class MemosTest extends TestCase
/** @test */
public function memo_name_are_required()
{
$this->actingAs($user = factory(\App\User::class)->create(), 'api');
$this->actingAs($user = factory(\App\Models\User::class)->create(), 'api');
$response = $this->post('/api/memos', array_merge($this->data(), ['name' => '']));
$response->assertSessionHasErrors('name');
@@ -62,7 +62,7 @@ class MemosTest extends TestCase
/** @test */
public function memo_are_required()
{
$this->actingAs($user = factory(\App\User::class)->create(), 'api');
$this->actingAs($user = factory(\App\Models\User::class)->create(), 'api');
$response = $this->post('/api/memos', array_merge($this->data(), ['memo' => '']));
$response->assertSessionHasErrors('memo');

View File

@@ -4,7 +4,7 @@ namespace Tests\Feature;
use App\Models\ToDo;
use App\Models\ToDoList;
use App\User;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Foundation\Testing\WithFaker;
use Tests\TestCase;

View File

@@ -3,7 +3,7 @@
namespace Tests\Feature;
use App\Models\ToDoList;
use App\User;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Foundation\Testing\WithFaker;
use Tests\TestCase;
@@ -44,7 +44,7 @@ class ToDoListsTest extends TestCase
/** @test */
public function to_do_list_name_are_required()
{
$this->actingAs($user = factory(\App\User::class)->create(), 'api');
$this->actingAs($user = factory(\App\Models\User::class)->create(), 'api');
$response = $this->post('/api/to-do-lists/', ['name' => '']);
$response->assertSessionHasErrors('name');

View File

@@ -2,7 +2,7 @@
namespace Tests\Feature;
use App\User;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Foundation\Testing\WithFaker;
use Symfony\Component\HttpFoundation\Response;