Compare commits

..

49 Commits

Author SHA1 Message Date
James Brooks
d5d92f5a3d Update original incident with new update status 2016-08-04 20:28:06 +01:00
Graham Campbell
247c1565a4 Merge branch 'master' into develop 2016-07-29 13:26:02 -04:00
Graham Campbell
8f5afff4a2 Merge branch '2.4' 2016-07-29 13:14:33 -04:00
Graham Campbell
a019d82010 Merge branch '2.4' 2016-07-25 23:03:58 +01:00
Graham Campbell
5b5db06ce3 Updated composer.lock hashes 2016-07-18 19:44:19 +01:00
Graham Campbell
b6635d30ee Merge branch '2.4' 2016-07-18 19:39:25 +01:00
Graham Campbell
5ae23b64d2 Bumped version 2016-07-18 19:39:18 +01:00
Graham Campbell
7583fedaec Updated laravel 2016-07-14 11:25:50 -07:00
Graham Campbell
eecd78496c Merge branch 'master' into develop 2016-07-14 11:25:16 -07:00
Graham Campbell
48dc39122f Merge branch 'master' into develop 2016-07-13 19:07:01 -07:00
Graham Campbell
3aacfb7849 Fixed the route service provider 2016-07-13 19:06:49 -07:00
Graham Campbell
2101b829bb Merge branch 'master' into develop 2016-07-13 18:41:58 -07:00
James Brooks
3913ab65ac Merge pull request #1962 from CachetHQ/user-management-api
Added Team Member API
2016-07-12 18:00:48 +01:00
James Brooks
2048e0899c Added Team Member API. Closes #1822 2016-07-12 17:59:50 +01:00
Graham Campbell
690290449e Merge branch 'master' into develop 2016-06-27 15:52:51 +01:00
Graham Campbell
e326381604 Merge branch 'master' into develop
# Conflicts:
#	composer.json
#	composer.lock
2016-06-11 00:55:48 +01:00
Graham Campbell
662fff9edf Merge branch 'master' into develop
# Conflicts:
#	VERSION
#	composer.json
#	composer.lock
2016-06-10 09:02:30 +01:00
Graham Campbell
c5c21cd8db Merge branch '2.3'
# Conflicts:
#	composer.lock
2016-06-07 11:21:25 +01:00
Graham Campbell
b960146512 Merge branch '2.3'
# Conflicts:
#	composer.json
#	composer.lock
2016-06-06 20:42:12 +01:00
Graham Campbell
3b6fb9f64e Use the new exception handler 2016-06-03 17:30:13 +01:00
Graham Campbell
acfb32bf1d Merge branch '2.3'
# Conflicts:
#	composer.json
#	composer.lock
2016-06-03 17:29:40 +01:00
James Brooks
f9946928c1 Merge pull request #1712 from CachetHQ/tags-api
Tags API
2016-06-02 11:25:14 +01:00
James Brooks
5176fca8f0 Implement the component tag API 2016-06-02 11:19:28 +01:00
James Brooks
4852f5558a Create a Tag api 2016-06-02 11:19:28 +01:00
Graham Campbell
b0c75a2319 Merge pull request #1863 from CachetHQ/analysis-8jl73Z
Applied fixes from StyleCI

[ci skip]
2016-05-30 12:15:20 +01:00
Graham Campbell
73d7303b6e Applied fixes from StyleCI
[ci skip]
2016-05-30 07:15:16 -04:00
Graham Campbell
2d8f2cbd63 Fixed typo 2016-05-30 12:14:56 +01:00
Graham Campbell
cb2ce8f67f Synced with laravel 5.3 2016-05-30 12:12:43 +01:00
Graham Campbell
d6d103cf15 Merge branch '2.3' 2016-05-29 19:38:59 +01:00
Graham Campbell
7f36783582 Merge branch '2.3' 2016-05-29 12:10:20 +01:00
Graham Campbell
ed851c232a Merge branch '2.3'
# Conflicts:
#	composer.lock
2016-05-28 22:07:52 +01:00
Graham Campbell
920a3ef6a9 Updated dependencies 2016-05-28 16:40:26 +01:00
Graham Campbell
15816c56bb Merge branch '2.3'
# Conflicts:
#	composer.json
#	composer.lock
2016-05-28 16:36:06 +01:00
Graham Campbell
e5e4b04151 Fix merge 2016-05-25 22:03:36 +01:00
Graham Campbell
283d343dd6 Merge branch '2.3'
# Conflicts:
#	composer.json
#	composer.lock
2016-05-25 22:03:20 +01:00
Graham Campbell
aa85c8708e Merge pull request #1742 from CachetHQ/next
Upgraded to Laravel 5.3
2016-05-25 19:54:46 +01:00
Graham Campbell
f93506fed9 Updated to the latest laravel version 2016-05-25 16:06:11 +01:00
Graham Campbell
b92f9d30fc Use the new bindings substitution middleware 2016-05-25 15:56:28 +01:00
Graham Campbell
3673e57c6f Upgraded to laravel 5.3 2016-05-25 12:38:16 +01:00
Graham Campbell
9fb6ae4fc0 Merge branch '2.3' 2016-05-25 12:28:46 +01:00
Graham Campbell
583601644c Merge branch '2.3'
# Conflicts:
#	composer.json
#	composer.lock
2016-05-25 12:04:37 +01:00
Graham Campbell
5ea816ce2b Merge pull request #1595 from CachetHQ/incident-updates
Incident updates
2016-05-14 08:47:03 +01:00
Joseph Cohen
541d410e41 Implement Incident Updates 2016-05-14 02:38:07 -05:00
Graham Campbell
03348b8ff2 Merge branch '2.3'
# Conflicts:
#	composer.lock
2016-05-13 00:38:09 +01:00
Graham Campbell
2e8743eb6b Merge branch '2.3' 2016-05-01 16:25:09 +01:00
Graham Campbell
66ff1cca65 Updated dependencies 2016-04-27 15:04:32 +01:00
Graham Campbell
64ff9b7d40 Updated phpunit and mockery 2016-04-27 15:01:48 +01:00
Graham Campbell
446aed6b9a Bumped min php version
# Conflicts:
#	composer.json
2016-04-27 15:01:30 +01:00
Graham Campbell
0281c44933 Bumped version 2016-04-27 15:00:45 +01:00
783 changed files with 66302 additions and 11630 deletions

View File

