mirror of
https://github.com/cachethq/cachet.git
synced 2026-03-09 18:17:02 +00:00
Compare commits
371 Commits
1.1
...
v2.0.0-bet
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e1ae1a1316 | ||
|
|
66779c3f0b | ||
|
|
7a998f2b69 | ||
|
|
6ba1b1188a | ||
|
|
39b6bfc6d0 | ||
|
|
9ad3b7e606 | ||
|
|
3988cfb6c0 | ||
|
|
9d20e7b3a4 | ||
|
|
d62598dd45 | ||
|
|
746b7aeb2a | ||
|
|
41b8b9660b | ||
|
|
019bb6b7ea | ||
|
|
bda07ea0dd | ||
|
|
9d91e19863 | ||
|
|
9887df6987 | ||
|
|
63d5161010 | ||
|
|
1a783d71f8 | ||
|
|
a288f84fc5 | ||
|
|
1e2b80d8d3 | ||
|
|
d3fcffce72 | ||
|
|
22c39df73f | ||
|
|
8bd46105e6 | ||
|
|
35679a23d0 | ||
|
|
6c048d45d6 | ||
|
|
995fdd4049 | ||
|
|
b6fbe53b28 | ||
|
|
22204811c2 | ||
|
|
a374ae9abd | ||
|
|
b68efe0631 | ||
|
|
ce8e710173 | ||
|
|
8bd510a653 | ||
|
|
efdddfb847 | ||
|
|
22b6af8f0f | ||
|
|
04321db166 | ||
|
|
9bef541057 | ||
|
|
af62c5683f | ||
|
|
238dcbcaeb | ||
|
|
4e9f8772e8 | ||
|
|
710348c0b6 | ||
|
|
7909465e98 | ||
|
|
9fac22b863 | ||
|
|
55429283c0 | ||
|
|
32063510fb | ||
|
|
814fcd844c | ||
|
|
715adda424 | ||
|
|
9ea4698f21 | ||
|
|
a91d0be1a8 | ||
|
|
2091f0ddf0 | ||
|
|
674be657c7 | ||
|
|
2dd393a569 | ||
|
|
9d4ec9c711 | ||
|
|
bc16eda3ec | ||
|
|
1cf63e025b | ||
|
|
92c08b63d7 | ||
|
|
4793617f9b | ||
|
|
d4745ebb7b | ||
|
|
1ba807c724 | ||
|
|
5bbbb4ec58 | ||
|
|
5c3e935b13 | ||
|
|
6afea3674c | ||
|
|
ef159b38e7 | ||
|
|
752d353900 | ||
|
|
5b897f18b9 | ||
|
|
532a7139a3 | ||
|
|
54d3419d5e | ||
|
|
021a842520 | ||
|
|
a08f39f351 | ||
|
|
753fa00d92 | ||
|
|
677caf86c5 | ||
|
|
01ed08dcb1 | ||
|
|
af7258d54f | ||
|
|
127d0d0d55 | ||
|
|
939bdf0c4e | ||
|
|
e9702e4292 | ||
|
|
b4f7adfdfd | ||
|
|
4d7d5b5734 | ||
|
|
43fa49bdd8 | ||
|
|
f16c17c824 | ||
|
|
0f353a3db3 | ||
|
|
4baaf69907 | ||
|
|
1914e54def | ||
|
|
130dc11740 | ||
|
|
ac429b1e2a | ||
|
|
9426c7a9de | ||
|
|
be3a8c4c85 | ||
|
|
bc730a5d95 | ||
|
|
26c0ff9af7 | ||
|
|
dedfda2dc2 | ||
|
|
dbcf567505 | ||
|
|
52119f97cf | ||
|
|
e9e5768406 | ||
|
|
14aea5a1f0 | ||
|
|
ea8531ddc1 | ||
|
|
254c81af1b | ||
|
|
1fc1cd7cba | ||
|
|
b6056faa72 | ||
|
|
4c0fb53ba7 | ||
|
|
bd6b3f09d0 | ||
|
|
b511a91a7f | ||
|
|
093bd8c55c | ||
|
|
a21fae88d4 | ||
|
|
e6a8e25eed | ||
|
|
3c2388e83b | ||
|
|
4fc31445ff | ||
|
|
97cbbc2830 | ||
|
|
2f332a193e | ||
|
|
3fca767624 | ||
|
|
e59a490878 | ||
|
|
c2ad8e14f3 | ||
|
|
1ceaed3911 | ||
|
|
a688b495d7 | ||
|
|
59937229b2 | ||
|
|
1c892f64f0 | ||
|
|
66bd80d080 | ||
|
|
db6faa70d3 | ||
|
|
65023ec7da | ||
|
|
6b4b71552d | ||
|
|
7bd158bb6c | ||
|
|
b408036c76 | ||
|
|
75020a6576 | ||
|
|
c75bdad4fa | ||
|
|
2a15991e16 | ||
|
|
6aedf27300 | ||
|
|
102457b491 | ||
|
|
afa2b3ca7e | ||
|
|
282e61d202 | ||
|
|
e8427cb06b | ||
|
|
3e0d38aa4c | ||
|
|
df0acb40de | ||
|
|
3e9336c598 | ||
|
|
e8bc3fb818 | ||
|
|
08e9705088 | ||
|
|
3ca1ae5d70 | ||
|
|
f7f01c5059 | ||
|
|
c13aece3a4 | ||
|
|
051e26e653 | ||
|
|
3f8471d8da | ||
|
|
eadedeecbf | ||
|
|
8c03c80582 | ||
|
|
4ae9d96f25 | ||
|
|
354bfffc97 | ||
|
|
4384438d46 | ||
|
|
18f98d19f0 | ||
|
|
b8b81f7e1c | ||
|
|
30b05f360d | ||
|
|
d4c1b23b3f | ||
|
|
d3cd8201a6 | ||
|
|
80caeea86a | ||
|
|
a9a5eef275 | ||
|
|
92ab7c8451 | ||
|
|
935fb9c7c1 | ||
|
|
ba57d51142 | ||
|
|
e735dd5dc4 | ||
|
|
49a7b55a12 | ||
|
|
a6d3b69f75 | ||
|
|
91fe0ed72f | ||
|
|
45784c3720 | ||
|
|
c2f8f23159 | ||
|
|
3af02f725b | ||
|
|
d2d605e884 | ||
|
|
7e5ec12c05 | ||
|
|
0973930710 | ||
|
|
a02afa2d28 | ||
|
|
6a18554768 | ||
|
|
00d7c715ff | ||
|
|
8fad9f567b | ||
|
|
6d983a1b21 | ||
|
|
9a964a9aee | ||
|
|
f4b569f2fd | ||
|
|
d40b6cef57 | ||
|
|
cf14483577 | ||
|
|
687b46389d | ||
|
|
b0ec13fa13 | ||
|
|
536ae3502d | ||
|
|
2fbc044057 | ||
|
|
45181bfe5c | ||
|
|
68a0839e13 | ||
|
|
4dd839719f | ||
|
|
600493f1cb | ||
|
|
c4e4035fea | ||
|
|
7ab139f82e | ||
|
|
6b362fd88d | ||
|
|
4f05f910e9 | ||
|
|
2311d67624 | ||
|
|
715d65f464 | ||
|
|
fa1a5fff0e | ||
|
|
d20ee2987b | ||
|
|
1ac4b7a64a | ||
|
|
941809037a | ||
|
|
0b8ce37e84 | ||
|
|
0851427f2d | ||
|
|
99cd275a9d | ||
|
|
1478a25008 | ||
|
|
60e9a64a3e | ||
|
|
75588db98e | ||
|
|
082062fa1b | ||
|
|
37d7908606 | ||
|
|
25a3626de5 | ||
|
|
6ee697cf7f | ||
|
|
698b05980d | ||
|
|
32b2a56573 | ||
|
|
be080a10ef | ||
|
|
c466620435 | ||
|
|
7be3aa2552 | ||
|
|
b80b53191b | ||
|
|
a239c34892 | ||
|
|
4a5110ae53 | ||
|
|
30eec9da24 | ||
|
|
5bc7a3e6f7 | ||
|
|
7c1f27c4a1 | ||
|
|
9581c5a394 | ||
|
|
64ff4d73c2 | ||
|
|
a93472f544 | ||
|
|
924eee9752 | ||
|
|
8250e4ebca | ||
|
|
11b4ab5c6c | ||
|
|
77ce0e21f4 | ||
|
|
cd9828275d | ||
|
|
ae7ab7ddc0 | ||
|
|
69e9d75037 | ||
|
|
70a5022740 | ||
|
|
f13b8debe4 | ||
|
|
57f0bebbc5 | ||
|
|
9414456fd1 | ||
|
|
77f19da9b0 | ||
|
|
7136457b49 | ||
|
|
062a16ca5b | ||
|
|
3de15fc5e8 | ||
|
|
f1b54bfe57 | ||
|
|
ba558e69a3 | ||
|
|
bf4ebcde45 | ||
|
|
a77efc12e0 | ||
|
|
92192232ed | ||
|
|
da3e561217 | ||
|
|
885c17054f | ||
|
|
d47121b93d | ||
|
|
860457bfae | ||
|
|
9112e2a58f | ||
|
|
a72033ffa2 | ||
|
|
1a7cec53ac | ||
|
|
bab843b4b1 | ||
|
|
889dd47a14 | ||
|
|
9a0d823c9a | ||
|
|
b037965c35 | ||
|
|
b4f1a8af61 | ||
|
|
5e69f23783 | ||
|
|
46cd61e3fe | ||
|
|
63ccab3eff | ||
|
|
82d0e88f68 | ||
|
|
8a3f9196d3 | ||
|
|
c2c815ab14 | ||
|
|
c928c99c8f | ||
|
|
9515d874bf | ||
|
|
532852f943 | ||
|
|
8fb5a3f992 | ||
|
|
59e1b22e18 | ||
|
|
a294b34d64 | ||
|
|
3d0aec3899 | ||
|
|
ed09ca46b8 | ||
|
|
905445d0ca | ||
|
|
1b953038be | ||
|
|
87563640ff | ||
|
|
b1600bdbee | ||
|
|
2ef8b8411f | ||
|
|
61d8fb8759 | ||
|
|
d99f95b2d6 | ||
|
|
4a22b1b053 | ||
|
|
a55bcb8c48 | ||
|
|
912c9e7c04 | ||
|
|
0bff2f9215 | ||
|
|
808bc5201d | ||
|
|
0194dbb634 | ||
|
|
ee0899f5c3 | ||
|
|
8b0f1033e5 | ||
|
|
b68647df8e | ||
|
|
1965dbb3e7 | ||
|
|
8c69123ce2 | ||
|
|
5c8369344d | ||
|
|
565e686f8c | ||
|
|
68a41ae49f | ||
|
|
bef736e865 | ||
|
|
308ee1bd81 | ||
|
|
3b487ea2ec | ||
|
|
b393557c8a | ||
|
|
bee4055228 | ||
|
|
7cd513a6bd | ||
|
|
8589089a04 | ||
|
|
cefabcef2d | ||
|
|
5858d8063b | ||
|
|
ade85e24bd | ||
|
|
324f8703ce | ||
|
|
9df14837b9 | ||
|
|
e3a3f97957 | ||
|
|
fbfa62d087 | ||
|
|
88efff58cc | ||
|
|
82a9dc9a4e | ||
|
|
4f0383b62b | ||
|
|
73c80992ae | ||
|
|
4b3ec45b03 | ||
|
|
065b1fd168 | ||
|
|
0a682a00f7 | ||
|
|
1c7fb1a434 | ||
|
|
fcf0cd675a | ||
|
|
02f069cdc1 | ||
|
|
1779ac40c9 | ||
|
|
32de1d512b | ||
|
|
e8d3c013a1 | ||
|
|
85efb7d114 | ||
|
|
11d77328dc | ||
|
|
c05e9d9867 | ||
|
|
b1eb57e573 | ||
|
|
3c4ccf00f1 | ||
|
|
79f66fc090 | ||
|
|
a05496f7d0 | ||
|
|
55ffbd74d4 | ||
|
|
f9f2e5c18a | ||
|
|
91ba722405 | ||
|
|
2ac9d3b23e | ||
|
|
848fb3b607 | ||
|
|
7d21a7682c | ||
|
|
e3c38c7461 | ||
|
|
c5a0ded808 | ||
|
|
3f2f5cd25b | ||
|
|
bbaa1fbfa6 | ||
|
|
0e83999f7d | ||
|
|
3c07529693 | ||
|
|
669fb4857a | ||
|
|
4693faa64f | ||
|
|
0802da8e01 | ||
|
|
f839bc06f5 | ||
|
|
bba4cf8cce | ||
|
|
701f947c33 | ||
|
|
36b36925c9 | ||
|
|
76d3692d9e | ||
|
|
3f7f4e7624 | ||
|
|
e76ecd493e | ||
|
|
d68b248fd7 | ||
|
|
5813364ccb | ||
|
|
8d0a716c2d | ||
|
|
e471796742 | ||
|
|
8dd762184e | ||
|
|
593dd04a4f | ||
|
|
fcbbfdd84e | ||
|
|
5d958bac81 | ||
|
|
578d4befef | ||
|
|
549c4e1594 | ||
|
|
5ce767dccc | ||
|
|
60536d5334 | ||
|
|
e5ddb65298 | ||
|
|
ef3c32c5e9 | ||
|
|
11cf7ef2c8 | ||
|
|
0c99204016 | ||
|
|
ca367ff151 | ||
|
|
06ecb4b9fb | ||
|
|
122138402b | ||
|
|
11d68ee3e5 | ||
|
|
2284bc5d3b | ||
|
|
a847cdc97e | ||
|
|
01c690608f | ||
|
|
5aee46d6b7 | ||
|
|
2615efc052 | ||
|
|
e5c6d6af70 | ||
|
|
29e045c458 | ||
|
|
d2c8f414f6 | ||
|
|
fb55beb47b | ||
|
|
84e1770e51 | ||
|
|
7f222677cc | ||
|
|
ec12ab07af | ||
|
|
0094246ee8 | ||
|
|
58a371b10b | ||
|
|
b626b5ee27 |
@@ -1 +0,0 @@
|
||||
.git
|
||||
@@ -12,6 +12,7 @@ DB_PASSWORD=secret
|
||||
CACHE_DRIVER=file
|
||||
SESSION_DRIVER=file
|
||||
QUEUE_DRIVER=database
|
||||
CACHET_EMOJI=false
|
||||
|
||||
MAIL_DRIVER=smtp
|
||||
MAIL_HOST=mailtrap.io
|
||||
@@ -20,7 +21,10 @@ MAIL_USERNAME=null
|
||||
MAIL_PASSWORD=null
|
||||
MAIL_ADDRESS=null
|
||||
MAIL_NAME=null
|
||||
MAIL_ENCRYPTION=tls
|
||||
|
||||
REDIS_HOST=null
|
||||
REDIS_DATABASE=null
|
||||
REDIS_PORT=null
|
||||
|
||||
GITHUB_TOKEN=null
|
||||
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -2,4 +2,3 @@
|
||||
node_modules
|
||||
phpunit.xml
|
||||
vendor
|
||||
.vagrant
|
||||
|
||||
12
.travis.yml
12
.travis.yml
@@ -4,16 +4,18 @@ php:
|
||||
- 5.5.9
|
||||
- 5.5
|
||||
- 5.6
|
||||
- 7.0
|
||||
- hhvm
|
||||
|
||||
sudo: false
|
||||
|
||||
install: travis_retry composer install --no-interaction --ignore-platform-reqs --no-scripts --prefer-source
|
||||
install:
|
||||
- travis_retry composer install --no-interaction --no-scripts --prefer-source
|
||||
|
||||
script:
|
||||
- bash -c 'if [ "$TRAVIS_PHP_VERSION" == "hhvm" ]; then vendor/bin/phpunit; fi;'
|
||||
- bash -c 'if [ "$TRAVIS_PHP_VERSION" != "hhvm" ]; then vendor/bin/phpunit --coverage-clover build/logs/clover.xml; fi;'
|
||||
- if [ "$TRAVIS_PHP_VERSION" != "5.5.9" ] && [ "$TRAVIS_PHP_VERSION" != "5.5" ] && [ "$TRAVIS_PHP_VERSION" != "5.6" ]; then vendor/bin/phpunit; fi
|
||||
- if [ "$TRAVIS_PHP_VERSION" == "5.5.9" ] || [ "$TRAVIS_PHP_VERSION" == "5.5" ] || [ "$TRAVIS_PHP_VERSION" == "5.6" ]; then vendor/bin/phpunit --coverage-clover build/logs/clover.xml; fi
|
||||
|
||||
after_script:
|
||||
- bash -c 'if [ "$TRAVIS_PHP_VERSION" != "hhvm" ]; then wget https://scrutinizer-ci.com/ocular.phar; fi;'
|
||||
- bash -c 'if [ "$TRAVIS_PHP_VERSION" != "hhvm" ]; then php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml; fi;'
|
||||
- if [ "$TRAVIS_PHP_VERSION" == "5.5.9" ] || [ "$TRAVIS_PHP_VERSION" == "5.5" ] || [ "$TRAVIS_PHP_VERSION" == "5.6" ]; then wget https://scrutinizer-ci.com/ocular.phar; fi
|
||||
- if [ "$TRAVIS_PHP_VERSION" == "5.5.9" ] || [ "$TRAVIS_PHP_VERSION" == "5.5" ] || [ "$TRAVIS_PHP_VERSION" == "5.6" ]; then php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml; fi
|
||||
|
||||
@@ -2,16 +2,15 @@
|
||||
|
||||
## Creating issues
|
||||
|
||||
Issues should be made by using the [issue tracker](https://github.com/cachethq/Cachet/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).
|
||||
|
||||
Things to remember:
|
||||
|
||||
- Be descriptive
|
||||
- Be respectful of others
|
||||
**Always be respectful.** Organization members reserve the right to lock topics if they feel necessary.
|
||||
|
||||
## Languages
|
||||
|
||||
When needing to add labels, placeholders or general text, you **must not** write directly into the source file, rather make use of the `./app/lang/` directory. Always provide the English translation and copy your English string to all other languages - making sure that the indentation and alignment of the arrays are updated.
|
||||
When needing to add labels, placeholders or general text, you **must not** write directly into the source file, rather make use of the `./resources/lang/` directory.
|
||||
|
||||
Always provide the English translation and copy your English string to all other languages - making sure that the indentation and alignment of the arrays are updated.
|
||||
|
||||
## Coding Standards
|
||||
|
||||
@@ -20,9 +19,9 @@ Please follow existing coding standards:
|
||||
```php
|
||||
<?php
|
||||
|
||||
namespace Foo\Bar\Controller;
|
||||
namespace CachetHQ\Cachet\Controller;
|
||||
|
||||
use Foo\Bar\Bar;
|
||||
use CachetHQ\Cachet\Bar;
|
||||
|
||||
class Foo extends Bar
|
||||
{
|
||||
@@ -50,18 +49,17 @@ class Foo extends Bar
|
||||
}
|
||||
```
|
||||
- Braces on a new line following: `namespace`, `use`, `function` and `class`.
|
||||
- Line lengths have a soft 80 limit and hard 120 length.
|
||||
- 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.
|
||||
- If your pull request consists of more than two commits, you **must** squash them into one.
|
||||
- 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 to Git and GitHub
|
||||
## 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.
|
||||
|
||||
@@ -75,8 +73,6 @@ If you're not particularly fond of the command line, you can get one of GitHub's
|
||||
|
||||
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).
|
||||
|
||||
There is always the Cachet Gitter chat to ask any questions you may have:
|
||||
|
||||
[](https://gitter.im/cachethq/Cachet?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
|
||||
## .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.
|
||||
|
||||
37
Dockerfile
37
Dockerfile
@@ -1,37 +0,0 @@
|
||||
FROM debian:jessie
|
||||
|
||||
# Using nodesource and debian jessie packages instead of compiling from scratch
|
||||
RUN DEBIAN_FRONTEND=noninteractive \
|
||||
echo "APT::Install-Recommends \"0\";" >> /etc/apt/apt.conf.d/02recommends && \
|
||||
echo "APT::Install-Suggests \"0\";" >> /etc/apt/apt.conf.d/02recommends && \
|
||||
apt-get -qq update && \
|
||||
apt-get -qq install \
|
||||
ca-certificates nginx php5-fpm=5.* php5-curl php5-readline php5-mcrypt php5-mysql php5-apcu php5-cli \
|
||||
git sqlite libsqlite3-dev curl supervisor cron php5-pgsql && \
|
||||
apt-get clean && apt-get autoremove -qq && \
|
||||
rm -rf /var/lib/apt/lists/* /usr/share/doc /usr/share/man /tmp/*
|
||||
|
||||
COPY docker/supervisord.conf /etc/supervisor/supervisord.conf
|
||||
COPY docker/entrypoint.sh /sbin/entrypoint.sh
|
||||
COPY . /var/www/html/
|
||||
WORKDIR /var/www/html/
|
||||
|
||||
# copy the various nginx and supervisor conf (to handle both fpm and nginx)
|
||||
RUN sed -i -e "s/;daemonize\s*=\s*yes/daemonize = no/g" /etc/php5/fpm/php-fpm.conf ;\
|
||||
echo "daemon off;" >> /etc/nginx/nginx.conf ;\
|
||||
mv /var/www/html/docker/php-fpm-pool.conf /etc/php5/fpm/pool.d/www.conf ;\
|
||||
rm -f /etc/nginx/sites-enabled/* ;\
|
||||
rm -f /etc/nginx/conf.d/* ;\
|
||||
mv /var/www/html/docker/nginx-site.conf /etc/nginx/conf.d/default.conf ;\
|
||||
mv /var/www/html/docker/.env.docker /var/www/html/.env ;\
|
||||
rm -r /var/www/html/docker ;\
|
||||
chown -R www-data /var/www/html ;\
|
||||
curl -sS https://getcomposer.org/installer | php && php composer.phar install --no-dev -o
|
||||
|
||||
EXPOSE 8000
|
||||
|
||||
COPY docker/crontab /etc/cron.d/artisan-schedule
|
||||
RUN chmod 0644 /etc/cron.d/artisan-schedule
|
||||
RUN touch /var/log/cron.log
|
||||
|
||||
CMD ["/sbin/entrypoint.sh"]
|
||||
@@ -1,40 +0,0 @@
|
||||
---
|
||||
ip: "192.168.10.10"
|
||||
memory: 2048
|
||||
cpus: 1
|
||||
hostname: cachet
|
||||
name: cachet
|
||||
provider: virtualbox
|
||||
|
||||
authorize: ~/.ssh/id_rsa.pub
|
||||
|
||||
keys:
|
||||
- ~/.ssh/id_rsa
|
||||
|
||||
folders:
|
||||
- map: "/srv/www/Cachet"
|
||||
to: "/home/vagrant/Cachet"
|
||||
|
||||
sites:
|
||||
- map: homestead.app
|
||||
to: "/home/vagrant/Cachet/public"
|
||||
|
||||
databases:
|
||||
- cachet
|
||||
|
||||
variables:
|
||||
- key: APP_ENV
|
||||
value: local
|
||||
|
||||
# blackfire:
|
||||
# - id: foo
|
||||
# token: bar
|
||||
# client-id: foo
|
||||
# client-token: bar
|
||||
|
||||
# ports:
|
||||
# - send: 93000
|
||||
# to: 9300
|
||||
# - send: 7777
|
||||
# to: 777
|
||||
# protocol: udp
|
||||
111
README.md
111
README.md
@@ -21,6 +21,10 @@
|
||||
- Subscriber notifications via Email
|
||||
- Two factor authentication, with Google Authenticator
|
||||
|
||||
## Usage in production
|
||||
|
||||
The `master` branch of this repository is a development branch and **should not** be used in production. Instead, please check out the latest tag release.
|
||||
|
||||
## Requirements
|
||||
|
||||
- PHP 5.5.9+ or newer
|
||||
@@ -28,7 +32,7 @@
|
||||
|
||||
### Development Requirements
|
||||
|
||||
The following extra dependencies are required to develop Cachet:
|
||||
Theses extra dependencies are required to develop Cachet:
|
||||
|
||||
- Node.js
|
||||
- Bower
|
||||
@@ -38,6 +42,10 @@ The following extra dependencies are required to develop Cachet:
|
||||
|
||||
You can now find our documentation at [https://docs.cachethq.io](https://docs.cachethq.io).
|
||||
|
||||
- [Installing Cachet](https://docs.cachethq.io/docs/installing-cachet)
|
||||
- [Getting started with Docker](https://docs.cachethq.io/docs/get-started-with-docker)
|
||||
- [Getting started with Vagrant](https://docs.cachethq.io/docs/get-started-with-vagrant)
|
||||
|
||||
### Demo Account
|
||||
|
||||
To test out the demo, you may login to the [Dashboard](https://demo.cachethq.io/dashboard) with the following:
|
||||
@@ -47,103 +55,10 @@ To test out the demo, you may login to the [Dashboard](https://demo.cachethq.io/
|
||||
|
||||
The demo is reset every half hour.
|
||||
|
||||
## What Cachet is not
|
||||
|
||||
Here is a list of things that Cachet is not or does not do:
|
||||
|
||||
1. It does not monitor your services. It works only as a way to display the status of your services. *However, Cachet is able to receive updates from third-party services via its API.*
|
||||
2. It does not work on a plugin system. There are no monitoring services to extend.
|
||||
3. It's not a Twitter clone.
|
||||
|
||||
## Quickstart with Vagrant
|
||||
|
||||
If you would like to utilize [laravel homestead](http://laravel.com/docs/5.1/homestead), we have a per-project installation available to use for development purposes.
|
||||
|
||||
First, install dependencies by `composer install` and modify Homestead.yaml to map your Cachet directory to the Vagrant VM properly. It looks like this by default:
|
||||
|
||||
```yaml
|
||||
folders:
|
||||
- map: "/srv/www/Cachet"
|
||||
to: "/home/vagrant/Cachet"
|
||||
```
|
||||
|
||||
Change the map key to the location of your Cachet installation and follow the instructions below.
|
||||
|
||||
```bash
|
||||
# Copy over your environment variables
|
||||
$ cp .env.example .env
|
||||
|
||||
# Initiate VM
|
||||
$ vagrant up
|
||||
|
||||
# Generate application key
|
||||
$ php artisan key:generate
|
||||
|
||||
# SSH into your machine
|
||||
$ vagrant ssh
|
||||
|
||||
# Run migrations
|
||||
$ cd Cachet && php artisan migrate
|
||||
```
|
||||
|
||||
Navigate to http://192.168.10.10 and begin using Cachet!
|
||||
|
||||
## Quickstart with Docker
|
||||
|
||||
Run a DB container (you can either pass in environment variables for the DB, or mount a config with `-v /my/database.php:/var/www/html/app/config/database.php`):
|
||||
|
||||
```bash
|
||||
$ export DB_USERNAME=cachet
|
||||
$ export DB_PASSWORD=cachet
|
||||
$ export DB_ROOT_PASSWORD=cachet
|
||||
$ export DB_DATABASE=cachet
|
||||
$ docker run --name mysql -e MYSQL_USER=$DB_USERNAME -e MYSQL_PASSWORD=$DB_PASSWORD -e MYSQL_ROOT_PASSWORD=$DB_ROOT_PASSWORD -e MYSQL_DATABASE=$DB_DATABASE -d mysql
|
||||
```
|
||||
|
||||
Initialize the DB if you haven't yet:
|
||||
|
||||
```bash
|
||||
$ docker run --rm --link mysql:mysql -e DB_HOST=mysql -e DB_DATABASE=$DB_DATABASE -e DB_USERNAME=$DB_USERNAME -e DB_PASSWORD=$DB_PASSWORD cachethq/cachet:latest php artisan migrate --force
|
||||
```
|
||||
|
||||
Run Cachet:
|
||||
|
||||
```bash
|
||||
$ docker run -d --name cachet --link mysql:mysql -p 80:8000 -e DB_HOST=mysql -e DB_DATABASE=$DB_DATABASE -e DB_USERNAME=$DB_USERNAME -e DB_PASSWORD=$DB_PASSWORD cachethq/cachet:latest
|
||||
```
|
||||
|
||||
Now go to `http://<ipdockerisboundto>/setup` and have fun!
|
||||
|
||||
Note: When running in production you should ensure that you enable SSL.
|
||||
This is commonly achieved by running Nginx with your certificates on your Docker host, service or load balancers in-front of the running container, or by adding your custom SSL certificates and configuration to the supplied Nginx configuration.
|
||||
|
||||
### docker-compose
|
||||
|
||||
Quickly launch Cachet and MySQL docker images with [docker-compose](https://docs.docker.com/compose/)
|
||||
|
||||
```bash
|
||||
git clone https://github.com/cachethq/Cachet.git
|
||||
cd Cachet
|
||||
docker-compose build
|
||||
docker-compose up
|
||||
```
|
||||
|
||||
To initialize the database, utilize [docker exec](https://docs.docker.com/reference/commandline/cli/#exec):
|
||||
```bash
|
||||
docker exec -it cachet_cachet_1 php artisan migrate --force
|
||||
```
|
||||
|
||||
Continue to `http://<ipdockerisboundto>/setup` to configure Cachet.
|
||||
|
||||
## Addons
|
||||
|
||||
- [cachet-monitor](https://github.com/castawaylabs/cachet-monitor) - For URL monitoring. Automatic incident updates.
|
||||
- [sensu-cachet](https://github.com/bimlendu/sensu-cachethq) - Sensu handler for updating CachetHQ.
|
||||
|
||||
## Read more about Cachet
|
||||
|
||||
For more information on why I started developing Cachet, check out my [Cachet articles on my blog](https://james-brooks.uk/tag/cachet/?utm_source=github&utm_medium=readme&utm_campaign=github-cachet).
|
||||
|
||||
## 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 us at support@alt-three.com. All security vulnerabilities will be promptly addressed.
|
||||
|
||||
23
Vagrantfile
vendored
23
Vagrantfile
vendored
@@ -1,23 +0,0 @@
|
||||
require 'json'
|
||||
require 'yaml'
|
||||
|
||||
VAGRANTFILE_API_VERSION = "2"
|
||||
confDir = $confDir ||= File.expand_path("vendor/laravel/homestead")
|
||||
|
||||
homesteadYamlPath = "Homestead.yaml"
|
||||
afterScriptPath = "after.sh"
|
||||
aliasesPath = "aliases"
|
||||
|
||||
require File.expand_path(confDir + '/scripts/homestead.rb')
|
||||
|
||||
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
||||
if File.exists? aliasesPath then
|
||||
config.vm.provision "file", source: aliasesPath, destination: "~/.bash_aliases"
|
||||
end
|
||||
|
||||
Homestead.configure(config, YAML::load(File.read(homesteadYamlPath)))
|
||||
|
||||
if File.exists? afterScriptPath then
|
||||
config.vm.provision "shell", path: afterScriptPath
|
||||
end
|
||||
end
|
||||
93
app/Commands/Component/AddComponentCommand.php
Normal file
93
app/Commands/Component/AddComponentCommand.php
Normal file
@@ -0,0 +1,93 @@
|
||||
<?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\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;
|
||||
|
||||
/**
|
||||
* The validation rules.
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
public $rules = [
|
||||
'name' => 'required|string',
|
||||
'description' => 'string',
|
||||
'status' => 'required|integer',
|
||||
'link' => 'url',
|
||||
'order' => 'integer',
|
||||
'group_id' => 'integer',
|
||||
];
|
||||
|
||||
/**
|
||||
* 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
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($name, $description, $status, $link, $order, $group_id)
|
||||
{
|
||||
$this->name = $name;
|
||||
$this->description = $description;
|
||||
$this->status = (int) $status;
|
||||
$this->link = $link;
|
||||
$this->order = $order;
|
||||
$this->group_id = $group_id;
|
||||
}
|
||||
}
|
||||
36
app/Commands/Component/RemoveComponentCommand.php
Normal file
36
app/Commands/Component/RemoveComponentCommand.php
Normal 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\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;
|
||||
}
|
||||
}
|
||||
104
app/Commands/Component/UpdateComponentCommand.php
Normal file
104
app/Commands/Component/UpdateComponentCommand.php
Normal file
@@ -0,0 +1,104 @@
|
||||
<?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\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;
|
||||
|
||||
/**
|
||||
* The validation rules.
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
public $rules = [
|
||||
'name' => 'string',
|
||||
'description' => 'string',
|
||||
'status' => 'integer',
|
||||
'link' => 'url',
|
||||
'order' => 'integer',
|
||||
'group_id' => 'integer',
|
||||
];
|
||||
|
||||
/**
|
||||
* 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
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Component $component, $name, $description, $status, $link, $order, $group_id)
|
||||
{
|
||||
$this->component = $component;
|
||||
$this->name = $name;
|
||||
$this->description = $description;
|
||||
$this->status = (int) $status;
|
||||
$this->link = $link;
|
||||
$this->order = $order;
|
||||
$this->group_id = $group_id;
|
||||
}
|
||||
}
|
||||
53
app/Commands/ComponentGroup/AddComponentGroupCommand.php
Normal file
53
app/Commands/ComponentGroup/AddComponentGroupCommand.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?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\Commands\ComponentGroup;
|
||||
|
||||
final class AddComponentGroupCommand
|
||||
{
|
||||
/**
|
||||
* The component group name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $name;
|
||||
|
||||
/**
|
||||
* The component group description.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $order;
|
||||
|
||||
/**
|
||||
* The validation rules.
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
public $rules = [
|
||||
'name' => 'required|string',
|
||||
'order' => 'integer',
|
||||
];
|
||||
|
||||
/**
|
||||
* Create a add component group command instance.
|
||||
*
|
||||
* @param string $name
|
||||
* @param int $order
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($name, $order)
|
||||
{
|
||||
$this->name = $name;
|
||||
$this->order = (int) $order;
|
||||
}
|
||||
}
|
||||
36
app/Commands/ComponentGroup/RemoveComponentGroupCommand.php
Normal file
36
app/Commands/ComponentGroup/RemoveComponentGroupCommand.php
Normal 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\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;
|
||||
}
|
||||
}
|
||||
64
app/Commands/ComponentGroup/UpdateComponentGroupCommand.php
Normal file
64
app/Commands/ComponentGroup/UpdateComponentGroupCommand.php
Normal 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\Commands\ComponentGroup;
|
||||
|
||||
use CachetHQ\Cachet\Models\ComponentGroup;
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* The validation rules.
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
public $rules = [
|
||||
'name' => 'string',
|
||||
'order' => 'integer',
|
||||
];
|
||||
|
||||
/**
|
||||
* Create a add component group command instance.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Models\ComponentGroup $group
|
||||
* @param string $name
|
||||
* @param int $order
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(ComponentGroup $group, $name, $order)
|
||||
{
|
||||
$this->group = $group;
|
||||
$this->name = $name;
|
||||
$this->order = (int) $order;
|
||||
}
|
||||
}
|
||||
36
app/Commands/Incident/RemoveIncidentCommand.php
Normal file
36
app/Commands/Incident/RemoveIncidentCommand.php
Normal 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\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;
|
||||
}
|
||||
}
|
||||
113
app/Commands/Incident/ReportIncidentCommand.php
Normal file
113
app/Commands/Incident/ReportIncidentCommand.php
Normal file
@@ -0,0 +1,113 @@
|
||||
<?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\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;
|
||||
|
||||
/**
|
||||
* The validation rules.
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
public $rules = [
|
||||
'name' => 'required|string',
|
||||
'status' => 'required|integer',
|
||||
'message' => 'string',
|
||||
'visible' => 'boolean',
|
||||
'component_id' => 'integer',
|
||||
'component_status' => 'integer',
|
||||
'notify' => 'boolean',
|
||||
'incident_date' => '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
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($name, $status, $message, $visible, $component_id, $component_status, $notify, $incident_date)
|
||||
{
|
||||
$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;
|
||||
}
|
||||
}
|
||||
73
app/Commands/Incident/ReportMaintenanceCommand.php
Normal file
73
app/Commands/Incident/ReportMaintenanceCommand.php
Normal 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\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' => 'boolean',
|
||||
'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;
|
||||
}
|
||||
}
|
||||
123
app/Commands/Incident/UpdateIncidentCommand.php
Normal file
123
app/Commands/Incident/UpdateIncidentCommand.php
Normal file
@@ -0,0 +1,123 @@
|
||||
<?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\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;
|
||||
|
||||
/**
|
||||
* The validation rules.
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
public $rules = [
|
||||
'name' => 'string',
|
||||
'status' => 'integer',
|
||||
'message' => 'string',
|
||||
'visible' => 'boolean',
|
||||
'component_id' => 'integer',
|
||||
'component_status' => 'integer',
|
||||
'notify' => 'boolean',
|
||||
];
|
||||
|
||||
/**
|
||||
* Create a new update incident command instance.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Models\Incident $name
|
||||
* @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
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Incident $incident, $name, $status, $message, $visible, $component_id, $component_status, $notify, $incident_date = 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;
|
||||
}
|
||||
}
|
||||
104
app/Commands/Metric/AddMetricCommand.php
Normal file
104
app/Commands/Metric/AddMetricCommand.php
Normal file
@@ -0,0 +1,104 @@
|
||||
<?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\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 validation rules.
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
public $rules = [
|
||||
'name' => 'required|string',
|
||||
'suffix' => 'required|string',
|
||||
'description' => 'string',
|
||||
'display_chart' => 'boolean',
|
||||
'default_value' => 'integer',
|
||||
'calc_type' => 'integer',
|
||||
'display_chart' => 'integer',
|
||||
'places' => 'integer|between:0,4',
|
||||
];
|
||||
|
||||
/**
|
||||
* 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
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($name, $suffix, $description, $default_value, $calc_type, $display_chart, $places)
|
||||
{
|
||||
$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;
|
||||
}
|
||||
}
|
||||
64
app/Commands/Metric/AddMetricPointCommand.php
Normal file
64
app/Commands/Metric/AddMetricPointCommand.php
Normal 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\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' => 'integer',
|
||||
'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;
|
||||
}
|
||||
}
|
||||
36
app/Commands/Metric/RemoveMetricCommand.php
Normal file
36
app/Commands/Metric/RemoveMetricCommand.php
Normal 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\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;
|
||||
}
|
||||
}
|
||||
36
app/Commands/Metric/RemoveMetricPointCommand.php
Normal file
36
app/Commands/Metric/RemoveMetricPointCommand.php
Normal 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\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;
|
||||
}
|
||||
}
|
||||
115
app/Commands/Metric/UpdateMetricCommand.php
Normal file
115
app/Commands/Metric/UpdateMetricCommand.php
Normal file
@@ -0,0 +1,115 @@
|
||||
<?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\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 validation rules.
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
public $rules = [
|
||||
'name' => 'string',
|
||||
'suffix' => 'string',
|
||||
'description' => 'string',
|
||||
'display_chart' => 'boolean',
|
||||
'default_value' => 'numeric',
|
||||
'calc_type' => 'integer|in:0,1',
|
||||
'display_chart' => 'integer',
|
||||
'places' => 'numeric|min:0|max:4',
|
||||
];
|
||||
|
||||
/**
|
||||
* 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
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Metric $metric, $name, $suffix, $description, $default_value, $calc_type, $display_chart, $places)
|
||||
{
|
||||
$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;
|
||||
}
|
||||
}
|
||||
74
app/Commands/Metric/UpdateMetricPointCommand.php
Normal file
74
app/Commands/Metric/UpdateMetricPointCommand.php
Normal file
@@ -0,0 +1,74 @@
|
||||
<?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\Commands\Metric;
|
||||
|
||||
use CachetHQ\Cachet\Models\Metric;
|
||||
use CachetHQ\Cachet\Models\MetricPoint;
|
||||
|
||||
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 int
|
||||
*/
|
||||
public $value;
|
||||
|
||||
/**
|
||||
* The metric point created at.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $created_at;
|
||||
|
||||
/**
|
||||
* The validation rules.
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
public $rules = [
|
||||
'value' => 'integer',
|
||||
'created_at' => 'string',
|
||||
];
|
||||
|
||||
/**
|
||||
* Create a new update metric point command instance.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Models\MetricPoint $point
|
||||
* @param \CachetHQ\Cachet\Models\Metric $metric
|
||||
* @param int $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;
|
||||
}
|
||||
}
|
||||
52
app/Commands/Subscriber/SubscribeSubscriberCommand.php
Normal file
52
app/Commands/Subscriber/SubscribeSubscriberCommand.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?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\Commands\Subscriber;
|
||||
|
||||
final class SubscribeSubscriberCommand
|
||||
{
|
||||
/**
|
||||
* The subscriber email.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $email;
|
||||
|
||||
/**
|
||||
* The subscriber auto verification.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
public $verified;
|
||||
|
||||
/**
|
||||
* The validation rules.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $rules = [
|
||||
'email' => 'required|email',
|
||||
];
|
||||
|
||||
/**
|
||||
* Create a new subscribe subscriber command instance.
|
||||
*
|
||||
* @param string $email
|
||||
* @param bool $verified
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($email, $verified = false)
|
||||
{
|
||||
$this->email = $email;
|
||||
$this->verified = $verified;
|
||||
}
|
||||
}
|
||||
36
app/Commands/Subscriber/UnsubscribeSubscriberCommand.php
Normal file
36
app/Commands/Subscriber/UnsubscribeSubscriberCommand.php
Normal 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\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 string $subscriber
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Subscriber $subscriber)
|
||||
{
|
||||
$this->subscriber = $subscriber;
|
||||
}
|
||||
}
|
||||
36
app/Commands/Subscriber/VerifySubscriberCommand.php
Normal file
36
app/Commands/Subscriber/VerifySubscriberCommand.php
Normal 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\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 string $subscriber
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Subscriber $subscriber)
|
||||
{
|
||||
$this->subscriber = $subscriber;
|
||||
}
|
||||
}
|
||||
72
app/Commands/User/AddTeamMemberCommand.php
Normal file
72
app/Commands/User/AddTeamMemberCommand.php
Normal file
@@ -0,0 +1,72 @@
|
||||
<?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\Commands\User;
|
||||
|
||||
final class AddTeamMemberCommand
|
||||
{
|
||||
/**
|
||||
* 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',
|
||||
'password' => 'string',
|
||||
'level' => 'integer',
|
||||
];
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
}
|
||||
34
app/Commands/User/GenerateApiTokenCommand.php
Normal file
34
app/Commands/User/GenerateApiTokenCommand.php
Normal 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\Commands\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)
|
||||
{
|
||||
$this->user = $user;
|
||||
}
|
||||
}
|
||||
36
app/Commands/User/RemoveUserCommand.php
Normal file
36
app/Commands/User/RemoveUserCommand.php
Normal 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\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;
|
||||
}
|
||||
}
|
||||
@@ -20,6 +20,8 @@ class AppComposer
|
||||
* Index page view composer.
|
||||
*
|
||||
* @param \Illuminate\Contracts\View\View $view
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function compose(View $view)
|
||||
{
|
||||
@@ -27,10 +29,6 @@ class AppComposer
|
||||
$mailAddress = env('MAIL_ADDRESS', false);
|
||||
$mailFrom = env('MAIL_NAME', false);
|
||||
|
||||
$withData = [
|
||||
'subscribersEnabled' => $isEnabled && $mailAddress && $mailFrom,
|
||||
];
|
||||
|
||||
$view->with($withData);
|
||||
$view->withSubscribersEnabled($isEnabled && $mailAddress && $mailFrom);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,15 +14,17 @@ namespace CachetHQ\Cachet\Composers;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class LoggedUserComposer
|
||||
class CurrentUserComposer
|
||||
{
|
||||
/**
|
||||
* Bind data to the view.
|
||||
*
|
||||
* @param \Illuminate\Contracts\View\View $view
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function compose(View $view)
|
||||
{
|
||||
$view->with('loggedUser', Auth::user());
|
||||
$view->withCurrentUser(Auth::user());
|
||||
}
|
||||
}
|
||||
@@ -21,10 +21,12 @@ class DashboardComposer
|
||||
* Bind data to the view.
|
||||
*
|
||||
* @param \Illuminate\Contracts\View\View $view
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function compose(View $view)
|
||||
{
|
||||
$view->with('incidentCount', Incident::notScheduled()->count());
|
||||
$view->with('componentCount', Component::all()->count());
|
||||
$view->withIncidentCount(Incident::notScheduled()->count());
|
||||
$view->withComponentCount(Component::all()->count());
|
||||
}
|
||||
}
|
||||
|
||||
65
app/Composers/MetricsComposer.php
Normal file
65
app/Composers/MetricsComposer.php
Normal 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\Composers;
|
||||
|
||||
use CachetHQ\Cachet\Facades\Setting;
|
||||
use CachetHQ\Cachet\Models\Metric;
|
||||
use CachetHQ\Cachet\Repositories\Metric\MetricRepository;
|
||||
use Illuminate\Contracts\View\View;
|
||||
|
||||
class MetricsComposer
|
||||
{
|
||||
/**
|
||||
* @var \CachetHQ\Cachet\Repositories\Metric\MetricRepository
|
||||
*/
|
||||
protected $metricRepository;
|
||||
|
||||
/**
|
||||
* Construct a new home controller instance.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Repositories\Metric\MetricRepository $metricRepository
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(MetricRepository $metricRepository)
|
||||
{
|
||||
$this->metricRepository = $metricRepository;
|
||||
}
|
||||
|
||||
/**
|
||||
* Metrics view composer.
|
||||
*
|
||||
* @param \Illuminate\Contracts\View\View $view
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function compose(View $view)
|
||||
{
|
||||
$metrics = null;
|
||||
$metricData = [];
|
||||
if ($displayMetrics = Setting::get('display_graphs')) {
|
||||
$metrics = Metric::where('display_chart', 1)->get();
|
||||
|
||||
$metrics->map(function ($metric) use (&$metricData) {
|
||||
$metricData[$metric->id] = [
|
||||
'today' => $this->metricRepository->listPointsToday($metric),
|
||||
'week' => $this->metricRepository->listPointsForWeek($metric),
|
||||
'month' => $this->metricRepository->listPointsForMonth($metric),
|
||||
];
|
||||
});
|
||||
}
|
||||
|
||||
$view->withDisplayMetrics($displayMetrics)
|
||||
->withMetrics($metrics)
|
||||
->withMetricData($metricData);
|
||||
}
|
||||
}
|
||||
@@ -11,22 +11,26 @@
|
||||
|
||||
namespace CachetHQ\Cachet\Composers;
|
||||
|
||||
use CachetHQ\Cachet\Facades\Setting;
|
||||
use CachetHQ\Cachet\Models\Component;
|
||||
use CachetHQ\Cachet\Models\ComponentGroup;
|
||||
use CachetHQ\Cachet\Models\Incident;
|
||||
use Illuminate\Contracts\View\View;
|
||||
|
||||
class IndexComposer
|
||||
class StatusPageComposer
|
||||
{
|
||||
/**
|
||||
* Index page view composer.
|
||||
*
|
||||
* @param \Illuminate\Contracts\View\View $view
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function compose(View $view)
|
||||
{
|
||||
// Default data
|
||||
$withData = [
|
||||
'systemStatus' => 'danger',
|
||||
'systemStatus' => 'info',
|
||||
'systemMessage' => trans('cachet.service.bad'),
|
||||
'favicon' => 'favicon-high-alert',
|
||||
];
|
||||
@@ -49,6 +53,18 @@ class IndexComposer
|
||||
}
|
||||
}
|
||||
|
||||
$view->with($withData);
|
||||
// Scheduled maintenance code.
|
||||
$scheduledMaintenance = Incident::scheduled()->orderBy('scheduled_at')->get();
|
||||
|
||||
// Component & Component Group lists.
|
||||
$usedComponentGroups = Component::where('group_id', '>', 0)->groupBy('group_id')->lists('group_id');
|
||||
$componentGroups = ComponentGroup::whereIn('id', $usedComponentGroups)->orderBy('order')->get();
|
||||
$ungroupedComponents = Component::where('group_id', 0)->orderBy('order')->orderBy('created_at')->get();
|
||||
|
||||
$view->with($withData)
|
||||
->withComponentGroups($componentGroups)
|
||||
->withUngroupedComponents($ungroupedComponents)
|
||||
->withScheduledMaintenance($scheduledMaintenance)
|
||||
->withPageTitle(Setting::get('app_name'));
|
||||
}
|
||||
}
|
||||
@@ -20,18 +20,21 @@ class ThemeComposer
|
||||
* Bind data to the view.
|
||||
*
|
||||
* @param \Illuminate\Contracts\View\View $view
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function compose(View $view)
|
||||
{
|
||||
$view->with('themeBackgroundColor', Setting::get('style_background_color'));
|
||||
$view->with('themeTextColor', Setting::get('style_text_color'));
|
||||
|
||||
$viewData = $view->getData();
|
||||
$themeView = array_only($viewData, preg_grep('/^theme/', array_keys($viewData)));
|
||||
$hasThemeSettings = array_filter($themeView, function ($data) {
|
||||
return $data != null;
|
||||
});
|
||||
|
||||
$view->with('themeSetup', !empty($hasThemeSettings));
|
||||
// Theme colors.
|
||||
$view->withThemeBackgroundColor(Setting::get('style_background_color', '#F0F3F4'));
|
||||
$view->withThemeBackgroundFills(Setting::get('style_background_fills', '#FFFFFF'));
|
||||
$view->withThemeTextColor(Setting::get('style_text_color', '#333333'));
|
||||
$view->withThemeReds(Setting::get('style_reds', '#ff6f6f'));
|
||||
$view->withThemeBlues(Setting::get('style_blues', '#3498db'));
|
||||
$view->withThemeGreens(Setting::get('style_greens', '#7ED321'));
|
||||
$view->withThemeYellows(Setting::get('style_yellows', '#F7CA18'));
|
||||
$view->withThemeOranges(Setting::get('style_oranges', '#FF8800'));
|
||||
$view->withThemeMetrics(Setting::get('style_metrics', '#0dccc0'));
|
||||
$view->withThemeLinks(Setting::get('style_links', '#7ED321'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,8 @@ class TimezoneLocaleComposer
|
||||
* Timezones and Locales composer.
|
||||
*
|
||||
* @param \Illuminate\Contracts\View\View $view
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function compose(View $view)
|
||||
{
|
||||
@@ -45,6 +47,7 @@ class TimezoneLocaleComposer
|
||||
'Europe' => DateTimeZone::EUROPE,
|
||||
'Indian' => DateTimeZone::INDIAN,
|
||||
'Pacific' => DateTimeZone::PACIFIC,
|
||||
'UTC' => DateTimeZone::UTC,
|
||||
];
|
||||
|
||||
$timezones = [];
|
||||
@@ -65,9 +68,7 @@ class TimezoneLocaleComposer
|
||||
}
|
||||
}
|
||||
|
||||
$view->with([
|
||||
'timezones' => $timezones,
|
||||
'langs' => $langs,
|
||||
]);
|
||||
$view->withTimezones($timezones);
|
||||
$view->withLangs($langs);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,6 +33,8 @@ class Repository
|
||||
* Create a new settings service instance.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Models\Setting $model
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Setting $model)
|
||||
{
|
||||
@@ -75,6 +77,8 @@ class Repository
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $value
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function set($name, $value)
|
||||
{
|
||||
|
||||
331
app/Console/Commands/DemoSeederCommand.php
Normal file
331
app/Console/Commands/DemoSeederCommand.php
Normal file
@@ -0,0 +1,331 @@
|
||||
<?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\Console\Commands;
|
||||
|
||||
use CachetHQ\Cachet\Models\Component;
|
||||
use CachetHQ\Cachet\Models\ComponentGroup;
|
||||
use CachetHQ\Cachet\Models\Incident;
|
||||
use CachetHQ\Cachet\Models\Metric;
|
||||
use CachetHQ\Cachet\Models\MetricPoint;
|
||||
use CachetHQ\Cachet\Models\Setting;
|
||||
use CachetHQ\Cachet\Models\User;
|
||||
use DateInterval;
|
||||
use DateTime;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Console\ConfirmableTrait;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
|
||||
/**
|
||||
* This is the demo seeder command.
|
||||
*
|
||||
* @author James Brooks <james@alt-three.com>
|
||||
*/
|
||||
class DemoSeederCommand extends Command
|
||||
{
|
||||
use ConfirmableTrait;
|
||||
|
||||
/**
|
||||
* The console command name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $name = 'cachet:seed';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Seeds Cachet with demo data.';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function fire()
|
||||
{
|
||||
if (!$this->confirmToProceed()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->seedComponentGroups();
|
||||
$this->seedComponents();
|
||||
$this->seedIncidents();
|
||||
$this->seedMetricPoints();
|
||||
$this->seedMetrics();
|
||||
$this->seedSettings();
|
||||
$this->seedUsers();
|
||||
|
||||
$this->info('Database seeded with demo data successfully!');
|
||||
}
|
||||
|
||||
/**
|
||||
* Seed the component groups table.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function seedComponentGroups()
|
||||
{
|
||||
$defaultGroups = [
|
||||
[
|
||||
'name' => 'Websites',
|
||||
'order' => 1,
|
||||
],
|
||||
];
|
||||
|
||||
ComponentGroup::truncate();
|
||||
|
||||
foreach ($defaultGroups as $group) {
|
||||
ComponentGroup::create($group);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Seed the components table.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function seedComponents()
|
||||
{
|
||||
$defaultComponents = [
|
||||
[
|
||||
'name' => 'API',
|
||||
'description' => 'Used by third-parties to connect to us',
|
||||
'status' => 1,
|
||||
'order' => 0,
|
||||
'group_id' => 0,
|
||||
'link' => '',
|
||||
], [
|
||||
'name' => 'Documentation',
|
||||
'description' => 'Kindly powered by Readme.io',
|
||||
'status' => 1,
|
||||
'order' => 0,
|
||||
'group_id' => 1,
|
||||
'link' => 'https://docs.cachethq.io',
|
||||
], [
|
||||
'name' => 'Website',
|
||||
'description' => '',
|
||||
'status' => 1,
|
||||
'order' => 0,
|
||||
'group_id' => 1,
|
||||
'link' => 'https://cachethq.io',
|
||||
], [
|
||||
'name' => 'Blog',
|
||||
'description' => 'The Cachet Blog.',
|
||||
'status' => 1,
|
||||
'order' => 0,
|
||||
'group_id' => 1,
|
||||
'link' => 'https://blog.cachethq.io',
|
||||
],
|
||||
];
|
||||
|
||||
Component::truncate();
|
||||
|
||||
foreach ($defaultComponents as $component) {
|
||||
Component::create($component);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Seed the incidents table.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function seedIncidents()
|
||||
{
|
||||
$defaultIncidents = [
|
||||
[
|
||||
'name' => 'Awesome',
|
||||
'message' => ':+1: We totally nailed the fix.',
|
||||
'status' => 4,
|
||||
'component_id' => 0,
|
||||
'scheduled_at' => null,
|
||||
'visible' => 1,
|
||||
],
|
||||
[
|
||||
'name' => 'Monitoring the fix',
|
||||
'message' => ":ship: We've deployed a fix.",
|
||||
'status' => 3,
|
||||
'component_id' => 0,
|
||||
'scheduled_at' => null,
|
||||
'visible' => 1,
|
||||
],
|
||||
[
|
||||
'name' => 'Update',
|
||||
'message' => "We've identified the problem. Our engineers are currently looking at it.",
|
||||
'status' => 2,
|
||||
'component_id' => 0,
|
||||
'scheduled_at' => null,
|
||||
'visible' => 1,
|
||||
],
|
||||
[
|
||||
'name' => 'Test Incident',
|
||||
'message' => 'Something went wrong, with something or another.',
|
||||
'status' => 1,
|
||||
'component_id' => 0,
|
||||
'scheduled_at' => null,
|
||||
'visible' => 1,
|
||||
],
|
||||
[
|
||||
'name' => 'Investigating the API',
|
||||
'message' => ':zap: We\'ve seen high response times from our API. It looks to be fixing itself as time goes on.',
|
||||
'status' => 1,
|
||||
'component_id' => 1,
|
||||
'scheduled_at' => null,
|
||||
'visible' => 1,
|
||||
],
|
||||
];
|
||||
|
||||
Incident::truncate();
|
||||
|
||||
foreach ($defaultIncidents as $incident) {
|
||||
Incident::create($incident);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Seed the metric points table.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function seedMetricPoints()
|
||||
{
|
||||
MetricPoint::truncate();
|
||||
|
||||
// Generate 11 hours of metric points
|
||||
for ($i = 0; $i < 11; $i++) {
|
||||
$metricTime = (new DateTime())->sub(new DateInterval('PT'.$i.'H'));
|
||||
|
||||
MetricPoint::create([
|
||||
'metric_id' => 1,
|
||||
'value' => rand(1, 10),
|
||||
'created_at' => $metricTime,
|
||||
'updated_at' => $metricTime,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Seed the metrics table.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function seedMetrics()
|
||||
{
|
||||
$defaultMetrics = [
|
||||
[
|
||||
'name' => 'Cups of coffee',
|
||||
'suffix' => 'Cups',
|
||||
'description' => 'How many cups of coffee we\'ve drank.',
|
||||
'default_value' => 0,
|
||||
'calc_type' => 1,
|
||||
'display_chart' => 1,
|
||||
],
|
||||
];
|
||||
|
||||
Metric::truncate();
|
||||
|
||||
foreach ($defaultMetrics as $metric) {
|
||||
Metric::create($metric);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Seed the settings table.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function seedSettings()
|
||||
{
|
||||
$defaultSettings = [
|
||||
[
|
||||
'name' => 'app_name',
|
||||
'value' => 'Cachet Demo',
|
||||
],
|
||||
[
|
||||
'name' => 'app_domain',
|
||||
'value' => 'https://demo.cachethq.io',
|
||||
],
|
||||
[
|
||||
'name' => 'show_support',
|
||||
'value' => '1',
|
||||
],
|
||||
[
|
||||
'name' => 'app_locale',
|
||||
'value' => 'en',
|
||||
],
|
||||
[
|
||||
'name' => 'app_timezone',
|
||||
'value' => 'Europe/London',
|
||||
],
|
||||
[
|
||||
'name' => 'app_incident_days',
|
||||
'value' => '7',
|
||||
],
|
||||
[
|
||||
'name' => 'app_analytics',
|
||||
'value' => 'UA-58442674-3',
|
||||
],
|
||||
[
|
||||
'name' => 'app_analytics_gs',
|
||||
'value' => 'GSN-712462-P',
|
||||
],
|
||||
[
|
||||
'name' => 'display_graphs',
|
||||
'value' => '1',
|
||||
],
|
||||
];
|
||||
|
||||
Setting::truncate();
|
||||
|
||||
foreach ($defaultSettings as $setting) {
|
||||
Setting::create($setting);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Seed the users table.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function seedUsers()
|
||||
{
|
||||
$users = [
|
||||
[
|
||||
'username' => 'test',
|
||||
'password' => 'test123',
|
||||
'email' => 'test@test.com',
|
||||
'level' => 1,
|
||||
'api_key' => '9yMHsdioQosnyVK4iCVR',
|
||||
],
|
||||
];
|
||||
|
||||
User::truncate();
|
||||
|
||||
foreach ($users as $user) {
|
||||
User::create($user);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the console command options.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getOptions()
|
||||
{
|
||||
return [
|
||||
['force', null, InputOption::VALUE_NONE, 'Force the operation to run when in production.'],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,111 +0,0 @@
|
||||
<?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\Console\Commands;
|
||||
|
||||
use DirectoryIterator;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class FixPermissionsCommand extends Command
|
||||
{
|
||||
/**
|
||||
* The console command name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $name = 'cachet:chmod';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Fixes file and directory permissions. Ensures SQLite database is writable.';
|
||||
|
||||
/**
|
||||
* Path to the storage directory.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $storageDirectory;
|
||||
|
||||
/**
|
||||
* Path of the database directory.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $databaseDirectory;
|
||||
|
||||
/**
|
||||
* Path of the SQLite database file.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $databasePath;
|
||||
|
||||
/**
|
||||
* Which database connection are we using?
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $databaseDefault;
|
||||
|
||||
/**
|
||||
* Create a new fix permissions command instance.
|
||||
*
|
||||
* @param string $storageDirectory
|
||||
* @param string $databaseDirectory
|
||||
* @param string $databasePath
|
||||
* @param string $databaseDefault
|
||||
*/
|
||||
public function __construct($storageDirectory, $databaseDirectory, $databasePath, $databaseDefault)
|
||||
{
|
||||
$this->storageDirectory = $storageDirectory;
|
||||
$this->databaseDirectory = $databaseDirectory;
|
||||
$this->databasePath = $databasePath;
|
||||
$this->databaseDefault = $databaseDefault;
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*/
|
||||
public function fire()
|
||||
{
|
||||
$this->recursiveChmod($this->storageDirectory);
|
||||
|
||||
if ($this->databaseDefault === 'sqlite') {
|
||||
chmod($this->databaseDirectory, 755);
|
||||
chmod($this->databasePath, 755);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Recursively sets a paths file permissions.
|
||||
*
|
||||
* @param string $path
|
||||
* @param string $mode
|
||||
*/
|
||||
protected function recursiveChmod($path, $mode = '0755')
|
||||
{
|
||||
$dir = new DirectoryIterator($path);
|
||||
foreach ($dir as $item) {
|
||||
if (!$item->isDot()) {
|
||||
chmod($item->getPathname(), $mode);
|
||||
}
|
||||
|
||||
if ($item->isDir() && !$item->isDot()) {
|
||||
$this->recursiveChmod($item->getPathname());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,7 @@
|
||||
|
||||
namespace CachetHQ\Cachet\Console;
|
||||
|
||||
use CachetHQ\Cachet\Console\Commands\DemoSeederCommand;
|
||||
use Illuminate\Console\Scheduling\Schedule;
|
||||
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
|
||||
|
||||
@@ -22,13 +23,15 @@ class Kernel extends ConsoleKernel
|
||||
* @var array
|
||||
*/
|
||||
protected $commands = [
|
||||
'CachetHQ\Cachet\Console\Commands\FixPermissionsCommand',
|
||||
DemoSeederCommand::class,
|
||||
];
|
||||
|
||||
/**
|
||||
* Define the application's command schedule.
|
||||
*
|
||||
* @param \Illuminate\Console\Scheduling\Schedule $schedule
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function schedule(Schedule $schedule)
|
||||
{
|
||||
|
||||
34
app/Events/Component/ComponentWasAddedEvent.php
Normal file
34
app/Events/Component/ComponentWasAddedEvent.php
Normal 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\Events\Component;
|
||||
|
||||
use CachetHQ\Cachet\Models\Component;
|
||||
|
||||
class ComponentWasAddedEvent
|
||||
{
|
||||
/**
|
||||
* The component that was added.
|
||||
*
|
||||
* @var \CachetHQ\Cachet\Models\Component
|
||||
*/
|
||||
public $component;
|
||||
|
||||
/**
|
||||
* Create a new component was added event instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Component $component)
|
||||
{
|
||||
$this->component = $component;
|
||||
}
|
||||
}
|
||||
34
app/Events/Component/ComponentWasRemovedEvent.php
Normal file
34
app/Events/Component/ComponentWasRemovedEvent.php
Normal 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\Events\Component;
|
||||
|
||||
use CachetHQ\Cachet\Models\Component;
|
||||
|
||||
class ComponentWasRemovedEvent
|
||||
{
|
||||
/**
|
||||
* The component that was removed.
|
||||
*
|
||||
* @var \CachetHQ\Cachet\Models\Component
|
||||
*/
|
||||
public $component;
|
||||
|
||||
/**
|
||||
* Create a new component was removed event instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Component $component)
|
||||
{
|
||||
$this->component = $component;
|
||||
}
|
||||
}
|
||||
34
app/Events/Component/ComponentWasUpdatedEvent.php
Normal file
34
app/Events/Component/ComponentWasUpdatedEvent.php
Normal 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\Events\Component;
|
||||
|
||||
use CachetHQ\Cachet\Models\Component;
|
||||
|
||||
class ComponentWasUpdatedEvent
|
||||
{
|
||||
/**
|
||||
* The component that was updated.
|
||||
*
|
||||
* @var \CachetHQ\Cachet\Models\Component
|
||||
*/
|
||||
public $component;
|
||||
|
||||
/**
|
||||
* Create a new component was updated event instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Component $component)
|
||||
{
|
||||
$this->component = $component;
|
||||
}
|
||||
}
|
||||
34
app/Events/ComponentGroup/ComponentGroupWasAddedEvent.php
Normal file
34
app/Events/ComponentGroup/ComponentGroupWasAddedEvent.php
Normal 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\Events\ComponentGroup;
|
||||
|
||||
use CachetHQ\Cachet\Models\ComponentGroup;
|
||||
|
||||
class ComponentGroupWasAddedEvent
|
||||
{
|
||||
/**
|
||||
* The component group that was added.
|
||||
*
|
||||
* @var \CachetHQ\Cachet\Models\ComponentGroup
|
||||
*/
|
||||
public $group;
|
||||
|
||||
/**
|
||||
* Create a new component group was added event instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(ComponentGroup $group)
|
||||
{
|
||||
$this->group = $group;
|
||||
}
|
||||
}
|
||||
34
app/Events/ComponentGroup/ComponentGroupWasRemovedEvent.php
Normal file
34
app/Events/ComponentGroup/ComponentGroupWasRemovedEvent.php
Normal 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\Events\ComponentGroup;
|
||||
|
||||
use CachetHQ\Cachet\Models\ComponentGroup;
|
||||
|
||||
class ComponentGroupWasRemovedEvent
|
||||
{
|
||||
/**
|
||||
* The component group that was removed.
|
||||
*
|
||||
* @var \CachetHQ\Cachet\Models\ComponentGroup
|
||||
*/
|
||||
public $group;
|
||||
|
||||
/**
|
||||
* Create a new component group was removed event instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(ComponentGroup $group)
|
||||
{
|
||||
$this->group = $group;
|
||||
}
|
||||
}
|
||||
34
app/Events/ComponentGroup/ComponentGroupWasUpdatedEvent.php
Normal file
34
app/Events/ComponentGroup/ComponentGroupWasUpdatedEvent.php
Normal 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\Events\ComponentGroup;
|
||||
|
||||
use CachetHQ\Cachet\Models\ComponentGroup;
|
||||
|
||||
class ComponentGroupWasUpdatedEvent
|
||||
{
|
||||
/**
|
||||
* The component group that was updated.
|
||||
*
|
||||
* @var \CachetHQ\Cachet\Models\ComponentGroup
|
||||
*/
|
||||
public $group;
|
||||
|
||||
/**
|
||||
* Create a new component group was updated event instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(ComponentGroup $group)
|
||||
{
|
||||
$this->group = $group;
|
||||
}
|
||||
}
|
||||
32
app/Events/Incident/IncidentWasRemovedEvent.php
Normal file
32
app/Events/Incident/IncidentWasRemovedEvent.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?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\Events\Incident;
|
||||
|
||||
use CachetHQ\Cachet\Models\Incident;
|
||||
|
||||
class IncidentWasRemovedEvent
|
||||
{
|
||||
/**
|
||||
* The incident that has been removed.
|
||||
*
|
||||
* @var \CachetHQ\Cachet\Models\Incident
|
||||
*/
|
||||
public $incident;
|
||||
|
||||
/**
|
||||
* Create a new incident was removed event instance.
|
||||
*/
|
||||
public function __construct(Incident $incident)
|
||||
{
|
||||
$this->incident = $incident;
|
||||
}
|
||||
}
|
||||
@@ -9,11 +9,11 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace CachetHQ\Cachet\Events;
|
||||
namespace CachetHQ\Cachet\Events\Incident;
|
||||
|
||||
use CachetHQ\Cachet\Models\Incident;
|
||||
|
||||
class IncidentHasReportedEvent
|
||||
class IncidentWasReportedEvent
|
||||
{
|
||||
/**
|
||||
* The incident that has been reported.
|
||||
@@ -24,6 +24,8 @@ class IncidentHasReportedEvent
|
||||
|
||||
/**
|
||||
* Create a new incident has reported event instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Incident $incident)
|
||||
{
|
||||
34
app/Events/Incident/IncidentWasUpdatedEvent.php
Normal file
34
app/Events/Incident/IncidentWasUpdatedEvent.php
Normal 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\Events\Incident;
|
||||
|
||||
use CachetHQ\Cachet\Models\Incident;
|
||||
|
||||
class IncidentWasUpdatedEvent
|
||||
{
|
||||
/**
|
||||
* The incident that has been updated.
|
||||
*
|
||||
* @var \CachetHQ\Cachet\Models\Incident
|
||||
*/
|
||||
public $incident;
|
||||
|
||||
/**
|
||||
* Create a new incident has updated event instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Incident $incident)
|
||||
{
|
||||
$this->incident = $incident;
|
||||
}
|
||||
}
|
||||
@@ -9,11 +9,11 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace CachetHQ\Cachet\Events;
|
||||
namespace CachetHQ\Cachet\Events\Incident;
|
||||
|
||||
use CachetHQ\Cachet\Models\Incident;
|
||||
|
||||
class MaintenanceHasScheduledEvent
|
||||
class MaintenanceWasScheduledEvent
|
||||
{
|
||||
/**
|
||||
* The incident that has been reported.
|
||||
@@ -24,6 +24,8 @@ class MaintenanceHasScheduledEvent
|
||||
|
||||
/**
|
||||
* Create a new maintenance has scheduled event instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Incident $incident)
|
||||
{
|
||||
34
app/Events/Metric/MetricPointWasAddedEvent.php
Normal file
34
app/Events/Metric/MetricPointWasAddedEvent.php
Normal 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\Events\Metric;
|
||||
|
||||
use CachetHQ\Cachet\Models\MetricPoint;
|
||||
|
||||
class MetricPointWasAddedEvent
|
||||
{
|
||||
/**
|
||||
* The metric point that was added.
|
||||
*
|
||||
* @var \CachetHQ\Cachet\Models\MetricPoint
|
||||
*/
|
||||
public $metric;
|
||||
|
||||
/**
|
||||
* Create a new metric point was added event instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(MetricPoint $metric)
|
||||
{
|
||||
$this->metric = $metric;
|
||||
}
|
||||
}
|
||||
34
app/Events/Metric/MetricPointWasRemovedEvent.php
Normal file
34
app/Events/Metric/MetricPointWasRemovedEvent.php
Normal 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\Events\Metric;
|
||||
|
||||
use CachetHQ\Cachet\Models\MetricPoint;
|
||||
|
||||
class MetricPointWasRemovedEvent
|
||||
{
|
||||
/**
|
||||
* The metric point that was removed.
|
||||
*
|
||||
* @var \CachetHQ\Cachet\Models\MetricPoint
|
||||
*/
|
||||
public $metricPoint;
|
||||
|
||||
/**
|
||||
* Create a new metric point was removed event instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(MetricPoint $metricPoint)
|
||||
{
|
||||
$this->metricPoint = $metricPoint;
|
||||
}
|
||||
}
|
||||
34
app/Events/Metric/MetricPointWasUpdatedEvent.php
Normal file
34
app/Events/Metric/MetricPointWasUpdatedEvent.php
Normal 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\Events\Metric;
|
||||
|
||||
use CachetHQ\Cachet\Models\MetricPoint;
|
||||
|
||||
class MetricPointWasUpdatedEvent
|
||||
{
|
||||
/**
|
||||
* The metric point that was updated.
|
||||
*
|
||||
* @var \CachetHQ\Cachet\Models\MetricPoint
|
||||
*/
|
||||
public $point;
|
||||
|
||||
/**
|
||||
* Create a new metric point was updated event instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(MetricPoint $point)
|
||||
{
|
||||
$this->point = $point;
|
||||
}
|
||||
}
|
||||
34
app/Events/Metric/MetricWasAddedEvent.php
Normal file
34
app/Events/Metric/MetricWasAddedEvent.php
Normal 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\Events\Metric;
|
||||
|
||||
use CachetHQ\Cachet\Models\Metric;
|
||||
|
||||
class MetricWasAddedEvent
|
||||
{
|
||||
/**
|
||||
* The metric that was added.
|
||||
*
|
||||
* @var \CachetHQ\Cachet\Models\Metric
|
||||
*/
|
||||
public $metric;
|
||||
|
||||
/**
|
||||
* Create a new metric was added event instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Metric $metric)
|
||||
{
|
||||
$this->metric = $metric;
|
||||
}
|
||||
}
|
||||
34
app/Events/Metric/MetricWasRemovedEvent.php
Normal file
34
app/Events/Metric/MetricWasRemovedEvent.php
Normal 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\Events\Metric;
|
||||
|
||||
use CachetHQ\Cachet\Models\Metric;
|
||||
|
||||
class MetricWasRemovedEvent
|
||||
{
|
||||
/**
|
||||
* The metric that was removed.
|
||||
*
|
||||
* @var \CachetHQ\Cachet\Models\Metric
|
||||
*/
|
||||
public $metric;
|
||||
|
||||
/**
|
||||
* Create a new metric was removed event instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Metric $metric)
|
||||
{
|
||||
$this->metric = $metric;
|
||||
}
|
||||
}
|
||||
34
app/Events/Metric/MetricWasUpdatedEvent.php
Normal file
34
app/Events/Metric/MetricWasUpdatedEvent.php
Normal 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\Events\Metric;
|
||||
|
||||
use CachetHQ\Cachet\Models\Metric;
|
||||
|
||||
class MetricWasUpdatedEvent
|
||||
{
|
||||
/**
|
||||
* The metric that was updated.
|
||||
*
|
||||
* @var \CachetHQ\Cachet\Models\MetricPoint
|
||||
*/
|
||||
public $metric;
|
||||
|
||||
/**
|
||||
* Create a new metric was updated event instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Metric $metric)
|
||||
{
|
||||
$this->metric = $metric;
|
||||
}
|
||||
}
|
||||
34
app/Events/Subscriber/SubscriberHasSubscribedEvent.php
Normal file
34
app/Events/Subscriber/SubscriberHasSubscribedEvent.php
Normal 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\Events\Subscriber;
|
||||
|
||||
use CachetHQ\Cachet\Models\Subscriber;
|
||||
|
||||
class SubscriberHasSubscribedEvent
|
||||
{
|
||||
/**
|
||||
* The subscriber who has subscribed.
|
||||
*
|
||||
* @var \CachetHQ\Cachet\Models\Subscriber
|
||||
*/
|
||||
public $subscriber;
|
||||
|
||||
/**
|
||||
* Create a new subscriber has subscribed event instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Subscriber $subscriber)
|
||||
{
|
||||
$this->subscriber = $subscriber;
|
||||
}
|
||||
}
|
||||
34
app/Events/Subscriber/SubscriberHasUnsubscribedEvent.php
Normal file
34
app/Events/Subscriber/SubscriberHasUnsubscribedEvent.php
Normal 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\Events\Subscriber;
|
||||
|
||||
use CachetHQ\Cachet\Models\Subscriber;
|
||||
|
||||
class SubscriberHasUnsubscribedEvent
|
||||
{
|
||||
/**
|
||||
* The subscriber who has unsubscribed.
|
||||
*
|
||||
* @var \CachetHQ\Cachet\Models\Subscriber
|
||||
*/
|
||||
public $subscriber;
|
||||
|
||||
/**
|
||||
* Create a new subscriber has unsubscribed event instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Subscriber $subscriber)
|
||||
{
|
||||
$this->subscriber = $subscriber;
|
||||
}
|
||||
}
|
||||
@@ -9,21 +9,23 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace CachetHQ\Cachet\Events;
|
||||
namespace CachetHQ\Cachet\Events\Subscriber;
|
||||
|
||||
use CachetHQ\Cachet\Models\Subscriber;
|
||||
|
||||
class CustomerHasSubscribedEvent
|
||||
class SubscriberHasVerifiedEvent
|
||||
{
|
||||
/**
|
||||
* The customer who has subscribed.
|
||||
* The subscriber who has verified.
|
||||
*
|
||||
* @var \CachetHQ\Cachet\Models\Subscriber
|
||||
*/
|
||||
public $subscriber;
|
||||
|
||||
/**
|
||||
* Create a new customer has subscribed event instance.
|
||||
* Create a new subscriber has subscribed event instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Subscriber $subscriber)
|
||||
{
|
||||
17
app/Events/User/UserEventInterface.php
Normal file
17
app/Events/User/UserEventInterface.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?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\Events\User;
|
||||
|
||||
interface UserEventInterface
|
||||
{
|
||||
//
|
||||
}
|
||||
34
app/Events/User/UserWasAddedEvent.php
Normal file
34
app/Events/User/UserWasAddedEvent.php
Normal 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\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.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(User $user)
|
||||
{
|
||||
$this->user = $user;
|
||||
}
|
||||
}
|
||||
34
app/Events/User/UserWasRemovedEvent.php
Normal file
34
app/Events/User/UserWasRemovedEvent.php
Normal 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\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.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(User $user)
|
||||
{
|
||||
$this->user = $user;
|
||||
}
|
||||
}
|
||||
@@ -29,6 +29,8 @@ class RedirectDisplayer implements DisplayerInterface
|
||||
* Create a new redirect displayer instance.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Request $request)
|
||||
{
|
||||
@@ -65,10 +67,11 @@ class RedirectDisplayer implements DisplayerInterface
|
||||
*
|
||||
* @param \Exception $original
|
||||
* @param \Exception $transformed
|
||||
* @param int $code
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function canDisplay(Exception $original, Exception $transformed)
|
||||
public function canDisplay(Exception $original, Exception $transformed, $code)
|
||||
{
|
||||
$redirect = $transformed instanceof HttpExceptionInterface && $transformed->getStatusCode() === 401;
|
||||
|
||||
|
||||
@@ -27,6 +27,8 @@ class ApiFilter
|
||||
* Create a new api filter instance.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Request $request)
|
||||
{
|
||||
@@ -39,10 +41,11 @@ class ApiFilter
|
||||
* @param \GrahamCampbell\Exceptions\Displayers\DisplayerInterface[] $displayers
|
||||
* @param \Exception $original
|
||||
* @param \Exception $transformed
|
||||
* @param int $code
|
||||
*
|
||||
* @return \GrahamCampbell\Exceptions\Displayers\DisplayerInterface[]
|
||||
*/
|
||||
public function filter(array $displayers, Exception $original, Exception $transformed)
|
||||
public function filter(array $displayers, Exception $original, Exception $transformed, $code)
|
||||
{
|
||||
if ($this->request->is('api*')) {
|
||||
foreach ($displayers as $index => $displayer) {
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
<?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\Exceptions;
|
||||
|
||||
use GrahamCampbell\Exceptions\ExceptionHandler;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
|
||||
class Handler extends ExceptionHandler
|
||||
{
|
||||
/**
|
||||
* A list of the exception types that should not be reported.
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected $dontReport = [
|
||||
NotFoundHttpException::class,
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?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\Handlers\Commands\Component;
|
||||
|
||||
use CachetHQ\Cachet\Commands\Component\AddComponentCommand;
|
||||
use CachetHQ\Cachet\Events\Component\ComponentWasAddedEvent;
|
||||
use CachetHQ\Cachet\Models\Component;
|
||||
|
||||
class AddComponentCommandHandler
|
||||
{
|
||||
/**
|
||||
* Handle the add component command.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Commands\Component\AddComponentCommand $command
|
||||
*
|
||||
* @return \CachetHQ\Cachet\Models\Component
|
||||
*/
|
||||
public function handle(AddComponentCommand $command)
|
||||
{
|
||||
$component = Component::create([
|
||||
'name' => $command->name,
|
||||
'description' => $command->description,
|
||||
'link' => $command->link,
|
||||
'status' => $command->status,
|
||||
'order' => $command->order,
|
||||
'group_id' => $command->group_id,
|
||||
]);
|
||||
|
||||
event(new ComponentWasAddedEvent($component));
|
||||
|
||||
return $component;
|
||||
}
|
||||
}
|
||||
@@ -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\Handlers\Commands\Component;
|
||||
|
||||
use CachetHQ\Cachet\Commands\Component\RemoveComponentCommand;
|
||||
use CachetHQ\Cachet\Events\Component\ComponentWasRemovedEvent;
|
||||
|
||||
class RemoveComponentCommandHandler
|
||||
{
|
||||
/**
|
||||
* Handle the remove component command.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Commands\Component\RemoveComponentCommand $command
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function handle(RemoveComponentCommand $command)
|
||||
{
|
||||
$component = $command->component;
|
||||
|
||||
event(new ComponentWasRemovedEvent($component));
|
||||
|
||||
$component->delete();
|
||||
}
|
||||
}
|
||||
@@ -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\Handlers\Commands\Component;
|
||||
|
||||
use CachetHQ\Cachet\Commands\Component\UpdateComponentCommand;
|
||||
use CachetHQ\Cachet\Events\Component\ComponentWasUpdatedEvent;
|
||||
use CachetHQ\Cachet\Models\Component;
|
||||
|
||||
class UpdateComponentCommandHandler
|
||||
{
|
||||
/**
|
||||
* Handle the update component command.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Commands\Component\UpdateComponentCommand $command
|
||||
*
|
||||
* @return \CachetHQ\Cachet\Models\Component
|
||||
*/
|
||||
public function handle(UpdateComponentCommand $command)
|
||||
{
|
||||
$component = $command->component;
|
||||
$component->update($this->filterComponentData($command));
|
||||
|
||||
event(new ComponentWasUpdatedEvent($component));
|
||||
|
||||
return $component;
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the command data.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Commands\Component\UpdateComponentCommand $command
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function filterComponentData($command)
|
||||
{
|
||||
return array_filter([
|
||||
'name' => $command->name,
|
||||
'description' => $command->description,
|
||||
'link' => $command->link,
|
||||
'status' => $command->status,
|
||||
'order' => $command->order,
|
||||
'group_id' => $command->group_id,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?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\Handlers\Commands\ComponentGroup;
|
||||
|
||||
use CachetHQ\Cachet\Commands\ComponentGroup\AddComponentGroupCommand;
|
||||
use CachetHQ\Cachet\Events\ComponentGroup\ComponentGroupWasAddedEvent;
|
||||
use CachetHQ\Cachet\Models\ComponentGroup;
|
||||
|
||||
class AddComponentGroupCommandHandler
|
||||
{
|
||||
/**
|
||||
* Handle the add component group command.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Commands\ComponentGroup\AddComponentGroupCommand $command
|
||||
*
|
||||
* @return \CachetHQ\Cachet\Models\ComponentGroup
|
||||
*/
|
||||
public function handle(AddComponentGroupCommand $command)
|
||||
{
|
||||
$group = ComponentGroup::create([
|
||||
'name' => $command->name,
|
||||
'order' => $command->order,
|
||||
]);
|
||||
|
||||
event(new ComponentGroupWasAddedEvent($group));
|
||||
|
||||
return $group;
|
||||
}
|
||||
}
|
||||
@@ -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\Handlers\Commands\ComponentGroup;
|
||||
|
||||
use CachetHQ\Cachet\Commands\ComponentGroup\RemoveComponentGroupCommand;
|
||||
use CachetHQ\Cachet\Events\ComponentGroup\ComponentGroupWasRemovedEvent;
|
||||
|
||||
class RemoveComponentGroupCommandHandler
|
||||
{
|
||||
/**
|
||||
* Handle the remove component group command.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\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();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?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\Handlers\Commands\ComponentGroup;
|
||||
|
||||
use CachetHQ\Cachet\Commands\ComponentGroup\UpdateComponentGroupCommand;
|
||||
use CachetHQ\Cachet\Events\ComponentGroup\ComponentGroupWasUpdatedEvent;
|
||||
|
||||
class UpdateComponentGroupCommandHandler
|
||||
{
|
||||
/**
|
||||
* Handle the update component group command.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Commands\ComponentGroup\UpdateComponentGroupCommand $command
|
||||
*
|
||||
* @return \CachetHQ\Cachet\Models\ComponentGroup
|
||||
*/
|
||||
public function handle(UpdateComponentGroupCommand $command)
|
||||
{
|
||||
$group = $command->group;
|
||||
$group->update([
|
||||
'name' => $command->name,
|
||||
'order' => $command->order,
|
||||
]);
|
||||
|
||||
event(new ComponentGroupWasUpdatedEvent($group));
|
||||
|
||||
return $group;
|
||||
}
|
||||
}
|
||||
@@ -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\Handlers\Commands\Incident;
|
||||
|
||||
use CachetHQ\Cachet\Commands\Incident\RemoveIncidentCommand;
|
||||
use CachetHQ\Cachet\Events\Incident\IncidentWasRemovedEvent;
|
||||
|
||||
class RemoveIncidentCommandHandler
|
||||
{
|
||||
/**
|
||||
* Handle the remove incident command.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Commands\Incident\RemoveIncidentCommand $command
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function handle(RemoveIncidentCommand $command)
|
||||
{
|
||||
$incident = $command->incident;
|
||||
|
||||
event(new IncidentWasRemovedEvent($incident));
|
||||
|
||||
$incident->delete();
|
||||
}
|
||||
}
|
||||
@@ -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\Handlers\Commands\Incident;
|
||||
|
||||
use CachetHQ\Cachet\Commands\Incident\ReportIncidentCommand;
|
||||
use CachetHQ\Cachet\Events\Incident\IncidentWasReportedEvent;
|
||||
use CachetHQ\Cachet\Models\Component;
|
||||
use CachetHQ\Cachet\Models\Incident;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
use Jenssegers\Date\Date;
|
||||
|
||||
class ReportIncidentCommandHandler
|
||||
{
|
||||
/**
|
||||
* Handle the report incident command.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Commands\Incident\ReportIncidentCommand $command
|
||||
*
|
||||
* @return \CachetHQ\Cachet\Models\Incident
|
||||
*/
|
||||
public function handle(ReportIncidentCommand $command)
|
||||
{
|
||||
$incident = Incident::create([
|
||||
'name' => $command->name,
|
||||
'status' => $command->status,
|
||||
'message' => $command->message,
|
||||
'visible' => $command->visible,
|
||||
'component' => $command->component_id,
|
||||
]);
|
||||
|
||||
// The incident occurred at a different time.
|
||||
if ($command->incident_date) {
|
||||
$incidentDate = Date::createFromFormat('d/m/Y H:i', $command->incident_date, config('cachet.timezone'))->setTimezone(Config::get('app.timezone'));
|
||||
|
||||
$incident->update([
|
||||
'created_at' => $incidentDate,
|
||||
'updated_at' => $incidentDate,
|
||||
]);
|
||||
}
|
||||
|
||||
// Update the component.
|
||||
if ($command->component_id) {
|
||||
Component::find($command->component_id)->update([
|
||||
'status' => $command->component_status,
|
||||
]);
|
||||
}
|
||||
|
||||
// Notify subscribers.
|
||||
if ($command->notify) {
|
||||
event(new IncidentWasReportedEvent($incident));
|
||||
}
|
||||
|
||||
return $incident;
|
||||
}
|
||||
}
|
||||
@@ -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\Handlers\Commands\Incident;
|
||||
|
||||
use CachetHQ\Cachet\Commands\Incident\ReportMaintenanceCommand;
|
||||
use CachetHQ\Cachet\Events\Incident\MaintenanceWasScheduledEvent;
|
||||
use CachetHQ\Cachet\Models\Incident;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
use Jenssegers\Date\Date;
|
||||
|
||||
class ReportMaintenanceCommandHandler
|
||||
{
|
||||
/**
|
||||
* Handle the report maintenance command.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Commands\Incident\ReportMaintenanceCommand $command
|
||||
*
|
||||
* @return \CachetHQ\Cachet\Models\Incident
|
||||
*/
|
||||
public function handle(ReportMaintenanceCommand $command)
|
||||
{
|
||||
// TODO: Add validation to scheduledAt
|
||||
$scheduledAt = Date::createFromFormat('d/m/Y H:i', $command->timestamp, config('cachet.timezone'))
|
||||
->setTimezone(Config::get('app.timezone'));
|
||||
|
||||
$maintenanceEvent = Incident::create([
|
||||
'name' => $command->name,
|
||||
'message' => $command->message,
|
||||
'scheduled_at' => $scheduledAt,
|
||||
'status' => 0,
|
||||
'visible' => 1,
|
||||
]);
|
||||
|
||||
// Notify subscribers.
|
||||
if ($command->notify) {
|
||||
event(new MaintenanceWasScheduledEvent($maintenanceEvent));
|
||||
}
|
||||
|
||||
return $maintenanceEvent;
|
||||
}
|
||||
}
|
||||
@@ -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\Handlers\Commands\Incident;
|
||||
|
||||
use CachetHQ\Cachet\Commands\Incident\UpdateIncidentCommand;
|
||||
use CachetHQ\Cachet\Events\Incident\IncidentWasUpdatedEvent;
|
||||
use CachetHQ\Cachet\Models\Component;
|
||||
use CachetHQ\Cachet\Models\Incident;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
use Jenssegers\Date\Date;
|
||||
|
||||
class UpdateIncidentCommandHandler
|
||||
{
|
||||
/**
|
||||
* Handle the update incident command.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Commands\Incident\UpdateIncidentCommand $command
|
||||
*
|
||||
* @return \CachetHQ\Cachet\Models\Incident
|
||||
*/
|
||||
public function handle(UpdateIncidentCommand $command)
|
||||
{
|
||||
$incident = $command->incident;
|
||||
$incident->update($this->filterIncidentData($command));
|
||||
|
||||
// The incident occurred at a different time.
|
||||
if ($command->incident_date) {
|
||||
$incidentDate = Date::createFromFormat('d/m/Y H:i', $command->incident_date, config('cachet.timezone'))->setTimezone(Config::get('app.timezone'));
|
||||
|
||||
$incident->update([
|
||||
'created_at' => $incidentDate,
|
||||
'updated_at' => $incidentDate,
|
||||
]);
|
||||
}
|
||||
|
||||
// Update the component.
|
||||
if ($command->component_id) {
|
||||
Component::find($command->component_id)->update([
|
||||
'status' => $command->component_status,
|
||||
]);
|
||||
}
|
||||
|
||||
// Notify subscribers.
|
||||
if ($command->notify) {
|
||||
event(new IncidentWasUpdatedEvent($incident));
|
||||
}
|
||||
|
||||
return $incident;
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the command data.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Commands\Incident\UpdateIncidentCommand $command
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function filterIncidentData($command)
|
||||
{
|
||||
return array_filter([
|
||||
'name' => $command->name,
|
||||
'status' => $command->status,
|
||||
'message' => $command->message,
|
||||
'visible' => $command->visible,
|
||||
'component_id' => $command->component_id,
|
||||
'component_status' => $command->component_status,
|
||||
'notify' => $command->notify,
|
||||
]);
|
||||
}
|
||||
}
|
||||
43
app/Handlers/Commands/Metric/AddMetricCommandHandler.php
Normal file
43
app/Handlers/Commands/Metric/AddMetricCommandHandler.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?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\Handlers\Commands\Metric;
|
||||
|
||||
use CachetHQ\Cachet\Commands\Metric\AddMetricCommand;
|
||||
use CachetHQ\Cachet\Events\Metric\MetricWasAddedEvent;
|
||||
use CachetHQ\Cachet\Models\Metric;
|
||||
|
||||
class AddMetricCommandHandler
|
||||
{
|
||||
/**
|
||||
* Handle the add metric command.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Commands\Metric\AddMetricCommand $command
|
||||
*
|
||||
* @return \CachetHQ\Cachet\Models\Metric
|
||||
*/
|
||||
public function handle(AddMetricCommand $command)
|
||||
{
|
||||
$metric = Metric::create([
|
||||
'name' => $command->name,
|
||||
'suffix' => $command->suffix,
|
||||
'description' => $command->description,
|
||||
'default_value' => $command->default_value,
|
||||
'calc_type' => $command->calc_type,
|
||||
'display_chart' => $command->display_chart,
|
||||
'places' => $command->places,
|
||||
]);
|
||||
|
||||
event(new MetricWasAddedEvent($metric));
|
||||
|
||||
return $metric;
|
||||
}
|
||||
}
|
||||
@@ -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\Handlers\Commands\Metric;
|
||||
|
||||
use CachetHQ\Cachet\Commands\Metric\AddMetricPointCommand;
|
||||
use CachetHQ\Cachet\Events\Metric\MetricPointWasAddedEvent;
|
||||
use CachetHQ\Cachet\Models\MetricPoint;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class AddMetricPointCommandHandler
|
||||
{
|
||||
/**
|
||||
* Handle the add metric point command.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Commands\Metric\AddMetricPointCommand $command
|
||||
*
|
||||
* @return \CachetHQ\Cachet\Models\MetricPoint
|
||||
*/
|
||||
public function handle(AddMetricPointCommand $command)
|
||||
{
|
||||
$metric = $command->metric;
|
||||
$createdAt = $command->created_at;
|
||||
|
||||
$data = [
|
||||
'metric_id' => $metric->id,
|
||||
'value' => $command->value,
|
||||
];
|
||||
|
||||
if ($createdAt) {
|
||||
$data['created_at'] = Carbon::createFromFormat('U', $createdAt)->format('Y-m-d H:i:s');
|
||||
}
|
||||
|
||||
$metricPoint = MetricPoint::create($data);
|
||||
|
||||
event(new MetricPointWasAddedEvent($metricPoint));
|
||||
|
||||
return $metricPoint;
|
||||
}
|
||||
}
|
||||
35
app/Handlers/Commands/Metric/RemoveMetricCommandHandler.php
Normal file
35
app/Handlers/Commands/Metric/RemoveMetricCommandHandler.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?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\Handlers\Commands\Metric;
|
||||
|
||||
use CachetHQ\Cachet\Commands\Metric\RemoveMetricCommand;
|
||||
use CachetHQ\Cachet\Events\Metric\MetricWasRemovedEvent;
|
||||
use CachetHQ\Cachet\Models\Metric;
|
||||
|
||||
class RemoveMetricCommandHandler
|
||||
{
|
||||
/**
|
||||
* Handle the remove metric command.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Commands\Metric\RemoveMetricCommand $command
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function handle(RemoveMetricCommand $command)
|
||||
{
|
||||
$metric = $command->metric;
|
||||
|
||||
event(new MetricWasRemovedEvent($metric));
|
||||
|
||||
$metric->delete();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?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\Handlers\Commands\Metric;
|
||||
|
||||
use CachetHQ\Cachet\Commands\Metric\RemoveMetricPointCommand;
|
||||
use CachetHQ\Cachet\Events\Metric\MetricPointWasRemovedEvent;
|
||||
use CachetHQ\Cachet\Models\Metric;
|
||||
|
||||
class RemoveMetricPointCommandHandler
|
||||
{
|
||||
/**
|
||||
* Handle the remove metric point command.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Commands\Metric\RemoveMetricPointCommand $command
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function handle(RemoveMetricPointCommand $command)
|
||||
{
|
||||
$metricPoint = $command->metricPoint;
|
||||
|
||||
event(new MetricPointWasRemovedEvent($metricPoint));
|
||||
|
||||
$metricPoint->delete();
|
||||
}
|
||||
}
|
||||
57
app/Handlers/Commands/Metric/UpdateMetricCommandHandler.php
Normal file
57
app/Handlers/Commands/Metric/UpdateMetricCommandHandler.php
Normal file
@@ -0,0 +1,57 @@
|
||||
<?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\Handlers\Commands\Metric;
|
||||
|
||||
use CachetHQ\Cachet\Commands\Metric\UpdateMetricCommand;
|
||||
use CachetHQ\Cachet\Events\Metric\MetricWasUpdatedEvent;
|
||||
use CachetHQ\Cachet\Models\Metric;
|
||||
|
||||
class UpdateMetricCommandHandler
|
||||
{
|
||||
/**
|
||||
* Handle the update metric command.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Commands\Metric\UpdateMetricCommand $command
|
||||
*
|
||||
* @return \CachetHQ\Cachet\Models\Metric
|
||||
*/
|
||||
public function handle(UpdateMetricCommand $command)
|
||||
{
|
||||
$metric = $command->metric;
|
||||
|
||||
$metric->update($this->filterMetricData($command));
|
||||
|
||||
event(new MetricWasUpdatedEvent($metric));
|
||||
|
||||
return $metric;
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the command data.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Commands\Metric\UpdateMetricCommand $command
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function filterMetricData($command)
|
||||
{
|
||||
return array_filter([
|
||||
'name' => $command->name,
|
||||
'suffix' => $command->suffix,
|
||||
'description' => $command->description,
|
||||
'default_value' => $command->default_value,
|
||||
'calc_type' => $command->calc_type,
|
||||
'display_chart' => $command->display_chart,
|
||||
'places' => $command->places,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -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\Handlers\Commands\Metric;
|
||||
|
||||
use CachetHQ\Cachet\Commands\Metric\UpdateMetricPointCommand;
|
||||
use CachetHQ\Cachet\Events\Metric\MetricPointWasUpdatedEvent;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class UpdateMetricPointCommandHandler
|
||||
{
|
||||
/**
|
||||
* Handle the update metric point command.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Commands\Metric\UpdateMetricPointCommand $command
|
||||
*
|
||||
* @return \CachetHQ\Cachet\Models\MetricPoint
|
||||
*/
|
||||
public function handle(UpdateMetricPointCommand $command)
|
||||
{
|
||||
$point = $command->point;
|
||||
$metric = $command->metric;
|
||||
$createdAt = $command->created_at;
|
||||
|
||||
$data = [
|
||||
'metric_id' => $metric->id,
|
||||
'value' => $command->value,
|
||||
];
|
||||
|
||||
if ($createdAt) {
|
||||
$data['created_at'] = Carbon::createFromFormat('U', $createdAt)->format('Y-m-d H:i:s');
|
||||
}
|
||||
|
||||
$point->update($data);
|
||||
|
||||
event(new MetricPointWasUpdatedEvent($point));
|
||||
|
||||
return $point;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
<?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\Handlers\Commands\Subscriber;
|
||||
|
||||
use CachetHQ\Cachet\Commands\Subscriber\SubscribeSubscriberCommand;
|
||||
use CachetHQ\Cachet\Commands\Subscriber\VerifySubscriberCommand;
|
||||
use CachetHQ\Cachet\Events\Subscriber\SubscriberHasSubscribedEvent;
|
||||
use CachetHQ\Cachet\Models\Subscriber;
|
||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||
|
||||
class SubscribeSubscriberCommandHandler
|
||||
{
|
||||
use DispatchesJobs;
|
||||
|
||||
/**
|
||||
* Handle the subscribe subscriber command.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Commands\Subscriber\SubscribeSubscriberCommand $command
|
||||
*
|
||||
* @return \CachetHQ\Cachet\Models\Subscriber
|
||||
*/
|
||||
public function handle(SubscribeSubscriberCommand $command)
|
||||
{
|
||||
$subscriber = Subscriber::create(['email' => $command->email]);
|
||||
|
||||
if ($command->verified) {
|
||||
$this->dispatch(new VerifySubscriberCommand($subscriber));
|
||||
} else {
|
||||
event(new SubscriberHasSubscribedEvent($subscriber));
|
||||
}
|
||||
|
||||
return $subscriber;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?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\Handlers\Commands\Subscriber;
|
||||
|
||||
use CachetHQ\Cachet\Commands\Subscriber\UnsubscribeSubscriberCommand;
|
||||
use CachetHQ\Cachet\Events\Subscriber\SubscriberHasUnsubscribedEvent;
|
||||
use CachetHQ\Cachet\Models\Subscriber;
|
||||
|
||||
class UnsubscribeSubscriberCommandHandler
|
||||
{
|
||||
/**
|
||||
* Handle the subscribe customer command.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Commands\Subscriber\UnsubscribeSubscriberCommand $command
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function handle(UnsubscribeSubscriberCommand $command)
|
||||
{
|
||||
$subscriber = $command->subscriber;
|
||||
|
||||
event(new SubscriberHasUnsubscribedEvent($subscriber));
|
||||
|
||||
$subscriber->delete();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?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\Handlers\Commands\Subscriber;
|
||||
|
||||
use CachetHQ\Cachet\Commands\Subscriber\VerifySubscriberCommand;
|
||||
use CachetHQ\Cachet\Events\Subscriber\SubscriberHasVerifiedEvent;
|
||||
use CachetHQ\Cachet\Models\Subscriber;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class VerifySubscriberCommandHandler
|
||||
{
|
||||
/**
|
||||
* Handle the subscribe customer command.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Commands\Subscriber\VerifySubscriberCommand $command
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function handle(VerifySubscriberCommand $command)
|
||||
{
|
||||
$subscriber = $command->subscriber;
|
||||
|
||||
$subscriber->verified_at = Carbon::now();
|
||||
$subscriber->save();
|
||||
|
||||
event(new SubscriberHasVerifiedEvent($subscriber));
|
||||
}
|
||||
}
|
||||
40
app/Handlers/Commands/User/AddTeamMemberCommandHandler.php
Normal file
40
app/Handlers/Commands/User/AddTeamMemberCommandHandler.php
Normal 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\Handlers\Commands\User;
|
||||
|
||||
use CachetHQ\Cachet\Commands\User\AddTeamMemberCommand;
|
||||
use CachetHQ\Cachet\Events\User\UserWasAddedEvent;
|
||||
use CachetHQ\Cachet\Models\User;
|
||||
|
||||
class AddTeamMemberCommandHandler
|
||||
{
|
||||
/**
|
||||
* Handle the add team member command.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Commands\User\AddTeamMemberCommand $command
|
||||
*
|
||||
* @return \CachetHQ\Cachet\Models\User
|
||||
*/
|
||||
public function handle(AddTeamMemberCommand $command)
|
||||
{
|
||||
$user = User::create([
|
||||
'username' => $command->username,
|
||||
'password' => $command->password,
|
||||
'email' => $command->email,
|
||||
'level' => $command->level,
|
||||
]);
|
||||
|
||||
event(new UserWasAddedEvent($user));
|
||||
|
||||
return $user;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?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\Handlers\Commands\User;
|
||||
|
||||
use CachetHQ\Cachet\Commands\User\GenerateApiTokenCommand;
|
||||
use CachetHQ\Cachet\Models\User;
|
||||
|
||||
class GenerateApiTokenCommandHandler
|
||||
{
|
||||
/**
|
||||
* Handle the generate api key command.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Commands\User\GenerateApiTokenCommand $command
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function handle(GenerateApiTokenCommand $command)
|
||||
{
|
||||
$user = $command->user;
|
||||
|
||||
$user->api_key = User::generateApiKey();
|
||||
$user->save();
|
||||
|
||||
//event(new GeneratedApiTokenEvent($user));
|
||||
}
|
||||
}
|
||||
35
app/Handlers/Commands/User/RemoveUserCommandHandler.php
Normal file
35
app/Handlers/Commands/User/RemoveUserCommandHandler.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?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\Handlers\Commands\User;
|
||||
|
||||
use CachetHQ\Cachet\Commands\User\RemoveUserCommand;
|
||||
use CachetHQ\Cachet\Events\User\UserWasRemovedEvent;
|
||||
use CachetHQ\Cachet\Models\User;
|
||||
|
||||
class RemoveUserCommandHandler
|
||||
{
|
||||
/**
|
||||
* Handle the remove user command.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Commands\User\RemoveUserCommand $command
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function handle(RemoveUserCommand $command)
|
||||
{
|
||||
$user = $command->user;
|
||||
|
||||
event(new UserWasRemovedEvent($user));
|
||||
|
||||
$user->delete();
|
||||
}
|
||||
}
|
||||
@@ -9,13 +9,13 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace CachetHQ\Cachet\Handlers\Events;
|
||||
namespace CachetHQ\Cachet\Handlers\Events\Incident;
|
||||
|
||||
use CachetHQ\Cachet\Events\IncidentHasReportedEvent;
|
||||
use CachetHQ\Cachet\Events\Incident\IncidentWasReportedEvent;
|
||||
use CachetHQ\Cachet\Models\Subscriber;
|
||||
use Illuminate\Contracts\Mail\MailQueue;
|
||||
use Illuminate\Mail\Message;
|
||||
use McCool\LaravelAutoPresenter\PresenterDecorator;
|
||||
use McCool\LaravelAutoPresenter\Facades\AutoPresenter;
|
||||
|
||||
class SendIncidentEmailNotificationHandler
|
||||
{
|
||||
@@ -33,48 +33,46 @@ class SendIncidentEmailNotificationHandler
|
||||
*/
|
||||
protected $subscriber;
|
||||
|
||||
/**
|
||||
* The presenter instance.
|
||||
*
|
||||
* @var \McCool\LaravelAutoPresenter\PresenterDecorator
|
||||
*/
|
||||
protected $presenter;
|
||||
|
||||
/**
|
||||
* Create a new send incident email notification handler.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Mail\Mailer $mailer
|
||||
* @param \CachetHQ\Cachet\Models\Subscriber $subscriber
|
||||
* @param \McCool\LaravelAutoPresenter\PresenterDecorator $presenter
|
||||
* @param \Illuminate\Contracts\Mail\Mailer $mailer
|
||||
* @param \CachetHQ\Cachet\Models\Subscriber $subscriber
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(MailQueue $mailer, Subscriber $subscriber, PresenterDecorator $presenter)
|
||||
public function __construct(MailQueue $mailer, Subscriber $subscriber)
|
||||
{
|
||||
$this->mailer = $mailer;
|
||||
$this->subscriber = $subscriber;
|
||||
$this->presenter = $presenter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the event.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Events\IncidentHasReportedEvent $event
|
||||
* @param \CachetHQ\Cachet\Events\Incident\IncidentHasReportedEvent $event
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function handle(IncidentHasReportedEvent $event)
|
||||
public function handle(IncidentWasReportedEvent $event)
|
||||
{
|
||||
$data = $this->presenter->decorate($event->incident);
|
||||
$incident = AutoPresenter::decorate($event->incident);
|
||||
$component = AutoPresenter::decorate($event->incident->component);
|
||||
|
||||
// Only send emails for public incidents.
|
||||
if ($event->incident->visible === 1) {
|
||||
foreach ($this->subscriber->all() as $subscriber) {
|
||||
$mail = [
|
||||
'email' => $subscriber->email,
|
||||
'subject' => 'New incident reported.',
|
||||
'status' => $data->humanStatus,
|
||||
'htmlContent' => $data->formattedMessage,
|
||||
'textContent' => $data->message,
|
||||
'token' => $subscriber->token,
|
||||
'unsubscribeLink' => route('unsubscribe', ['code' => $subscriber->verify_code]),
|
||||
'appUrl' => env('APP_URL'),
|
||||
'email' => $subscriber->email,
|
||||
'subject' => 'New incident reported.',
|
||||
'has_component' => ($event->incident->component) ? true : false,
|
||||
'component_name' => $component ? $component->name : null,
|
||||
'status' => $incident->humanStatus,
|
||||
'html_content' => $incident->formattedMessage,
|
||||
'text_content' => $incident->message,
|
||||
'token' => $subscriber->token,
|
||||
'unsubscribe_link' => route('subscribe.unsubscribe', ['code' => $subscriber->verify_code]),
|
||||
'app_url' => env('APP_URL'),
|
||||
];
|
||||
|
||||
$this->mailer->queue([
|
||||
@@ -9,13 +9,13 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace CachetHQ\Cachet\Handlers\Events;
|
||||
namespace CachetHQ\Cachet\Handlers\Events\Incident;
|
||||
|
||||
use CachetHQ\Cachet\Events\MaintenanceHasScheduledEvent;
|
||||
use CachetHQ\Cachet\Events\Incident\MaintenanceWasScheduledEvent;
|
||||
use CachetHQ\Cachet\Models\Subscriber;
|
||||
use Illuminate\Contracts\Mail\MailQueue;
|
||||
use Illuminate\Mail\Message;
|
||||
use McCool\LaravelAutoPresenter\PresenterDecorator;
|
||||
use McCool\LaravelAutoPresenter\Facades\AutoPresenter;
|
||||
|
||||
class SendMaintenanceEmailNotificationHandler
|
||||
{
|
||||
@@ -33,46 +33,42 @@ class SendMaintenanceEmailNotificationHandler
|
||||
*/
|
||||
protected $subscriber;
|
||||
|
||||
/**
|
||||
* The presenter instance.
|
||||
*
|
||||
* @var \McCool\LaravelAutoPresenter\PresenterDecorator
|
||||
*/
|
||||
protected $presenter;
|
||||
|
||||
/**
|
||||
* Create a new send maintenance email notification handler.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Mail\Mailer $mailer
|
||||
* @param \CachetHQ\Cachet\Models\Subscriber $subscriber
|
||||
* @param \McCool\LaravelAutoPresenter\PresenterDecorator $presenter
|
||||
* @param \Illuminate\Contracts\Mail\Mailer $mailer
|
||||
* @param \CachetHQ\Cachet\Models\Subscriber $subscriber
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(MailQueue $mailer, Subscriber $subscriber, PresenterDecorator $presenter)
|
||||
public function __construct(MailQueue $mailer, Subscriber $subscriber)
|
||||
{
|
||||
$this->mailer = $mailer;
|
||||
$this->subscriber = $subscriber;
|
||||
$this->presenter = $presenter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the event.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Events\MaintenanceHasScheduledEvent $event
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function handle(MaintenanceHasScheduledEvent $event)
|
||||
public function handle(MaintenanceWasScheduledEvent $event)
|
||||
{
|
||||
$data = $this->presenter->decorate($event->incident);
|
||||
$data = AutoPresenter::decorate($event->incident);
|
||||
|
||||
foreach ($this->subscriber->all() as $subscriber) {
|
||||
$mail = [
|
||||
'email' => $subscriber->email,
|
||||
'subject' => 'Scheduled maintenance.',
|
||||
'status' => $data->humanStatus,
|
||||
'htmlContent' => $data->formattedMessage,
|
||||
'textContent' => $data->message,
|
||||
'token' => $subscriber->token,
|
||||
'unsubscribeLink' => route('unsubscribe', ['code' => $subscriber->verify_code]),
|
||||
'appUrl' => env('APP_URL'),
|
||||
'email' => $subscriber->email,
|
||||
'subject' => 'Scheduled maintenance.',
|
||||
'status' => $data->humanStatus,
|
||||
'html_content' => $data->formattedMessage,
|
||||
'text_content' => $data->message,
|
||||
'scheduled_at' => $data->scheduled_at_formatted,
|
||||
'token' => $subscriber->token,
|
||||
'unsubscribe_link' => route('subscribe.unsubscribe', ['code' => $subscriber->verify_code]),
|
||||
'app_url' => env('APP_URL'),
|
||||
];
|
||||
|
||||
$this->mailer->queue([
|
||||
@@ -9,9 +9,9 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace CachetHQ\Cachet\Handlers\Events;
|
||||
namespace CachetHQ\Cachet\Handlers\Events\Subscriber;
|
||||
|
||||
use CachetHQ\Cachet\Events\CustomerHasSubscribedEvent;
|
||||
use CachetHQ\Cachet\Events\Subscriber\SubscriberHasSubscribedEvent;
|
||||
use Illuminate\Contracts\Mail\MailQueue;
|
||||
use Illuminate\Mail\Message;
|
||||
|
||||
@@ -28,6 +28,8 @@ class SendSubscriberVerificationEmailHandler
|
||||
* Create a new send subscriber verification email handler.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Mail\Mailer $mailer
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(MailQueue $mailer)
|
||||
{
|
||||
@@ -37,15 +39,17 @@ class SendSubscriberVerificationEmailHandler
|
||||
/**
|
||||
* Handle the event.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Events\CustomerHasSubscribedEvent $event
|
||||
* @param \CachetHQ\Cachet\Events\SubscriberHasSubscribedEvent $event
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function handle(CustomerHasSubscribedEvent $event)
|
||||
public function handle(SubscriberHasSubscribedEvent $event)
|
||||
{
|
||||
$mail = [
|
||||
'email' => $event->subscriber->email,
|
||||
'subject' => 'Confirm your subscription.',
|
||||
'link' => route('subscribe-verify', ['code' => $event->subscriber->verify_code]),
|
||||
'appUrl' => env('APP_URL'),
|
||||
'email' => $event->subscriber->email,
|
||||
'subject' => 'Confirm your subscription.',
|
||||
'link' => route('subscribe.verify', ['code' => $event->subscriber->verify_code]),
|
||||
'app_url' => env('APP_URL'),
|
||||
];
|
||||
|
||||
$this->mailer->queue([
|
||||
@@ -1,21 +0,0 @@
|
||||
<?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\Http\Controllers;
|
||||
|
||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||
use Illuminate\Foundation\Validation\ValidatesRequests;
|
||||
use Illuminate\Routing\Controller as BaseController;
|
||||
|
||||
abstract class AbstractController extends BaseController
|
||||
{
|
||||
use DispatchesJobs, ValidatesRequests;
|
||||
}
|
||||
@@ -1,331 +0,0 @@
|
||||
<?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\Http\Controllers\Admin;
|
||||
|
||||
use CachetHQ\Cachet\Http\Controllers\AbstractController;
|
||||
use CachetHQ\Cachet\Models\Component;
|
||||
use CachetHQ\Cachet\Models\ComponentGroup;
|
||||
use CachetHQ\Cachet\Models\Tag;
|
||||
use GrahamCampbell\Binput\Facades\Binput;
|
||||
use Illuminate\Support\Facades\Redirect;
|
||||
use Illuminate\Support\Facades\View;
|
||||
|
||||
class ComponentController extends AbstractController
|
||||
{
|
||||
protected $subMenu = [];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->subMenu = [
|
||||
'components' => [
|
||||
'title' => trans('dashboard.components.components'),
|
||||
'url' => route('dashboard.components'),
|
||||
'icon' => 'ion-outlet',
|
||||
'active' => false,
|
||||
],
|
||||
'groups' => [
|
||||
'title' => trans_choice('dashboard.components.groups.groups', 2),
|
||||
'url' => route('dashboard.components.groups'),
|
||||
'icon' => 'ion-folder',
|
||||
'active' => false,
|
||||
],
|
||||
];
|
||||
|
||||
View::share([
|
||||
'sub_menu' => $this->subMenu,
|
||||
'sub_title' => trans_choice('dashboard.components.components', 2),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the components view.
|
||||
*
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function showComponents()
|
||||
{
|
||||
$components = Component::orderBy('order')->orderBy('created_at')->get();
|
||||
|
||||
$this->subMenu['components']['active'] = true;
|
||||
|
||||
return View::make('dashboard.components.index')->with([
|
||||
'page_title' => trans_choice('dashboard.components.components', 2).' - '.trans('dashboard.dashboard'),
|
||||
'components' => $components,
|
||||
'sub_menu' => $this->subMenu,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the component groups view.
|
||||
*
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function showComponentGroups()
|
||||
{
|
||||
$this->subMenu['groups']['active'] = true;
|
||||
|
||||
return View::make('dashboard.components.groups.index')->with([
|
||||
'page_title' => trans_choice('dashboard.components.groups.groups', 2).' - '.trans('dashboard.dashboard'),
|
||||
'groups' => ComponentGroup::orderBy('order')->get(),
|
||||
'sub_menu' => $this->subMenu,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the edit component view.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Models\Component $component
|
||||
*
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function showEditComponent(Component $component)
|
||||
{
|
||||
$groups = ComponentGroup::all();
|
||||
|
||||
$pageTitle = sprintf(
|
||||
'"%s" - %s - %s',
|
||||
$component->name,
|
||||
trans('dashboard.components.edit.title'),
|
||||
trans('dashboard.dashboard')
|
||||
);
|
||||
|
||||
return View::make('dashboard.components.edit')->with([
|
||||
'page_title' => $pageTitle,
|
||||
'component' => $component,
|
||||
'groups' => $groups,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates a component.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Models\Component $component
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function updateComponentAction(Component $component)
|
||||
{
|
||||
$_component = Binput::get('component');
|
||||
$tags = array_pull($_component, 'tags');
|
||||
|
||||
$component->update($_component);
|
||||
|
||||
if (!$component->isValid()) {
|
||||
return Redirect::back()->withInput(Binput::all())
|
||||
->with('title', sprintf(
|
||||
'%s %s',
|
||||
trans('dashboard.notifications.whoops'),
|
||||
trans('dashboard.components.edit.failure')
|
||||
))
|
||||
->with('errors', $component->getErrors());
|
||||
}
|
||||
|
||||
// The component was added successfully, so now let's deal with the tags.
|
||||
$tags = preg_split('/ ?, ?/', $tags);
|
||||
|
||||
// For every tag, do we need to create it?
|
||||
$componentTags = array_map(function ($taggable) use ($component) {
|
||||
return Tag::firstOrCreate([
|
||||
'name' => $taggable,
|
||||
])->id;
|
||||
}, $tags);
|
||||
|
||||
$component->tags()->sync($componentTags);
|
||||
|
||||
$successMsg = sprintf(
|
||||
'%s %s',
|
||||
trans('dashboard.notifications.awesome'),
|
||||
trans('dashboard.components.edit.success')
|
||||
);
|
||||
|
||||
return Redirect::back()->with('success', $successMsg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the add component view.
|
||||
*
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function showAddComponent()
|
||||
{
|
||||
$groups = ComponentGroup::all();
|
||||
|
||||
return View::make('dashboard.components.add')->with([
|
||||
'page_title' => trans('dashboard.components.add.title').' - '.trans('dashboard.dashboard'),
|
||||
'groups' => $groups,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new component.
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function createComponentAction()
|
||||
{
|
||||
$_component = Binput::get('component');
|
||||
// We deal with tags separately.
|
||||
$tags = array_pull($_component, 'tags');
|
||||
|
||||
$component = Component::create($_component);
|
||||
|
||||
if (!$component->isValid()) {
|
||||
return Redirect::back()->withInput(Binput::all())
|
||||
->with('title', sprintf(
|
||||
'%s %s',
|
||||
trans('dashboard.notifications.whoops'),
|
||||
trans('dashboard.components.add.failure')
|
||||
))
|
||||
->with('errors', $component->getErrors());
|
||||
}
|
||||
|
||||
// The component was added successfully, so now let's deal with the tags.
|
||||
$tags = preg_split('/ ?, ?/', $tags);
|
||||
|
||||
// For every tag, do we need to create it?
|
||||
$componentTags = array_map(function ($taggable) use ($component) {
|
||||
return Tag::firstOrCreate([
|
||||
'name' => $taggable,
|
||||
])->id;
|
||||
}, $tags);
|
||||
|
||||
$component->tags()->sync($componentTags);
|
||||
|
||||
$successMsg = sprintf(
|
||||
'%s %s',
|
||||
trans('dashboard.notifications.awesome'),
|
||||
trans('dashboard.components.add.success')
|
||||
);
|
||||
|
||||
return Redirect::back()->with('success', $successMsg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes a given component.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Models\Component $component
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function deleteComponentAction(Component $component)
|
||||
{
|
||||
$component->delete();
|
||||
|
||||
return Redirect::back();
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes a given component group.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Models\ComponentGroup $group
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function deleteComponentGroupAction(ComponentGroup $group)
|
||||
{
|
||||
$group->components->map(function ($component) {
|
||||
$component->update([
|
||||
'group_id' => 0,
|
||||
]);
|
||||
});
|
||||
|
||||
$group->delete();
|
||||
|
||||
return Redirect::back();
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the add component group view.
|
||||
*
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function showAddComponentGroup()
|
||||
{
|
||||
return View::make('dashboard.components.groups.add')->with([
|
||||
'page_title' => trans('dashboard.components.groups.add.title').' - '.trans('dashboard.dashboard'),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the edit component group view.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Models\ComponentGroup $group
|
||||
*
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function showEditComponentGroup(ComponentGroup $group)
|
||||
{
|
||||
return View::make('dashboard.components.groups.edit')->with([
|
||||
'page_title' => trans('dashboard.components.groups.edit.title').' - '.trans('dashboard.dashboard'),
|
||||
'group' => $group,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new component.
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function postAddComponentGroup()
|
||||
{
|
||||
$group = ComponentGroup::create(Binput::get('group'));
|
||||
|
||||
if (!$group->isValid()) {
|
||||
return Redirect::back()->withInput(Binput::all())
|
||||
->with('title', sprintf(
|
||||
'%s %s',
|
||||
trans('dashboard.notifications.whoops'),
|
||||
trans('dashboard.components.groups.add.failure')
|
||||
))
|
||||
->with('errors', $group->getErrors());
|
||||
}
|
||||
|
||||
$successMsg = sprintf(
|
||||
'%s %s',
|
||||
trans('dashboard.notifications.awesome'),
|
||||
trans('dashboard.components.groups.add.success')
|
||||
);
|
||||
|
||||
return Redirect::back()->with('success', $successMsg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates a component group.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Models\ComponentGroup $group
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function updateComponentGroupAction(ComponentGroup $group)
|
||||
{
|
||||
$groupData = Binput::get('group');
|
||||
$group->update($groupData);
|
||||
|
||||
if (!$group->isValid()) {
|
||||
return Redirect::back()->withInput(Binput::all())
|
||||
->with('title', sprintf(
|
||||
'%s %s',
|
||||
trans('dashboard.notifications.whoops'),
|
||||
trans('dashboard.components.groups.edit.failure')
|
||||
))
|
||||
->with('errors', $group->getErrors());
|
||||
}
|
||||
|
||||
$successMsg = sprintf(
|
||||
'%s %s',
|
||||
trans('dashboard.notifications.awesome'),
|
||||
trans('dashboard.components.groups.edit.success')
|
||||
);
|
||||
|
||||
return Redirect::back()->with('success', $successMsg);
|
||||
}
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
<?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\Http\Controllers\Admin;
|
||||
|
||||
use CachetHQ\Cachet\Http\Controllers\AbstractController;
|
||||
use CachetHQ\Cachet\Models\Component;
|
||||
use Illuminate\Support\Facades\View;
|
||||
|
||||
class DashboardController extends AbstractController
|
||||
{
|
||||
/**
|
||||
* Shows the dashboard view.
|
||||
*
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function showDashboard()
|
||||
{
|
||||
$components = Component::orderBy('order')->get();
|
||||
|
||||
return View::make('dashboard.index')->with([
|
||||
'components' => $components,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the notifications view.
|
||||
*
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function showNotifications()
|
||||
{
|
||||
return View::make('dashboard.notifications.index')->with([
|
||||
'page_title' => trans('dashboard.notifications.notifications').' '.trans('dashboard.dashboard'),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -1,327 +0,0 @@
|
||||
<?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\Http\Controllers\Admin;
|
||||
|
||||
use CachetHQ\Cachet\Events\IncidentHasReportedEvent;
|
||||
use CachetHQ\Cachet\Facades\Setting;
|
||||
use CachetHQ\Cachet\Http\Controllers\AbstractController;
|
||||
use CachetHQ\Cachet\Models\Component;
|
||||
use CachetHQ\Cachet\Models\ComponentGroup;
|
||||
use CachetHQ\Cachet\Models\Incident;
|
||||
use CachetHQ\Cachet\Models\IncidentTemplate;
|
||||
use GrahamCampbell\Binput\Facades\Binput;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
use Illuminate\Support\Facades\Redirect;
|
||||
use Illuminate\Support\Facades\View;
|
||||
use Jenssegers\Date\Date;
|
||||
|
||||
class IncidentController extends AbstractController
|
||||
{
|
||||
/**
|
||||
* Stores the sub-sidebar tree list.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $subMenu = [];
|
||||
|
||||
/**
|
||||
* Creates a new DashIncidentController instance.
|
||||
*
|
||||
* @return \CachetHQ\Cachet\Http\Controllers\DashScheduleController
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->subMenu = [
|
||||
'incidents' => [
|
||||
'title' => trans('dashboard.incidents.incidents'),
|
||||
'url' => route('dashboard.incidents'),
|
||||
'icon' => 'ion-android-checkmark-circle',
|
||||
'active' => true,
|
||||
],
|
||||
'schedule' => [
|
||||
'title' => trans('dashboard.schedule.schedule'),
|
||||
'url' => route('dashboard.schedule'),
|
||||
'icon' => 'ion-android-calendar',
|
||||
'active' => false,
|
||||
],
|
||||
];
|
||||
|
||||
View::share('sub_menu', $this->subMenu);
|
||||
View::share('sub_title', trans('dashboard.incidents.title'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the incidents view.
|
||||
*
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function showIncidents()
|
||||
{
|
||||
$incidents = Incident::notScheduled()->orderBy('created_at', 'desc')->get();
|
||||
|
||||
return View::make('dashboard.incidents.index')->with([
|
||||
'page_title' => trans('dashboard.incidents.incidents').' - '.trans('dashboard.dashboard'),
|
||||
'incidents' => $incidents,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the add incident view.
|
||||
*
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function showAddIncident()
|
||||
{
|
||||
$componentsInGroups = ComponentGroup::with('components')->get();
|
||||
$componentsOutGroups = Component::where('group_id', 0)->get();
|
||||
|
||||
return View::make('dashboard.incidents.add')->with([
|
||||
'page_title' => trans('dashboard.incidents.add.title').' - '.trans('dashboard.dashboard'),
|
||||
'componentsInGroups' => $componentsInGroups,
|
||||
'componentsOutGroups' => $componentsOutGroups,
|
||||
'incidentTemplates' => IncidentTemplate::all(),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the incident templates.
|
||||
*
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function showTemplates()
|
||||
{
|
||||
return View::make('dashboard.incidents.templates.index')->with([
|
||||
'page_title' => trans('dashboard.incidents.templates.title').' - '.trans('dashboard.dashboard'),
|
||||
'incidentTemplates' => IncidentTemplate::all(),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new incident.
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function createIncidentAction()
|
||||
{
|
||||
$incidentData = Binput::get('incident');
|
||||
$componentStatus = array_pull($incidentData, 'component_status');
|
||||
|
||||
if (array_has($incidentData, 'created_at') && $incidentData['created_at']) {
|
||||
$incidentDate = Date::createFromFormat('d/m/Y H:i', $incidentData['created_at'], Setting::get('app_timezone'))->setTimezone(Config::get('app.timezone'));
|
||||
$incidentData['created_at'] = $incidentDate;
|
||||
$incidentData['updated_at'] = $incidentDate;
|
||||
} else {
|
||||
unset($incidentData['created_at']);
|
||||
}
|
||||
|
||||
$incident = Incident::create($incidentData);
|
||||
|
||||
if (!$incident->isValid()) {
|
||||
return Redirect::back()->withInput(Binput::all())
|
||||
->with('title', sprintf(
|
||||
'%s %s',
|
||||
trans('dashboard.notifications.whoops'),
|
||||
trans('dashboard.incidents.add.failure')
|
||||
))
|
||||
->with('errors', $incident->getErrors());
|
||||
}
|
||||
|
||||
// Update the component.
|
||||
if (isset($incidentData['component_id']) && (int) $incidentData['component_id'] > 0) {
|
||||
Component::find($incidentData['component_id'])->update([
|
||||
'status' => $componentStatus,
|
||||
]);
|
||||
}
|
||||
|
||||
$successMsg = sprintf(
|
||||
'%s %s',
|
||||
trans('dashboard.notifications.awesome'),
|
||||
trans('dashboard.incidents.add.success')
|
||||
);
|
||||
|
||||
$isEnabled = (bool) Setting::get('enable_subscribers', false);
|
||||
$mailAddress = env('MAIL_ADDRESS', false);
|
||||
$mailFrom = env('MAIL_NAME', false);
|
||||
$subscribersEnabled = $isEnabled && $mailAddress && $mailFrom;
|
||||
|
||||
if (array_get($incidentData, 'notify') && $subscribersEnabled) {
|
||||
event(new IncidentHasReportedEvent($incident));
|
||||
}
|
||||
|
||||
return Redirect::back()->with('success', $successMsg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the add incident template view.
|
||||
*
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function showAddIncidentTemplate()
|
||||
{
|
||||
return View::make('dashboard.incidents.templates.add')->with([
|
||||
'page_title' => trans('dashboard.incidents.templates.add.title').' - '.trans('dashboard.dashboard'),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the edit incident template view.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Models\IncidentTemplate $template
|
||||
*
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function showEditTemplateAction(IncidentTemplate $template)
|
||||
{
|
||||
return View::make('dashboard.incidents.templates.edit')->with([
|
||||
'page_title' => trans('dashboard.incidents.templates.edit.title').' - '.trans('dashboard.dashboard'),
|
||||
'template' => $template,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes an incident template.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Models\IncidentTemplate $template
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function deleteTemplateAction(IncidentTemplate $template)
|
||||
{
|
||||
$template->delete();
|
||||
|
||||
return Redirect::back();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new incident template.
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function createIncidentTemplateAction()
|
||||
{
|
||||
$_template = Binput::get('template');
|
||||
$template = IncidentTemplate::create($_template);
|
||||
|
||||
if (!$template->isValid()) {
|
||||
return Redirect::back()->withInput(Binput::all())
|
||||
->with('title', sprintf(
|
||||
'%s %s',
|
||||
trans('dashboard.notifications.awesome'),
|
||||
trans('dashboard.incidents.templates.add.failure')
|
||||
))
|
||||
->with('errors', $template->getErrors());
|
||||
}
|
||||
|
||||
$successMsg = sprintf(
|
||||
'%s %s',
|
||||
trans('dashboard.notifications.awesome'),
|
||||
trans('dashboard.incidents.templates.add.success')
|
||||
);
|
||||
|
||||
return Redirect::back()->with('success', $successMsg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes a given incident.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Models\Incident $incident
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function deleteIncidentAction(Incident $incident)
|
||||
{
|
||||
$incident->delete();
|
||||
|
||||
return Redirect::back();
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the edit incident view.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Models\Incident $incident
|
||||
*
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function showEditIncidentAction(Incident $incident)
|
||||
{
|
||||
$componentsInGroups = ComponentGroup::with('components')->get();
|
||||
$componentsOutGroups = Component::where('group_id', 0)->get();
|
||||
|
||||
return View::make('dashboard.incidents.edit')->with([
|
||||
'page_title' => trans('dashboard.incidents.edit.title').' - '.trans('dashboard.dashboard'),
|
||||
'incident' => $incident,
|
||||
'componentsInGroups' => $componentsInGroups,
|
||||
'componentsOutGroups' => $componentsOutGroups,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit an incident.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Models\Incident $incident
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function editIncidentAction(Incident $incident)
|
||||
{
|
||||
$incidentData = Binput::get('incident');
|
||||
|
||||
if (array_has($incidentData, 'created_at') && $incidentData['created_at']) {
|
||||
$incidentDate = Date::createFromFormat('d/m/Y H:i', $incidentData['created_at'], Setting::get('app_timezone'))->setTimezone(Config::get('app.timezone'));
|
||||
$incidentData['created_at'] = $incidentDate;
|
||||
$incidentData['updated_at'] = $incidentDate;
|
||||
} else {
|
||||
unset($incidentData['created_at']);
|
||||
}
|
||||
|
||||
$incident->update($incidentData);
|
||||
|
||||
if (!$incident->isValid()) {
|
||||
return Redirect::back()->withInput(Binput::all())
|
||||
->with('title', sprintf(
|
||||
'%s %s',
|
||||
trans('dashboard.notifications.awesome'),
|
||||
trans('dashboard.incidents.templates.edit.failure')
|
||||
))
|
||||
->with('errors', $incident->getErrors());
|
||||
}
|
||||
|
||||
$componentStatus = array_pull($incidentData, 'component_status');
|
||||
if ($incident->component) {
|
||||
$incident->component->update([
|
||||
'status' => $componentStatus,
|
||||
]);
|
||||
}
|
||||
|
||||
$successMsg = sprintf(
|
||||
'%s %s',
|
||||
trans('dashboard.notifications.awesome'),
|
||||
trans('dashboard.incidents.edit.success')
|
||||
);
|
||||
|
||||
return Redirect::to('dashboard/incidents')->with('success', $successMsg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit an incident template.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Models\IncidentTemplate $template
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function editTemplateAction(IncidentTemplate $template)
|
||||
{
|
||||
$template->update(Binput::get('template'));
|
||||
|
||||
return Redirect::back()->with('updatedTemplate', $template);
|
||||
}
|
||||
}
|
||||
@@ -1,192 +0,0 @@
|
||||
<?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\Http\Controllers\Admin;
|
||||
|
||||
use CachetHQ\Cachet\Http\Controllers\AbstractController;
|
||||
use CachetHQ\Cachet\Models\Metric;
|
||||
use CachetHQ\Cachet\Models\MetricPoint;
|
||||
use GrahamCampbell\Binput\Facades\Binput;
|
||||
use Illuminate\Support\Facades\Redirect;
|
||||
use Illuminate\Support\Facades\View;
|
||||
|
||||
class MetricController extends AbstractController
|
||||
{
|
||||
/**
|
||||
* Shows the metrics view.
|
||||
*
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function showMetrics()
|
||||
{
|
||||
$metrics = Metric::orderBy('created_at', 'desc')->get();
|
||||
|
||||
return View::make('dashboard.metrics.index')->with([
|
||||
'page_title' => trans('dashboard.metrics.metrics').' - '.trans('dashboard.dashboard'),
|
||||
'metrics' => $metrics,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the add metric view.
|
||||
*
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function showAddMetric()
|
||||
{
|
||||
return View::make('dashboard.metrics.add')->with([
|
||||
'page_title' => trans('dashboard.metrics.add.title').' - '.trans('dashboard.dashboard'),
|
||||
'metricMetricPoints' => MetricPoint::all(),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the metric points.
|
||||
*
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function showMetricPoints()
|
||||
{
|
||||
return View::make('dashboard.metrics.points.index')->with([
|
||||
'page_title' => trans('dashboard.metrics.points.title').' - '.trans('dashboard.dashboard'),
|
||||
'metricMetricPoints' => MetricPoint::all(),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new metric.
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function createMetricAction()
|
||||
{
|
||||
$metricData = Binput::get('metric');
|
||||
$metric = Metric::create($metricData);
|
||||
|
||||
if (!$metric->isValid()) {
|
||||
return Redirect::back()->withInput(Binput::all())
|
||||
->with('title', sprintf(
|
||||
'%s %s',
|
||||
trans('dashboard.notifications.whoops'),
|
||||
trans('dashboard.metrics.add.failure')
|
||||
))
|
||||
->with('errors', $metric->getErrors());
|
||||
}
|
||||
|
||||
$successMsg = sprintf(
|
||||
'%s %s',
|
||||
trans('dashboard.notifications.awesome'),
|
||||
trans('dashboard.metrics.add.success')
|
||||
);
|
||||
|
||||
return Redirect::back()->with('success', $successMsg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the add metric point view.
|
||||
*
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function showAddMetricPoint()
|
||||
{
|
||||
return View::make('dashboard.metrics.points.add')->with([
|
||||
'page_title' => trans('dashboard.metrics.points.add.title').' - '.trans('dashboard.dashboard'),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new metric point.
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function createMetricPointAction()
|
||||
{
|
||||
$_point = Binput::get('point', null, false);
|
||||
$point = MetricPoint::create($_point);
|
||||
|
||||
if (!$point->isValid()) {
|
||||
return Redirect::back()->withInput(Binput::all())
|
||||
->with('title', sprintf(
|
||||
'%s %s',
|
||||
trans('dashboard.notifications.awesome'),
|
||||
trans('dashboard.metrics.points.add.failure')
|
||||
))
|
||||
->with('errors', $point->getErrors());
|
||||
}
|
||||
|
||||
$successMsg = sprintf(
|
||||
'%s %s',
|
||||
trans('dashboard.notifications.awesome'),
|
||||
trans('dashboard.metrics.points.add.success')
|
||||
);
|
||||
|
||||
return Redirect::back()->with('success', $successMsg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes a given metric.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Models\Metric $metric
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function deleteMetricAction(Metric $metric)
|
||||
{
|
||||
$metric->delete();
|
||||
|
||||
return Redirect::back();
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the edit metric view.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Models\Metric $metric
|
||||
*
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function showEditMetricAction(Metric $metric)
|
||||
{
|
||||
return View::make('dashboard.metrics.edit')->with([
|
||||
'page_title' => trans('dashboard.metrics.edit.title').' - '.trans('dashboard.dashboard'),
|
||||
'metric' => $metric,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit an metric.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Models\Metric $metric
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function editMetricAction(Metric $metric)
|
||||
{
|
||||
$metricData = Binput::get('metric', null, false);
|
||||
$metric->update($metricData);
|
||||
|
||||
if (!$metric->isValid()) {
|
||||
return Redirect::back()->withInput(Binput::all())
|
||||
->with('title', sprintf(
|
||||
'<strong>%s</strong>',
|
||||
trans('dashboard.notifications.awesome')
|
||||
))
|
||||
->with('errors', $metric->getErrors());
|
||||
}
|
||||
|
||||
$successMsg = sprintf(
|
||||
'%s %s',
|
||||
trans('dashboard.notifications.awesome'),
|
||||
trans('dashboard.metrics.edit.success')
|
||||
);
|
||||
|
||||
return Redirect::to('dashboard/metrics')->with('success', $successMsg);
|
||||
}
|
||||
}
|
||||
@@ -1,104 +0,0 @@
|
||||
<?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\Http\Controllers\Admin;
|
||||
|
||||
use CachetHQ\Cachet\Events\CustomerHasSubscribedEvent;
|
||||
use CachetHQ\Cachet\Http\Controllers\AbstractController;
|
||||
use CachetHQ\Cachet\Models\Subscriber;
|
||||
use GrahamCampbell\Binput\Facades\Binput;
|
||||
use Illuminate\Support\Facades\Redirect;
|
||||
use Illuminate\Support\Facades\View;
|
||||
|
||||
class SubscriberController extends AbstractController
|
||||
{
|
||||
/**
|
||||
* Shows the subscribers view.
|
||||
*
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function showSubscribers()
|
||||
{
|
||||
$subscribers = Subscriber::all();
|
||||
|
||||
return View::make('dashboard.subscribers.index')
|
||||
->with([
|
||||
'page_title' => trans('dashboard.subscribers.subscribers').' - '.trans('dashboard.dashboard'),
|
||||
'subscribers' => $subscribers,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the add subscriber view.
|
||||
*
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function showAddSubscriber()
|
||||
{
|
||||
return View::make('dashboard.subscribers.add')
|
||||
->with([
|
||||
'page_title' => trans('dashboard.subscribers.add.title').' - '.trans('dashboard.dashboard'),
|
||||
'incidentTemplates' => Subscriber::all(),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new subscriber.
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function createSubscriberAction()
|
||||
{
|
||||
$email = Binput::get('email');
|
||||
|
||||
$subscriber = Subscriber::create([
|
||||
'email' => $email,
|
||||
]);
|
||||
|
||||
if (!$subscriber->isValid()) {
|
||||
return Redirect::back()
|
||||
->withInput(Binput::all())
|
||||
->with('title', sprintf(
|
||||
'%s %s',
|
||||
trans('dashboard.notifications.whoops'),
|
||||
trans('dashboard.subscribers.add.failure')
|
||||
))
|
||||
->with('errors', $subscriber->getErrors());
|
||||
}
|
||||
|
||||
$successMsg = sprintf(
|
||||
'%s %s',
|
||||
trans('dashboard.notifications.awesome'),
|
||||
trans('dashboard.subscribers.add.success')
|
||||
);
|
||||
|
||||
event(new CustomerHasSubscribedEvent($subscriber));
|
||||
|
||||
return Redirect::back()
|
||||
->with('success', $successMsg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes a subscriber.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Models\Subscriber $subscriber
|
||||
*
|
||||
* @throws \Exception
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function deleteSubscriberAction(Subscriber $subscriber)
|
||||
{
|
||||
$subscriber->delete();
|
||||
|
||||
return Redirect::back();
|
||||
}
|
||||
}
|
||||
@@ -1,127 +0,0 @@
|
||||
<?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\Http\Controllers\Admin;
|
||||
|
||||
use CachetHQ\Cachet\Http\Controllers\AbstractController;
|
||||
use CachetHQ\Cachet\Models\User;
|
||||
use GrahamCampbell\Binput\Facades\Binput;
|
||||
use Illuminate\Support\Facades\Redirect;
|
||||
use Illuminate\Support\Facades\View;
|
||||
|
||||
class TeamController extends AbstractController
|
||||
{
|
||||
/**
|
||||
* Shows the team members view.
|
||||
*
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function showTeamView()
|
||||
{
|
||||
$team = User::all();
|
||||
|
||||
return View::make('dashboard.team.index')->with([
|
||||
'page_title' => trans('dashboard.team.team').' - '.trans('dashboard.dashboard'),
|
||||
'teamMembers' => $team,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the edit team member view.
|
||||
*
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function showTeamMemberView(User $user)
|
||||
{
|
||||
return View::make('dashboard.team.edit')->with([
|
||||
'page_title' => trans('dashboard.team.edit.title').' - '.trans('dashboard.dashboard'),
|
||||
'user' => $user,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the add team member view.
|
||||
*
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function showAddTeamMemberView()
|
||||
{
|
||||
return View::make('dashboard.team.add')->with([
|
||||
'page_title' => trans('dashboard.team.add.title').' - '.trans('dashboard.dashboard'),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new team member.
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function postAddUser()
|
||||
{
|
||||
$user = User::create(Binput::all());
|
||||
|
||||
if (!$user->isValid()) {
|
||||
return Redirect::back()->withInput(Binput::except('password'))
|
||||
->with('title', sprintf(
|
||||
'%s %s',
|
||||
trans('dashboard.notifications.whoops'),
|
||||
trans('dashboard.team.add.failure')
|
||||
))
|
||||
->with('errors', $user->getErrors());
|
||||
}
|
||||
|
||||
$successMsg = sprintf(
|
||||
'%s %s',
|
||||
trans('dashboard.notifications.awesome'),
|
||||
trans('dashboard.team.add.success')
|
||||
);
|
||||
|
||||
return Redirect::back()->with('success', $successMsg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates a user.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Models\User $user
|
||||
*
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function postUpdateUser(User $user)
|
||||
{
|
||||
$items = Binput::all();
|
||||
|
||||
$passwordChange = array_get($items, 'password');
|
||||
|
||||
if (trim($passwordChange) === '') {
|
||||
unset($items['password']);
|
||||
}
|
||||
|
||||
$user->update($items);
|
||||
|
||||
if (!$user->isValid()) {
|
||||
return Redirect::back()->withInput(Binput::except('password'))
|
||||
->with('title', sprintf(
|
||||
'%s %s',
|
||||
trans('dashboard.notifications.whoops'),
|
||||
trans('dashboard.team.edit.failure')
|
||||
))
|
||||
->with('errors', $user->getErrors());
|
||||
}
|
||||
|
||||
$successMsg = sprintf(
|
||||
'%s %s',
|
||||
trans('dashboard.notifications.awesome'),
|
||||
trans('dashboard.team.edit.success')
|
||||
);
|
||||
|
||||
return Redirect::back()->with('success', $successMsg);
|
||||
}
|
||||
}
|
||||
@@ -1,93 +0,0 @@
|
||||
<?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\Http\Controllers\Admin;
|
||||
|
||||
use CachetHQ\Cachet\Http\Controllers\AbstractController;
|
||||
use CachetHQ\Cachet\Models\User;
|
||||
use GrahamCampbell\Binput\Facades\Binput;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Redirect;
|
||||
use Illuminate\Support\Facades\View;
|
||||
use PragmaRX\Google2FA\Vendor\Laravel\Facade as Google2FA;
|
||||
|
||||
class UserController extends AbstractController
|
||||
{
|
||||
/**
|
||||
* Shows the user view.
|
||||
*
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function showUser()
|
||||
{
|
||||
return View::make('dashboard.user.index')->with([
|
||||
'page_title' => trans('dashboard.team.profile').' - '.trans('dashboard.dashboard'),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the current user.
|
||||
*
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function postUser()
|
||||
{
|
||||
$items = Binput::all();
|
||||
|
||||
$passwordChange = array_get($items, 'password');
|
||||
$enable2FA = (bool) array_pull($items, 'google2fa');
|
||||
|
||||
// Let's enable/disable auth
|
||||
if ($enable2FA && !Auth::user()->hasTwoFactor) {
|
||||
$items['google_2fa_secret'] = Google2FA::generateSecretKey();
|
||||
} elseif (!$enable2FA) {
|
||||
$items['google_2fa_secret'] = '';
|
||||
}
|
||||
|
||||
if (trim($passwordChange) === '') {
|
||||
unset($items['password']);
|
||||
}
|
||||
|
||||
$user = Auth::user();
|
||||
$user->update($items);
|
||||
|
||||
if (!$user->isValid()) {
|
||||
return Redirect::back()->withInput(Binput::except('password'))
|
||||
->with('title', sprintf(
|
||||
'%s %s',
|
||||
trans('dashboard.notifications.whoops'),
|
||||
trans('dashboard.team.edit.failure')
|
||||
))
|
||||
->with('errors', $user->getErrors());
|
||||
}
|
||||
|
||||
$successMsg = sprintf(
|
||||
'%s %s',
|
||||
trans('dashboard.notifications.awesome'),
|
||||
trans('dashboard.team.edit.success')
|
||||
);
|
||||
|
||||
return Redirect::back()->with('success', $successMsg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Regenerates the users API key.
|
||||
*
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function regenerateApiKey(User $user)
|
||||
{
|
||||
$user->api_key = User::generateApiKey();
|
||||
$user->save();
|
||||
|
||||
return Redirect::back();
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user