diff --git a/.env.example b/.env.example index 53d48bf..3602151 100755 --- a/.env.example +++ b/.env.example @@ -7,11 +7,11 @@ APP_URL=http://localhost LOG_CHANNEL=stack DB_CONNECTION=mysql -DB_HOST=127.0.0.1 +DB_HOST=mariadb DB_PORT=3306 -DB_DATABASE=laravel -DB_USERNAME=root -DB_PASSWORD= +DB_DATABASE=stm +DB_USERNAME=stm +DB_PASSWORD=stm BROADCAST_DRIVER=log CACHE_DRIVER=file @@ -23,15 +23,17 @@ 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 -MAIL_FROM_ADDRESS=null +MAIL_HOST=mail.avior.me +MAIL_PORT=587 +MAIL_USERNAME= pouet@avior.me +MAIL_PASSWORD= **** +MAIL_ENCRYPTION=tls MAIL_FROM_NAME="${APP_NAME}" + AWS_ACCESS_KEY_ID= AWS_SECRET_ACCESS_KEY= AWS_DEFAULT_REGION=us-east-1 diff --git a/Dockerfile b/Dockerfile index e295d7e..61e7c00 100755 --- a/Dockerfile +++ b/Dockerfile @@ -31,7 +31,7 @@ RUN apk --update add --no-cache --virtual build-deps yarn composer libzip-dev $P # pdo mysqli pdo_mysql are for database connexions RUN pecl install mcrypt RUN docker-php-ext-enable mcrypt -RUN docker-php-ext-install zip +RUN docker-php-ext-install zip pdo mysqli pdo_mysql # Setup nginx and PHP COPY ./docker/ / diff --git a/app/ContactUS.php b/app/ContactUS.php new file mode 100644 index 0000000..f0a4576 --- /dev/null +++ b/app/ContactUS.php @@ -0,0 +1,11 @@ +validate($request, ['name' => 'required', 'email' => 'required|email', 'message' => 'required']); + ContactUS::create($request->all()); + + + $email_sender = $request->get('email'); + + Mail::send( + 'email', + array( + 'name' => $request->get('name'), + 'email' => $request->get('email'), + 'user_message' => $request->get('message') + ), + function ($message) { + $message->from('pouet@avior.me'); + $message->to('brossard.nicolas09@gmail.com', 'Admin')->subject('Super Cours Laravel'); + } + ); + Mail::send( + 'email_receipt', + array( + 'name' => $request->get('name'), + ), + function ($message) use ($email_sender) { + $message->from('pouet@avior.me'); + $message->to($email_sender)->subject('Accusé de reception'); + } + ); + return back()->with('success', 'Bien joué mec!'); + } +} diff --git a/app/Mail/CA_Laravel.php b/app/Mail/CA_Laravel.php new file mode 100644 index 0000000..fb565f1 --- /dev/null +++ b/app/Mail/CA_Laravel.php @@ -0,0 +1,33 @@ +view('view.name'); + } +} diff --git a/app/config/app.php b/app/config/app.php index 510ef7d..64c619f 100755 --- a/app/config/app.php +++ b/app/config/app.php @@ -121,6 +121,7 @@ return array( 'Illuminate\Validation\ValidationServiceProvider', 'Illuminate\View\ViewServiceProvider', 'Illuminate\Workbench\WorkbenchServiceProvider', + 'Collective\Html\HtmlServiceProvider', ), @@ -135,7 +136,7 @@ return array( | */ - 'manifest' => storage_path().'/meta', + 'manifest' => storage_path() . '/meta', /* |-------------------------------------------------------------------------- @@ -164,7 +165,7 @@ return array( 'Eloquent' => 'Illuminate\Database\Eloquent\Model', 'Event' => 'Illuminate\Support\Facades\Event', 'File' => 'Illuminate\Support\Facades\File', - 'Form' => 'Illuminate\Support\Facades\Form', + // 'Form' => 'Illuminate\Support\Facades\Form', 'Hash' => 'Illuminate\Support\Facades\Hash', 'HTML' => 'Illuminate\Support\Facades\HTML', 'Input' => 'Illuminate\Support\Facades\Input', @@ -188,6 +189,8 @@ return array( 'URL' => 'Illuminate\Support\Facades\URL', 'Validator' => 'Illuminate\Support\Facades\Validator', 'View' => 'Illuminate\Support\Facades\View', + 'Form' => 'Collective\Html\FormFacade', + ), diff --git a/composer.json b/composer.json index 4ed8c09..4ad6027 100755 --- a/composer.json +++ b/composer.json @@ -11,7 +11,8 @@ "php": "^7.2", "fideloper/proxy": "^4.0", "laravel/framework": "^6.2", - "laravel/tinker": "^2.0" + "laravel/tinker": "^2.0", + "laravelcollective/html": "^6.0" }, "require-dev": { "facade/ignition": "^1.4", diff --git a/composer.lock b/composer.lock index aa0a716..1f27a33 100755 --- 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": "5ac7407dc851b5e4eb9c002f1ba28c68", + "content-hash": "34961f507e8019b81e251a30bf6f859c", "packages": [ { "name": "dnoegel/php-xdg-base-dir", @@ -633,6 +633,74 @@ ], "time": "2020-02-05T15:00:44+00:00" }, + { + "name": "laravelcollective/html", + "version": "v6.0.3", + "source": { + "type": "git", + "url": "https://github.com/LaravelCollective/html.git", + "reference": "bcc317d21a7e04eebcc81c4109fa84feaab63590" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/LaravelCollective/html/zipball/bcc317d21a7e04eebcc81c4109fa84feaab63590", + "reference": "bcc317d21a7e04eebcc81c4109fa84feaab63590", + "shasum": "" + }, + "require": { + "illuminate/http": "^6.0", + "illuminate/routing": "^6.0", + "illuminate/session": "^6.0", + "illuminate/support": "^6.0", + "illuminate/view": "^6.0", + "php": ">=7.2" + }, + "require-dev": { + "illuminate/database": "^6.0", + "mockery/mockery": "~1.0", + "phpunit/phpunit": "~7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "6.0-dev" + }, + "laravel": { + "providers": [ + "Collective\\Html\\HtmlServiceProvider" + ], + "aliases": { + "Form": "Collective\\Html\\FormFacade", + "Html": "Collective\\Html\\HtmlFacade" + } + } + }, + "autoload": { + "psr-4": { + "Collective\\Html\\": "src/" + }, + "files": [ + "src/helpers.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Adam Engebretson", + "email": "adam@laravelcollective.com" + }, + { + "name": "Taylor Otwell", + "email": "taylorotwell@gmail.com" + } + ], + "description": "HTML and Form Builders for the Laravel Framework", + "homepage": "https://laravelcollective.com", + "time": "2019-10-02T00:37:39+00:00" + }, { "name": "league/commonmark", "version": "1.3.0", diff --git a/database/migrations/2020_02_12_090350_create_contact_us_table.php b/database/migrations/2020_02_12_090350_create_contact_us_table.php new file mode 100644 index 0000000..72e7b5b --- /dev/null +++ b/database/migrations/2020_02_12_090350_create_contact_us_table.php @@ -0,0 +1,33 @@ +increments('id'); + $table->string('name'); + $table->string('email'); + $table->text('message'); + $table->timestamps(); + }); + } + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop("contactus"); + } +} diff --git a/docker-compose.override.yml b/docker-compose.override.yml index f1c116f..6f1dc7e 100755 --- a/docker-compose.override.yml +++ b/docker-compose.override.yml @@ -1,5 +1,9 @@ version: "3" services: + mariadb: + ports: + - "127.0.0.1:3307:3306" + php: image: project build: @@ -11,4 +15,17 @@ services: - ./:/project ports: - "127.0.0.1:8000:8000" - command: "php artisan serve --host=0.0.0.0 --port=8000" \ No newline at end of file + command: "php artisan serve --host=0.0.0.0 --port=8000" + + # run phpmyadmin to debug mysql + phpmyadmin: + image: phpmyadmin/phpmyadmin + environment: + - PMA_HOST=mariadb + - PMA_PORT=3306 + - PMA_USER=root + - PMA_PASSWORD=4sfdg64s89g4sfd6g84sd6g45 + ports: + - 8101:80 + networks: + - studiomoto diff --git a/docker-compose.yml b/docker-compose.yml index adfbe09..39cdce5 100755 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,4 +4,21 @@ services: image: project build: context: . - dockerfile: Dockerfile \ No newline at end of file + dockerfile: Dockerfile + networks: + - studiomoto + mariadb: + image: mysql + environment: + - MYSQL_ROOT_PASSWORD=4sfdg64s89g4sfd6g84sd6g45 + - MYSQL_DATABASE=stm + - MYSQL_USER=stm + - MYSQL_PASSWORD=stm + networks: + - studiomoto + volumes: + - ./.storage/mysql/:/var/lib/mysql + +networks: + studiomoto: + external: false diff --git a/resources/views/contactUS.blade.php b/resources/views/contactUS.blade.php new file mode 100644 index 0000000..2f3df93 --- /dev/null +++ b/resources/views/contactUS.blade.php @@ -0,0 +1,37 @@ + + +
++Name: {{ $name }} +
++Email: {{ $email }} +
++Message: {{ $user_message }} +
\ No newline at end of file diff --git a/resources/views/email_receipt.blade.php b/resources/views/email_receipt.blade.php new file mode 100644 index 0000000..82ba8b7 --- /dev/null +++ b/resources/views/email_receipt.blade.php @@ -0,0 +1,6 @@ +