Fixed order email, added site url tests, add doctrine/dbal, add service::site()

This commit is contained in:
Deon George 2020-02-09 23:12:34 +11:00
parent a92e94398c
commit cd18b98859
10 changed files with 316 additions and 28 deletions

View File

@ -38,7 +38,6 @@ before_script:
- mkdir -p /root/.composer
- if [ -n "$GITHUB_TOKEN" ]; then cat $GITHUB_TOKEN |base64 -d > /root/.composer/auth.json ; fi
- composer install
- composer require doctrine/dbal
# Copy over testing configuration.
# Don't forget to set the database config in .env.testing correctly

View File

@ -9,12 +9,12 @@ use App\Traits\NextKey;
class Payment extends Model
{
use NextKey;
const RECORD_ID = 'payment';
public $incrementing = FALSE;
const CREATED_AT = 'date_orig';
const UPDATED_AT = 'date_last';
const RECORD_ID = 'payment';
public $incrementing = FALSE;
protected $table = 'ab_payment';
protected $dates = ['date_payment'];
protected $dateFormat = 'U';

View File

@ -11,15 +11,14 @@ use App\Traits\NextKey;
class Product extends Model
{
use NextKey;
const RECORD_ID = 'product';
public $incrementing = FALSE;
protected $table = 'ab_product';
protected $with = ['descriptions'];
const CREATED_AT = 'date_orig';
const UPDATED_AT = 'date_last';
public $incrementing = FALSE;
public $dateFormat = 'U';
public function descriptions()

View File

@ -184,6 +184,17 @@ class Service extends Model
return $this->belongsTo(Product::class);
}
/**
* The site this service is configured for
*
* @todo It may be more appropriate to get this from the account->user attribute (ie: for mail actions)
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function site()
{
return $this->belongsTo(Site::class);
}
/**
* Return a child model with details of the service
*

View File

@ -12,6 +12,7 @@
"barryvdh/laravel-snappy": "^0.4.6",
"beyondcode/laravel-websockets": "^1.3",
"clarkeash/doorman": "^4.0",
"doctrine/dbal": "^2.10",
"eduardokum/laravel-mail-auto-embed": "^1.0",
"fideloper/proxy": "^4.0",
"h4cc/wkhtmltoimage-amd64": "^0.12.4",

252
composer.lock generated
View File

@ -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": "9f5c683a75f22be193805e80ff064350",
"content-hash": "c66583693e58610054b0cb827890548b",
"packages": [
{
"name": "barryvdh/laravel-snappy",
@ -428,6 +428,256 @@
],
"time": "2018-07-24T23:27:56+00:00"
},
{
"name": "doctrine/cache",
"version": "1.10.0",
"source": {
"type": "git",
"url": "https://github.com/doctrine/cache.git",
"reference": "382e7f4db9a12dc6c19431743a2b096041bcdd62"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/cache/zipball/382e7f4db9a12dc6c19431743a2b096041bcdd62",
"reference": "382e7f4db9a12dc6c19431743a2b096041bcdd62",
"shasum": ""
},
"require": {
"php": "~7.1"
},
"conflict": {
"doctrine/common": ">2.2,<2.4"
},
"require-dev": {
"alcaeus/mongo-php-adapter": "^1.1",
"doctrine/coding-standard": "^6.0",
"mongodb/mongodb": "^1.1",
"phpunit/phpunit": "^7.0",
"predis/predis": "~1.0"
},
"suggest": {
"alcaeus/mongo-php-adapter": "Required to use legacy MongoDB driver"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.9.x-dev"
}
},
"autoload": {
"psr-4": {
"Doctrine\\Common\\Cache\\": "lib/Doctrine/Common/Cache"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Guilherme Blanco",
"email": "guilhermeblanco@gmail.com"
},
{
"name": "Roman Borschel",
"email": "roman@code-factory.org"
},
{
"name": "Benjamin Eberlei",
"email": "kontakt@beberlei.de"
},
{
"name": "Jonathan Wage",
"email": "jonwage@gmail.com"
},
{
"name": "Johannes Schmitt",
"email": "schmittjoh@gmail.com"
}
],
"description": "PHP Doctrine Cache library is a popular cache implementation that supports many different drivers such as redis, memcache, apc, mongodb and others.",
"homepage": "https://www.doctrine-project.org/projects/cache.html",
"keywords": [
"abstraction",
"apcu",
"cache",
"caching",
"couchdb",
"memcached",
"php",
"redis",
"xcache"
],
"time": "2019-11-29T15:36:20+00:00"
},
{
"name": "doctrine/dbal",
"version": "v2.10.1",
"source": {
"type": "git",
"url": "https://github.com/doctrine/dbal.git",
"reference": "c2b8e6e82732a64ecde1cddf9e1e06cb8556e3d8"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/dbal/zipball/c2b8e6e82732a64ecde1cddf9e1e06cb8556e3d8",
"reference": "c2b8e6e82732a64ecde1cddf9e1e06cb8556e3d8",
"shasum": ""
},
"require": {
"doctrine/cache": "^1.0",
"doctrine/event-manager": "^1.0",
"ext-pdo": "*",
"php": "^7.2"
},
"require-dev": {
"doctrine/coding-standard": "^6.0",
"jetbrains/phpstorm-stubs": "^2019.1",
"phpstan/phpstan": "^0.11.3",
"phpunit/phpunit": "^8.4.1",
"symfony/console": "^2.0.5|^3.0|^4.0|^5.0"
},
"suggest": {
"symfony/console": "For helpful console commands such as SQL execution and import of files."
},
"bin": [
"bin/doctrine-dbal"
],
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.10.x-dev",
"dev-develop": "3.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Doctrine\\DBAL\\": "lib/Doctrine/DBAL"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Guilherme Blanco",
"email": "guilhermeblanco@gmail.com"
},
{
"name": "Roman Borschel",
"email": "roman@code-factory.org"
},
{
"name": "Benjamin Eberlei",
"email": "kontakt@beberlei.de"
},
{
"name": "Jonathan Wage",
"email": "jonwage@gmail.com"
}
],
"description": "Powerful PHP database abstraction layer (DBAL) with many features for database schema introspection and management.",
"homepage": "https://www.doctrine-project.org/projects/dbal.html",
"keywords": [
"abstraction",
"database",
"db2",
"dbal",
"mariadb",
"mssql",
"mysql",
"oci8",
"oracle",
"pdo",
"pgsql",
"postgresql",
"queryobject",
"sasql",
"sql",
"sqlanywhere",
"sqlite",
"sqlserver",
"sqlsrv"
],
"time": "2020-01-04T12:56:21+00:00"
},
{
"name": "doctrine/event-manager",
"version": "1.1.0",
"source": {
"type": "git",
"url": "https://github.com/doctrine/event-manager.git",
"reference": "629572819973f13486371cb611386eb17851e85c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/event-manager/zipball/629572819973f13486371cb611386eb17851e85c",
"reference": "629572819973f13486371cb611386eb17851e85c",
"shasum": ""
},
"require": {
"php": "^7.1"
},
"conflict": {
"doctrine/common": "<2.9@dev"
},
"require-dev": {
"doctrine/coding-standard": "^6.0",
"phpunit/phpunit": "^7.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Doctrine\\Common\\": "lib/Doctrine/Common"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Guilherme Blanco",
"email": "guilhermeblanco@gmail.com"
},
{
"name": "Roman Borschel",
"email": "roman@code-factory.org"
},
{
"name": "Benjamin Eberlei",
"email": "kontakt@beberlei.de"
},
{
"name": "Jonathan Wage",
"email": "jonwage@gmail.com"
},
{
"name": "Johannes Schmitt",
"email": "schmittjoh@gmail.com"
},
{
"name": "Marco Pivetta",
"email": "ocramius@gmail.com"
}
],
"description": "The Doctrine Event Manager is a simple PHP event system that was built to be used with the various Doctrine projects.",
"homepage": "https://www.doctrine-project.org/projects/event-manager.html",
"keywords": [
"event",
"event dispatcher",
"event manager",
"event system",
"events"
],
"time": "2019-11-10T09:48:07+00:00"
},
{
"name": "doctrine/inflector",
"version": "1.3.1",

View File

@ -15,7 +15,9 @@
<div class="col-md-6 col-sm-6 additional-nav">
<ul class="list-unstyled list-inline pull-right">
<li><a href="{{ url('home') }}">Log In</a></li>
<li><a href="{{ url('register') }}">Registration</a></li>
@isset($register)
<li><a href="{{ url('register') }}">Registration</a></li>
@endisset
</ul>
</div>
<!-- END TOP BAR MENU -->

View File

@ -1,30 +1,26 @@
@component('mail::message',['site'=>$site,'heading'=>'Please Order the following...'])
# Please order the following service.
@component('mail::panel')
@component('mail::message',['site'=>$site,'heading'=>'New Order'])
Please order the following...
@component('mail::table')
| Service | Details |
| :---------- | :---------------- |
| Account | {{ $service->account_name }} ({!! $service->account->account_id_url !!}) |
| Service ID | {!! $service->service_id_url !!} |
| Product | {{ $service->product_name }} |
@switch($service->product_category)
@case('ADSL')
| Address | {{ $service->type->service_address }} |
@break;
@case('VOIP')
| Number | {{ $service->type->service_number }} |
| Supplier Details | {{ join(':',$service->order_info) }} |
@break;
@endswitch
| Service | Details |
| :---------- | :---------------- |
| Account | {{ $service->account_name }} ({!! $service->account->account_id_url !!}) |
| Service ID | {!! $service->service_id_url !!} |
| Product | {{ $service->product_name }} |
@switch($service->product_category)
@case('ADSL')
| Address | {{ $service->type->service_address }} |
@break;
@case('VOIP')
| Number | {{ $service->type->service_number }} |
| Supplier Details | {{ join(':',$service->order_info) }} |
@break;
@endswitch
@endcomponent
**NOTES:** {{ $notes }}
@endcomponent
Thanks,<br>
{{ config('app.name') }}
@endcomponent

View File

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

View File

@ -0,0 +1,27 @@
<?php
namespace Tests\Feature;
use Tests\TestCase;
class SiteURLTest extends TestCase
{
/**
* A basic test example.
*
* @return void
*/
public function testHomeURL()
{
$response = $this->get('/');
$response->assertStatus(200);
}
public function testLoginURL()
{
$response = $this->get('/login');
$response->assertStatus(200);
}
}