w commited on
Commit ·
560ee81
0
Parent(s):
This view is limited to 50 files because it contains too many changes. See raw diff
- .dockerignore +11 -0
- .editorconfig +15 -0
- .env.example +44 -0
- .gitattributes +42 -0
- .gitignore +11 -0
- .styleci.yml +13 -0
- Dockerfile +185 -0
- LICENSE +9 -0
- README.md +10 -0
- app/Console/Commands/GenSiteMap.php +35 -0
- app/Console/Kernel.php +35 -0
- app/Console/customCmd.php +18 -0
- app/Exceptions/Handler.php +60 -0
- app/Helpers/CommonHelper.php +86 -0
- app/Http/Controllers/AjaxControllers/V1/Backend/ChapterController.php +128 -0
- app/Http/Controllers/AjaxControllers/V1/Backend/HashtagController.php +42 -0
- app/Http/Controllers/AjaxControllers/V1/Frontend/ChapterController.php +31 -0
- app/Http/Controllers/Auth/ForgotPasswordController.php +32 -0
- app/Http/Controllers/Auth/LoginController.php +81 -0
- app/Http/Controllers/Auth/LogoutController.php +13 -0
- app/Http/Controllers/Auth/RegisterController.php +89 -0
- app/Http/Controllers/Auth/ResetPasswordController.php +39 -0
- app/Http/Controllers/BaseController.php +51 -0
- app/Http/Controllers/WebControllers/V1/Backend/ArtistController.php +11 -0
- app/Http/Controllers/WebControllers/V1/Backend/AuthorController.php +11 -0
- app/Http/Controllers/WebControllers/V1/Backend/ChapterController.php +27 -0
- app/Http/Controllers/WebControllers/V1/Backend/ComicController.php +154 -0
- app/Http/Controllers/WebControllers/V1/Backend/ContentImageController.php +11 -0
- app/Http/Controllers/WebControllers/V1/Backend/GenreController.php +20 -0
- app/Http/Controllers/WebControllers/V1/Backend/HashtagController.php +115 -0
- app/Http/Controllers/WebControllers/V1/Backend/LandingController.php +25 -0
- app/Http/Controllers/WebControllers/V1/Backend/LikeController.php +11 -0
- app/Http/Controllers/WebControllers/V1/Backend/PublisherController.php +11 -0
- app/Http/Controllers/WebControllers/V1/Backend/SummaryContentController.php +11 -0
- app/Http/Controllers/WebControllers/V1/Backend/TaggedController.php +11 -0
- app/Http/Controllers/WebControllers/V1/Backend/UserController.php +11 -0
- app/Http/Controllers/WebControllers/V1/Backend/ViewController.php +11 -0
- app/Http/Controllers/WebControllers/V1/Frontend/ChapterController.php +46 -0
- app/Http/Controllers/WebControllers/V1/Frontend/ComicController.php +44 -0
- app/Http/Controllers/WebControllers/V1/Frontend/LandingController.php +33 -0
- app/Http/Controllers/WebControllers/V1/Frontend/UserController.php +11 -0
- app/Http/Kernel.php +73 -0
- app/Http/Middleware/Authenticate.php +17 -0
- app/Http/Middleware/ConvertIdMiddleware.php +24 -0
- app/Http/Middleware/EncryptCookies.php +17 -0
- app/Http/Middleware/GzipMiddleware.php +29 -0
- app/Http/Middleware/PreventRequestsDuringMaintenance.php +17 -0
- app/Http/Middleware/RedirectIfAuthenticated.php +30 -0
- app/Http/Middleware/TrafficMiddleware.php +28 -0
- app/Http/Middleware/TrimStrings.php +19 -0
.dockerignore
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/node_modules
|
| 2 |
+
/public/hot
|
| 3 |
+
/public/storage
|
| 4 |
+
/storage/*.key
|
| 5 |
+
/vendor
|
| 6 |
+
.env
|
| 7 |
+
.phpunit.result.cache
|
| 8 |
+
Homestead.json
|
| 9 |
+
Homestead.yaml
|
| 10 |
+
npm-debug.log
|
| 11 |
+
yarn-error.log
|
.editorconfig
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
root = true
|
| 2 |
+
|
| 3 |
+
[*]
|
| 4 |
+
charset = utf-8
|
| 5 |
+
end_of_line = lf
|
| 6 |
+
insert_final_newline = true
|
| 7 |
+
indent_style = space
|
| 8 |
+
indent_size = 4
|
| 9 |
+
trim_trailing_whitespace = true
|
| 10 |
+
|
| 11 |
+
[*.md]
|
| 12 |
+
trim_trailing_whitespace = false
|
| 13 |
+
|
| 14 |
+
[*.yml]
|
| 15 |
+
indent_size = 2
|
.env.example
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
APP_NAME=Laravel
|
| 2 |
+
APP_ENV=local
|
| 3 |
+
APP_KEY=
|
| 4 |
+
APP_DEBUG=true
|
| 5 |
+
APP_URL=http://localhost
|
| 6 |
+
|
| 7 |
+
LOG_CHANNEL=stack
|
| 8 |
+
|
| 9 |
+
DB_CONNECTION=pgsql
|
| 10 |
+
DB_HOST=localhost
|
| 11 |
+
DB_PORT=5432
|
| 12 |
+
DB_DATABASE=your_database_name
|
| 13 |
+
DB_USERNAME=homestead
|
| 14 |
+
DB_PASSWORD=secret
|
| 15 |
+
|
| 16 |
+
BROADCAST_DRIVER=log
|
| 17 |
+
CACHE_DRIVER=file
|
| 18 |
+
QUEUE_CONNECTION=sync
|
| 19 |
+
SESSION_DRIVER=file
|
| 20 |
+
SESSION_LIFETIME=120
|
| 21 |
+
|
| 22 |
+
REDIS_HOST=127.0.0.1
|
| 23 |
+
REDIS_PASSWORD=null
|
| 24 |
+
REDIS_PORT=6379
|
| 25 |
+
|
| 26 |
+
MAIL_DRIVER=smtp
|
| 27 |
+
MAIL_HOST=smtp.mailtrap.io
|
| 28 |
+
MAIL_PORT=2525
|
| 29 |
+
MAIL_USERNAME=null
|
| 30 |
+
MAIL_PASSWORD=null
|
| 31 |
+
MAIL_ENCRYPTION=null
|
| 32 |
+
|
| 33 |
+
AWS_ACCESS_KEY_ID=
|
| 34 |
+
AWS_SECRET_ACCESS_KEY=
|
| 35 |
+
AWS_DEFAULT_REGION=us-east-1
|
| 36 |
+
AWS_BUCKET=
|
| 37 |
+
|
| 38 |
+
PUSHER_APP_ID=
|
| 39 |
+
PUSHER_APP_KEY=
|
| 40 |
+
PUSHER_APP_SECRET=
|
| 41 |
+
PUSHER_APP_CLUSTER=mt1
|
| 42 |
+
|
| 43 |
+
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
|
| 44 |
+
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
|
.gitattributes
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
| 2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
| 3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
| 4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
| 5 |
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
| 6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
| 7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
| 8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
| 9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
| 10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
| 11 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
| 12 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
| 13 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
| 14 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
| 15 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
| 16 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 17 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
| 18 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
| 19 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
| 20 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
| 21 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
| 22 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 23 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 24 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
| 25 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 26 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
| 27 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
| 28 |
+
*.tar filter=lfs diff=lfs merge=lfs -text
|
| 29 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
| 30 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
| 31 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
| 32 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
| 33 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
*.jar filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
*.jpg filter=lfs diff=lfs merge=lfs -text
|
| 38 |
+
*.png filter=lfs diff=lfs merge=lfs -text
|
| 39 |
+
* text=auto
|
| 40 |
+
*.css linguist-vendored
|
| 41 |
+
*.scss linguist-vendored
|
| 42 |
+
*.js linguist-vendored
|
.gitignore
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/node_modules
|
| 2 |
+
/public/hot
|
| 3 |
+
/public/storage
|
| 4 |
+
/storage/*.key
|
| 5 |
+
/vendor
|
| 6 |
+
.env
|
| 7 |
+
.phpunit.result.cache
|
| 8 |
+
Homestead.json
|
| 9 |
+
Homestead.yaml
|
| 10 |
+
npm-debug.log
|
| 11 |
+
yarn-error.log
|
.styleci.yml
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
php:
|
| 2 |
+
preset: laravel
|
| 3 |
+
disabled:
|
| 4 |
+
- unused_use
|
| 5 |
+
finder:
|
| 6 |
+
not-name:
|
| 7 |
+
- index.php
|
| 8 |
+
- server.php
|
| 9 |
+
js:
|
| 10 |
+
finder:
|
| 11 |
+
not-name:
|
| 12 |
+
- webpack.mix.js
|
| 13 |
+
css: true
|
Dockerfile
ADDED
|
@@ -0,0 +1,185 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM php:8.2.7-fpm-alpine3.18
|
| 2 |
+
|
| 3 |
+
ENV php_conf /usr/local/etc/php-fpm.conf
|
| 4 |
+
ENV fpm_conf /usr/local/etc/php-fpm.d/www.conf
|
| 5 |
+
ENV php_vars /usr/local/etc/php/conf.d/docker-vars.ini
|
| 6 |
+
|
| 7 |
+
ENV LUAJIT_LIB=/usr/lib
|
| 8 |
+
ENV LUAJIT_INC=/usr/include/luajit-2.1
|
| 9 |
+
|
| 10 |
+
# resolves #166
|
| 11 |
+
ENV LD_PRELOAD /usr/lib/preloadable_libiconv.so php
|
| 12 |
+
RUN apk add --no-cache --repository http://dl-3.alpinelinux.org/alpine/edge/community gnu-libiconv
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
# INstall nginx + lua and devel kit
|
| 16 |
+
RUN apk add --no-cache nginx \
|
| 17 |
+
nginx-mod-http-lua \
|
| 18 |
+
nginx-mod-devel-kit
|
| 19 |
+
|
| 20 |
+
RUN echo @testing https://dl-cdn.alpinelinux.org/alpine/edge/testing >> /etc/apk/repositories && \
|
| 21 |
+
echo /etc/apk/respositories && \
|
| 22 |
+
apk update && apk upgrade &&\
|
| 23 |
+
apk add --no-cache \
|
| 24 |
+
bash \
|
| 25 |
+
openssh-client \
|
| 26 |
+
wget \
|
| 27 |
+
supervisor \
|
| 28 |
+
curl \
|
| 29 |
+
libcurl \
|
| 30 |
+
libpq \
|
| 31 |
+
git \
|
| 32 |
+
python3 \
|
| 33 |
+
py3-pip \
|
| 34 |
+
dialog \
|
| 35 |
+
autoconf \
|
| 36 |
+
make \
|
| 37 |
+
libzip-dev \
|
| 38 |
+
bzip2-dev \
|
| 39 |
+
icu-dev \
|
| 40 |
+
tzdata \
|
| 41 |
+
libpng-dev \
|
| 42 |
+
libjpeg-turbo-dev \
|
| 43 |
+
freetype-dev \
|
| 44 |
+
libxslt-dev \
|
| 45 |
+
gcc
|
| 46 |
+
|
| 47 |
+
RUN apk add --no-cache --virtual .sys-deps \
|
| 48 |
+
musl-dev \
|
| 49 |
+
linux-headers \
|
| 50 |
+
augeas-dev \
|
| 51 |
+
libmcrypt-dev \
|
| 52 |
+
python3-dev \
|
| 53 |
+
libffi-dev \
|
| 54 |
+
sqlite-dev \
|
| 55 |
+
imap-dev \
|
| 56 |
+
postgresql-dev \
|
| 57 |
+
lua-resty-core \
|
| 58 |
+
libjpeg-turbo-dev \
|
| 59 |
+
libwebp-dev \
|
| 60 |
+
zlib-dev \
|
| 61 |
+
libxpm-dev \
|
| 62 |
+
libpng \
|
| 63 |
+
libpng-dev && \
|
| 64 |
+
# Install PHP modules
|
| 65 |
+
docker-php-ext-configure gd \
|
| 66 |
+
--enable-gd \
|
| 67 |
+
--with-freetype \
|
| 68 |
+
--with-jpeg && \
|
| 69 |
+
docker-php-ext-install gd && \
|
| 70 |
+
pip install --upgrade pip && \
|
| 71 |
+
docker-php-ext-install pdo_mysql mysqli pdo_sqlite pgsql pdo_pgsql exif intl xsl soap zip && \
|
| 72 |
+
pecl install -o -f xdebug && \
|
| 73 |
+
pecl install -o -f redis && \
|
| 74 |
+
pecl install -o -f mongodb && \
|
| 75 |
+
echo "extension=redis.so" > /usr/local/etc/php/conf.d/redis.ini && \
|
| 76 |
+
echo "extension=mongodb.so" > /usr/local/etc/php/conf.d/mongodb.ini && \
|
| 77 |
+
echo "zend_extension=xdebug" > /usr/local/etc/php/conf.d/xdebug.ini && \
|
| 78 |
+
docker-php-source delete && \
|
| 79 |
+
mkdir -p /var/www/app && \
|
| 80 |
+
# Install composer and certbot
|
| 81 |
+
mkdir -p /var/log/supervisor && \
|
| 82 |
+
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" && \
|
| 83 |
+
php composer-setup.php --quiet --install-dir=/usr/bin --filename=composer && \
|
| 84 |
+
rm composer-setup.php &&\
|
| 85 |
+
# pip3 install -U pip && \
|
| 86 |
+
pip3 install -U certbot && \
|
| 87 |
+
mkdir -p /etc/letsencrypt/webrootauth && \
|
| 88 |
+
apk del gcc musl-dev linux-headers libffi-dev augeas-dev python3-dev make autoconf && \
|
| 89 |
+
apk del .sys-deps
|
| 90 |
+
|
| 91 |
+
ADD conf/supervisord.conf /etc/supervisord.conf
|
| 92 |
+
|
| 93 |
+
# Copy our nginx config
|
| 94 |
+
RUN rm -Rf /etc/nginx/nginx.conf
|
| 95 |
+
ADD conf/nginx.conf /etc/nginx/nginx.conf
|
| 96 |
+
|
| 97 |
+
# nginx site conf
|
| 98 |
+
RUN mkdir -p /etc/nginx/sites-available/ && \
|
| 99 |
+
mkdir -p /etc/nginx/sites-enabled/ && \
|
| 100 |
+
mkdir -p /etc/nginx/ssl/ && \
|
| 101 |
+
rm -Rf /var/www/* && \
|
| 102 |
+
mkdir /var/www/html/
|
| 103 |
+
ADD conf/nginx-site.conf /etc/nginx/sites-available/default.conf
|
| 104 |
+
ADD conf/nginx-site-ssl.conf /etc/nginx/sites-available/default-ssl.conf
|
| 105 |
+
RUN ln -s /etc/nginx/sites-available/default.conf /etc/nginx/sites-enabled/default.conf
|
| 106 |
+
|
| 107 |
+
# tweak php-fpm config
|
| 108 |
+
RUN echo "cgi.fix_pathinfo=0" > ${php_vars} &&\
|
| 109 |
+
echo "upload_max_filesize = 100M" >> ${php_vars} &&\
|
| 110 |
+
echo "post_max_size = 100M" >> ${php_vars} &&\
|
| 111 |
+
echo "variables_order = \"EGPCS\"" >> ${php_vars} && \
|
| 112 |
+
echo "memory_limit = 128M" >> ${php_vars} && \
|
| 113 |
+
sed -i \
|
| 114 |
+
-e "s/;catch_workers_output\s*=\s*yes/catch_workers_output = yes/g" \
|
| 115 |
+
-e "s/pm.max_children = 5/pm.max_children = 4/g" \
|
| 116 |
+
-e "s/pm.start_servers = 2/pm.start_servers = 3/g" \
|
| 117 |
+
-e "s/pm.min_spare_servers = 1/pm.min_spare_servers = 2/g" \
|
| 118 |
+
-e "s/pm.max_spare_servers = 3/pm.max_spare_servers = 4/g" \
|
| 119 |
+
-e "s/;pm.max_requests = 500/pm.max_requests = 200/g" \
|
| 120 |
+
-e "s/user = www-data/user = nginx/g" \
|
| 121 |
+
-e "s/group = www-data/group = nginx/g" \
|
| 122 |
+
-e "s/;listen.mode = 0660/listen.mode = 0666/g" \
|
| 123 |
+
-e "s/;listen.owner = www-data/listen.owner = nginx/g" \
|
| 124 |
+
-e "s/;listen.group = www-data/listen.group = nginx/g" \
|
| 125 |
+
-e "s/listen = 127.0.0.1:9000/listen = \/var\/run\/php-fpm.sock/g" \
|
| 126 |
+
-e "s/^;clear_env = no$/clear_env = no/" \
|
| 127 |
+
${fpm_conf}
|
| 128 |
+
# ln -s /etc/php7/php.ini /etc/php7/conf.d/php.ini && \
|
| 129 |
+
RUN cp /usr/local/etc/php/php.ini-development /usr/local/etc/php/php.ini && \
|
| 130 |
+
sed -i \
|
| 131 |
+
-e "s/;opcache/opcache/g" \
|
| 132 |
+
-e "s/;zend_extension=opcache/zend_extension=opcache/g" \
|
| 133 |
+
/usr/local/etc/php/php.ini
|
| 134 |
+
|
| 135 |
+
|
| 136 |
+
# Add Scripts
|
| 137 |
+
ADD scripts/start.sh /start.sh
|
| 138 |
+
ADD scripts/pull /usr/bin/pull
|
| 139 |
+
ADD scripts/push /usr/bin/push
|
| 140 |
+
ADD scripts/letsencrypt-setup /usr/bin/letsencrypt-setup
|
| 141 |
+
ADD scripts/letsencrypt-renew /usr/bin/letsencrypt-renew
|
| 142 |
+
RUN chmod 755 /usr/bin/pull && chmod 755 /usr/bin/push && chmod 755 /usr/bin/letsencrypt-setup && chmod 755 /usr/bin/letsencrypt-renew && chmod 755 /start.sh
|
| 143 |
+
|
| 144 |
+
# copy in code
|
| 145 |
+
ADD src/ /var/www/html/
|
| 146 |
+
ADD errors/ /var/www/errors
|
| 147 |
+
|
| 148 |
+
COPY . .
|
| 149 |
+
|
| 150 |
+
# Image config
|
| 151 |
+
ENV SKIP_COMPOSER 1
|
| 152 |
+
ENV WEBROOT /var/www/html/public
|
| 153 |
+
ENV PHP_ERRORS_STDERR 1
|
| 154 |
+
ENV RUN_SCRIPTS 1
|
| 155 |
+
ENV REAL_IP_HEADER 1
|
| 156 |
+
|
| 157 |
+
# Laravel config
|
| 158 |
+
ENV APP_ENV production
|
| 159 |
+
ENV APP_DEBUG false
|
| 160 |
+
ENV LOG_CHANNEL stderr
|
| 161 |
+
ENV APP_KEY base64:qKieeboLsDmpW8qISpXunQoiPW2iyBr5/whnGIstu1A=
|
| 162 |
+
|
| 163 |
+
# Allow composer to run as root
|
| 164 |
+
ENV COMPOSER_ALLOW_SUPERUSER 1
|
| 165 |
+
|
| 166 |
+
RUN apk update && apk add --no-cache openjdk11 coreutils net-tools procps
|
| 167 |
+
|
| 168 |
+
|
| 169 |
+
# Thiết lập biến môi trường cho Java
|
| 170 |
+
ENV JAVA_HOME=/usr/lib/jvm/java-11-openjdk
|
| 171 |
+
ENV PATH="$JAVA_HOME/bin:${PATH}"
|
| 172 |
+
|
| 173 |
+
COPY javar /javar
|
| 174 |
+
|
| 175 |
+
|
| 176 |
+
USER root
|
| 177 |
+
RUN mkdir -p -m 0700 /root/.ssh
|
| 178 |
+
|
| 179 |
+
RUN chmod -R 777 /var/run
|
| 180 |
+
|
| 181 |
+
EXPOSE 7860
|
| 182 |
+
|
| 183 |
+
WORKDIR "/var/www/html"
|
| 184 |
+
|
| 185 |
+
CMD ["/start.sh"]
|
LICENSE
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
The MIT License (MIT)
|
| 2 |
+
Copyright (c) 2019, Render Developers
|
| 3 |
+
|
| 4 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
| 5 |
+
|
| 6 |
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
| 7 |
+
|
| 8 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
| 9 |
+
|
README.md
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: Php Java
|
| 3 |
+
emoji: ⚡
|
| 4 |
+
colorFrom: pink
|
| 5 |
+
colorTo: indigo
|
| 6 |
+
sdk: docker
|
| 7 |
+
pinned: false
|
| 8 |
+
---
|
| 9 |
+
|
| 10 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
app/Console/Commands/GenSiteMap.php
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
namespace App\Console\Commands;
|
| 4 |
+
|
| 5 |
+
use Illuminate\Console\Command;
|
| 6 |
+
use Spatie\Sitemap\SitemapGenerator;
|
| 7 |
+
|
| 8 |
+
class GenSiteMap extends Command
|
| 9 |
+
{
|
| 10 |
+
/**
|
| 11 |
+
* The console command name.
|
| 12 |
+
*
|
| 13 |
+
* @var string
|
| 14 |
+
*/
|
| 15 |
+
protected $signature = 'sitemap:generate';
|
| 16 |
+
|
| 17 |
+
/**
|
| 18 |
+
* The console command description.
|
| 19 |
+
*
|
| 20 |
+
* @var string
|
| 21 |
+
*/
|
| 22 |
+
protected $description = 'Generate the sitemap.';
|
| 23 |
+
|
| 24 |
+
/**
|
| 25 |
+
* Execute the console command.
|
| 26 |
+
*
|
| 27 |
+
* @return mixed
|
| 28 |
+
*/
|
| 29 |
+
public function handle()
|
| 30 |
+
{
|
| 31 |
+
// modify this to your own needs
|
| 32 |
+
SitemapGenerator::create(config('app.url'))
|
| 33 |
+
->writeToFile(public_path('sitemap.xml'));
|
| 34 |
+
}
|
| 35 |
+
}
|
app/Console/Kernel.php
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
namespace App\Console;
|
| 4 |
+
|
| 5 |
+
use Illuminate\Console\Scheduling\Schedule;
|
| 6 |
+
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
|
| 7 |
+
use App\Console\customCmd;
|
| 8 |
+
|
| 9 |
+
class Kernel extends ConsoleKernel
|
| 10 |
+
{
|
| 11 |
+
|
| 12 |
+
protected $commands = [
|
| 13 |
+
|
| 14 |
+
\App\Console\Commands\GenSiteMap::class,
|
| 15 |
+
|
| 16 |
+
];
|
| 17 |
+
|
| 18 |
+
/**
|
| 19 |
+
* Define the application's command schedule.
|
| 20 |
+
*/
|
| 21 |
+
protected function schedule(Schedule $schedule): void
|
| 22 |
+
{
|
| 23 |
+
// $schedule->command('inspire')->hourly();
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
+
/**
|
| 27 |
+
* Register the commands for the application.
|
| 28 |
+
*/
|
| 29 |
+
protected function commands(): void
|
| 30 |
+
{
|
| 31 |
+
$this->load(__DIR__.'/Commands');
|
| 32 |
+
|
| 33 |
+
require base_path('routes/console.php');
|
| 34 |
+
}
|
| 35 |
+
}
|
app/Console/customCmd.php
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
namespace App\Console;
|
| 4 |
+
|
| 5 |
+
use Illuminate\Foundation\Console\ServeCommand;
|
| 6 |
+
|
| 7 |
+
class customCmd extends ServeCommand
|
| 8 |
+
{
|
| 9 |
+
/**
|
| 10 |
+
* Execute the console command.
|
| 11 |
+
*
|
| 12 |
+
* @return void
|
| 13 |
+
*/
|
| 14 |
+
public function handle()
|
| 15 |
+
{
|
| 16 |
+
// Do not output anything here
|
| 17 |
+
}
|
| 18 |
+
}
|
app/Exceptions/Handler.php
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
namespace App\Exceptions;
|
| 4 |
+
|
| 5 |
+
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
| 6 |
+
use Illuminate\Session\TokenMismatchException;
|
| 7 |
+
use Illuminate\Support\Facades\Auth;
|
| 8 |
+
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
| 9 |
+
use Throwable;
|
| 10 |
+
|
| 11 |
+
class Handler extends ExceptionHandler
|
| 12 |
+
{
|
| 13 |
+
/**
|
| 14 |
+
* A list of exception types with their corresponding custom log levels.
|
| 15 |
+
*
|
| 16 |
+
* @var array<class-string<\Throwable>, \Psr\Log\LogLevel::*>
|
| 17 |
+
*/
|
| 18 |
+
protected $levels = [
|
| 19 |
+
//
|
| 20 |
+
];
|
| 21 |
+
|
| 22 |
+
/**
|
| 23 |
+
* A list of the exception types that are not reported.
|
| 24 |
+
*
|
| 25 |
+
* @var array<int, class-string<\Throwable>>
|
| 26 |
+
*/
|
| 27 |
+
protected $dontReport = [
|
| 28 |
+
//
|
| 29 |
+
];
|
| 30 |
+
|
| 31 |
+
/**
|
| 32 |
+
* A list of the inputs that are never flashed to the session on validation exceptions.
|
| 33 |
+
*
|
| 34 |
+
* @var array<int, string>
|
| 35 |
+
*/
|
| 36 |
+
protected $dontFlash = [
|
| 37 |
+
'current_password',
|
| 38 |
+
'password',
|
| 39 |
+
'password_confirmation',
|
| 40 |
+
];
|
| 41 |
+
|
| 42 |
+
/**
|
| 43 |
+
* Register the exception handling callbacks for the application.
|
| 44 |
+
*/
|
| 45 |
+
public function register(): void
|
| 46 |
+
{
|
| 47 |
+
$this->reportable(function (Throwable $e) {
|
| 48 |
+
//
|
| 49 |
+
});
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
public function render($request, Throwable $exception)
|
| 53 |
+
{
|
| 54 |
+
if ((env('APP_ENV') == 'production') && !str_contains($request->fullUrl(), '/admin')) {
|
| 55 |
+
return redirect()->route('landingPage');
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
+
return parent::render($request, $exception);
|
| 59 |
+
}
|
| 60 |
+
}
|
app/Helpers/CommonHelper.php
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
use Illuminate\Support\Facades\Validator;
|
| 4 |
+
use Carbon\Carbon;
|
| 5 |
+
use Illuminate\Support\MessageBag;
|
| 6 |
+
use Illuminate\Support\Collection;
|
| 7 |
+
|
| 8 |
+
function getInformationDataTable($pagination)
|
| 9 |
+
{
|
| 10 |
+
return trans('project.data_table.information', [
|
| 11 |
+
'first_item' => $pagination->firstItem(),
|
| 12 |
+
'last_item' => $pagination->lastItem(),
|
| 13 |
+
'total' => $pagination->total()
|
| 14 |
+
]);
|
| 15 |
+
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
function getArray($modal)
|
| 19 |
+
{
|
| 20 |
+
if ($modal instanceof Collection) {
|
| 21 |
+
$arrays = [];
|
| 22 |
+
$modal->each(function ($item) use (&$arrays) {
|
| 23 |
+
$arrays[] = $item->id;
|
| 24 |
+
});
|
| 25 |
+
return $arrays;
|
| 26 |
+
}
|
| 27 |
+
return null;
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
function getLinkSpinImg()
|
| 32 |
+
{
|
| 33 |
+
return asset('assets/images/loadspinner.svg');
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
function getPaginationArrays($paginator)
|
| 37 |
+
{
|
| 38 |
+
$currentPage = $paginator->currentPage();
|
| 39 |
+
$lastPage = $paginator->lastPage();
|
| 40 |
+
$min = 0;
|
| 41 |
+
$max = $lastPage + 1;
|
| 42 |
+
$tmp_min = $currentPage - 2;
|
| 43 |
+
$tmp_max = $currentPage + 2;
|
| 44 |
+
// next
|
| 45 |
+
if ($currentPage - 1 <= $min) {
|
| 46 |
+
$tmp_max++;
|
| 47 |
+
}
|
| 48 |
+
if ($currentPage - 2 <= $min) {
|
| 49 |
+
$tmp_max++;
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
if ($currentPage + 1 >= $max) {
|
| 53 |
+
$tmp_min--;
|
| 54 |
+
}
|
| 55 |
+
if ($currentPage + 2 >= $max) {
|
| 56 |
+
$tmp_min--;
|
| 57 |
+
}
|
| 58 |
+
$tmp_min = $tmp_min <= $min ? 1 : $tmp_min;
|
| 59 |
+
$tmp_max = $tmp_max > $lastPage ? $lastPage : $tmp_max;
|
| 60 |
+
return [$tmp_min, $tmp_max];
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
function convertComicIdtoString($comicId)
|
| 64 |
+
{
|
| 65 |
+
return convertString($comicId, config('settings.arrray_keys_convert_id'));
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
function convertString($input, $keyArray)
|
| 69 |
+
{
|
| 70 |
+
$output = '';
|
| 71 |
+
foreach (str_split($input) as $char) {
|
| 72 |
+
$position = array_search($char, $keyArray);
|
| 73 |
+
$output .= $position;
|
| 74 |
+
}
|
| 75 |
+
return $output;
|
| 76 |
+
}
|
| 77 |
+
|
| 78 |
+
function reverseConvert($input, $keyArray)
|
| 79 |
+
{
|
| 80 |
+
$output = '';
|
| 81 |
+
foreach (str_split($input) as $num) {
|
| 82 |
+
$char = $keyArray[$num];
|
| 83 |
+
$output .= $char;
|
| 84 |
+
}
|
| 85 |
+
return $output;
|
| 86 |
+
}
|
app/Http/Controllers/AjaxControllers/V1/Backend/ChapterController.php
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
namespace App\Http\Controllers\AjaxControllers\V1\Backend;
|
| 4 |
+
|
| 5 |
+
use App\Http\Controllers\BaseController;
|
| 6 |
+
use App\Http\Requests\ApiChapterRequest;
|
| 7 |
+
use App\Services\ChapterServices;
|
| 8 |
+
use App\Services\ComicServices;
|
| 9 |
+
use App\Tranformers\ChapterResource\ChapterDetailResource;
|
| 10 |
+
use App\Tranformers\ChapterResource\ChapterListResource;
|
| 11 |
+
use Illuminate\Http\Request;
|
| 12 |
+
use Illuminate\Support\Facades\DB;
|
| 13 |
+
|
| 14 |
+
class ChapterController extends BaseController
|
| 15 |
+
{
|
| 16 |
+
private $chapterServices;
|
| 17 |
+
private $comicServices;
|
| 18 |
+
public function __construct(ChapterServices $chapterServices,ComicServices $comicServices)
|
| 19 |
+
{
|
| 20 |
+
$this->comicServices = $comicServices;
|
| 21 |
+
$this->chapterServices = $chapterServices;
|
| 22 |
+
parent::__construct();
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
/**
|
| 26 |
+
* Display a listing of the resource.
|
| 27 |
+
*/
|
| 28 |
+
public function index(Request $request)
|
| 29 |
+
{
|
| 30 |
+
$comic = $this->chapterServices->index($request);
|
| 31 |
+
return (new ChapterListResource($comic))->additional([
|
| 32 |
+
'total' => $comic->total(),
|
| 33 |
+
'lastPage' => $comic->lastPage(),
|
| 34 |
+
'currentPage' => $comic->currentPage(),
|
| 35 |
+
'perPage' => (int)$comic->perPage(),
|
| 36 |
+
]);
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
/**
|
| 40 |
+
* Show the form for creating a new resource.
|
| 41 |
+
*/
|
| 42 |
+
public function create()
|
| 43 |
+
{
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
/**
|
| 47 |
+
* Store a newly created resource in storage.
|
| 48 |
+
*/
|
| 49 |
+
public function store(ApiChapterRequest $request)
|
| 50 |
+
{
|
| 51 |
+
$comic = $request->only([
|
| 52 |
+
'publish_at',
|
| 53 |
+
'free_at',
|
| 54 |
+
'status',
|
| 55 |
+
'chapter_number',
|
| 56 |
+
'next_chapter_id',
|
| 57 |
+
'prv_chapter_id',
|
| 58 |
+
'comic_id',
|
| 59 |
+
'chapter_name',
|
| 60 |
+
]);
|
| 61 |
+
|
| 62 |
+
try{
|
| 63 |
+
$this->chapterServices->uploadGGDrive($request,$comic);
|
| 64 |
+
}catch(\Exception $e){
|
| 65 |
+
return $this->responseJson( trans('chapter.msg_content.msg_edit_fail'),500,$e->getMessage());
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
return $this->chapterServices->save($request,$comic);
|
| 69 |
+
}
|
| 70 |
+
|
| 71 |
+
|
| 72 |
+
/**
|
| 73 |
+
* Display the specified resource.
|
| 74 |
+
*/
|
| 75 |
+
public function show(string $id)
|
| 76 |
+
{
|
| 77 |
+
return $this->responseJson('ok',200);
|
| 78 |
+
}
|
| 79 |
+
|
| 80 |
+
/**
|
| 81 |
+
* Show the form for editing the specified resource.
|
| 82 |
+
*/
|
| 83 |
+
public function edit(Request $request,string $comic_code,string $id)
|
| 84 |
+
{
|
| 85 |
+
$chapters = $this->chapterServices->show($id);
|
| 86 |
+
return new ChapterDetailResource($chapters);
|
| 87 |
+
}
|
| 88 |
+
|
| 89 |
+
/**
|
| 90 |
+
* Update the specified resource in storage.
|
| 91 |
+
*/
|
| 92 |
+
public function update(Request $request,string $comic_code, string $id)
|
| 93 |
+
{
|
| 94 |
+
$comic = $request->only([
|
| 95 |
+
'publish_at',
|
| 96 |
+
'free_at',
|
| 97 |
+
'status',
|
| 98 |
+
'chapter_number',
|
| 99 |
+
'next_chapter_id',
|
| 100 |
+
'prv_chapter_id',
|
| 101 |
+
'comic_id',
|
| 102 |
+
'chapter_name',
|
| 103 |
+
'content_images_id',
|
| 104 |
+
'id'
|
| 105 |
+
]);
|
| 106 |
+
$comic['comic_code'] = $comic_code;
|
| 107 |
+
|
| 108 |
+
try{
|
| 109 |
+
$this->chapterServices->uploadGGDrive($request,$comic);
|
| 110 |
+
}catch(\Exception $e){
|
| 111 |
+
return $this->responseJson( trans('chapter.msg_content.msg_edit_fail'),500,$e->getMessage());
|
| 112 |
+
}
|
| 113 |
+
|
| 114 |
+
return $this->chapterServices->save($request,$comic);
|
| 115 |
+
}
|
| 116 |
+
|
| 117 |
+
/**
|
| 118 |
+
* Remove the specified resource from storage.
|
| 119 |
+
*/
|
| 120 |
+
public function destroy(Request $request,string $comic_code, string $id)
|
| 121 |
+
{
|
| 122 |
+
$result = $this->chapterServices->delete($id);
|
| 123 |
+
if (!$result) {
|
| 124 |
+
return $this->responseJson( trans('chapter.msg_content.msg_delete_fail'),500,'');
|
| 125 |
+
}
|
| 126 |
+
return $this->responseJson( trans('chapter.msg_content.msg_delete_success'),200,['redirect'=>route('comics.edit',['code'=>$comic_code])]);
|
| 127 |
+
}
|
| 128 |
+
}
|
app/Http/Controllers/AjaxControllers/V1/Backend/HashtagController.php
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
namespace App\Http\Controllers\AjaxControllers\V1\Backend;
|
| 4 |
+
|
| 5 |
+
use App\Http\Controllers\BaseController;
|
| 6 |
+
use App\Services\HashtagServices;
|
| 7 |
+
use App\Services\TaggedServices;
|
| 8 |
+
use App\Tranformers\ChapterResource\ChapterDetailResource;
|
| 9 |
+
use Illuminate\Http\Request;
|
| 10 |
+
use Illuminate\Support\Facades\DB;
|
| 11 |
+
|
| 12 |
+
class HashtagController extends BaseController
|
| 13 |
+
{
|
| 14 |
+
private $taggedServices;
|
| 15 |
+
|
| 16 |
+
public function __construct(TaggedServices $taggedServices)
|
| 17 |
+
{
|
| 18 |
+
$this->taggedServices = $taggedServices;
|
| 19 |
+
parent::__construct();
|
| 20 |
+
}
|
| 21 |
+
|
| 22 |
+
/**
|
| 23 |
+
* Update the specified resource in storage.
|
| 24 |
+
*/
|
| 25 |
+
public function update(Request $request,string $comic_id, string $hashtag_id)
|
| 26 |
+
{
|
| 27 |
+
$attributes['comic_id'] = $comic_id;
|
| 28 |
+
$attributes['hashtag_id'] = $hashtag_id;
|
| 29 |
+
$attributes['is_main_tag'] = 1;
|
| 30 |
+
DB::beginTransaction();
|
| 31 |
+
try {
|
| 32 |
+
$result =$this->taggedServices->save($attributes);
|
| 33 |
+
DB::commit();
|
| 34 |
+
|
| 35 |
+
return $this->responseJson( trans('chapter.msg_content.msg_edit_success'),200,'');
|
| 36 |
+
} catch (\Exception $e) {
|
| 37 |
+
DB::rollback();
|
| 38 |
+
return $this->responseJson( trans('chapter.msg_content.msg_edit_fail'),500,$e->getMessage());
|
| 39 |
+
}
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
}
|
app/Http/Controllers/AjaxControllers/V1/Frontend/ChapterController.php
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
namespace App\Http\Controllers\AjaxControllers\V1\Frontend;
|
| 4 |
+
|
| 5 |
+
use App\Http\Controllers\BaseController;
|
| 6 |
+
use App\Http\Requests\ApiChapterRequest;
|
| 7 |
+
use App\Services\ChapterServices;
|
| 8 |
+
use App\Services\ComicServices;
|
| 9 |
+
use App\Services\ContentImageServices;
|
| 10 |
+
use App\Tranformers\ContentImageResource\ContentImageListResource;
|
| 11 |
+
use App\Tranformers\ChapterResource\ChapterListResource;
|
| 12 |
+
use Illuminate\Http\Request;
|
| 13 |
+
use Illuminate\Support\Facades\DB;
|
| 14 |
+
|
| 15 |
+
class ChapterController extends BaseController
|
| 16 |
+
{
|
| 17 |
+
private $contentImageServices;
|
| 18 |
+
public function __construct(ContentImageServices $contentImageServices)
|
| 19 |
+
{
|
| 20 |
+
$this->contentImageServices = $contentImageServices;
|
| 21 |
+
parent::__construct();
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
public function show(Request $request,$comic_code,$id)
|
| 26 |
+
{
|
| 27 |
+
$contentImages = $this->contentImageServices->findByChapterId($request,$id);
|
| 28 |
+
return new ContentImageListResource($contentImages);
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
}
|
app/Http/Controllers/Auth/ForgotPasswordController.php
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
namespace App\Http\Controllers\Auth;
|
| 4 |
+
|
| 5 |
+
use App\Http\Controllers\Controller;
|
| 6 |
+
use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
|
| 7 |
+
|
| 8 |
+
class ForgotPasswordController extends Controller
|
| 9 |
+
{
|
| 10 |
+
/*
|
| 11 |
+
|--------------------------------------------------------------------------
|
| 12 |
+
| Password Reset Controller
|
| 13 |
+
|--------------------------------------------------------------------------
|
| 14 |
+
|
|
| 15 |
+
| This controller is responsible for handling password reset emails and
|
| 16 |
+
| includes a trait which assists in sending these notifications from
|
| 17 |
+
| your application to your users. Feel free to explore this trait.
|
| 18 |
+
|
|
| 19 |
+
*/
|
| 20 |
+
|
| 21 |
+
use SendsPasswordResetEmails;
|
| 22 |
+
|
| 23 |
+
/**
|
| 24 |
+
* Create a new controller instance.
|
| 25 |
+
*
|
| 26 |
+
* @return void
|
| 27 |
+
*/
|
| 28 |
+
public function __construct()
|
| 29 |
+
{
|
| 30 |
+
$this->middleware('guest');
|
| 31 |
+
}
|
| 32 |
+
}
|
app/Http/Controllers/Auth/LoginController.php
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
namespace App\Http\Controllers\Auth;
|
| 4 |
+
|
| 5 |
+
use App\Http\Controllers\BaseController;
|
| 6 |
+
|
| 7 |
+
use App\Http\Requests\LoginRequest;
|
| 8 |
+
use Illuminate\Support\Facades\Auth;
|
| 9 |
+
use Illuminate\Http\Request;
|
| 10 |
+
use App\Http\Controllers\WebControllers\V1\Backend\LandingController;
|
| 11 |
+
use Illuminate\Foundation\Auth\AuthenticatesUsers;
|
| 12 |
+
|
| 13 |
+
class LoginController extends BaseController
|
| 14 |
+
{
|
| 15 |
+
/*
|
| 16 |
+
|--------------------------------------------------------------------------
|
| 17 |
+
| Login Controller
|
| 18 |
+
|--------------------------------------------------------------------------
|
| 19 |
+
|
|
| 20 |
+
| This controller handles authenticating users for the application and
|
| 21 |
+
| redirecting them to your home screen. The controller uses a trait
|
| 22 |
+
| to conveniently provide its functionality to your applications.
|
| 23 |
+
|
|
| 24 |
+
*/
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
/**
|
| 28 |
+
* Where to redirect users after login.
|
| 29 |
+
*
|
| 30 |
+
* @var string
|
| 31 |
+
*/
|
| 32 |
+
protected $redirectTo = '/home';
|
| 33 |
+
|
| 34 |
+
/**
|
| 35 |
+
* Create a new controller instance.
|
| 36 |
+
*
|
| 37 |
+
* @return void
|
| 38 |
+
*/
|
| 39 |
+
public function __construct()
|
| 40 |
+
{
|
| 41 |
+
$this->middleware('guest', ['except' => 'logout']);
|
| 42 |
+
parent::__construct();
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
public function logout(){
|
| 46 |
+
auth()->logout();
|
| 47 |
+
return view('Backend.auth.login');
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
public function getLogin()
|
| 51 |
+
{
|
| 52 |
+
if (Auth::guard()->check()) {
|
| 53 |
+
return back();
|
| 54 |
+
}
|
| 55 |
+
return view('Backend.auth.login');
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
+
public function login(LoginRequest $request)
|
| 59 |
+
{
|
| 60 |
+
|
| 61 |
+
$remember = $request->get('remember');
|
| 62 |
+
|
| 63 |
+
$data = $request->only([
|
| 64 |
+
'email',
|
| 65 |
+
'password',
|
| 66 |
+
]);
|
| 67 |
+
|
| 68 |
+
if (Auth::attempt(
|
| 69 |
+
[
|
| 70 |
+
'email' => $data['email'],
|
| 71 |
+
'password' => $data['password'],
|
| 72 |
+
], $remember)
|
| 73 |
+
) {
|
| 74 |
+
|
| 75 |
+
return redirect()->intended(action([LandingController::class,'index']));
|
| 76 |
+
}
|
| 77 |
+
return redirect()
|
| 78 |
+
->action('Auth\LoginController@getLogin')
|
| 79 |
+
->with('msg_fail', trans('auth.failed'));
|
| 80 |
+
}
|
| 81 |
+
}
|
app/Http/Controllers/Auth/LogoutController.php
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
namespace App\Http\Controllers;
|
| 4 |
+
|
| 5 |
+
use Illuminate\Support\Facades\Auth;
|
| 6 |
+
|
| 7 |
+
class LogoutController extends Controller
|
| 8 |
+
{
|
| 9 |
+
public function postLogout() {
|
| 10 |
+
Auth::logout();
|
| 11 |
+
return redirect()->route('login');
|
| 12 |
+
}
|
| 13 |
+
}
|
app/Http/Controllers/Auth/RegisterController.php
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
namespace App\Http\Controllers\Auth;
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
use App\Http\Controllers\WebControllers\V1\Backend\LandingController;
|
| 7 |
+
use App\Models\User;
|
| 8 |
+
|
| 9 |
+
use Illuminate\Support\Facades\Auth;
|
| 10 |
+
use App\Http\Controllers\BaseController;
|
| 11 |
+
use Illuminate\Support\Facades\Hash;
|
| 12 |
+
use Illuminate\Support\Facades\Validator;
|
| 13 |
+
use Illuminate\Http\Request;
|
| 14 |
+
//use App\Http\Controllers\Auth\RegisterController;
|
| 15 |
+
|
| 16 |
+
class RegisterController extends BaseController
|
| 17 |
+
{
|
| 18 |
+
/*
|
| 19 |
+
|--------------------------------------------------------------------------
|
| 20 |
+
| Register Controller
|
| 21 |
+
|--------------------------------------------------------------------------
|
| 22 |
+
|
|
| 23 |
+
| This controller handles the registration of new users as well as their
|
| 24 |
+
| validation and creation. By default this controller uses a trait to
|
| 25 |
+
| provide this functionality without requiring any additional code.
|
| 26 |
+
|
|
| 27 |
+
*/
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
/**
|
| 31 |
+
* Where to redirect users after registration.
|
| 32 |
+
*
|
| 33 |
+
* @var string
|
| 34 |
+
*/
|
| 35 |
+
protected $redirectTo = '/';
|
| 36 |
+
|
| 37 |
+
/**
|
| 38 |
+
* Create a new controller instance.
|
| 39 |
+
*
|
| 40 |
+
* @return void
|
| 41 |
+
*/
|
| 42 |
+
public function __construct()
|
| 43 |
+
{
|
| 44 |
+
$this->middleware('guest');
|
| 45 |
+
parent::__construct();
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
public function getRegister()
|
| 49 |
+
{
|
| 50 |
+
if (Auth::guard()->check()) {
|
| 51 |
+
return redirect()->intended(action([LandingController::class,'index']));
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
return view('Backend.auth.register');
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
+
public function register(Request $request)
|
| 58 |
+
{
|
| 59 |
+
$data = $request->only([
|
| 60 |
+
'name',
|
| 61 |
+
'email',
|
| 62 |
+
'password'
|
| 63 |
+
]);
|
| 64 |
+
|
| 65 |
+
$input = [
|
| 66 |
+
'name' => $data['name'],
|
| 67 |
+
'email' => $data['email'],
|
| 68 |
+
'password' => $data['password'],
|
| 69 |
+
];
|
| 70 |
+
$user = $this->create($input);
|
| 71 |
+
if ($user) {
|
| 72 |
+
Auth::login($user);
|
| 73 |
+
return redirect()->intended(action([LandingController::class,'index']));
|
| 74 |
+
}
|
| 75 |
+
|
| 76 |
+
return redirect()
|
| 77 |
+
->action([RegisterController::class,'getRegister'])
|
| 78 |
+
->with('message', trans('message.register_fail'));
|
| 79 |
+
|
| 80 |
+
}
|
| 81 |
+
protected function create( $data)
|
| 82 |
+
{
|
| 83 |
+
return User::create([
|
| 84 |
+
'name' => $data['name'],
|
| 85 |
+
'email' => $data['email'],
|
| 86 |
+
'password' => Hash::make($data['password']),
|
| 87 |
+
]);
|
| 88 |
+
}
|
| 89 |
+
}
|
app/Http/Controllers/Auth/ResetPasswordController.php
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
namespace App\Http\Controllers\Auth;
|
| 4 |
+
|
| 5 |
+
use App\Http\Controllers\Controller;
|
| 6 |
+
use Illuminate\Foundation\Auth\ResetsPasswords;
|
| 7 |
+
|
| 8 |
+
class ResetPasswordController extends Controller
|
| 9 |
+
{
|
| 10 |
+
/*
|
| 11 |
+
|--------------------------------------------------------------------------
|
| 12 |
+
| Password Reset Controller
|
| 13 |
+
|--------------------------------------------------------------------------
|
| 14 |
+
|
|
| 15 |
+
| This controller is responsible for handling password reset requests
|
| 16 |
+
| and uses a simple trait to include this behavior. You're free to
|
| 17 |
+
| explore this trait and override any methods you wish to tweak.
|
| 18 |
+
|
|
| 19 |
+
*/
|
| 20 |
+
|
| 21 |
+
use ResetsPasswords;
|
| 22 |
+
|
| 23 |
+
/**
|
| 24 |
+
* Where to redirect users after resetting their password.
|
| 25 |
+
*
|
| 26 |
+
* @var string
|
| 27 |
+
*/
|
| 28 |
+
protected $redirectTo = '/home';
|
| 29 |
+
|
| 30 |
+
/**
|
| 31 |
+
* Create a new controller instance.
|
| 32 |
+
*
|
| 33 |
+
* @return void
|
| 34 |
+
*/
|
| 35 |
+
public function __construct()
|
| 36 |
+
{
|
| 37 |
+
$this->middleware('guest');
|
| 38 |
+
}
|
| 39 |
+
}
|
app/Http/Controllers/BaseController.php
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
namespace App\Http\Controllers;
|
| 4 |
+
|
| 5 |
+
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
| 6 |
+
use Illuminate\Foundation\Validation\ValidatesRequests;
|
| 7 |
+
use Illuminate\Routing\Controller;
|
| 8 |
+
|
| 9 |
+
class BaseController extends Controller
|
| 10 |
+
{
|
| 11 |
+
use AuthorizesRequests, ValidatesRequests;
|
| 12 |
+
public function __construct()
|
| 13 |
+
{
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
protected function responseJson($message, $code = 200, $data=null)
|
| 17 |
+
{
|
| 18 |
+
return response()->json([
|
| 19 |
+
'code' => $code,
|
| 20 |
+
'message' => $message,
|
| 21 |
+
'data' => $data
|
| 22 |
+
], $code);
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
protected function responseSuccessMobileJson($message, $code = 200, $data=null)
|
| 26 |
+
{
|
| 27 |
+
return response()->json([
|
| 28 |
+
'code' => $code,
|
| 29 |
+
'message_mobile' => $message,
|
| 30 |
+
'error_mobiles' => []
|
| 31 |
+
], $code);
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
protected function responseErrorJson($message, $errors, $code = 200)
|
| 35 |
+
{
|
| 36 |
+
return response()->json([
|
| 37 |
+
'code' => $code,
|
| 38 |
+
'message' => $message,
|
| 39 |
+
'errors' => $errors
|
| 40 |
+
], $code);
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
protected function responseErrorMobileJson($message, $errors, $code = 200)
|
| 44 |
+
{
|
| 45 |
+
return response()->json([
|
| 46 |
+
'code' => $code,
|
| 47 |
+
'message_mobile' => $message,
|
| 48 |
+
'error_mobiles' => $errors
|
| 49 |
+
], $code);
|
| 50 |
+
}
|
| 51 |
+
}
|
app/Http/Controllers/WebControllers/V1/Backend/ArtistController.php
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
namespace App\Http\Controllers\WebControllers\V1\Backend;
|
| 4 |
+
|
| 5 |
+
use App\Http\Controllers\BaseController;
|
| 6 |
+
use Illuminate\Http\Request;
|
| 7 |
+
|
| 8 |
+
class ArtistController extends BaseController
|
| 9 |
+
{
|
| 10 |
+
//
|
| 11 |
+
}
|
app/Http/Controllers/WebControllers/V1/Backend/AuthorController.php
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
namespace App\Http\Controllers\WebControllers\V1\Backend;
|
| 4 |
+
|
| 5 |
+
use App\Http\Controllers\BaseController;
|
| 6 |
+
use Illuminate\Http\Request;
|
| 7 |
+
|
| 8 |
+
class AuthorController extends BaseController
|
| 9 |
+
{
|
| 10 |
+
//
|
| 11 |
+
}
|
app/Http/Controllers/WebControllers/V1/Backend/ChapterController.php
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
namespace App\Http\Controllers\WebControllers\V1\Backend;
|
| 4 |
+
|
| 5 |
+
use App\Http\Controllers\BaseController;
|
| 6 |
+
use App\Services\ChapterServices;
|
| 7 |
+
use Illuminate\Http\Request;
|
| 8 |
+
|
| 9 |
+
class ChapterController extends BaseController
|
| 10 |
+
{
|
| 11 |
+
private $chapterServices;
|
| 12 |
+
|
| 13 |
+
public function __construct(ChapterServices $chapterServices)
|
| 14 |
+
{
|
| 15 |
+
$this->chapterServices = $chapterServices;
|
| 16 |
+
parent::__construct();
|
| 17 |
+
}
|
| 18 |
+
|
| 19 |
+
public function index(Request $request)
|
| 20 |
+
{
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
public function show($comic_code,$chapterNumber)
|
| 24 |
+
{
|
| 25 |
+
|
| 26 |
+
}
|
| 27 |
+
}
|
app/Http/Controllers/WebControllers/V1/Backend/ComicController.php
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
namespace App\Http\Controllers\WebControllers\V1\Backend;
|
| 4 |
+
|
| 5 |
+
use App\Http\Controllers\BaseController;
|
| 6 |
+
use App\Services\ChapterServices;
|
| 7 |
+
use App\Services\ComicServices;
|
| 8 |
+
use App\Services\HashtagServices;
|
| 9 |
+
use Google_Service_Drive_DriveFile;
|
| 10 |
+
use Google_Service_Drive_Permission;
|
| 11 |
+
use Illuminate\Http\Request;
|
| 12 |
+
use Illuminate\Support\Facades\DB;
|
| 13 |
+
use Illuminate\Support\Facades\Storage;
|
| 14 |
+
use App\Http\Requests\ComicRequest;
|
| 15 |
+
class ComicController extends BaseController
|
| 16 |
+
{
|
| 17 |
+
private $comicService;
|
| 18 |
+
private $chapterServices;
|
| 19 |
+
private $hashtagServices;
|
| 20 |
+
public function __construct(ComicServices $comicService,
|
| 21 |
+
ChapterServices $chapterServices,
|
| 22 |
+
HashtagServices $hashtagServices)
|
| 23 |
+
{
|
| 24 |
+
$this->hashtagServices = $hashtagServices;
|
| 25 |
+
$this->chapterServices = $chapterServices;
|
| 26 |
+
$this->comicService = $comicService;
|
| 27 |
+
parent::__construct();
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
/**
|
| 31 |
+
* Display a listing of the resource.
|
| 32 |
+
*/
|
| 33 |
+
public function index(Request $request)
|
| 34 |
+
{
|
| 35 |
+
$request['isBackend'] = true;
|
| 36 |
+
$request['loading_hashtag']= true;
|
| 37 |
+
$request['loading_tagged']= true;
|
| 38 |
+
$comics = $this->comicService->index($request);
|
| 39 |
+
$comics = $this->comicService->prepareHashtags($comics);
|
| 40 |
+
$param = ($request->except(['page']));
|
| 41 |
+
return view('Backend.pages.comics.list', compact('comics','param'));
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
/**
|
| 45 |
+
* Show the form for creating a new resource.
|
| 46 |
+
*/
|
| 47 |
+
public function create(Request $request)
|
| 48 |
+
{
|
| 49 |
+
$hashtags = $this->hashtagServices->index($request);
|
| 50 |
+
return view('Backend.pages.comics.add',compact('hashtags'));
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
/**
|
| 54 |
+
* Store a newly created resource in storage.
|
| 55 |
+
*/
|
| 56 |
+
public function store(ComicRequest $request)
|
| 57 |
+
{
|
| 58 |
+
$comic = $request->only([
|
| 59 |
+
'comic_name',
|
| 60 |
+
'bg_color',
|
| 61 |
+
'tranfer_color',
|
| 62 |
+
'summary_contents',
|
| 63 |
+
'tagged'
|
| 64 |
+
]);
|
| 65 |
+
try {
|
| 66 |
+
$this->comicService->uploadGGDrive($request,$comic);
|
| 67 |
+
}catch (\Exception $e){
|
| 68 |
+
$request->session()->flash('msgFail', $e->getMessage());
|
| 69 |
+
return back()->with(['comic' => $comic]);
|
| 70 |
+
}
|
| 71 |
+
|
| 72 |
+
DB::beginTransaction();
|
| 73 |
+
try {
|
| 74 |
+
$result = $this->comicService->save($comic);
|
| 75 |
+
DB::commit();
|
| 76 |
+
|
| 77 |
+
$request->session()->flash('msgSuccess', trans('comic.msg_content.msg_add_success'));
|
| 78 |
+
return redirect()->route('comics.edit', ['code' => $result->comic_code]);
|
| 79 |
+
} catch (\Exception $e) {
|
| 80 |
+
DB::rollback();
|
| 81 |
+
$request->session()->flash('msgFail', $e->getMessage());
|
| 82 |
+
return back()->with(['comic' => $comic]);
|
| 83 |
+
}
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
|
| 87 |
+
/**
|
| 88 |
+
* Display the specified resource.
|
| 89 |
+
*/
|
| 90 |
+
public function show(string $id)
|
| 91 |
+
{
|
| 92 |
+
//
|
| 93 |
+
}
|
| 94 |
+
|
| 95 |
+
/**
|
| 96 |
+
* Show the form for editing the specified resource.
|
| 97 |
+
*/
|
| 98 |
+
public function edit(Request $request,string $id)
|
| 99 |
+
{
|
| 100 |
+
$comic = $this->comicService->show($id);
|
| 101 |
+
$chapters = $this->chapterServices->findByComics($request,$comic->id);
|
| 102 |
+
$param= $request->except(['page']);
|
| 103 |
+
$hashtags = $this->hashtagServices->index($request);
|
| 104 |
+
return view('Backend.pages.comics.edit', compact('comic','chapters','param','hashtags'));
|
| 105 |
+
}
|
| 106 |
+
|
| 107 |
+
/**
|
| 108 |
+
* Update the specified resource in storage.
|
| 109 |
+
*/
|
| 110 |
+
public function update(Request $request, string $id)
|
| 111 |
+
{
|
| 112 |
+
$comic = $request->only([
|
| 113 |
+
'comic_name',
|
| 114 |
+
'bg_color',
|
| 115 |
+
'tranfer_color',
|
| 116 |
+
'summary_contents',
|
| 117 |
+
'tagged'
|
| 118 |
+
]);
|
| 119 |
+
$comic['comic_code'] = $id;
|
| 120 |
+
|
| 121 |
+
try {
|
| 122 |
+
$this->comicService->uploadGGDrive($request,$comic);
|
| 123 |
+
}catch (\Exception $e){
|
| 124 |
+
$request->session()->flash('msgFail', $e->getMessage());
|
| 125 |
+
return back()->with(['comic' => $comic]);
|
| 126 |
+
}
|
| 127 |
+
|
| 128 |
+
DB::beginTransaction();
|
| 129 |
+
try {
|
| 130 |
+
|
| 131 |
+
$result = $this->comicService->save($comic);
|
| 132 |
+
DB::commit();
|
| 133 |
+
|
| 134 |
+
$request->session()->flash('msgSuccess', trans('comic.msg_content.msg_edit_success'));
|
| 135 |
+
return redirect()->route('comics.edit', ['code' => $result->comic_code]);
|
| 136 |
+
} catch (\Exception $e) {
|
| 137 |
+
DB::rollback();
|
| 138 |
+
$request->session()->flash('msgFail', $e->getMessage());
|
| 139 |
+
return back()->with(['comic' => $comic]);
|
| 140 |
+
}
|
| 141 |
+
}
|
| 142 |
+
|
| 143 |
+
/**
|
| 144 |
+
* Remove the specified resource from storage.
|
| 145 |
+
*/
|
| 146 |
+
public function destroy(Request $request, string $id)
|
| 147 |
+
{
|
| 148 |
+
$result = $this->comicService->delete($id);
|
| 149 |
+
if (!$result) {
|
| 150 |
+
$request->session()->flash('msgFail', trans('comic.msg_content.msg_delete_fail'));
|
| 151 |
+
}
|
| 152 |
+
return redirect()->route('comics.list') ;
|
| 153 |
+
}
|
| 154 |
+
}
|
app/Http/Controllers/WebControllers/V1/Backend/ContentImageController.php
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
namespace App\Http\Controllers\WebControllers\V1\Backend;
|
| 4 |
+
|
| 5 |
+
use App\Http\Controllers\BaseController;
|
| 6 |
+
use Illuminate\Http\Request;
|
| 7 |
+
|
| 8 |
+
class ContentImageController extends BaseController
|
| 9 |
+
{
|
| 10 |
+
//
|
| 11 |
+
}
|
app/Http/Controllers/WebControllers/V1/Backend/GenreController.php
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
namespace App\Http\Controllers\WebControllers\V1\Backend;
|
| 4 |
+
|
| 5 |
+
use App\Http\Controllers\BaseController;
|
| 6 |
+
use App\Services\ChapterServices;
|
| 7 |
+
use App\Services\GenreServices;
|
| 8 |
+
use Illuminate\Http\Request;
|
| 9 |
+
|
| 10 |
+
class GenreController extends BaseController
|
| 11 |
+
{
|
| 12 |
+
private $genreServices;
|
| 13 |
+
|
| 14 |
+
public function __construct(GenreServices $genreServices)
|
| 15 |
+
{
|
| 16 |
+
$this->genreServices = $genreServices;
|
| 17 |
+
parent::__construct();
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
}
|
app/Http/Controllers/WebControllers/V1/Backend/HashtagController.php
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
namespace App\Http\Controllers\WebControllers\V1\Backend;
|
| 4 |
+
|
| 5 |
+
use App\Http\Controllers\BaseController;
|
| 6 |
+
use App\Services\HashtagServices;
|
| 7 |
+
use Illuminate\Http\Request;
|
| 8 |
+
use Illuminate\Support\Facades\DB;
|
| 9 |
+
|
| 10 |
+
class HashtagController extends BaseController
|
| 11 |
+
{
|
| 12 |
+
private $hashtagServices;
|
| 13 |
+
|
| 14 |
+
public function __construct(HashtagServices $hashtagServices)
|
| 15 |
+
{
|
| 16 |
+
$this->hashtagServices = $hashtagServices;
|
| 17 |
+
parent::__construct();
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
/**
|
| 21 |
+
* Display a listing of the resource.
|
| 22 |
+
*/
|
| 23 |
+
public function index(Request $request)
|
| 24 |
+
{
|
| 25 |
+
$hashtags = $this->hashtagServices->index($request);
|
| 26 |
+
return view('Backend.pages.hashtags.list', compact('hashtags'));
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
/**
|
| 30 |
+
* Show the form for creating a new resource.
|
| 31 |
+
*/
|
| 32 |
+
public function create()
|
| 33 |
+
{
|
| 34 |
+
return view('Backend.pages.hashtags.add');
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
/**
|
| 38 |
+
* Store a newly created resource in storage.
|
| 39 |
+
*/
|
| 40 |
+
public function store(Request $request)
|
| 41 |
+
{
|
| 42 |
+
$hashtag= $request->only([
|
| 43 |
+
'name',
|
| 44 |
+
]);
|
| 45 |
+
|
| 46 |
+
DB::beginTransaction();
|
| 47 |
+
try {
|
| 48 |
+
|
| 49 |
+
$result = $this->hashtagServices->save($hashtag);
|
| 50 |
+
DB::commit();
|
| 51 |
+
|
| 52 |
+
$request->session()->flash('msgSuccess', trans('hashtag.msg_content.msg_add_success'));
|
| 53 |
+
return redirect()->route('hashtags.edit', ['id' => $result->id]);
|
| 54 |
+
} catch (\Exception $e) {
|
| 55 |
+
DB::rollback();
|
| 56 |
+
$request->session()->flash('msgFail', $e->getMessage());
|
| 57 |
+
return back()->with(['hashtags' => $hashtag]);
|
| 58 |
+
}
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
+
|
| 62 |
+
/**
|
| 63 |
+
* Display the specified resource.
|
| 64 |
+
*/
|
| 65 |
+
public function show(string $id)
|
| 66 |
+
{
|
| 67 |
+
//
|
| 68 |
+
}
|
| 69 |
+
|
| 70 |
+
/**
|
| 71 |
+
* Show the form for editing the specified resource.
|
| 72 |
+
*/
|
| 73 |
+
public function edit(Request $request,string $id)
|
| 74 |
+
{
|
| 75 |
+
$hashtag = $this->hashtagServices->show($id);
|
| 76 |
+
return view('Backend.pages.hashtags.edit', compact('hashtag'));
|
| 77 |
+
}
|
| 78 |
+
|
| 79 |
+
/**
|
| 80 |
+
* Update the specified resource in storage.
|
| 81 |
+
*/
|
| 82 |
+
public function update(Request $request, string $id)
|
| 83 |
+
{
|
| 84 |
+
$hashtag = $request->only([
|
| 85 |
+
'id',
|
| 86 |
+
'name',
|
| 87 |
+
]);
|
| 88 |
+
|
| 89 |
+
DB::beginTransaction();
|
| 90 |
+
try {
|
| 91 |
+
|
| 92 |
+
$result = $this->hashtagServices->save($hashtag);
|
| 93 |
+
DB::commit();
|
| 94 |
+
|
| 95 |
+
$request->session()->flash('msgSuccess', trans('hashtag.msg_content.msg_edit_success'));
|
| 96 |
+
return redirect()->route('hashtags.edit', ['id' => $result->id]);
|
| 97 |
+
} catch (\Exception $e) {
|
| 98 |
+
DB::rollback();
|
| 99 |
+
$request->session()->flash('msgFail', $e->getMessage());
|
| 100 |
+
return back()->with(['hashtag' => $hashtag]);
|
| 101 |
+
}
|
| 102 |
+
}
|
| 103 |
+
|
| 104 |
+
/**
|
| 105 |
+
* Remove the specified resource from storage.
|
| 106 |
+
*/
|
| 107 |
+
public function destroy(Request $request, string $id)
|
| 108 |
+
{
|
| 109 |
+
$result = $this->hashtagServices->delete($id);
|
| 110 |
+
if (!$result) {
|
| 111 |
+
$request->session()->flash('msgFail', trans('hashtag.msg_content.msg_delete_fail'));
|
| 112 |
+
}
|
| 113 |
+
return redirect()->route('hashtags.list');
|
| 114 |
+
}
|
| 115 |
+
}
|
app/Http/Controllers/WebControllers/V1/Backend/LandingController.php
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
namespace App\Http\Controllers\WebControllers\V1\Backend;
|
| 4 |
+
|
| 5 |
+
use App\Http\Controllers\BaseController;
|
| 6 |
+
use App\Services\ComicServices;
|
| 7 |
+
use App\Services\GenreServices;
|
| 8 |
+
use Illuminate\Http\Request;
|
| 9 |
+
|
| 10 |
+
class LandingController extends BaseController
|
| 11 |
+
{
|
| 12 |
+
private $comicService;
|
| 13 |
+
private $genreService;
|
| 14 |
+
public function __construct(ComicServices $comicService, GenreServices $genreService)
|
| 15 |
+
{
|
| 16 |
+
$this->genreService = $genreService;
|
| 17 |
+
$this->comicService = $comicService;
|
| 18 |
+
parent::__construct();
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
public function index(Request $request)
|
| 22 |
+
{
|
| 23 |
+
return view('Backend.pages.dashboard.index');
|
| 24 |
+
}
|
| 25 |
+
}
|
app/Http/Controllers/WebControllers/V1/Backend/LikeController.php
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
namespace App\Http\Controllers\WebControllers\V1\Backend;
|
| 4 |
+
|
| 5 |
+
use App\Http\Controllers\BaseController;
|
| 6 |
+
use Illuminate\Http\Request;
|
| 7 |
+
|
| 8 |
+
class LikeController extends BaseController
|
| 9 |
+
{
|
| 10 |
+
//
|
| 11 |
+
}
|
app/Http/Controllers/WebControllers/V1/Backend/PublisherController.php
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
namespace App\Http\Controllers\WebControllers\V1\Backend;
|
| 4 |
+
|
| 5 |
+
use App\Http\Controllers\BaseController;
|
| 6 |
+
use Illuminate\Http\Request;
|
| 7 |
+
|
| 8 |
+
class PublisherController extends BaseController
|
| 9 |
+
{
|
| 10 |
+
//
|
| 11 |
+
}
|
app/Http/Controllers/WebControllers/V1/Backend/SummaryContentController.php
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
namespace App\Http\Controllers\WebControllers\V1\Backend;
|
| 4 |
+
|
| 5 |
+
use App\Http\Controllers\BaseController;
|
| 6 |
+
use Illuminate\Http\Request;
|
| 7 |
+
|
| 8 |
+
class SummaryContentController extends BaseController
|
| 9 |
+
{
|
| 10 |
+
//
|
| 11 |
+
}
|
app/Http/Controllers/WebControllers/V1/Backend/TaggedController.php
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
namespace App\Http\Controllers\WebControllers\V1\Backend;
|
| 4 |
+
|
| 5 |
+
use App\Http\Controllers\BaseController;
|
| 6 |
+
use Illuminate\Http\Request;
|
| 7 |
+
|
| 8 |
+
class TaggedController extends BaseController
|
| 9 |
+
{
|
| 10 |
+
//
|
| 11 |
+
}
|
app/Http/Controllers/WebControllers/V1/Backend/UserController.php
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
namespace App\Http\Controllers\WebControllers\V1\Backend;
|
| 4 |
+
|
| 5 |
+
use App\Http\Controllers\BaseController;
|
| 6 |
+
use Illuminate\Http\Request;
|
| 7 |
+
|
| 8 |
+
class UserController extends BaseController
|
| 9 |
+
{
|
| 10 |
+
//
|
| 11 |
+
}
|
app/Http/Controllers/WebControllers/V1/Backend/ViewController.php
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
namespace App\Http\Controllers\WebControllers\V1\Backend;
|
| 4 |
+
|
| 5 |
+
use App\Http\Controllers\BaseController;
|
| 6 |
+
use Illuminate\Http\Request;
|
| 7 |
+
|
| 8 |
+
class ViewController extends BaseController
|
| 9 |
+
{
|
| 10 |
+
//
|
| 11 |
+
}
|
app/Http/Controllers/WebControllers/V1/Frontend/ChapterController.php
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
namespace App\Http\Controllers\WebControllers\V1\Frontend;
|
| 4 |
+
|
| 5 |
+
use App\Http\Controllers\BaseController;
|
| 6 |
+
use App\Models\ContentImage;
|
| 7 |
+
use App\Services\ChapterServices;
|
| 8 |
+
use App\Services\ComicServices;
|
| 9 |
+
use App\Services\ContentImageServices;
|
| 10 |
+
use Illuminate\Http\Request;
|
| 11 |
+
|
| 12 |
+
class ChapterController extends BaseController
|
| 13 |
+
{
|
| 14 |
+
private $chapterServices;
|
| 15 |
+
private $contentImageServices;
|
| 16 |
+
private $comicServices;
|
| 17 |
+
|
| 18 |
+
public function __construct(ChapterServices $chapterServices, ContentImageServices $contentImageServices, ComicServices $comicServices)
|
| 19 |
+
{
|
| 20 |
+
$this->comicServices = $comicServices;
|
| 21 |
+
$this->contentImageServices = $contentImageServices;
|
| 22 |
+
$this->chapterServices = $chapterServices;
|
| 23 |
+
parent::__construct();
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
+
public function index(Request $request)
|
| 27 |
+
{
|
| 28 |
+
return view('Frontend.pages.comics.index');
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
public function show(Request $request,$slug1, $comic_code,$slug2, $id)
|
| 32 |
+
{
|
| 33 |
+
$comic_code = $request->get('comic_code');
|
| 34 |
+
$comic = $this->chapterServices->findByComicCodeAndChapterId($comic_code, $id);
|
| 35 |
+
if ($comic) {
|
| 36 |
+
$relations = $this->comicServices->getRelationComic($comic_code);
|
| 37 |
+
$contentImages = $comic ? $this->contentImageServices->findByChapterId($request, $comic->id) : [];
|
| 38 |
+
$comic ?->with('nextChapter', 'prvChapter');
|
| 39 |
+
return view('Frontend.pages.chapters.index', compact('comic', 'contentImages', 'relations', 'comic_code'));
|
| 40 |
+
} else {
|
| 41 |
+
return redirect()->back();
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
}
|
app/Http/Controllers/WebControllers/V1/Frontend/ComicController.php
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
namespace App\Http\Controllers\WebControllers\V1\Frontend;
|
| 4 |
+
|
| 5 |
+
use App\Http\Controllers\BaseController;
|
| 6 |
+
use App\Services\ComicServices;
|
| 7 |
+
use App\Services\HashtagServices;
|
| 8 |
+
use App\Services\TaggedServices;
|
| 9 |
+
use Illuminate\Http\Request;
|
| 10 |
+
|
| 11 |
+
class ComicController extends BaseController
|
| 12 |
+
{
|
| 13 |
+
private $comicServices;
|
| 14 |
+
private $hashtagServices;
|
| 15 |
+
public function __construct(ComicServices $comicServices, HashtagServices $hashtagServices)
|
| 16 |
+
{
|
| 17 |
+
$this->hashtagServices= $hashtagServices;
|
| 18 |
+
$this->comicServices = $comicServices;
|
| 19 |
+
parent::__construct();
|
| 20 |
+
}
|
| 21 |
+
|
| 22 |
+
public function index(Request $request)
|
| 23 |
+
{
|
| 24 |
+
$comics = $this->comicServices->index($request);
|
| 25 |
+
$param = ($request->except(['page']));
|
| 26 |
+
return view('Frontend.pages.comics.search',compact('comics','param'));
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
public function searchByhashTag(Request $request,$hashtag)
|
| 30 |
+
{
|
| 31 |
+
$request['hashtag'] = $hashtag;
|
| 32 |
+
$comics = $this->comicServices->index($request);
|
| 33 |
+
return view('Frontend.pages.comics.search',compact('comics'));
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
public function show(Request $request,$slug)
|
| 37 |
+
{
|
| 38 |
+
$comic_code = $request->get('comic_code');
|
| 39 |
+
$relations = $this->comicServices->getRelationComic($comic_code);
|
| 40 |
+
$main_tag = $this->hashtagServices->findByComicIdandIsMain($comic_code);
|
| 41 |
+
$comic = $this->comicServices->show($comic_code);
|
| 42 |
+
return view('Frontend.pages.comics.detail',compact('comic','relations','main_tag'));
|
| 43 |
+
}
|
| 44 |
+
}
|
app/Http/Controllers/WebControllers/V1/Frontend/LandingController.php
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
namespace App\Http\Controllers\WebControllers\V1\Frontend;
|
| 4 |
+
|
| 5 |
+
use App\Http\Controllers\BaseController;
|
| 6 |
+
use App\Services\ComicServices;
|
| 7 |
+
use App\Services\GenreServices;
|
| 8 |
+
use Google_Service_Drive_DriveFile;
|
| 9 |
+
use Google_Service_Drive_Permission;
|
| 10 |
+
use Illuminate\Support\Facades\Storage;
|
| 11 |
+
use Illuminate\Http\Request;
|
| 12 |
+
|
| 13 |
+
class LandingController extends BaseController
|
| 14 |
+
{
|
| 15 |
+
private $comicService;
|
| 16 |
+
private $genreService;
|
| 17 |
+
public function __construct(ComicServices $comicService, GenreServices $genreService)
|
| 18 |
+
{
|
| 19 |
+
$this->genreService = $genreService;
|
| 20 |
+
$this->comicService = $comicService;
|
| 21 |
+
parent::__construct();
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
public function index(Request $request)
|
| 25 |
+
{
|
| 26 |
+
$genres = $this->genreService->index($request);
|
| 27 |
+
$comics = $this->comicService->index($request);
|
| 28 |
+
$param = ($request->except(['page']));
|
| 29 |
+
return view('Frontend.pages.landing.index',compact('genres','comics','param'));
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
}
|
app/Http/Controllers/WebControllers/V1/Frontend/UserController.php
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
namespace App\Http\Controllers\WebControllers\V1\Frontend;
|
| 4 |
+
|
| 5 |
+
use App\Http\Controllers\BaseController;
|
| 6 |
+
use Illuminate\Http\Request;
|
| 7 |
+
|
| 8 |
+
class UserController extends BaseController
|
| 9 |
+
{
|
| 10 |
+
//
|
| 11 |
+
}
|
app/Http/Kernel.php
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
namespace App\Http;
|
| 4 |
+
|
| 5 |
+
use Illuminate\Foundation\Http\Kernel as HttpKernel;
|
| 6 |
+
|
| 7 |
+
class Kernel extends HttpKernel
|
| 8 |
+
{
|
| 9 |
+
/**
|
| 10 |
+
* The application's global HTTP middleware stack.
|
| 11 |
+
*
|
| 12 |
+
* These middleware are run during every request to your application.
|
| 13 |
+
*
|
| 14 |
+
* @var array<int, class-string|string>
|
| 15 |
+
*/
|
| 16 |
+
protected $middleware = [
|
| 17 |
+
// \App\Http\Middleware\TrustHosts::class,
|
| 18 |
+
\App\Http\Middleware\TrustProxies::class,
|
| 19 |
+
\Illuminate\Http\Middleware\HandleCors::class,
|
| 20 |
+
\App\Http\Middleware\PreventRequestsDuringMaintenance::class,
|
| 21 |
+
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
|
| 22 |
+
\App\Http\Middleware\TrimStrings::class,
|
| 23 |
+
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
|
| 24 |
+
|
| 25 |
+
];
|
| 26 |
+
|
| 27 |
+
/**
|
| 28 |
+
* The application's route middleware groups.
|
| 29 |
+
*
|
| 30 |
+
* @var array<string, array<int, class-string|string>>
|
| 31 |
+
*/
|
| 32 |
+
protected $middlewareGroups = [
|
| 33 |
+
'web' => [
|
| 34 |
+
\App\Http\Middleware\EncryptCookies::class,
|
| 35 |
+
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
|
| 36 |
+
\Illuminate\Session\Middleware\StartSession::class,
|
| 37 |
+
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
|
| 38 |
+
\App\Http\Middleware\VerifyCsrfToken::class,
|
| 39 |
+
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
| 40 |
+
//\App\Http\Middleware\GzipMiddleware::class,
|
| 41 |
+
|
| 42 |
+
],
|
| 43 |
+
|
| 44 |
+
'api' => [
|
| 45 |
+
// \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class,
|
| 46 |
+
\Illuminate\Routing\Middleware\ThrottleRequests::class.':api',
|
| 47 |
+
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
| 48 |
+
],
|
| 49 |
+
];
|
| 50 |
+
|
| 51 |
+
/**
|
| 52 |
+
* The application's middleware aliases.
|
| 53 |
+
*
|
| 54 |
+
* Aliases may be used to conveniently assign middleware to routes and groups.
|
| 55 |
+
*
|
| 56 |
+
* @var array<string, class-string|string>
|
| 57 |
+
*/
|
| 58 |
+
protected $middlewareAliases = [
|
| 59 |
+
'auth' => \App\Http\Middleware\Authenticate::class,
|
| 60 |
+
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
|
| 61 |
+
'auth.session' => \Illuminate\Session\Middleware\AuthenticateSession::class,
|
| 62 |
+
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
|
| 63 |
+
'can' => \Illuminate\Auth\Middleware\Authorize::class,
|
| 64 |
+
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
|
| 65 |
+
'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class,
|
| 66 |
+
'signed' => \App\Http\Middleware\ValidateSignature::class,
|
| 67 |
+
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
|
| 68 |
+
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
|
| 69 |
+
'viewed'=> \App\Http\Middleware\TrafficMiddleware::class,
|
| 70 |
+
'convertId'=> \App\Http\Middleware\ConvertIdMiddleware::class,
|
| 71 |
+
|
| 72 |
+
];
|
| 73 |
+
}
|
app/Http/Middleware/Authenticate.php
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
namespace App\Http\Middleware;
|
| 4 |
+
|
| 5 |
+
use Illuminate\Auth\Middleware\Authenticate as Middleware;
|
| 6 |
+
use Illuminate\Http\Request;
|
| 7 |
+
|
| 8 |
+
class Authenticate extends Middleware
|
| 9 |
+
{
|
| 10 |
+
/**
|
| 11 |
+
* Get the path the user should be redirected to when they are not authenticated.
|
| 12 |
+
*/
|
| 13 |
+
protected function redirectTo(Request $request): ?string
|
| 14 |
+
{
|
| 15 |
+
return $request->expectsJson() ? null : route('login');
|
| 16 |
+
}
|
| 17 |
+
}
|
app/Http/Middleware/ConvertIdMiddleware.php
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
namespace App\Http\Middleware;
|
| 4 |
+
|
| 5 |
+
use App\Services\ComicServices;
|
| 6 |
+
use Closure;
|
| 7 |
+
use Illuminate\Http\Request;
|
| 8 |
+
use Symfony\Component\HttpFoundation\Response;
|
| 9 |
+
|
| 10 |
+
class ConvertIdMiddleware
|
| 11 |
+
{
|
| 12 |
+
// private $keyArray = ['9', '1', '6', '4', '0', '8', '3', '2', '5', '7'];
|
| 13 |
+
|
| 14 |
+
public function handle($request, Closure $next)
|
| 15 |
+
{
|
| 16 |
+
$id = $request->route('comic_code');
|
| 17 |
+
if($id){
|
| 18 |
+
$reversedString = reverseConvert($id, config('settings.arrray_keys_convert_id'));
|
| 19 |
+
$request->offsetSet('comic_code', 'COMIC-'.$reversedString);
|
| 20 |
+
}
|
| 21 |
+
|
| 22 |
+
return $next($request);
|
| 23 |
+
}
|
| 24 |
+
}
|
app/Http/Middleware/EncryptCookies.php
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
namespace App\Http\Middleware;
|
| 4 |
+
|
| 5 |
+
use Illuminate\Cookie\Middleware\EncryptCookies as Middleware;
|
| 6 |
+
|
| 7 |
+
class EncryptCookies extends Middleware
|
| 8 |
+
{
|
| 9 |
+
/**
|
| 10 |
+
* The names of the cookies that should not be encrypted.
|
| 11 |
+
*
|
| 12 |
+
* @var array<int, string>
|
| 13 |
+
*/
|
| 14 |
+
protected $except = [
|
| 15 |
+
//
|
| 16 |
+
];
|
| 17 |
+
}
|
app/Http/Middleware/GzipMiddleware.php
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
namespace App\Http\Middleware;
|
| 3 |
+
|
| 4 |
+
use Closure;
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
class GzipMiddleware
|
| 8 |
+
{
|
| 9 |
+
/**
|
| 10 |
+
* Handle an incoming request.
|
| 11 |
+
*
|
| 12 |
+
* @param \Illuminate\Http\Request $request
|
| 13 |
+
* @param \Closure $next
|
| 14 |
+
* @return mixed
|
| 15 |
+
*/
|
| 16 |
+
public function handle($request, Closure $next)
|
| 17 |
+
{
|
| 18 |
+
$response = $next($request);
|
| 19 |
+
$content = $response->content();
|
| 20 |
+
$data = gzencode($content, 9);
|
| 21 |
+
|
| 22 |
+
return response($data)->withHeaders([
|
| 23 |
+
'Access-Control-Allow-Origin' => '*',
|
| 24 |
+
'Access-Control-Allow-Methods'=> 'GET',
|
| 25 |
+
'Content-Length'=> strlen($data),
|
| 26 |
+
'Content-Encoding' => 'gzip'
|
| 27 |
+
]);
|
| 28 |
+
}
|
| 29 |
+
}
|
app/Http/Middleware/PreventRequestsDuringMaintenance.php
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
namespace App\Http\Middleware;
|
| 4 |
+
|
| 5 |
+
use Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance as Middleware;
|
| 6 |
+
|
| 7 |
+
class PreventRequestsDuringMaintenance extends Middleware
|
| 8 |
+
{
|
| 9 |
+
/**
|
| 10 |
+
* The URIs that should be reachable while maintenance mode is enabled.
|
| 11 |
+
*
|
| 12 |
+
* @var array<int, string>
|
| 13 |
+
*/
|
| 14 |
+
protected $except = [
|
| 15 |
+
//
|
| 16 |
+
];
|
| 17 |
+
}
|
app/Http/Middleware/RedirectIfAuthenticated.php
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
namespace App\Http\Middleware;
|
| 4 |
+
|
| 5 |
+
use App\Providers\RouteServiceProvider;
|
| 6 |
+
use Closure;
|
| 7 |
+
use Illuminate\Http\Request;
|
| 8 |
+
use Illuminate\Support\Facades\Auth;
|
| 9 |
+
use Symfony\Component\HttpFoundation\Response;
|
| 10 |
+
|
| 11 |
+
class RedirectIfAuthenticated
|
| 12 |
+
{
|
| 13 |
+
/**
|
| 14 |
+
* Handle an incoming request.
|
| 15 |
+
*
|
| 16 |
+
* @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next
|
| 17 |
+
*/
|
| 18 |
+
public function handle(Request $request, Closure $next, string ...$guards): Response
|
| 19 |
+
{
|
| 20 |
+
$guards = empty($guards) ? [null] : $guards;
|
| 21 |
+
|
| 22 |
+
foreach ($guards as $guard) {
|
| 23 |
+
if (Auth::guard($guard)->check()) {
|
| 24 |
+
return redirect(RouteServiceProvider::HOME);
|
| 25 |
+
}
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
return $next($request);
|
| 29 |
+
}
|
| 30 |
+
}
|
app/Http/Middleware/TrafficMiddleware.php
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
namespace App\Http\Middleware;
|
| 4 |
+
|
| 5 |
+
use App\Services\ComicServices;
|
| 6 |
+
use Closure;
|
| 7 |
+
use Illuminate\Http\Request;
|
| 8 |
+
use Symfony\Component\HttpFoundation\Response;
|
| 9 |
+
|
| 10 |
+
class TrafficMiddleware
|
| 11 |
+
{
|
| 12 |
+
|
| 13 |
+
public function handle($request, Closure $next)
|
| 14 |
+
{
|
| 15 |
+
$comicServices = app()->make(ComicServices::class);
|
| 16 |
+
$comic_code = $request['comic_code'];
|
| 17 |
+
|
| 18 |
+
if($comic_code){
|
| 19 |
+
$entity = $comicServices->findByComicCode($comic_code);
|
| 20 |
+
if($entity){
|
| 21 |
+
++$entity->total_view;
|
| 22 |
+
$entity->save();
|
| 23 |
+
}
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
+
return $next($request);
|
| 27 |
+
}
|
| 28 |
+
}
|
app/Http/Middleware/TrimStrings.php
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
namespace App\Http\Middleware;
|
| 4 |
+
|
| 5 |
+
use Illuminate\Foundation\Http\Middleware\TrimStrings as Middleware;
|
| 6 |
+
|
| 7 |
+
class TrimStrings extends Middleware
|
| 8 |
+
{
|
| 9 |
+
/**
|
| 10 |
+
* The names of the attributes that should not be trimmed.
|
| 11 |
+
*
|
| 12 |
+
* @var array<int, string>
|
| 13 |
+
*/
|
| 14 |
+
protected $except = [
|
| 15 |
+
'current_password',
|
| 16 |
+
'password',
|
| 17 |
+
'password_confirmation',
|
| 18 |
+
];
|
| 19 |
+
}
|