@@ -1,18 +1,12 @@
# This file is for unifying the coding style for different editors and IDEs
# editorconfig.org
root = true
[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
[*.md]
trim_trailing_whitespace = false
[*.{yml,yaml}]
indent_size = 2
[docker-compose.yml]
indent_style = space
indent_size = 4
trim_trailing_whitespace = true

View File

@@ -1,68 +1,32 @@
APP_NAME=Cachet
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_TIMEZONE=UTC
APP_URL=http://cachet.test
APP_ENV=production
APP_DEBUG=false
APP_URL=http://localhost
APP_KEY=SomeRandomString
APP_LOCALE=en
APP_FALLBACK_LOCALE=en
APP_FAKER_LOCALE=en_US
DB_DRIVER=mysql
DB_HOST=localhost
DB_DATABASE=cachet
DB_USERNAME=homestead
DB_PASSWORD=secret
DB_PORT=null
DB_PREFIX=null
APP_MAINTENANCE_DRIVER=file
# APP_MAINTENANCE_STORE=database
CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync
CACHET_EMOJI=false
BCRYPT_ROUNDS=12
LOG_CHANNEL=stack
LOG_STACK=single
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug
DB_CONNECTION=sqlite
# DB_HOST=127.0.0.1
# DB_PORT=3306
# DB_DATABASE=laravel
# DB_USERNAME=root
# DB_PASSWORD=
SESSION_DRIVER=database
SESSION_LIFETIME=120
SESSION_ENCRYPT=false
SESSION_PATH=/
SESSION_DOMAIN=null
BROADCAST_CONNECTION=log
FILESYSTEM_DISK=local
QUEUE_CONNECTION=database
CACHE_STORE=database
CACHE_PREFIX=
MEMCACHED_HOST=127.0.0.1
REDIS_CLIENT=phpredis
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_MAILER=log
MAIL_HOST=127.0.0.1
MAIL_DRIVER=smtp
MAIL_HOST=mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS="hello@example.com"
MAIL_FROM_NAME="${APP_NAME}"
MAIL_ADDRESS=null
MAIL_NAME=null
MAIL_ENCRYPTION=tls
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
AWS_USE_PATH_STYLE_ENDPOINT=false
REDIS_HOST=null
REDIS_DATABASE=null
REDIS_PORT=null
VITE_APP_NAME="${APP_NAME}"
CACHET_BEACON=false
CACHET_EMOJI=false
CACHET_AUTO_TWITTER=true
GITHUB_TOKEN=null

View File

@@ -1,46 +0,0 @@
# Contributor Covenant Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
## Scope
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at james@alt-three.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/

View File

@@ -1,94 +0,0 @@
# Contribution Guidelines
## Thank you
Firstly, thank you for taking an interest in Cachet and for reading this guide.
## Creating issues
We track feature requests and bug reports on the [issue tracker](https://github.com/cachethq/Cachet/issues). Please send support requests to our support email; [support@alt-three.com](mailto:support@alt-three.com?subject=Cachet%20Support).
**Always be respectful.** Organisation members reserve the right to lock topics if they feel necessary.
## Languages
This project accepts **English translations** only. Translations will be updated automatically through the [CrowdIn](https://translate.cachethq.io) integration.
Please submit alternative translations to the [Cachet CrowdIn](https://translate.cachethq.io) project. CrowdIn will automatically send a Pull Request with your updates in.
## Coding Standards
Please try to follow existing coding standards. [StyleCI](https://styleci.io) will analyse and fix any discrepancies in coding standards.
## Introduction into Git and GitHub
If you are new to Git, GitHub and the whole open source software community, welcome! Here are some resources for getting started and understanding what it's all about.
- [Try Git](https://try.github.io/levels/1/challenges/1) by Code School
- [GitHub Help](https://help.github.com)
If you're not fond of the command line, you can get one of GitHub's free GUI desktop apps:
- [GitHub for Mac](https://github.com/blog/1510-installing-git-from-github-for-mac)
- [GitHub for Windows](https://github.com/blog/1127-github-for-windows)
If you're feeling adventurous, you can become a Git & GitHub master with the [Git Path on Code School](https://www.codeschool.com/paths/git).
## .editorconfig
You should also make use of the [.editorconfig](/.editorconfig) file found within the root of the repository. It'll make sure that your editor is setup with the same file settings.
## Ways to help:
Start by becoming familiar with Cachet. If you're already using Cachet, that's a great head start. If not, check out the latest [demo](https://dev.cachethq.io) and have a play. You can also download and install Cachet locally to familiarise yourself that way.
You don't have to be a developer to help improve Cachet, infact there are lots of ways that you can help us.
### Spread the word
There are a lot of people who don't know about Cachet or what a status page is and how important it can be. [Tweet about Cachet](https://twitter.com/CachetHQ). Write blog posts about your success (or failures, we're not perfect) with Cachet and share what you took away from it.
### Help with Documentation
Cachet is in use around the world. Cachet speaks multiple languages. Our documentation doesn't and can be hard to understand for non-English speaking people. Documentation should be easy to understand and we need your help to make this possible. Check out [CachetHQ/Docs](https://github.com/CachetHQ/Docs) to contribute to our documentation.
### As a non-developer/non-designer
We're always looking for new [translations](#translations).
Of course bug reports, feature requests and [documentation](https://docs.cachethq.io) are always appreciated.
### As a designer
As Cachet gains new features, the design and ideas that were once a perfect fit need updating and in some cases designing from scratch. This is where you come in! Fancy giving Cachet a lick of paint? Sweet!
You'll need to install Node.js with NPM or Yarn.
To get started you can do the following:
1. Install Node.js and our dev dependencies.
2. Run `npm run dev`
3. Make your changes to the SCSS files in `./resources/assets/sass/`
If you're making a lot of changes, you'll find that running `npm run watch` will make life easier for you!
When you're happy with your changes, please run `npm run prod` to minify the assets.
### As a developer
Built using [Laravel](https://laravel.com).
We use these extra dependencies to develop Cachet:
- Node.js
- NPM or Yarn
- Composer
- Git
Once cloned to your local machine, you'll need some demo data! Run `php artisan cachet:seed` to get the demo installation ready for action.
### #YOLO JUST SUBMIT A PR
_A great idea taken from https://github.com/metabase/metabase/blob/master/docs/contributing.md#yolo-just-submit-a-pr._
> If you come up with something really cool, and want to share it with us, just submit a PR. If it hasn't gone through the above process, we probably won't merge it as is, but if it's compelling, we're more than willing to help you via code review, design review and generally OCD nitpicking so that it fits into the rest of our codebase.

5
.github/FUNDING.yml vendored
View File

@@ -1,5 +0,0 @@
# These are supported funding model platforms
github:
- jbrooksuk
- cachethq

20
.github/ISSUE_TEMPLATE vendored Normal file
View File

@@ -0,0 +1,20 @@
Before submitting your issue, please make sure that you've checked the checkboxes below.
- [ ] I am running the [latest release](https://github.com/CachetHQ/Cachet/releases/latest) version of Cachet.
- [ ] I am running at least PHP 5.6.4. *You can check this by running `php -v`.*
- [ ] I have ran `rm -rf bootstrap/cache/*`.
### Expected behaviour
*Please describe what you're expecting to see happen.*
### Actual behaviour
*Please describe what you're actually seeing happen.*
### Steps to reproduce
*If your issue requires any specific steps to reproduce, please outline them here.*
1. First step
2. Second step

24
.gitignore vendored
View File

@@ -1,22 +1,4 @@
/.phpunit.cache
/node_modules
/public/build
/public/hot
/public/storage
/public/css/filament
/public/js/filament
/public/vendor/cachethq/cachet
/storage/*.key
/vendor
.env
.env.backup
.env.production
.phpunit.result.cache
Homestead.json
Homestead.yaml
auth.json
npm-debug.log
yarn-error.log
/.fleet
/.idea
/.vscode
node_modules
phpunit.xml
vendor

12
.travis.yml Normal file
View File

@@ -0,0 +1,12 @@
language: php
php:
- 5.6
- 7.0
- hhvm
sudo: false
install: travis_retry composer install --no-interaction --no-scripts --prefer-source
script: vendor/bin/phpunit

76
CONTRIBUTING.md Normal file
View File

@@ -0,0 +1,76 @@
# Contribution Guidelines
## Creating issues
Feature requests and bug reports should be made by using the [issue tracker](https://github.com/cachethq/Cachet/issues). Support questions should be directed to our support email; [support@alt-three.com](mailto:support@alt-three.com?subject=Cachet Support).
**Always be respectful.** Organization members reserve the right to lock topics if they feel necessary.
## Languages
Any non-English translations must be made on the [Cachet CrowdIn](https://translate.cachethq.io) project. This makes syncing translations much easier.
## Coding Standards
Please follow existing coding standards:
```php
<?php
namespace CachetHQ\Cachet\Controller;
use CachetHQ\Cachet\Bar;
class Foo extends Bar
{
public function baz()
{
if ($condition) {
}
}
}
```
- At least one newline separating `namespace`, `use`, `function` and `class` declarations.
- Spaces around operators, loops, conditions and control blocks:
```php
<?php
use \Exception;
if ($condition === (10 + 2)) {
try {
throw Exception("Something went wrong...");
} catch (Exception $e) {
// Do something here.
}
}
```
- Braces on a new line following: `namespace`, `use`, `function` and `class`.
- PHP constants should be in lowercase; `true`, `false` and `null`.
- Defined constants should always be in uppercase.
- Never leave trailing spaces at the end of a line.
- Files should end with one blank line.
- Do not use `# Bash` style comments.
- Always add or update Docblocs to functions.
- We use [StyleCI](https://styleci.io) to automatically check code standards in Pull Requests. If your PR fails the CI check, then apply the supplied patch and re-push.
If you're still unsure, then take a look at existing code.
## Introduction into Git and GitHub
If you are new to Git, GitHub and the whole open source software community, welcome! Here are some resources for getting started and understanding what it's all about.
- [Try Git](https://try.github.io/levels/1/challenges/1) by Code School
- [GitHub Help](https://help.github.com)
If you're not particularly fond of the command line, you can get one of GitHub's free GUI desktop apps:
- [GitHub for Mac](https://github.com/blog/1510-installing-git-from-github-for-mac)
- [GitHub for Windows](https://github.com/blog/1127-github-for-windows)
If you're feeling adventurous, you can become a Git & GitHub master with the [Git Path on Code School](https://www.codeschool.com/paths/git).
## .editorconfig
You should also make use of the [.editorconfig](/.editorconfig) file found within the root of the repository. It'll make sure that your editor is setup with the same file settings.

12
LICENSE Normal file
View File

@@ -0,0 +1,12 @@
Copyright (c) 2015-2016 Alt Three Services Limited.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. Neither the name of the Cachet nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

113
README.md
View File

@@ -1,53 +1,108 @@
<p align="center">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://cachethq.io/assets/cachet-logo-dark.svg">
<img alt="Cachet Logo" src="https://cachethq.io/assets/cachet-logo-light.svg">
</picture>
</p>
# Cachet
Cachet, the open-source status page system.
[![StyleCI](https://styleci.io/repos/26730195/shield)](https://styleci.io/repos/26730195/)
[![Build Status](https://img.shields.io/travis/CachetHQ/Cachet/master.svg?style=flat-square)](https://travis-ci.org/CachetHQ/Cachet)
[![Software License](https://img.shields.io/badge/license-BSD3-brightgreen.svg?style=flat-square)](LICENSE)
[![Crowdin](https://d322cqt584bo4o.cloudfront.net/cachet/localized.svg)](http://translate.cachethq.io/project/cachet)
[![Packagist](https://img.shields.io/packagist/v/cachethq/cachet.svg?style=flat-square)](https://packagist.org/packages/cachethq/cachet)
## Cachet 3.x Announcement
![Screenshot](https://cachethq.io/img/main-interface.jpg)
For more information on the Cachet rebuild and our plans for 3.x, you can read the announcement [here](https://github.com/CachetHQ/Cachet/discussions/4342).
Cachet is a beautiful and powerful open source status page system, a free replacement to services such as StatusPage.io, Status.io and others.
## Show your support
Cachet is a BSD-3-licensed open source project. If you'd like to support future development, check out the [Patreon campaign](https://patreon.com/jbrooksuk).
## Features
- List your service components
- Report incidents
- Customise the look of your status page
- List your services components
- Log incidents
- Apply custom CSS to the status page
- Markdown support for incident messages
- A powerful JSON API
- JSON API
- Translated into eleven languages
- Metrics
- Multi-lingual
- Subscriber notifications via email
- Two factor authentication
- Cross-database support: MySQL, PostgreSQL and SQLite
- Subscriber notifications via Email
- Two factor authentication, with Google Authenticator
## Usage in production
Use of `master` in a production environment is not recommended as it may change at any time.
## Requirements
- PHP 8.1 or later
- PHP 5.6.4+ or newer
- Apache or Nginx server
- [Composer](https://getcomposer.org)
- A supported database: MySQL, PostgreSQL or SQLite
## How to contribute
We're always looking for contributions that improve Cachet. It's easy to get started and you don't even need to know how to write a single line of code!
### Contributing as a non-developer/non-designer
We're always looking for new [translations](#translations).
Of course bug reports, feature requests and [documentation](https://docs.cachethq.io) are always appreciated.
### Contributing as a designer
As Cachet gains new features, the design and ideas that were once a perfect fit need updating and in some cases designing from scratch. This is where you come in! Fancy giving Cachet a lick of paint? Sweet!
You'll need to install Node.js, Bower and Gulp.
To get started you can do the following:
1. Install Node.js and our dev dependencies.
2. Make your changes to the SCSS files in `./resources/assets/sass/`
3. Run `gulp`
If you're making a lot of changes, you'll find that running `gulp watch` will make life easier for you!
### Contributing as a developer
Built using [Laravel](https://laravel.com).
We use these extra dependencies to develop Cachet:
- Node.js
- Gulp
- Git
Once cloned to your local machine, you'll need some demo data! Run `php artisan cachet:seed` to get the demo installation on the go.
## Installation, Upgrades and Documentation
You can find documentation at [https://docs.cachethq.io](https://docs.cachethq.io).
You can now find our documentation at [https://docs.cachethq.io](https://docs.cachethq.io).
Here are some useful quick links:
- [Installing Cachet](https://docs.cachethq.io/docs/installing-cachet)
- [Getting started with Docker](https://docs.cachethq.io/docs/get-started-with-docker)
- [Installing Cachet](https://docs.cachethq.io/installation/)
- [Getting started with Docker](https://docs.cachethq.io/installation/docker)
### Demo Account
### Demo
To test out the demo, you may login to the [Dashboard](https://demo.cachethq.io/dashboard) with the following:
To test out the v3 demo, you can log in to the [Cachet dashboard](https://v3.cachethq.io/dashboard) with the following credentials:
- **Username:** test or test@test.com
- **Password:** test123
- **Email:** `test@test.com`
- **Password:** `test123`
The demo is reset every half hour.
> **Note**
> The demo will automatically reset every 30 minutes.
### Release Notes
We list releases on the [Releases page](https://github.com/CachetHQ/Cachet/releases) of the [Cachet GitHub repository](https://github.com/CachetHQ/Cachet). On the Releases page, you can also find the release notes for each release.
## Translations
A special thank you to our [translators](https://crowdin.com/project/cachet/activity_stream), who have allowed us to share Cachet with the world. If you'd like to contribute translations, please check out our [CrowdIn project](https://crowdin.com/project/cachet).
## Security Vulnerabilities
If you discover a security vulnerability within Cachet, please send an e-mail to [support@cachethq.io](mailto:support@cachethq.io?Cachet%20Security%20Vulnerability). All security vulnerabilities are reviewed on a case-by-case basis.
If you discover a security vulnerability within Cachet, please send an e-mail to us at support@alt-three.com. We handle all security vulnerabilities on a case-by-case basis.
## Installations
We offer a paid installation service, which starts at $99 but is subject to change, dependant on your setup and infrastructure.
To find out more, email us at support@alt-three.com

View File

@@ -1,17 +0,0 @@
# Security Policy
**PLEASE DON'T DISCLOSE SECURITY-RELATED ISSUES PUBLICLY, [SEE BELOW](#reporting-a-vulnerability).**
## Supported Versions
Use this section to tell people about which versions of your project are
currently being supported with security updates.
| Version | Supported |
| ------- | ------------------ |
| 2.4 | :white_check_mark: |
| < 2.4 | :x: |
## Reporting a Vulnerability
If you discover a security vulnerability within Cachet, please email James Brooks at james@cachethq.io. All security vulnerabilities will be promptly addressed.

1
VERSION Normal file
View File

@@ -0,0 +1 @@
3.0.0-dev

View File

@@ -0,0 +1,103 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Bus\Commands\Component;
final class AddComponentCommand
{
/**
* The component name.
*
* @var string
*/
public $name;
/**
* The component description.
*
* @var string
*/
public $description;
/**
* The component status.
*
* @var int
*/
public $status;
/**
* The component link.
*
* @var string
*/
public $link;
/**
* The component order.
*
* @var int
*/
public $order;
/**
* The component group.
*
* @var int
*/
public $group_id;
/**
* Is the component enabled?
*
* @var bool
*/
public $enabled;
/**
* The validation rules.
*
* @var string[]
*/
public $rules = [
'name' => 'required|string',
'description' => 'string',
'status' => 'int|min:1|max:4',
'link' => 'url',
'order' => 'int',
'group_id' => 'int',
'enabled' => 'bool',
];
/**
* Create a new add component command instance.
*
* @param string $name
* @param string $description
* @param int $status
* @param string $link
* @param int $order
* @param int $group_id
* @param bool $enabled
*
* @return void
*/
public function __construct($name, $description, $status, $link, $order, $group_id, $enabled)
{
$this->name = $name;
$this->description = $description;
$this->status = (int) $status;
$this->link = $link;
$this->order = $order;
$this->group_id = $group_id;
$this->enabled = $enabled;
}
}

View File

@@ -0,0 +1,36 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Bus\Commands\Component;
use CachetHQ\Cachet\Models\Component;
final class RemoveComponentCommand
{
/**
* The component to remove.
*
* @var \CachetHQ\Cachet\Models\Component
*/
public $component;
/**
* Create a new remove component command instance.
*
* @param \CachetHQ\Cachet\Models\Component $component
*
* @return void
*/
public function __construct(Component $component)
{
$this->component = $component;
}
}

View File

@@ -0,0 +1,114 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Bus\Commands\Component;
use CachetHQ\Cachet\Models\Component;
final class UpdateComponentCommand
{
/**
* The component to update.
*
* @var \CachetHQ\Cachet\Models\Component
*/
public $component;
/**
* The component name.
*
* @var string
*/
public $name;
/**
* The component description.
*
* @var string
*/
public $description;
/**
* The component status.
*
* @var int
*/
public $status;
/**
* The component link.
*
* @var string
*/
public $link;
/**
* The component order.
*
* @var int
*/
public $order;
/**
* The component group.
*
* @var int
*/
public $group_id;
/**
* Is the component enabled?
*
* @var bool
*/
public $enabled;
/**
* The validation rules.
*
* @var string[]
*/
public $rules = [
'name' => 'string',
'description' => 'string',
'status' => 'int|min:1|max:4',
'link' => 'url',
'order' => 'int',
'group_id' => 'int',
'enabled' => 'bool',
];
/**
* Create a new update component command instance.
*
* @param \CachetHQ\Cachet\Models\Component $component
* @param string $name
* @param string $description
* @param int $status
* @param string $link
* @param int $order
* @param int $group_id
* @param bool $enabled
*
* @return void
*/
public function __construct(Component $component, $name, $description, $status, $link, $order, $group_id, $enabled)
{
$this->component = $component;
$this->name = $name;
$this->description = $description;
$this->status = (int) $status;
$this->link = $link;
$this->order = $order;
$this->group_id = $group_id;
$this->enabled = $enabled;
}
}

View File

@@ -0,0 +1,68 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Bus\Commands\ComponentGroup;
/**
* This is the add component group command.
*
* @author James Brooks <james@alt-three.com>
*/
final class AddComponentGroupCommand
{
/**
* The component group name.
*
* @var string
*/
public $name;
/**
* The component group description.
*
* @var int
*/
public $order;
/**
* Is the component group collapsed?
*
* @var int
*/
public $collapsed;
/**
* The validation rules.
*
* @var string[]
*/
public $rules = [
'name' => 'required|string',
'order' => 'int',
'collapsed' => 'int|between:0,3',
];
/**
* Create a add component group command instance.
*
* @param string $name
* @param int $order
* @param int $collapsed
*
* @return void
*/
public function __construct($name, $order, $collapsed)
{
$this->name = $name;
$this->order = (int) $order;
$this->collapsed = $collapsed;
}
}

View File

@@ -0,0 +1,36 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Bus\Commands\ComponentGroup;
use CachetHQ\Cachet\Models\ComponentGroup;
final class RemoveComponentGroupCommand
{
/**
* The component group to remove.
*
* @var \CachetHQ\Cachet\Models\ComponentGroup
*/
public $group;
/**
* Create a new remove component group command instance.
*
* @param \CachetHQ\Cachet\Models\ComponentGroup $group
*
* @return void
*/
public function __construct(ComponentGroup $group)
{
$this->group = $group;
}
}

View File

@@ -0,0 +1,79 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Bus\Commands\ComponentGroup;
use CachetHQ\Cachet\Models\ComponentGroup;
/**
* This is the update component group command.
*
* @author James Brooks <james@alt-three.com>
*/
final class UpdateComponentGroupCommand
{
/**
* The component group.
*
* @var \CachetHQ\Cachet\Models\ComponentGroup
*/
public $group;
/**
* The component group name.
*
* @var string
*/
public $name;
/**
* The component group description.
*
* @var int
*/
public $order;
/**
* Is the component group collapsed?
*
* @var int
*/
public $collapsed;
/**
* The validation rules.
*
* @var string[]
*/
public $rules = [
'name' => 'string',
'order' => 'int',
'collapsed' => 'int|between:0,3',
];
/**
* Create a add component group command instance.
*
* @param \CachetHQ\Cachet\Models\ComponentGroup $group
* @param string $name
* @param int $order
* @param int $collapsed
*
* @return void
*/
public function __construct(ComponentGroup $group, $name, $order, $collapsed)
{
$this->group = $group;
$this->name = $name;
$this->order = (int) $order;
$this->collapsed = $collapsed;
}
}

View File

@@ -0,0 +1,61 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Bus\Commands\ComponentTag;
use CachetHQ\Cachet\Models\Component;
use CachetHQ\Cachet\Models\Tag;
/**
* This is the add component tag command.
*
* @author James Brooks <james@alt-three.com>
*/
final class AddComponentTagCommand
{
/**
* The component to add the tag to.
*
* @var \CachetHQ\Cachet\Models\Component
*/
public $component;
/**
* The tag to add to the component.
*
* @var \CachetHQ\Cachet\Models\Tag
*/
public $tag;
/**
* The validation rules.
*
* @var string[]
*/
public $rules = [
'component' => 'required',
'tag' => 'required',
];
/**
* Create a add component tag command instance.
*
* @param \CachetHQ\Cachet\Models\Component $component
* @param \CachetHQ\Cachet\Models\Tag $tag
*
* @return void
*/
public function __construct(Component $component, Tag $tag)
{
$this->component = $component;
$this->tag = $tag;
}
}

View File

@@ -0,0 +1,61 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Bus\Commands\ComponentTag;
use CachetHQ\Cachet\Models\Component;
use CachetHQ\Cachet\Models\Tag;
/**
* This is the delete component tag command.
*
* @author James Brooks <james@alt-three.com>
*/
final class DeleteComponentTagCommand
{
/**
* The component to delete the tag from.
*
* @var \CachetHQ\Cachet\Models\Component
*/
public $component;
/**
* The tag to delete.
*
* @var \CachetHQ\Cachet\Models\Tag
*/
public $tag;
/**
* The validation rules.
*
* @var string[]
*/
public $rules = [
'component' => 'required',
'tag' => 'required',
];
/**
* Create a delete component tag command instance.
*
* @param \CachetHQ\Cachet\Models\Component $component
* @param \CachetHQ\Cachet\Models\Tag $tag
*
* @return void
*/
public function __construct(Component $component, Tag $tag)
{
$this->component = $component;
$this->tag = $tag;
}
}

View File

@@ -0,0 +1,36 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Bus\Commands\Incident;
use CachetHQ\Cachet\Models\Incident;
final class RemoveIncidentCommand
{
/**
* The incident to remove.
*
* @var \CachetHQ\Cachet\Models\Incident
*/
public $incident;
/**
* Create a new remove incident command instance.
*
* @param \CachetHQ\Cachet\Models\Incident $incident
*
* @return void
*/
public function __construct(Incident $incident)
{
$this->incident = $incident;
}
}

View File

@@ -0,0 +1,132 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Bus\Commands\Incident;
final class ReportIncidentCommand
{
/**
* The incident name.
*
* @var string
*/
public $name;
/**
* The incident status.
*
* @var int
*/
public $status;
/**
* The incident message.
*
* @var string
*/
public $message;
/**
* The incident visibility.
*
* @var int
*/
public $visible;
/**
* The incident component.
*
* @var int
*/
public $component_id;
/**
* The component status.
*
* @var int
*/
public $component_status;
/**
* Whether to notify about the incident or not.
*
* @var bool
*/
public $notify;
/**
* The date at which the incident occurred.
*
* @var string|null
*/
public $incident_date;
/**
* A given incident template.
*
* @var string|null
*/
public $template;
/**
* Variables for the incident template.
*
* @var string[]|null
*/
public $template_vars;
/**
* The validation rules.
*
* @var string[]
*/
public $rules = [
'name' => 'required|string',
'status' => 'required|int|min:0|max:4',
'message' => 'string',
'visible' => 'bool',
'component_id' => 'int|required_with:component_status',
'component_status' => 'int|min:1|max:4|required_with:component_id',
'notify' => 'bool',
'incident_date' => 'string',
'template' => 'string',
];
/**
* Create a new report incident command instance.
*
* @param string $name
* @param int $status
* @param string $message
* @param int $visible
* @param int $component_id
* @param int $component_status
* @param bool $notify
* @param string|null $incident_date
* @param string|null $template
* @param array|null $template_vars
*
* @return void
*/
public function __construct($name, $status, $message, $visible, $component_id, $component_status, $notify, $incident_date, $template, array $template_vars = null)
{
$this->name = $name;
$this->status = $status;
$this->message = $message;
$this->visible = $visible;
$this->component_id = $component_id;
$this->component_status = $component_status;
$this->notify = $notify;
$this->incident_date = $incident_date;
$this->template = $template;
$this->template_vars = $template_vars;
}
}

View File

@@ -0,0 +1,73 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Bus\Commands\Incident;
final class ReportMaintenanceCommand
{
/**
* The maintenance name.
*
* @var string
*/
public $name;
/**
* The maintenance message.
*
* @var string
*/
public $message;
/**
* Whether to notify about the maintenance or not.
*
* @var bool
*/
public $notify;
/**
* Timestamp of when the maintenance is due to start.
*
* @var string
*/
public $timestamp;
/**
* The validation rules.
*
* @var string[]
*/
public $rules = [
'name' => 'required|string',
'message' => 'string',
'notify' => 'bool',
'timestamp' => 'string',
];
/**
* Create a new report maintenance command instance.
*
* @param string $name
* @param string $message
* @param bool $notify
* @param string $timestamp
*
* @return void
*/
public function __construct($name, $message, $notify, $timestamp)
{
$this->name = $name;
$this->message = $message;
$this->notify = $notify;
$this->timestamp = $timestamp;
}
}

View File

@@ -0,0 +1,142 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Bus\Commands\Incident;
use CachetHQ\Cachet\Models\Incident;
final class UpdateIncidentCommand
{
/**
* The incident to update.
*
* @var \CachetHQ\Cachet\Models\Incident
*/
public $incident;
/**
* The incident name.
*
* @var string
*/
public $name;
/**
* The incident status.
*
* @var int
*/
public $status;
/**
* The incident message.
*
* @var string
*/
public $message;
/**
* The incident visibility.
*
* @var int
*/
public $visible;
/**
* The incident component.
*
* @var int
*/
public $component_id;
/**
* The component status.
*
* @var int
*/
public $component_status;
/**
* Whether to notify about the incident or not.
*
* @var bool
*/
public $notify;
/**
* The date that the incident occurred on.
*
* @var string
*/
public $incident_date;
/**
* A given incident template.
*
* @var string|null
*/
public $template;
/**
* Variables for the incident template.
*
* @var string[]|null
*/
public $template_vars;
/**
* The validation rules.
*
* @var string[]
*/
public $rules = [
'name' => 'string',
'status' => 'int|min:0|max:4',
'message' => 'string',
'visible' => 'bool',
'component_id' => 'int',
'component_status' => 'int|min:1|max:4|required_with:component_id',
'notify' => 'bool',
'template' => 'string',
];
/**
* Create a new update incident command instance.
*
* @param \CachetHQ\Cachet\Models\Incident $incident
* @param string $name
* @param int $status
* @param string $message
* @param int $visible
* @param int $component_id
* @param int $component_status
* @param bool $notify
* @param string|null $incident_date
* @param string|null $template
* @param array|null $template_vars
*
* @return void
*/
public function __construct(Incident $incident, $name, $status, $message, $visible, $component_id, $component_status, $notify, $incident_date, $template, array $template_vars = null)
{
$this->incident = $incident;
$this->name = $name;
$this->status = $status;
$this->message = $message;
$this->visible = $visible;
$this->component_id = $component_id;
$this->component_status = $component_status;
$this->notify = $notify;
$this->incident_date = $incident_date;
$this->template = $template;
$this->template_vars = $template_vars;
}
}

View File

@@ -0,0 +1,41 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Bus\Commands\IncidentUpdate;
use CachetHQ\Cachet\Models\IncidentUpdate;
/**
* This is the remove incident update command.
*
* @author James Brooks <james@alt-three.com>
*/
final class RemoveIncidentUpdateCommand
{
/**
* The incident update to remove.
*
* @var \CachetHQ\Cachet\Models\IncidentUpdate
*/
public $incidentUpdate;
/**
* Create a new remove incident update command instance.
*
* @param \CachetHQ\Cachet\Models\IncidentUpdate $incidentUpdate
*
* @return void
*/
public function __construct(IncidentUpdate $incidentUpdate)
{
$this->incidentUpdate = $incidentUpdate;
}
}

View File

@@ -0,0 +1,81 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Bus\Commands\IncidentUpdate;
use CachetHQ\Cachet\Models\Incident;
use CachetHQ\Cachet\Models\User;
/**
* This is the report incident update command.
*
* @author James Brooks <james@alt-three.com>
*/
final class ReportIncidentUpdateCommand
{
/**
* The incident.
*
* @var \CachetHQ\Cachet\Models\Incident
*/
public $incident;
/**
* The incident status.
*
* @var int
*/
public $status;
/**
* The incident message.
*
* @var string
*/
public $message;
/**
* The user.
*
* @var \CachetHQ\Cachet\Models\User
*/
public $user;
/**
* The validation rules.
*
* @var string[]
*/
public $rules = [
'incident' => 'required',
'status' => 'required|int|min:1|max:4',
'message' => 'required|string',
'user' => 'required',
];
/**
* Create a new report incident update command instance.
*
* @param \CachetHQ\Cachet\Models\Incident $incident
* @param string $status
* @param string $message
* @param \CachetHQ\Cachet\Models\User $user
*
* @return void
*/
public function __construct(Incident $incident, $status, $message, User $user)
{
$this->incident = $incident;
$this->status = $status;
$this->message = $message;
$this->user = $user;
}
}

View File

@@ -0,0 +1,81 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Bus\Commands\IncidentUpdate;
use CachetHQ\Cachet\Models\IncidentUpdate;
use CachetHQ\Cachet\Models\User;
/**
* This is the update incident update command.
*
* @author James Brooks <james@alt-three.com>
*/
final class UpdateIncidentUpdateCommand
{
/**
* The incident update.
*
* @var \CachetHQ\Cachet\Models\IncidentUpdate
*/
public $update;
/**
* The incident status.
*
* @var int
*/
public $status;
/**
* The incident message.
*
* @var string
*/
public $message;
/**
* The user.
*
* @var \CachetHQ\Cachet\Models\User
*/
public $user;
/**
* The validation rules.
*
* @var string[]
*/
public $rules = [
'update' => 'required',
'status' => 'int|min:1|max:4',
'message' => 'string',
'user' => 'required',
];
/**
* Create a new update incident update command instance.
*
* @param \CachetHQ\Cachet\Models\IncidentUpdate $update
* @param string $status
* @param string $message
* @param \CachetHQ\Cachet\Models\User $user
*
* @return void
*/
public function __construct(IncidentUpdate $update, $status, $message, User $user)
{
$this->update = $update;
$this->status = $status;
$this->message = $message;
$this->user = $user;
}
}

View File

@@ -0,0 +1,36 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Bus\Commands\Invite;
use CachetHQ\Cachet\Models\Invite;
final class ClaimInviteCommand
{
/**
* The invite to mark as claimed.
*
* @var \CachetHQ\Cachet\Models\Invite
*/
public $invite;
/**
* Create a new claim invite command instance.
*
* @param \CachetHQ\Cachet\Models\Invite $invite
*
* @return void
*/
public function __construct(Invite $invite)
{
$this->invite = $invite;
}
}

View File

@@ -0,0 +1,134 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Bus\Commands\Metric;
final class AddMetricCommand
{
/**
* The metric name.
*
* @var string
*/
public $name;
/**
* The metric suffix.
*
* @var string
*/
public $suffix;
/**
* The metric description.
*
* @var string
*/
public $description;
/**
* The metric default value.
*
* @var float
*/
public $default_value;
/**
* The metric calculation type.
*
* @var int
*/
public $calc_type;
/**
* The metric display chart.
*
* @var int
*/
public $display_chart;
/**
* The metric decimal places.
*
* @var int
*/
public $places;
/**
* The view to show the metric points in.
*
* @var int
*/
public $default_view;
/**
* The threshold to buffer the metric points in.
*
* @var int
*/
public $threshold;
/**
* The order of which to place the metric in.
*
* @var int
*/
public $order;
/**
* The validation rules.
*
* @var string[]
*/
public $rules = [
'name' => 'required|string',
'suffix' => 'required|string',
'description' => 'string',
'display_chart' => 'bool',
'default_value' => 'int',
'calc_type' => 'int',
'display_chart' => 'int',
'places' => 'int|between:0,4',
'default_view' => 'int|between:0,3',
'threshold' => 'numeric|between:0,10',
'order' => 'int',
];
/**
* Create a new add metric command instance.
*
* @param string $name
* @param string $suffix
* @param string $description
* @param float $default_value
* @param int $calc_type
* @param int $display_chart
* @param int $places
* @param int $default_view
* @param int $threshold
* @param int $order
*
* @return void
*/
public function __construct($name, $suffix, $description, $default_value, $calc_type, $display_chart, $places, $default_view, $threshold, $order = 0)
{
$this->name = $name;
$this->suffix = $suffix;
$this->description = $description;
$this->default_value = $default_value;
$this->calc_type = $calc_type;
$this->display_chart = $display_chart;
$this->places = $places;
$this->default_view = $default_view;
$this->threshold = $threshold;
$this->order = $order;
}
}

View File

@@ -0,0 +1,64 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Bus\Commands\Metric;
use CachetHQ\Cachet\Models\Metric;
final class AddMetricPointCommand
{
/**
* The metric to add.
*
* @var \CachetHQ\Cachet\Models\Metric
*/
public $metric;
/**
* The metric point value.
*
* @var int
*/
public $value;
/**
* The metric point created at.
*
* @var string
*/
public $created_at;
/**
* The validation rules.
*
* @var string[]
*/
public $rules = [
'value' => 'numeric',
'created_at' => 'string',
];
/**
* Create a new add metric point command instance.
*
* @param \CachetHQ\Cachet\Models\Metric $metric
* @param int $value
* @param string $created_at
*
* @return void
*/
public function __construct(Metric $metric, $value, $created_at)
{
$this->metric = $metric;
$this->value = $value;
$this->created_at = $created_at;
}
}

View File

@@ -0,0 +1,36 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Bus\Commands\Metric;
use CachetHQ\Cachet\Models\Metric;
final class RemoveMetricCommand
{
/**
* The metric to remove.
*
* @var \CachetHQ\Cachet\Models\Metric
*/
public $metric;
/**
* Create a new remove metric command instance.
*
* @param \CachetHQ\Cachet\Models\Metric $metric
*
* @return void
*/
public function __construct(Metric $metric)
{
$this->metric = $metric;
}
}

View File

@@ -0,0 +1,36 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Bus\Commands\Metric;
use CachetHQ\Cachet\Models\MetricPoint;
final class RemoveMetricPointCommand
{
/**
* The metric point to remove.
*
* @var \CachetHQ\Cachet\Models\MetricPoint
*/
public $metricPoint;
/**
* Create a new remove metric point command instance.
*
* @param \CachetHQ\Cachet\Models\MetricPoint $metricPoint
*
* @return void
*/
public function __construct(MetricPoint $metricPoint)
{
$this->metricPoint = $metricPoint;
}
}

View File

@@ -0,0 +1,145 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Bus\Commands\Metric;
use CachetHQ\Cachet\Models\Metric;
final class UpdateMetricCommand
{
/**
* The metric.
*
* @var \CachetHQ\Cachet\Models\Metric
*/
public $metric;
/**
* The metric name.
*
* @var string
*/
public $name;
/**
* The metric suffix.
*
* @var string
*/
public $suffix;
/**
* The metric description.
*
* @var string
*/
public $description;
/**
* The metric default value.
*
* @var float
*/
public $default_value;
/**
* The metric calculation type.
*
* @var int
*/
public $calc_type;
/**
* The metric display chart.
*
* @var int
*/
public $display_chart;
/**
* The metric decimal places.
*
* @var int
*/
public $places;
/**
* The view to show the metric points in.
*
* @var int
*/
public $default_view;
/**
* The threshold to buffer the metric points in.
*
* @var int
*/
public $threshold;
/**
* The order of which to place the metric in.
*
* @var int|null
*/
public $order;
/**
* The validation rules.
*
* @var string[]
*/
public $rules = [
'name' => 'string',
'suffix' => 'string',
'description' => 'string',
'display_chart' => 'bool',
'default_value' => 'numeric',
'calc_type' => 'int|in:0,1',
'display_chart' => 'int',
'places' => 'numeric|between:0,4',
'default_view' => 'numeric|between:0,4',
'threshold' => 'numeric|between:0,10',
'order' => 'int',
];
/**
* Create a new update metric command instance.
*
* @param \CachetHQ\Cachet\Models\Metric $metric
* @param string $name
* @param string $suffix
* @param string $description
* @param float $default_value
* @param int $calc_type
* @param int $display_chart
* @param int $places
* @param int $default_view
* @param int $threshold
* @param int|null $order
*
* @return void
*/
public function __construct(Metric $metric, $name, $suffix, $description, $default_value, $calc_type, $display_chart, $places, $default_view, $threshold, $order = null)
{
$this->metric = $metric;
$this->name = $name;
$this->suffix = $suffix;
$this->description = $description;
$this->default_value = $default_value;
$this->calc_type = $calc_type;
$this->display_chart = $display_chart;
$this->places = $places;
$this->default_view = $default_view;
$this->threshold = $threshold;
$this->order = $order;
}
}

View File

@@ -0,0 +1,79 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Bus\Commands\Metric;
use CachetHQ\Cachet\Models\Metric;
use CachetHQ\Cachet\Models\MetricPoint;
/**
* This is the update metric point command.
*
* @author James Brooks <james@alt-three.com>
*/
final class UpdateMetricPointCommand
{
/**
* The metric point.
*
* @var \CachetHQ\Cachet\Models\MetricPoint
*/
public $point;
/**
* The metric.
*
* @var \CachetHQ\Cachet\Models\Metric
*/
public $metric;
/**
* The metric point value.
*
* @var float
*/
public $value;
/**
* The metric point created at.
*
* @var string
*/
public $created_at;
/**
* The validation rules.
*
* @var string[]
*/
public $rules = [
'value' => 'numeric',
'created_at' => 'string',
];
/**
* Create a new update metric point command instance.
*
* @param \CachetHQ\Cachet\Models\MetricPoint $point
* @param \CachetHQ\Cachet\Models\Metric $metric
* @param float $value
* @param string $created_at
*
* @return void
*/
public function __construct(MetricPoint $point, Metric $metric, $value, $created_at)
{
$this->point = $point;
$this->metric = $metric;
$this->value = $value;
$this->created_at = $created_at;
}
}

View File

@@ -0,0 +1,66 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Bus\Commands\Subscriber;
/**
* This is the subscribe subscriber command.
*
* @author James Brooks <james@alt-three.com>
*/
final class SubscribeSubscriberCommand
{
/**
* The subscriber email.
*
* @var string
*/
public $email;
/**
* The subscriber auto verification.
*
* @var bool
*/
public $verified;
/**
* The list of subscriptions to set the subscriber up with.
*
* @var array|null
*/
public $subscriptions;
/**
* The validation rules.
*
* @var array
*/
public $rules = [
'email' => 'required|email',
];
/**
* Create a new subscribe subscriber command instance.
*
* @param string $email
* @param bool $verified
* @param array|null $subscriptions
*
* @return void
*/
public function __construct($email, $verified = false, $subscriptions = null)
{
$this->email = $email;
$this->verified = $verified;
$this->subscriptions = $subscriptions;
}
}

View File

@@ -0,0 +1,36 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Bus\Commands\Subscriber;
use CachetHQ\Cachet\Models\Subscriber;
final class UnsubscribeSubscriberCommand
{
/**
* The subscriber to unsubscribe.
*
* @var \CachetHQ\Cachet\Models\Subscriber
*/
public $subscriber;
/**
* Create a unsubscribe subscriber command instance.
*
* @param \CachetHQ\Cachet\Models\Subscriber $subscriber
*
* @return void
*/
public function __construct(Subscriber $subscriber)
{
$this->subscriber = $subscriber;
}
}

View File

@@ -0,0 +1,36 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Bus\Commands\Subscriber;
use CachetHQ\Cachet\Models\Subscription;
final class UnsubscribeSubscriptionCommand
{
/**
* The subscription to unsubscribe.
*
* @var \CachetHQ\Cachet\Models\Subscription
*/
public $subscription;
/**
* Create a unsubscribe subscription command instance.
*
* @param \CachetHQ\Cachet\Models\Subscription $subscription
*
* @return void
*/
public function __construct(Subscription $subscription)
{
$this->subscription = $subscription;
}
}

View File

@@ -0,0 +1,50 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Bus\Commands\Subscriber;
use CachetHQ\Cachet\Models\Subscriber;
/**
* This is the subscribe subscriber command.
*
* @author Joseph Cohen <joe@alt-three.com>
*/
final class UpdateSubscriberSubscriptionCommand
{
/**
* The subscriber email.
*
* @var \CachetHQ\Cachet\Models\Subscriber
*/
public $subscriber;
/**
* The subscriptions that we want to add.
*
* @var array|null
*/
public $subscriptions;
/**
* Create a new subscribe subscriber command instance.
*
* @param \CachetHQ\Cachet\Models\Subscriber $subscriber
* @param null|array $subscriptions
*
* @return void
*/
public function __construct($subscriber, $subscriptions = null)
{
$this->subscriber = $subscriber;
$this->subscriptions = $subscriptions;
}
}

View File

@@ -0,0 +1,36 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Bus\Commands\Subscriber;
use CachetHQ\Cachet\Models\Subscriber;
final class VerifySubscriberCommand
{
/**
* The subscriber to verify.
*
* @var \CachetHQ\Cachet\Models\Subscriber
*/
public $subscriber;
/**
* Create a verify subscriber command instance.
*
* @param \CachetHQ\Cachet\Models\Subscriber $subscriber
*
* @return void
*/
public function __construct(Subscriber $subscriber)
{
$this->subscriber = $subscriber;
}
}

View File

@@ -0,0 +1,58 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Bus\Commands\Tag;
/**
* This is the create tag command.
*
* @author James Brooks <james@alt-three.com>
*/
final class CreateTagCommand
{
/**
* The name.
*
* @var string
*/
public $name;
/**
* The slug.
*
* @var string
*/
public $slug;
/**
* The validation rules.
*
* @var array
*/
public $rules = [
'name' => 'required|string',
'slug' => 'sometimes|string',
];
/**
* Create a new create tag command instance.
*
* @param string $name
* @param string $slug
*
* @return void
*/
public function __construct($name, $slug)
{
$this->name = $name;
$this->slug = $slug;
}
}

View File

@@ -0,0 +1,50 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Bus\Commands\Tag;
use CachetHQ\Cachet\Models\Tag;
/**
* This is the delete tag command.
*
* @author James Brooks <james@alt-three.com>
*/
final class DeleteTagCommand
{
/**
* The tag.
*
* @var \CachetHQ\Cachet\Models\Tag
*/
public $tag;
/**
* The validation rules.
*
* @var array
*/
public $rules = [
'tag' => 'required',
];
/**
* Create a new delete tag command instance.
*
* @param \CachetHQ\Cachet\Models\Tag $tag
*
* @return void
*/
public function __construct(Tag $tag)
{
$this->tag = $tag;
}
}

View File

@@ -0,0 +1,70 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Bus\Commands\Tag;
use CachetHQ\Cachet\Models\Tag;
/**
* This is the update tag command.
*
* @author James Brooks <james@alt-three.com>
*/
final class UpdateTagCommand
{
/**
* The tag.
*
* @var \CachetHQ\Cachet\Models\Tag
*/
public $tag;
/**
* The name.
*
* @var string
*/
public $name;
/**
* The slug.
*
* @var string
*/
public $slug;
/**
* The validation rules.
*
* @var array
*/
public $rules = [
'tag' => 'required',
'name' => 'sometimes|string',
'slug' => 'sometimes|string',
];
/**
* Create a new update tag command instance.
*
* @param \CachetHQ\Cachet\Models\Tag $tag
* @param string $name
* @param string $slug
*
* @return void
*/
public function __construct(Tag $tag, $name, $slug)
{
$this->tag = $tag;
$this->name = $name;
$this->slug = $slug;
}
}

View File

@@ -0,0 +1,78 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Bus\Commands\User;
/**
* This is the add user command.
*
* @author James Brooks <james@alt-three.com>
*/
final class AddUserCommand
{
/**
* The user username.
*
* @var string
*/
public $username;
/**
* The user password.
*
* @var string
*/
public $password;
/**
* The user email.
*
* @var string
*/
public $email;
/**
* The user level.
*
* @var int
*/
public $level;
/**
* The validation rules.
*
* @var string[]
*/
public $rules = [
'name' => 'required|string',
'email' => 'required|email',
'password' => 'required|string',
'level' => 'int|min:1|max:2',
];
/**
* Create a new add team member command instance.
*
* @param string $username
* @param string $password
* @param string $email
* @param int $level
*
* @return void
*/
public function __construct($username, $password, $email, $level)
{
$this->username = $username;
$this->password = $password;
$this->email = $email;
$this->level = $level;
}
}

View File

@@ -0,0 +1,36 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Bus\Commands\User;
use CachetHQ\Cachet\Models\User;
final class GenerateApiTokenCommand
{
/**
* The user to generate the token.
*
* @var \CachetHQ\Cachet\Models\User
*/
public $user;
/**
* Create a new generate api token command instance.
*
* @param \CachetHQ\Cachet\Models\User $user
*
* @return void
*/
public function __construct(User $user)
{
$this->user = $user;
}
}

View File

@@ -0,0 +1,48 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Bus\Commands\User;
/**
* This is the invite user command.
*
* @author James Brooks <james@alt-three.com>
*/
final class InviteUserCommand
{
/**
* The invite emails.
*
* @var string[]
*/
public $emails;
/**
* The validation rules.
*
* @var string[]
*/
public $rules = [
'emails' => 'required|array|email',
];
/**
* Create a new invite user command instance.
*
* @param string[] $emails
*
* @return void
*/
public function __construct(array $emails)
{
$this->emails = $emails;
}
}

View File

@@ -0,0 +1,36 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Bus\Commands\User;
use CachetHQ\Cachet\Models\User;
final class RemoveUserCommand
{
/**
* The user to remove.
*
* @var \CachetHQ\Cachet\Models\User
*/
public $user;
/**
* Create a new remove user command instance.
*
* @param \CachetHQ\Cachet\Models\User $user
*
* @return void
*/
public function __construct(User $user)
{
$this->user = $user;
}
}

View File

@@ -0,0 +1,73 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Bus\Commands\User;
final class SignupUserCommand
{
/**
* The user username.
*
* @var string
*/
public $username;
/**
* The user password.
*
* @var string
*/
public $password;
/**
* The user email.
*
* @var string
*/
public $email;
/**
* The user level.
*
* @var int
*/
public $level;
/**
* The validation rules.
*
* @var string[]
*/
public $rules = [
'username' => 'required|string',
'password' => 'string',
'email' => 'required|string|email',
'level' => 'int',
];
/**
* Create a new signup user command instance.
*
* @param string $username
* @param string $password
* @param string $email
* @param int $level
*
* @return void
*/
public function __construct($username, $password, $email, $level)
{
$this->username = $username;
$this->password = $password;
$this->email = $email;
$this->level = $level;
}
}

View File

@@ -0,0 +1,90 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Bus\Commands\User;
use CachetHQ\Cachet\Models\User;
/**
* This is the update team member command.
*
* @author James Brooks <james@alt-three.com>
*/
final class UpdateTeamMemberCommand
{
/**
* The user to update.
*
* @var \CachetHQ\Cachet\Models\User
*/
public $user;
/**
* The user username.
*
* @var string
*/
public $username;
/**
* The user password.
*
* @var string
*/
public $password;
/**
* The user email.
*
* @var string
*/
public $email;
/**
* The user level.
*
* @var int
*/
public $level;
/**
* The validation rules.
*
* @var string[]
*/
public $rules = [
'user' => 'required',
'name' => 'required|string',
'email' => 'required|email',
'password' => 'required|string',
'level' => 'int|min:1|max:2',
];
/**
* Create a new add team member command instance.
*
* @param \CachetHQ\Cachet\Models\User $user
* @param string $username
* @param string $password
* @param string $email
* @param int $level
*
* @return void
*/
public function __construct(User $user, $username, $password, $email, $level)
{
$this->user = $user;
$this->username = $username;
$this->password = $password;
$this->email = $email;
$this->level = $level;
}
}

View File

@@ -0,0 +1,19 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Bus\Events\Component;
use CachetHQ\Cachet\Bus\Events\EventInterface;
interface ComponentEventInterface extends EventInterface
{
//
}

View File

@@ -0,0 +1,36 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Bus\Events\Component;
use CachetHQ\Cachet\Models\Component;
final class ComponentWasAddedEvent implements ComponentEventInterface
{
/**
* The component that was added.
*
* @var \CachetHQ\Cachet\Models\Component
*/
public $component;
/**
* Create a new component was added event instance.
*
* @param \CachetHQ\Cachet\Models\Component $component
*
* @return void
*/
public function __construct(Component $component)
{
$this->component = $component;
}
}

View File

@@ -0,0 +1,36 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Bus\Events\Component;
use CachetHQ\Cachet\Models\Component;
final class ComponentWasRemovedEvent implements ComponentEventInterface
{
/**
* The component that was removed.
*
* @var \CachetHQ\Cachet\Models\Component
*/
public $component;
/**
* Create a new component was removed event instance.
*
* @param \CachetHQ\Cachet\Models\Component $component
*
* @return void
*/
public function __construct(Component $component)
{
$this->component = $component;
}
}

View File

@@ -0,0 +1,36 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Bus\Events\Component;
use CachetHQ\Cachet\Models\Component;
final class ComponentWasUpdatedEvent implements ComponentEventInterface
{
/**
* The component that was updated.
*
* @var \CachetHQ\Cachet\Models\Component
*/
public $component;
/**
* Create a new component was updated event instance.
*
* @param \CachetHQ\Cachet\Models\Component $component
*
* @return void
*/
public function __construct(Component $component)
{
$this->component = $component;
}
}

View File

@@ -0,0 +1,19 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Bus\Events\ComponentGroup;
use CachetHQ\Cachet\Bus\Events\EventInterface;
interface ComponentGroupEventInterface extends EventInterface
{
//
}

View File

@@ -0,0 +1,36 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Bus\Events\ComponentGroup;
use CachetHQ\Cachet\Models\ComponentGroup;
final class ComponentGroupWasAddedEvent implements ComponentGroupEventInterface
{
/**
* The component group that was added.
*
* @var \CachetHQ\Cachet\Models\ComponentGroup
*/
public $group;
/**
* Create a new component group was added event instance.
*
* @param \CachetHQ\Cachet\Models\ComponentGroup $group
*
* @return void
*/
public function __construct(ComponentGroup $group)
{
$this->group = $group;
}
}

View File

@@ -0,0 +1,36 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Bus\Events\ComponentGroup;
use CachetHQ\Cachet\Models\ComponentGroup;
final class ComponentGroupWasRemovedEvent implements ComponentGroupEventInterface
{
/**
* The component group that was removed.
*
* @var \CachetHQ\Cachet\Models\ComponentGroup
*/
public $group;
/**
* Create a new component group was removed event instance.
*
* @param \CachetHQ\Cachet\Models\ComponentGroup $group
*
* @return void
*/
public function __construct(ComponentGroup $group)
{
$this->group = $group;
}
}

View File

@@ -0,0 +1,36 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Bus\Events\ComponentGroup;
use CachetHQ\Cachet\Models\ComponentGroup;
final class ComponentGroupWasUpdatedEvent implements ComponentGroupEventInterface
{
/**
* The component group that was updated.
*
* @var \CachetHQ\Cachet\Models\ComponentGroup
*/
public $group;
/**
* Create a new component group was updated event instance.
*
* @param \CachetHQ\Cachet\Models\ComponentGroup $group
*
* @return void
*/
public function __construct(ComponentGroup $group)
{
$this->group = $group;
}
}

View File

@@ -9,6 +9,9 @@
* file that was distributed with this source code.
*/
test('that true is true', function () {
expect(true)->toBeTrue();
});
namespace CachetHQ\Cachet\Bus\Events;
interface EventInterface
{
//
}

View File

@@ -0,0 +1,19 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Bus\Events\Incident;
use CachetHQ\Cachet\Bus\Events\EventInterface;
interface IncidentEventInterface extends EventInterface
{
//
}

View File

@@ -0,0 +1,36 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Bus\Events\Incident;
use CachetHQ\Cachet\Models\Incident;
final class IncidentWasRemovedEvent implements IncidentEventInterface
{
/**
* The incident that has been removed.
*
* @var \CachetHQ\Cachet\Models\Incident
*/
public $incident;
/**
* Create a new incident was removed event instance.
*
* @param \CachetHQ\Cachet\Models\Incident $incident
*
* @return void
*/
public function __construct(Incident $incident)
{
$this->incident = $incident;
}
}

View File

@@ -0,0 +1,36 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Bus\Events\Incident;
use CachetHQ\Cachet\Models\Incident;
final class IncidentWasReportedEvent implements IncidentEventInterface
{
/**
* The incident that has been reported.
*
* @var \CachetHQ\Cachet\Models\Incident
*/
public $incident;
/**
* Create a new incident has reported event instance.
*
* @param \CachetHQ\Cachet\Models\Incident $incident
*
* @return void
*/
public function __construct(Incident $incident)
{
$this->incident = $incident;
}
}

View File

@@ -0,0 +1,36 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Bus\Events\Incident;
use CachetHQ\Cachet\Models\Incident;
final class IncidentWasUpdatedEvent implements IncidentEventInterface
{
/**
* The incident that has been updated.
*
* @var \CachetHQ\Cachet\Models\Incident
*/
public $incident;
/**
* Create a new incident has updated event instance.
*
* @param \CachetHQ\Cachet\Models\Incident $incident
*
* @return void
*/
public function __construct(Incident $incident)
{
$this->incident = $incident;
}
}

View File

@@ -0,0 +1,36 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Bus\Events\Incident;
use CachetHQ\Cachet\Models\Incident;
final class MaintenanceWasScheduledEvent implements IncidentEventInterface
{
/**
* The incident that has been reported.
*
* @var \CachetHQ\Cachet\Models\Incident
*/
public $incident;
/**
* Create a new maintenance has scheduled event instance.
*
* @param \CachetHQ\Cachet\Models\Incident $incident
*
* @return void
*/
public function __construct(Incident $incident)
{
$this->incident = $incident;
}
}

View File

@@ -0,0 +1,24 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Bus\Events\IncidentUpdate;
use CachetHQ\Cachet\Bus\Events\EventInterface;
/**
* This is the incident update event interface.
*
* @author James Brooks <james@alt-three.com>
*/
interface IncidentUpdateEventInterface extends EventInterface
{
//
}

View File

@@ -0,0 +1,41 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Bus\Events\IncidentUpdate;
use CachetHQ\Cachet\Models\IncidentUpdate;
/**
* This is the incident update was removed event.
*
* @author James Brooks <james@alt-three.com>
*/
final class IncidentUpdateWasRemovedEvent implements IncidentUpdateEventInterface
{
/**
* The incident update that has been removed.
*
* @var \CachetHQ\Cachet\Models\IncidentUpdate
*/
public $update;
/**
* Create a new incident update was removed event instance.
*
* @param \CachetHQ\Cachet\Models\IncidentUpdate $update
*
* @return void
*/
public function __construct(IncidentUpdate $update)
{
$this->update = $update;
}
}

View File

@@ -0,0 +1,41 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Bus\Events\IncidentUpdate;
use CachetHQ\Cachet\Models\IncidentUpdate;
/**
* This is the incident update was reported event.
*
* @author James Brooks <james@alt-three.com>
*/
final class IncidentUpdateWasReportedEvent implements IncidentUpdateEventInterface
{
/**
* The incident update that has been reported.
*
* @var \CachetHQ\Cachet\Models\IncidentUpdate
*/
public $update;
/**
* Create a new incident update was reported event instance.
*
* @param \CachetHQ\Cachet\Models\IncidentUpdate $update
*
* @return void
*/
public function __construct(IncidentUpdate $update)
{
$this->update = $update;
}
}

View File

@@ -0,0 +1,41 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Bus\Events\IncidentUpdate;
use CachetHQ\Cachet\Models\IncidentUpdate;
/**
* This is the incident update was updated event.
*
* @author James Brooks <james@alt-three.com>
*/
final class IncidentUpdateWasUpdatedEvent implements IncidentUpdateEventInterface
{
/**
* The incident update that has been updated.
*
* @var \CachetHQ\Cachet\Models\IncidentUpdate
*/
public $update;
/**
* Create a new incident update was updated event instance.
*
* @param \CachetHQ\Cachet\Models\IncidentUpdate $update
*
* @return void
*/
public function __construct(IncidentUpdate $update)
{
$this->update = $update;
}
}

View File

@@ -9,8 +9,11 @@
* file that was distributed with this source code.
*/
it('returns a successful response', function () {
$response = $this->get('/');
namespace CachetHQ\Cachet\Bus\Events\Invite;
$response->assertStatus(200);
});
use CachetHQ\Cachet\Bus\Events\EventInterface;
interface InviteEventInterface extends EventInterface
{
//
}

View File

@@ -0,0 +1,34 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Bus\Events\Invite;
use CachetHQ\Cachet\Models\Invite;
final class InviteWasClaimedEvent implements InviteEventInterface
{
/**
* The invite that has been claimed.
*
* @var \CachetHQ\Cachet\Models\Invite
*/
public $invite;
/**
* Create a new invite was claimed event instance.
*
* @return void
*/
public function __construct(Invite $invite)
{
$this->invite = $invite;
}
}

View File

@@ -9,6 +9,11 @@
* file that was distributed with this source code.
*/
return [
App\Providers\AppServiceProvider::class,
];
namespace CachetHQ\Cachet\Bus\Events\Metric;
use CachetHQ\Cachet\Bus\Events\EventInterface;
interface MetricEventInterface extends EventInterface
{
//
}

View File

@@ -0,0 +1,36 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Bus\Events\Metric;
use CachetHQ\Cachet\Models\MetricPoint;
final class MetricPointWasAddedEvent implements MetricEventInterface
{
/**
* The metric point that was added.
*
* @var \CachetHQ\Cachet\Models\MetricPoint
*/
public $metricPoint;
/**
* Create a new metric point was added event instance.
*
* @param \CachetHQ\Cachet\Models\MetricPoint $metricPoint
*
* @return void
*/
public function __construct(MetricPoint $metricPoint)
{
$this->metricPoint = $metricPoint;
}
}

View File

@@ -0,0 +1,36 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Bus\Events\Metric;
use CachetHQ\Cachet\Models\MetricPoint;
final class MetricPointWasRemovedEvent implements MetricEventInterface
{
/**
* The metric point that was removed.
*
* @var \CachetHQ\Cachet\Models\MetricPoint
*/
public $metricPoint;
/**
* Create a new metric point was removed event instance.
*
* @param \CachetHQ\Cachet\Models\MetricPoint $memtricPoint
*
* @return void
*/
public function __construct(MetricPoint $metricPoint)
{
$this->metricPoint = $metricPoint;
}
}

View File

@@ -0,0 +1,36 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Bus\Events\Metric;
use CachetHQ\Cachet\Models\MetricPoint;
final class MetricPointWasUpdatedEvent implements MetricEventInterface
{
/**
* The metric point that was updated.
*
* @var \CachetHQ\Cachet\Models\MetricPoint
*/
public $metricPoint;
/**
* Create a new metric point was updated event instance.
*
* @param \CachetHQ\Cachet\Models\MetricPoint $metricPoint
*
* @return void
*/
public function __construct(MetricPoint $metricPoint)
{
$this->metricPoint = $metricPoint;
}
}

View File

@@ -0,0 +1,36 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Bus\Events\Metric;
use CachetHQ\Cachet\Models\Metric;
final class MetricWasAddedEvent implements MetricEventInterface
{
/**
* The metric that was added.
*
* @var \CachetHQ\Cachet\Models\Metric
*/
public $metric;
/**
* Create a new metric was added event instance.
*
* @param \CachetHQ\Cachet\Models\Metric $metric
*
* @return void
*/
public function __construct(Metric $metric)
{
$this->metric = $metric;
}
}

View File

@@ -0,0 +1,36 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Bus\Events\Metric;
use CachetHQ\Cachet\Models\Metric;
final class MetricWasRemovedEvent implements MetricEventInterface
{
/**
* The metric that was removed.
*
* @var \CachetHQ\Cachet\Models\Metric
*/
public $metric;
/**
* Create a new metric was removed event instance.
*
* @param \CachetHQ\Cachet\Models\Metric $metric
*
* @return void
*/
public function __construct(Metric $metric)
{
$this->metric = $metric;
}
}

View File

@@ -0,0 +1,36 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Bus\Events\Metric;
use CachetHQ\Cachet\Models\Metric;
final class MetricWasUpdatedEvent implements MetricEventInterface
{
/**
* The metric that was updated.
*
* @var \CachetHQ\Cachet\Models\MetricPoint
*/
public $metric;
/**
* Create a new metric was updated event instance.
*
* @param \CachetHQ\Cachet\Models\Metric $metric
*
* @return void
*/
public function __construct(Metric $metric)
{
$this->metric = $metric;
}
}

View File

@@ -0,0 +1,19 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Bus\Events\Subscriber;
use CachetHQ\Cachet\Bus\Events\EventInterface;
interface SubscriberEventInterface extends EventInterface
{
//
}

View File

@@ -0,0 +1,36 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Bus\Events\Subscriber;
use CachetHQ\Cachet\Models\Subscriber;
final class SubscriberHasSubscribedEvent implements SubscriberEventInterface
{
/**
* The subscriber who has subscribed.
*
* @var \CachetHQ\Cachet\Models\Subscriber
*/
public $subscriber;
/**
* Create a new subscriber has subscribed event instance.
*
* @param \CachetHQ\Cachet\Models\Subscriber $subscriber
*
* @return void
*/
public function __construct(Subscriber $subscriber)
{
$this->subscriber = $subscriber;
}
}

View File

@@ -0,0 +1,36 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Bus\Events\Subscriber;
use CachetHQ\Cachet\Models\Subscriber;
final class SubscriberHasUnsubscribedEvent implements SubscriberEventInterface
{
/**
* The subscriber who has unsubscribed.
*
* @var \CachetHQ\Cachet\Models\Subscriber
*/
public $subscriber;
/**
* Create a new subscriber has unsubscribed event instance.
*
* @param \CachetHQ\Cachet\Models\Subscriber $subscriber
*
* @return void
*/
public function __construct(Subscriber $subscriber)
{
$this->subscriber = $subscriber;
}
}

View File

@@ -0,0 +1,41 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Bus\Events\Subscriber;
use CachetHQ\Cachet\Models\Subscriber;
/**
* This is the subscriber has updated subscriptions event.
*
* @author James Brooks <james@alt-three.com>
*/
final class SubscriberHasUpdatedSubscriptionsEvent implements SubscriberEventInterface
{
/**
* The subscriber.
*
* @var \CachetHQ\Cachet\Models\Subscriber
*/
public $subscriber;
/**
* Create a new subscriber has updated subscriptions event instance.
*
* @param \CachetHQ\Cachet\Models\Subscriber $subscriber
*
* @return void
*/
public function __construct(Subscriber $subscriber)
{
$this->subscriber = $subscriber;
}
}

View File

@@ -0,0 +1,36 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Bus\Events\Subscriber;
use CachetHQ\Cachet\Models\Subscriber;
final class SubscriberHasVerifiedEvent implements SubscriberEventInterface
{
/**
* The subscriber who has verified.
*
* @var \CachetHQ\Cachet\Models\Subscriber
*/
public $subscriber;
/**
* Create a new subscriber has subscribed event instance.
*
* @param \CachetHQ\Cachet\Models\Subscriber $subscriber
*
* @return void
*/
public function __construct(Subscriber $subscriber)
{
$this->subscriber = $subscriber;
}
}

View File

@@ -9,10 +9,11 @@
* file that was distributed with this source code.
*/
namespace Tests;
namespace CachetHQ\Cachet\Bus\Events\User;
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
use CachetHQ\Cachet\Bus\Events\EventInterface;
abstract class TestCase extends BaseTestCase
interface UserEventInterface extends EventInterface
{
//
}

View File

@@ -0,0 +1,36 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Bus\Events\User;
use CachetHQ\Cachet\Models\User;
final class UserWasAddedEvent implements UserEventInterface
{
/**
* The user that has been added.
*
* @var \CachetHQ\Cachet\Models\User
*/
public $user;
/**
* Create a new user was added event instance.
*
* @param \CachetHQ\Cachet\Models\User $user
*
* @return void
*/
public function __construct(User $user)
{
$this->user = $user;
}
}

View File

@@ -0,0 +1,36 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Bus\Events\User;
use CachetHQ\Cachet\Models\Invite;
final class UserWasInvitedEvent implements UserEventInterface
{
/**
* The invite that has been added.
*
* @var \CachetHQ\Cachet\Models\Invite
*/
public $invite;
/**
* Create a new user was invite event instance.
*
* @param \CachetHQ\Cachet\Models\Invite $invite
*
* @return void
*/
public function __construct(Invite $invite)
{
$this->invite = $invite;
}
}

View File

@@ -0,0 +1,36 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Bus\Events\User;
use CachetHQ\Cachet\Models\User;
final class UserWasRemovedEvent implements UserEventInterface
{
/**
* The user that has been removed.
*
* @var \CachetHQ\Cachet\Models\User
*/
public $user;
/**
* Create a new user was removed event instance.
*
* @param \CachetHQ\Cachet\Models\User $user
*
* @return void
*/
public function __construct(User $user)
{
$this->user = $user;
}
}

View File

@@ -0,0 +1,41 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Bus\Events\User;
use CachetHQ\Cachet\Models\User;
/**
* This is the user was updated event.
*
* @author James Brooks <james@alt-three.com>
*/
final class UserWasUpdatedEvent implements UserEventInterface
{
/**
* The user that has been updated.
*
* @var \CachetHQ\Cachet\Models\User
*/
public $user;
/**
* Create a new user was updated event instance.
*
* @param \CachetHQ\Cachet\Models\User $user
*
* @return void
*/
public function __construct(User $user)
{
$this->user = $user;
}
}

View File

@@ -0,0 +1,23 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Bus\Exceptions;
/**
* This is the exception interface.
*
* @author Graham Campbell <graham@alt-three.com>
* @author James Brooks <james@alt-three.com>
*/
interface ExceptionInterface
{
//
}

View File

@@ -0,0 +1,24 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Bus\Exceptions\Tag;
use Exception;
/**
* This is the tag does not exist on component exception class.
*
* @author James Brooks <james@alt-three.com>
*/
class TagDoesNotExistOnComponentException extends Exception implements TagExceptionInterface
{
//
}

View File

@@ -0,0 +1,24 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Bus\Exceptions\Tag;
use CachetHQ\Cachet\Bus\Exceptions\ExceptionInterface;
/**
* This is the tag exception interface.
*
* @author James Brooks <james@alt-three.com>
*/
interface TagExceptionInterface extends ExceptionInterface
{
//
}

View File

@@ -0,0 +1,59 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Bus\Handlers\Commands\Component;
use CachetHQ\Cachet\Bus\Commands\Component\AddComponentCommand;
use CachetHQ\Cachet\Bus\Events\Component\ComponentWasAddedEvent;
use CachetHQ\Cachet\Models\Component;
class AddComponentCommandHandler
{
/**
* Handle the add component command.
*
* @param \CachetHQ\Cachet\Bus\Commands\Component\AddComponentCommand $command
*
* @return \CachetHQ\Cachet\Models\Component
*/
public function handle(AddComponentCommand $command)
{
$component = Component::create($this->filter($command));
event(new ComponentWasAddedEvent($component));
return $component;
}
/**
* Filter the command data.
*
* @param \CachetHQ\Cachet\Bus\Commands\Incident\AddComponentCommand $command
*
* @return array
*/
protected function filter(AddComponentCommand $command)
{
$params = [
'name' => $command->name,
'description' => $command->description,
'link' => $command->link,
'status' => $command->status,
'enabled' => $command->enabled,
'order' => $command->order,
'group_id' => $command->group_id,
];
return array_filter($params, function ($val) {
return $val !== null;
});
}
}

View File

@@ -0,0 +1,34 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Bus\Handlers\Commands\Component;
use CachetHQ\Cachet\Bus\Commands\Component\RemoveComponentCommand;
use CachetHQ\Cachet\Bus\Events\Component\ComponentWasRemovedEvent;
class RemoveComponentCommandHandler
{
/**
* Handle the remove component command.
*
* @param \CachetHQ\Cachet\Bus\Commands\Component\RemoveComponentCommand $command
*
* @return void
*/
public function handle(RemoveComponentCommand $command)
{
$component = $command->component;
event(new ComponentWasRemovedEvent($component));
$component->delete();
}
}

View File

@@ -0,0 +1,61 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Bus\Handlers\Commands\Component;
use CachetHQ\Cachet\Bus\Commands\Component\UpdateComponentCommand;
use CachetHQ\Cachet\Bus\Events\Component\ComponentWasUpdatedEvent;
use CachetHQ\Cachet\Models\Component;
class UpdateComponentCommandHandler
{
/**
* Handle the update component command.
*
* @param \CachetHQ\Cachet\Bus\Commands\Component\UpdateComponentCommand $command
*
* @return \CachetHQ\Cachet\Models\Component
*/
public function handle(UpdateComponentCommand $command)
{
$component = $command->component;
$component->update($this->filter($command));
event(new ComponentWasUpdatedEvent($component));
return $component;
}
/**
* Filter the command data.
*
* @param \CachetHQ\Cachet\Bus\Commands\Incident\UpdateComponentCommand $command
*
* @return array
*/
protected function filter(UpdateComponentCommand $command)
{
$params = [
'name' => $command->name,
'description' => $command->description,
'link' => $command->link,
'status' => $command->status,
'enabled' => $command->enabled,
'order' => $command->order,
'group_id' => $command->group_id,
];
return array_filter($params, function ($val) {
return $val !== null;
});
}
}

View File

@@ -0,0 +1,39 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Bus\Handlers\Commands\ComponentGroup;
use CachetHQ\Cachet\Bus\Commands\ComponentGroup\AddComponentGroupCommand;
use CachetHQ\Cachet\Bus\Events\ComponentGroup\ComponentGroupWasAddedEvent;
use CachetHQ\Cachet\Models\ComponentGroup;
class AddComponentGroupCommandHandler
{
/**
* Handle the add component group command.
*
* @param \CachetHQ\Cachet\Bus\Commands\ComponentGroup\AddComponentGroupCommand $command
*
* @return \CachetHQ\Cachet\Models\ComponentGroup
*/
public function handle(AddComponentGroupCommand $command)
{
$group = ComponentGroup::create([
'name' => $command->name,
'order' => $command->order,
'collapsed' => $command->collapsed,
]);
event(new ComponentGroupWasAddedEvent($group));
return $group;
}
}

View File

@@ -0,0 +1,39 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Bus\Handlers\Commands\ComponentGroup;
use CachetHQ\Cachet\Bus\Commands\ComponentGroup\RemoveComponentGroupCommand;
use CachetHQ\Cachet\Bus\Events\ComponentGroup\ComponentGroupWasRemovedEvent;
class RemoveComponentGroupCommandHandler
{
/**
* Handle the remove component group command.
*
* @param \CachetHQ\Cachet\Bus\Commands\ComponentGroup\RemoveComponentGroupCommand $command
*
* @return void
*/
public function handle(RemoveComponentGroupCommand $command)
{
$group = $command->group;
event(new ComponentGroupWasRemovedEvent($group));
// Remove the group id from all component.
$group->components->map(function ($component) {
$component->update(['group_id' => 0]);
});
$group->delete();
}
}

View File

@@ -0,0 +1,55 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Bus\Handlers\Commands\ComponentGroup;
use CachetHQ\Cachet\Bus\Commands\ComponentGroup\UpdateComponentGroupCommand;
use CachetHQ\Cachet\Bus\Events\ComponentGroup\ComponentGroupWasUpdatedEvent;
class UpdateComponentGroupCommandHandler
{
/**
* Handle the update component group command.
*
* @param \CachetHQ\Cachet\Bus\Commands\ComponentGroup\UpdateComponentGroupCommand $command
*
* @return \CachetHQ\Cachet\Models\ComponentGroup
*/
public function handle(UpdateComponentGroupCommand $command)
{
$group = $command->group;
$group->update($this->filter($command));
event(new ComponentGroupWasUpdatedEvent($group));
return $group;
}
/**
* Filter the command data.
*
* @param \CachetHQ\Cachet\Bus\Commands\ComponentGroup\UpdateComponentGroupCommand $command
*
* @return array
*/
protected function filter(UpdateComponentGroupCommand $command)
{
$params = [
'name' => $command->name,
'order' => $command->order,
'collapsed' => $command->collapsed,
];
return array_filter($params, function ($val) {
return $val !== null;
});
}
}

View File

@@ -0,0 +1,40 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Bus\Handlers\Commands\ComponentTag;
use CachetHQ\Cachet\Bus\Commands\ComponentTag\AddComponentTagCommand;
use CachetHQ\Cachet\Models\ComponentTag;
/**
* This is the add component tag command handler.
*
* @author James Brooks <james@alt-three.com>
*/
class AddComponentTagCommandHandler
{
/**
* Handle the add component tag command.
*
* @param \CachetHQ\Cachet\Bus\Commands\ComponentTag\AddComponentTagCommand $command
*
* @return \CachetHQ\Cachet\Models\ComponentTag
*/
public function handle(AddComponentTagCommand $command)
{
$tag = ComponentTag::create([
'component_id' => $command->component->id,
'tag_id' => $command->tag->id,
]);
return $tag;
}
}

View File

@@ -0,0 +1,41 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Bus\Handlers\Commands\ComponentTag;
use CachetHQ\Cachet\Bus\Commands\ComponentTag\DeleteComponentTagCommand;
use CachetHQ\Cachet\Bus\Exceptions\Tag\TagDoesNotExistOnComponentException;
use CachetHQ\Cachet\Models\ComponentTag;
/**
* This is the delete component tag command handler.
*
* @author James Brooks <james@alt-three.com>
*/
class DeleteComponentTagCommandHandler
{
/**
* Handle the add component tag command.
*
* @param \CachetHQ\Cachet\Bus\Commands\ComponentTag\DeleteComponentTagCommand $command
*
* @return void
*/
public function handle(DeleteComponentTagCommand $command)
{
// If the tag does not exist on the component, throw an exception.
if (!($componentTag = ComponentTag::tagForComponent($command->tag->id, $command->component->id))) {
throw new TagDoesNotExistOnComponentException('The given tag <'.$command->tag->id.'> does not exist on this component <'.$command->componnet->id.'>');
}
$componentTag->delete();
}
}

View File

@@ -0,0 +1,34 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Bus\Handlers\Commands\Incident;
use CachetHQ\Cachet\Bus\Commands\Incident\RemoveIncidentCommand;
use CachetHQ\Cachet\Bus\Events\Incident\IncidentWasRemovedEvent;
class RemoveIncidentCommandHandler
{
/**
* Handle the remove incident command.
*
* @param \CachetHQ\Cachet\Bus\Commands\Incident\RemoveIncidentCommand $command
*
* @return void
*/
public function handle(RemoveIncidentCommand $command)
{
$incident = $command->incident;
event(new IncidentWasRemovedEvent($incident));
$incident->delete();
}
}

View File

@@ -0,0 +1,128 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Bus\Handlers\Commands\Incident;
use CachetHQ\Cachet\Bus\Commands\Incident\ReportIncidentCommand;
use CachetHQ\Cachet\Bus\Events\Incident\IncidentWasReportedEvent;
use CachetHQ\Cachet\Dates\DateFactory;
use CachetHQ\Cachet\Models\Component;
use CachetHQ\Cachet\Models\Incident;
use CachetHQ\Cachet\Models\IncidentTemplate;
use Twig_Loader_String;
use TwigBridge\Bridge;
/**
* This is the report incident command handler.
*
* @author James Brooks <james@alt-three.com>
*/
class ReportIncidentCommandHandler
{
/**
* The date factory instance.
*
* @var \CachetHQ\Cachet\Dates\DateFactory
*/
protected $dates;
/**
* The twig bridge instance.
*
* @var \TwigBridge\Bridge
*/
protected $twig;
/**
* Create a new report incident command handler instance.
*
* @param \CachetHQ\Cachet\Dates\DateFactory $dates
* @param \TwigBridge\Bridge $twig
*
* @return void
*/
public function __construct(DateFactory $dates, Bridge $twig)
{
$this->dates = $dates;
$this->twig = $twig;
}
/**
* Handle the report incident command.
*
* @param \CachetHQ\Cachet\Bus\Commands\Incident\ReportIncidentCommand $command
*
* @return \CachetHQ\Cachet\Models\Incident
*/
public function handle(ReportIncidentCommand $command)
{
$data = [
'name' => $command->name,
'status' => $command->status,
'visible' => $command->visible,
];
if ($command->template) {
$data['message'] = $this->parseIncidentTemplate($command->template, $command->template_vars);
} else {
$data['message'] = $command->message;
}
// Link with the component.
if ($command->component_id) {
$data['component_id'] = $command->component_id;
}
// The incident occurred at a different time.
if ($command->incident_date) {
$incidentDate = $this->dates->create('d/m/Y H:i', $command->incident_date);
$data['created_at'] = $incidentDate;
$data['updated_at'] = $incidentDate;
}
// Create the incident
$incident = Incident::create($data);
// Update the component.
if ($command->component_id) {
Component::find($command->component_id)->update([
'status' => $command->component_status,
]);
}
$incident->notify = (bool) $command->notify;
event(new IncidentWasReportedEvent($incident));
return $incident;
}
/**
* Compiles an incident template into an incident message.
*
* @param string $templateSlug
* @param array $vars
*
* @return string
*/
protected function parseIncidentTemplate($templateSlug, $vars)
{
if ($vars === null) {
$vars = [];
}
$this->twig->setLoader(new Twig_Loader_String());
$template = IncidentTemplate::forSlug($templateSlug)->first();
return $this->twig->render($template->template, $vars);
}
}

View File

@@ -0,0 +1,65 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Bus\Handlers\Commands\Incident;
use CachetHQ\Cachet\Bus\Commands\Incident\ReportMaintenanceCommand;
use CachetHQ\Cachet\Bus\Events\Incident\MaintenanceWasScheduledEvent;
use CachetHQ\Cachet\Dates\DateFactory;
use CachetHQ\Cachet\Models\Incident;
class ReportMaintenanceCommandHandler
{
/**
* The date factory instance.
*
* @var \CachetHQ\Cachet\Dates\DateFactory
*/
protected $dates;
/**
* Create a new report maintenance command handler instance.
*
* @param \CachetHQ\Cachet\Dates\DateFactory $dates
*
* @return void
*/
public function __construct(DateFactory $dates)
{
$this->dates = $dates;
}
/**
* Handle the report maintenance command.
*
* @param \CachetHQ\Cachet\Bus\Commands\Incident\ReportMaintenanceCommand $command
*
* @return \CachetHQ\Cachet\Models\Incident
*/
public function handle(ReportMaintenanceCommand $command)
{
$scheduledAt = $this->dates->create('d/m/Y H:i', $command->timestamp);
$maintenanceEvent = Incident::create([
'name' => $command->name,
'message' => $command->message,
'scheduled_at' => $scheduledAt,
'status' => 0,
'visible' => 1,
]);
$maintenanceEvent->notify = (bool) $command->notify;
event(new MaintenanceWasScheduledEvent($maintenanceEvent));
return $maintenanceEvent;
}
}

Some files were not shown because too many files have changed in this diff Show More