mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-08-28 23:01:29 +00:00
Use laravel default error pages
This commit is contained in:
@@ -128,51 +128,6 @@ class BasePageController extends Controller
|
|||||||
return view('errors.404');
|
return view('errors.404');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
|
||||||
*/
|
|
||||||
public function show403(): View
|
|
||||||
{
|
|
||||||
return view('errors.403');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
|
||||||
*/
|
|
||||||
public function show503(): View
|
|
||||||
{
|
|
||||||
return view('errors.503')->with('Error', 'Service temporarily unavailable');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
|
||||||
*/
|
|
||||||
public function showBadBoy(): View
|
|
||||||
{
|
|
||||||
return view('errors.badboy')->with('Message', 'This is not you account.');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Show maintenance page.
|
|
||||||
*/
|
|
||||||
public function showMaintenance(): View
|
|
||||||
{
|
|
||||||
return view('errors.maintenance')->with('Message', 'We are performing an site maintenance.');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Show Security token mismatch page.
|
|
||||||
*/
|
|
||||||
public function showTokenError(): View
|
|
||||||
{
|
|
||||||
return view('errors.tokenError')->with('Error', 'Token mismatch');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function show429(string $retry = '')
|
|
||||||
{
|
|
||||||
abort(429, $retry);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function render(): void
|
public function render(): void
|
||||||
{
|
{
|
||||||
$this->smarty->display($this->page_template);
|
$this->smarty->display($this->page_template);
|
||||||
|
|||||||
@@ -283,6 +283,6 @@ class ProfileController extends BasePageController
|
|||||||
return redirect()->to('profile');
|
return redirect()->to('profile');
|
||||||
}
|
}
|
||||||
|
|
||||||
return view('errors.badboy')->with('warning', 'Dont try to delete another user account!');
|
return view('errors.503')->with('warning', 'Dont try to delete another user account!');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,5 @@
|
|||||||
@extends('errors.layout')
|
@extends('errors::minimal')
|
||||||
|
|
||||||
@section('title')
|
@section('title', __('Unauthorized'))
|
||||||
HTTP/1.1 401 Unathorized
|
@section('code', '401')
|
||||||
@endsection
|
@section('message', __('Unauthorized'))
|
||||||
|
|
||||||
@section('content')
|
|
||||||
{{ config('app.name') }} <br><br><br>
|
|
||||||
<b>Acess denied! You're permissions and/or role do not allow you to access this page</b>
|
|
||||||
@endsection
|
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
@extends('errors::minimal')
|
||||||
|
|
||||||
|
@section('title', __('Payment Required'))
|
||||||
|
@section('code', '402')
|
||||||
|
@section('message', __('Payment Required'))
|
||||||
@@ -1,10 +1,5 @@
|
|||||||
@extends('errors.layout')
|
@extends('errors::minimal')
|
||||||
|
|
||||||
@section('title')
|
@section('title', __('Forbidden'))
|
||||||
HTTP/1.1 403 Unathorized
|
@section('code', '403')
|
||||||
@endsection
|
@section('message', __($exception->getMessage() ?: 'Forbidden'))
|
||||||
|
|
||||||
@section('content')
|
|
||||||
{{ config('app.name') }} <br><br><br>
|
|
||||||
<b>You are not logged in!</b> <br>Please <a href='{!! url('/login'); !!}'>login</a>
|
|
||||||
@endsection
|
|
||||||
|
|||||||
Executable → Regular
+4
-8
@@ -1,9 +1,5 @@
|
|||||||
@extends('errors.layout')
|
@extends('errors::minimal')
|
||||||
|
|
||||||
@section('title')
|
@section('title', __('Not Found'))
|
||||||
HTTP/1.1 404 Not Found
|
@section('code', '404')
|
||||||
@endsection
|
@section('message', __('Not Found'))
|
||||||
|
|
||||||
@section('content')
|
|
||||||
We could not find page you are looking for. The page does not exist.
|
|
||||||
@endsection
|
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
@extends('errors::minimal')
|
||||||
|
|
||||||
|
@section('title', __('Page Expired'))
|
||||||
|
@section('code', '419')
|
||||||
|
@section('message', __('Page Expired'))
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
@extends('errors::minimal')
|
||||||
|
|
||||||
|
@section('title', __('Too Many Requests'))
|
||||||
|
@section('code', '429')
|
||||||
|
@section('message', __('Too Many Requests'))
|
||||||
@@ -1,29 +1,5 @@
|
|||||||
@extends('errors.layout')
|
@extends('errors::minimal')
|
||||||
|
|
||||||
@section('content')
|
@section('title', __('Server Error'))
|
||||||
|
@section('code', '500')
|
||||||
<div class="container">
|
@section('message', __('Server Error'))
|
||||||
<div class="row justify-content-center">
|
|
||||||
<div class="col-md-6">
|
|
||||||
<div class="clearfix">
|
|
||||||
<h1 class="float-left display-3 mr-4">500</h1>
|
|
||||||
<h4 class="pt-3">Houston, we have a problem!</h4>
|
|
||||||
<p class="text-muted">The page you are looking for is temporarily unavailable.</p>
|
|
||||||
</div>
|
|
||||||
<div class="input-prepend input-group">
|
|
||||||
<div class="input-group-prepend"><span class="input-group-text">
|
|
||||||
<svg class="c-icon">
|
|
||||||
<use xlink:href="assets/icons/coreui/free-symbol-defs.svg#cui-magnifying-glass"></use>
|
|
||||||
</svg></span></div>
|
|
||||||
<input class="form-control" id="prependedInput" size="16" type="text" placeholder="What are you looking for?"><span class="input-group-append">
|
|
||||||
<button class="btn btn-info" type="button">Search</button></span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
@endsection
|
|
||||||
|
|
||||||
@section('javascript')
|
|
||||||
|
|
||||||
@endsection
|
|
||||||
|
|||||||
Executable → Regular
+4
-14
@@ -1,15 +1,5 @@
|
|||||||
@extends('errors.layout')
|
@extends('errors::minimal')
|
||||||
|
|
||||||
@section('title')
|
@section('title', __('Service Unavailable'))
|
||||||
Be right back.
|
@section('code', '503')
|
||||||
@endsection
|
@section('message', __('Service Unavailable'))
|
||||||
|
|
||||||
@section('content')
|
|
||||||
@if(!empty($exception->getMessage()))
|
|
||||||
{{ $exception->getMessage() }}
|
|
||||||
@elseif(App::isDownForMaintenance() && empty($exception->getMessage()))
|
|
||||||
We are currently performing scheduled maintenance. We will be back shortly.
|
|
||||||
@else
|
|
||||||
Service temporarily unavailable. Please try again later!
|
|
||||||
@endif
|
|
||||||
@endsection
|
|
||||||
|
|||||||
@@ -1,11 +0,0 @@
|
|||||||
@extends('errors.layout')
|
|
||||||
|
|
||||||
@section('title')
|
|
||||||
You bad boy!
|
|
||||||
@endsection
|
|
||||||
|
|
||||||
@section('content')
|
|
||||||
You tried to delete another users account!
|
|
||||||
@endsection
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
@extends('errors.layout')
|
|
||||||
|
|
||||||
@section('title')
|
|
||||||
Too many requests.
|
|
||||||
@endsection
|
|
||||||
|
|
||||||
@section('content')
|
|
||||||
Too many requests, retry after 5 seconds!
|
|
||||||
@endsection
|
|
||||||
Executable → Regular
+35
-29
@@ -1,47 +1,53 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<title>
|
<meta charset="utf-8">
|
||||||
@yield('title')
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
</title>
|
|
||||||
|
|
||||||
<link href="https://fonts.googleapis.com/css?family=Lato:100" rel="stylesheet" type="text/css">
|
<title>@yield('title')</title>
|
||||||
|
|
||||||
|
<!-- Styles -->
|
||||||
<style>
|
<style>
|
||||||
html, body {
|
html, body {
|
||||||
height: 100%;
|
background-color: #fff;
|
||||||
}
|
color: #636b6f;
|
||||||
|
font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
|
||||||
body {
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
width: 100%;
|
|
||||||
color: #B0BEC5;
|
|
||||||
display: table;
|
|
||||||
font-weight: 100;
|
font-weight: 100;
|
||||||
font-family: \'Lato\', sans-serif;
|
height: 100vh;
|
||||||
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.container {
|
.full-height {
|
||||||
text-align: center;
|
height: 100vh;
|
||||||
display: table-cell;
|
}
|
||||||
vertical-align: middle;
|
|
||||||
|
.flex-center {
|
||||||
|
align-items: center;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.position-ref {
|
||||||
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
.content {
|
.content {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
display: inline-block;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.title {
|
.title {
|
||||||
font-size: 72px;
|
font-size: 36px;
|
||||||
margin-bottom: 40px;
|
padding: 20px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="container">
|
<div class="flex-center position-ref full-height">
|
||||||
@yield('content')
|
<div class="content">
|
||||||
</div>
|
<div class="title">
|
||||||
</body>
|
@yield('message')
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
</html>
|
</html>
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
@extends('errors.layout')
|
|
||||||
|
|
||||||
@section('title')
|
|
||||||
Be right back.
|
|
||||||
@endsection
|
|
||||||
|
|
||||||
@section('content')
|
|
||||||
We are currently performing maintenance. Please try again later!
|
|
||||||
@endsection
|
|
||||||
File diff suppressed because one or more lines are too long
@@ -1,9 +0,0 @@
|
|||||||
@extends('errors.layout')
|
|
||||||
|
|
||||||
@section('title')
|
|
||||||
Security token mismatch
|
|
||||||
@endsection
|
|
||||||
|
|
||||||
@section('content')
|
|
||||||
Security token mismatch!
|
|
||||||
@endsection
|
|
||||||
@@ -0,0 +1,518 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
UNAMEOUT="$(uname -s)"
|
||||||
|
|
||||||
|
# Verify operating system is supported...
|
||||||
|
case "${UNAMEOUT}" in
|
||||||
|
Linux*) MACHINE=linux;;
|
||||||
|
Darwin*) MACHINE=mac;;
|
||||||
|
*) MACHINE="UNKNOWN"
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [ "$MACHINE" == "UNKNOWN" ]; then
|
||||||
|
echo "Unsupported operating system [$(uname -s)]. Laravel Sail supports macOS, Linux, and Windows (WSL2)." >&2
|
||||||
|
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Determine if stdout is a terminal...
|
||||||
|
if test -t 1; then
|
||||||
|
# Determine if colors are supported...
|
||||||
|
ncolors=$(tput colors)
|
||||||
|
|
||||||
|
if test -n "$ncolors" && test "$ncolors" -ge 8; then
|
||||||
|
BOLD="$(tput bold)"
|
||||||
|
YELLOW="$(tput setaf 3)"
|
||||||
|
GREEN="$(tput setaf 2)"
|
||||||
|
NC="$(tput sgr0)"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Function that prints the available commands...
|
||||||
|
function display_help {
|
||||||
|
echo "Laravel Sail"
|
||||||
|
echo
|
||||||
|
echo "${YELLOW}Usage:${NC}" >&2
|
||||||
|
echo " sail COMMAND [options] [arguments]"
|
||||||
|
echo
|
||||||
|
echo "Unknown commands are passed to the docker-compose binary."
|
||||||
|
echo
|
||||||
|
echo "${YELLOW}docker-compose Commands:${NC}"
|
||||||
|
echo " ${GREEN}sail up${NC} Start the application"
|
||||||
|
echo " ${GREEN}sail up -d${NC} Start the application in the background"
|
||||||
|
echo " ${GREEN}sail stop${NC} Stop the application"
|
||||||
|
echo " ${GREEN}sail restart${NC} Restart the application"
|
||||||
|
echo " ${GREEN}sail ps${NC} Display the status of all containers"
|
||||||
|
echo
|
||||||
|
echo "${YELLOW}Artisan Commands:${NC}"
|
||||||
|
echo " ${GREEN}sail artisan ...${NC} Run an Artisan command"
|
||||||
|
echo " ${GREEN}sail artisan queue:work${NC}"
|
||||||
|
echo
|
||||||
|
echo "${YELLOW}PHP Commands:${NC}"
|
||||||
|
echo " ${GREEN}sail php ...${NC} Run a snippet of PHP code"
|
||||||
|
echo " ${GREEN}sail php -v${NC}"
|
||||||
|
echo
|
||||||
|
echo "${YELLOW}Composer Commands:${NC}"
|
||||||
|
echo " ${GREEN}sail composer ...${NC} Run a Composer command"
|
||||||
|
echo " ${GREEN}sail composer require laravel/sanctum${NC}"
|
||||||
|
echo
|
||||||
|
echo "${YELLOW}Node Commands:${NC}"
|
||||||
|
echo " ${GREEN}sail node ...${NC} Run a Node command"
|
||||||
|
echo " ${GREEN}sail node --version${NC}"
|
||||||
|
echo
|
||||||
|
echo "${YELLOW}NPM Commands:${NC}"
|
||||||
|
echo " ${GREEN}sail npm ...${NC} Run a npm command"
|
||||||
|
echo " ${GREEN}sail npx${NC} Run a npx command"
|
||||||
|
echo " ${GREEN}sail npm run prod${NC}"
|
||||||
|
echo
|
||||||
|
echo "${YELLOW}Yarn Commands:${NC}"
|
||||||
|
echo " ${GREEN}sail yarn ...${NC} Run a Yarn command"
|
||||||
|
echo " ${GREEN}sail yarn run prod${NC}"
|
||||||
|
echo
|
||||||
|
echo "${YELLOW}Database Commands:${NC}"
|
||||||
|
echo " ${GREEN}sail mysql${NC} Start a MySQL CLI session within the 'mysql' container"
|
||||||
|
echo " ${GREEN}sail mariadb${NC} Start a MySQL CLI session within the 'mariadb' container"
|
||||||
|
echo " ${GREEN}sail psql${NC} Start a PostgreSQL CLI session within the 'pgsql' container"
|
||||||
|
echo " ${GREEN}sail redis${NC} Start a Redis CLI session within the 'redis' container"
|
||||||
|
echo
|
||||||
|
echo "${YELLOW}Debugging:${NC}"
|
||||||
|
echo " ${GREEN}sail debug ...${NC} Run an Artisan command in debug mode"
|
||||||
|
echo " ${GREEN}sail debug queue:work${NC}"
|
||||||
|
echo
|
||||||
|
echo "${YELLOW}Running Tests:${NC}"
|
||||||
|
echo " ${GREEN}sail test${NC} Run the PHPUnit tests via the Artisan test command"
|
||||||
|
echo " ${GREEN}sail phpunit ...${NC} Run PHPUnit"
|
||||||
|
echo " ${GREEN}sail pest ...${NC} Run Pest"
|
||||||
|
echo " ${GREEN}sail pint ...${NC} Run Pint"
|
||||||
|
echo " ${GREEN}sail dusk${NC} Run the Dusk tests (Requires the laravel/dusk package)"
|
||||||
|
echo " ${GREEN}sail dusk:fails${NC} Re-run previously failed Dusk tests (Requires the laravel/dusk package)"
|
||||||
|
echo
|
||||||
|
echo "${YELLOW}Container CLI:${NC}"
|
||||||
|
echo " ${GREEN}sail shell${NC} Start a shell session within the application container"
|
||||||
|
echo " ${GREEN}sail bash${NC} Alias for 'sail shell'"
|
||||||
|
echo " ${GREEN}sail root-shell${NC} Start a root shell session within the application container"
|
||||||
|
echo " ${GREEN}sail root-bash${NC} Alias for 'sail root-shell'"
|
||||||
|
echo " ${GREEN}sail tinker${NC} Start a new Laravel Tinker session"
|
||||||
|
echo
|
||||||
|
echo "${YELLOW}Sharing:${NC}"
|
||||||
|
echo " ${GREEN}sail share${NC} Share the application publicly via a temporary URL"
|
||||||
|
echo " ${GREEN}sail open${NC} Open the site in your browser"
|
||||||
|
echo
|
||||||
|
echo "${YELLOW}Binaries:${NC}"
|
||||||
|
echo " ${GREEN}sail bin ...${NC} Run Composer binary scripts from the vendor/bin directory"
|
||||||
|
echo
|
||||||
|
echo "${YELLOW}Customization:${NC}"
|
||||||
|
echo " ${GREEN}sail artisan sail:publish${NC} Publish the Sail configuration files"
|
||||||
|
echo " ${GREEN}sail build --no-cache${NC} Rebuild all of the Sail containers"
|
||||||
|
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# Proxy the "help" command...
|
||||||
|
if [ $# -gt 0 ]; then
|
||||||
|
if [ "$1" == "help" ] || [ "$1" == "-h" ] || [ "$1" == "-help" ] || [ "$1" == "--help" ]; then
|
||||||
|
display_help
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
display_help
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Source the ".env" file so Laravel's environment variables are available...
|
||||||
|
if [ ! -z "$APP_ENV" ] && [ -f ./.env.$APP_ENV ]; then
|
||||||
|
source ./.env.$APP_ENV;
|
||||||
|
elif [ -f ./.env ]; then
|
||||||
|
source ./.env;
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Define environment variables...
|
||||||
|
export APP_PORT=${APP_PORT:-80}
|
||||||
|
export APP_SERVICE=${APP_SERVICE:-"laravel.test"}
|
||||||
|
export DB_PORT=${DB_PORT:-3306}
|
||||||
|
export WWWUSER=${WWWUSER:-$UID}
|
||||||
|
export WWWGROUP=${WWWGROUP:-$(id -g)}
|
||||||
|
|
||||||
|
export SAIL_FILES=${SAIL_FILES:-""}
|
||||||
|
export SAIL_SHARE_DASHBOARD=${SAIL_SHARE_DASHBOARD:-4040}
|
||||||
|
export SAIL_SHARE_SERVER_HOST=${SAIL_SHARE_SERVER_HOST:-"laravel-sail.site"}
|
||||||
|
export SAIL_SHARE_SERVER_PORT=${SAIL_SHARE_SERVER_PORT:-8080}
|
||||||
|
export SAIL_SHARE_SUBDOMAIN=${SAIL_SHARE_SUBDOMAIN:-""}
|
||||||
|
export SAIL_SHARE_DOMAIN=${SAIL_SHARE_DOMAIN:-"$SAIL_SHARE_SERVER_HOST"}
|
||||||
|
export SAIL_SHARE_SERVER=${SAIL_SHARE_SERVER:-""}
|
||||||
|
|
||||||
|
# Function that outputs Sail is not running...
|
||||||
|
function sail_is_not_running {
|
||||||
|
echo "${BOLD}Sail is not running.${NC}" >&2
|
||||||
|
echo "" >&2
|
||||||
|
echo "${BOLD}You may Sail using the following commands:${NC} './vendor/bin/sail up' or './vendor/bin/sail up -d'" >&2
|
||||||
|
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# Define Docker Compose command prefix...
|
||||||
|
docker compose &> /dev/null
|
||||||
|
if [ $? == 0 ]; then
|
||||||
|
DOCKER_COMPOSE=(docker compose)
|
||||||
|
else
|
||||||
|
DOCKER_COMPOSE=(docker-compose)
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "$SAIL_FILES" ]; then
|
||||||
|
# Convert SAIL_FILES to an array...
|
||||||
|
IFS=':' read -ra SAIL_FILES <<< "$SAIL_FILES"
|
||||||
|
|
||||||
|
for FILE in "${SAIL_FILES[@]}"; do
|
||||||
|
if [ -f "$FILE" ]; then
|
||||||
|
DOCKER_COMPOSE+=(-f "$FILE")
|
||||||
|
else
|
||||||
|
echo "${BOLD}Unable to find Docker Compose file: '${FILE}'${NC}" >&2
|
||||||
|
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
EXEC="yes"
|
||||||
|
|
||||||
|
if [ -z "$SAIL_SKIP_CHECKS" ]; then
|
||||||
|
# Ensure that Docker is running...
|
||||||
|
if ! docker info > /dev/null 2>&1; then
|
||||||
|
echo "${BOLD}Docker is not running.${NC}" >&2
|
||||||
|
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Determine if Sail is currently up...
|
||||||
|
if "${DOCKER_COMPOSE[@]}" ps "$APP_SERVICE" 2>&1 | grep 'Exit\|exited'; then
|
||||||
|
echo "${BOLD}Shutting down old Sail processes...${NC}" >&2
|
||||||
|
|
||||||
|
"${DOCKER_COMPOSE[@]}" down > /dev/null 2>&1
|
||||||
|
|
||||||
|
EXEC="no"
|
||||||
|
elif [ -z "$("${DOCKER_COMPOSE[@]}" ps -q)" ]; then
|
||||||
|
EXEC="no"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
ARGS=()
|
||||||
|
|
||||||
|
# Proxy PHP commands to the "php" binary on the application container...
|
||||||
|
if [ "$1" == "php" ]; then
|
||||||
|
shift 1
|
||||||
|
|
||||||
|
if [ "$EXEC" == "yes" ]; then
|
||||||
|
ARGS+=(exec -u sail)
|
||||||
|
[ ! -t 0 ] && ARGS+=(-T)
|
||||||
|
ARGS+=("$APP_SERVICE" "php" "$@")
|
||||||
|
else
|
||||||
|
sail_is_not_running
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Proxy vendor binary commands on the application container...
|
||||||
|
elif [ "$1" == "bin" ]; then
|
||||||
|
shift 1
|
||||||
|
|
||||||
|
if [ "$EXEC" == "yes" ]; then
|
||||||
|
ARGS+=(exec -u sail)
|
||||||
|
[ ! -t 0 ] && ARGS+=(-T)
|
||||||
|
ARGS+=("$APP_SERVICE" ./vendor/bin/"$@")
|
||||||
|
else
|
||||||
|
sail_is_not_running
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Proxy docker-compose commands to the docker-compose binary on the application container...
|
||||||
|
elif [ "$1" == "docker-compose" ]; then
|
||||||
|
shift 1
|
||||||
|
|
||||||
|
if [ "$EXEC" == "yes" ]; then
|
||||||
|
ARGS+=(exec -u sail)
|
||||||
|
[ ! -t 0 ] && ARGS+=(-T)
|
||||||
|
ARGS+=("$APP_SERVICE" "${DOCKER_COMPOSE[@]}")
|
||||||
|
else
|
||||||
|
sail_is_not_running
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Proxy Composer commands to the "composer" binary on the application container...
|
||||||
|
elif [ "$1" == "composer" ]; then
|
||||||
|
shift 1
|
||||||
|
|
||||||
|
if [ "$EXEC" == "yes" ]; then
|
||||||
|
ARGS+=(exec -u sail)
|
||||||
|
[ ! -t 0 ] && ARGS+=(-T)
|
||||||
|
ARGS+=("$APP_SERVICE" "composer" "$@")
|
||||||
|
else
|
||||||
|
sail_is_not_running
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Proxy Artisan commands to the "artisan" binary on the application container...
|
||||||
|
elif [ "$1" == "artisan" ] || [ "$1" == "art" ]; then
|
||||||
|
shift 1
|
||||||
|
|
||||||
|
if [ "$EXEC" == "yes" ]; then
|
||||||
|
ARGS+=(exec -u sail)
|
||||||
|
[ ! -t 0 ] && ARGS+=(-T)
|
||||||
|
ARGS+=("$APP_SERVICE" php artisan "$@")
|
||||||
|
else
|
||||||
|
sail_is_not_running
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Proxy the "debug" command to the "php artisan" binary on the application container with xdebug enabled...
|
||||||
|
elif [ "$1" == "debug" ]; then
|
||||||
|
shift 1
|
||||||
|
|
||||||
|
if [ "$EXEC" == "yes" ]; then
|
||||||
|
ARGS+=(exec -u sail -e XDEBUG_SESSION=1)
|
||||||
|
[ ! -t 0 ] && ARGS+=(-T)
|
||||||
|
ARGS+=("$APP_SERVICE" php artisan "$@")
|
||||||
|
else
|
||||||
|
sail_is_not_running
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Proxy the "test" command to the "php artisan test" Artisan command...
|
||||||
|
elif [ "$1" == "test" ]; then
|
||||||
|
shift 1
|
||||||
|
|
||||||
|
if [ "$EXEC" == "yes" ]; then
|
||||||
|
ARGS+=(exec -u sail)
|
||||||
|
[ ! -t 0 ] && ARGS+=(-T)
|
||||||
|
ARGS+=("$APP_SERVICE" php artisan test "$@")
|
||||||
|
else
|
||||||
|
sail_is_not_running
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Proxy the "phpunit" command to "php vendor/bin/phpunit"...
|
||||||
|
elif [ "$1" == "phpunit" ]; then
|
||||||
|
shift 1
|
||||||
|
|
||||||
|
if [ "$EXEC" == "yes" ]; then
|
||||||
|
ARGS+=(exec -u sail)
|
||||||
|
[ ! -t 0 ] && ARGS+=(-T)
|
||||||
|
ARGS+=("$APP_SERVICE" php vendor/bin/phpunit "$@")
|
||||||
|
else
|
||||||
|
sail_is_not_running
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Proxy the "pest" command to "php vendor/bin/pest"...
|
||||||
|
elif [ "$1" == "pest" ]; then
|
||||||
|
shift 1
|
||||||
|
|
||||||
|
if [ "$EXEC" == "yes" ]; then
|
||||||
|
ARGS+=(exec -u sail)
|
||||||
|
[ ! -t 0 ] && ARGS+=(-T)
|
||||||
|
ARGS+=("$APP_SERVICE" php vendor/bin/pest "$@")
|
||||||
|
else
|
||||||
|
sail_is_not_running
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Proxy the "pint" command to "php vendor/bin/pint"...
|
||||||
|
elif [ "$1" == "pint" ]; then
|
||||||
|
shift 1
|
||||||
|
|
||||||
|
if [ "$EXEC" == "yes" ]; then
|
||||||
|
ARGS+=(exec -u sail)
|
||||||
|
[ ! -t 0 ] && ARGS+=(-T)
|
||||||
|
ARGS+=("$APP_SERVICE" php vendor/bin/pint "$@")
|
||||||
|
else
|
||||||
|
sail_is_not_running
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Proxy the "dusk" command to the "php artisan dusk" Artisan command...
|
||||||
|
elif [ "$1" == "dusk" ]; then
|
||||||
|
shift 1
|
||||||
|
|
||||||
|
if [ "$EXEC" == "yes" ]; then
|
||||||
|
ARGS+=(exec -u sail)
|
||||||
|
[ ! -t 0 ] && ARGS+=(-T)
|
||||||
|
ARGS+=(-e "APP_URL=http://${APP_SERVICE}")
|
||||||
|
ARGS+=(-e "DUSK_DRIVER_URL=http://selenium:4444/wd/hub")
|
||||||
|
ARGS+=("$APP_SERVICE" php artisan dusk "$@")
|
||||||
|
else
|
||||||
|
sail_is_not_running
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Proxy the "dusk:fails" command to the "php artisan dusk:fails" Artisan command...
|
||||||
|
elif [ "$1" == "dusk:fails" ]; then
|
||||||
|
shift 1
|
||||||
|
|
||||||
|
if [ "$EXEC" == "yes" ]; then
|
||||||
|
ARGS+=(exec -u sail)
|
||||||
|
[ ! -t 0 ] && ARGS+=(-T)
|
||||||
|
ARGS+=(-e "APP_URL=http://${APP_SERVICE}")
|
||||||
|
ARGS+=(-e "DUSK_DRIVER_URL=http://selenium:4444/wd/hub")
|
||||||
|
ARGS+=("$APP_SERVICE" php artisan dusk:fails "$@")
|
||||||
|
else
|
||||||
|
sail_is_not_running
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Initiate a Laravel Tinker session within the application container...
|
||||||
|
elif [ "$1" == "tinker" ] ; then
|
||||||
|
shift 1
|
||||||
|
|
||||||
|
if [ "$EXEC" == "yes" ]; then
|
||||||
|
ARGS+=(exec -u sail)
|
||||||
|
[ ! -t 0 ] && ARGS+=(-T)
|
||||||
|
ARGS+=("$APP_SERVICE" php artisan tinker)
|
||||||
|
else
|
||||||
|
sail_is_not_running
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Proxy Node commands to the "node" binary on the application container...
|
||||||
|
elif [ "$1" == "node" ]; then
|
||||||
|
shift 1
|
||||||
|
|
||||||
|
if [ "$EXEC" == "yes" ]; then
|
||||||
|
ARGS+=(exec -u sail)
|
||||||
|
[ ! -t 0 ] && ARGS+=(-T)
|
||||||
|
ARGS+=("$APP_SERVICE" node "$@")
|
||||||
|
else
|
||||||
|
sail_is_not_running
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Proxy NPM commands to the "npm" binary on the application container...
|
||||||
|
elif [ "$1" == "npm" ]; then
|
||||||
|
shift 1
|
||||||
|
|
||||||
|
if [ "$EXEC" == "yes" ]; then
|
||||||
|
ARGS+=(exec -u sail)
|
||||||
|
[ ! -t 0 ] && ARGS+=(-T)
|
||||||
|
ARGS+=("$APP_SERVICE" npm "$@")
|
||||||
|
else
|
||||||
|
sail_is_not_running
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Proxy NPX commands to the "npx" binary on the application container...
|
||||||
|
elif [ "$1" == "npx" ]; then
|
||||||
|
shift 1
|
||||||
|
|
||||||
|
if [ "$EXEC" == "yes" ]; then
|
||||||
|
ARGS+=(exec -u sail)
|
||||||
|
[ ! -t 0 ] && ARGS+=(-T)
|
||||||
|
ARGS+=("$APP_SERVICE" npx "$@")
|
||||||
|
else
|
||||||
|
sail_is_not_running
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Proxy YARN commands to the "yarn" binary on the application container...
|
||||||
|
elif [ "$1" == "yarn" ]; then
|
||||||
|
shift 1
|
||||||
|
|
||||||
|
if [ "$EXEC" == "yes" ]; then
|
||||||
|
ARGS+=(exec -u sail)
|
||||||
|
[ ! -t 0 ] && ARGS+=(-T)
|
||||||
|
ARGS+=("$APP_SERVICE" yarn "$@")
|
||||||
|
else
|
||||||
|
sail_is_not_running
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Initiate a MySQL CLI terminal session within the "mysql" container...
|
||||||
|
elif [ "$1" == "mysql" ]; then
|
||||||
|
shift 1
|
||||||
|
|
||||||
|
if [ "$EXEC" == "yes" ]; then
|
||||||
|
ARGS+=(exec)
|
||||||
|
[ ! -t 0 ] && ARGS+=(-T)
|
||||||
|
ARGS+=(mysql bash -c)
|
||||||
|
ARGS+=("MYSQL_PWD=\${MYSQL_PASSWORD} mysql -u \${MYSQL_USER} \${MYSQL_DATABASE}")
|
||||||
|
else
|
||||||
|
sail_is_not_running
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Initiate a MySQL CLI terminal session within the "mariadb" container...
|
||||||
|
elif [ "$1" == "mariadb" ]; then
|
||||||
|
shift 1
|
||||||
|
|
||||||
|
if [ "$EXEC" == "yes" ]; then
|
||||||
|
ARGS+=(exec)
|
||||||
|
[ ! -t 0 ] && ARGS+=(-T)
|
||||||
|
ARGS+=(mariadb bash -c)
|
||||||
|
ARGS+=("MYSQL_PWD=\${MYSQL_PASSWORD} mysql -u \${MYSQL_USER} \${MYSQL_DATABASE}")
|
||||||
|
else
|
||||||
|
sail_is_not_running
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Initiate a PostgreSQL CLI terminal session within the "pgsql" container...
|
||||||
|
elif [ "$1" == "psql" ]; then
|
||||||
|
shift 1
|
||||||
|
|
||||||
|
if [ "$EXEC" == "yes" ]; then
|
||||||
|
ARGS+=(exec)
|
||||||
|
[ ! -t 0 ] && ARGS+=(-T)
|
||||||
|
ARGS+=(pgsql bash -c)
|
||||||
|
ARGS+=("PGPASSWORD=\${PGPASSWORD} psql -U \${POSTGRES_USER} \${POSTGRES_DB}")
|
||||||
|
else
|
||||||
|
sail_is_not_running
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Initiate a Bash shell within the application container...
|
||||||
|
elif [ "$1" == "shell" ] || [ "$1" == "bash" ]; then
|
||||||
|
shift 1
|
||||||
|
|
||||||
|
if [ "$EXEC" == "yes" ]; then
|
||||||
|
ARGS+=(exec -u sail)
|
||||||
|
[ ! -t 0 ] && ARGS+=(-T)
|
||||||
|
ARGS+=("$APP_SERVICE" bash "$@")
|
||||||
|
else
|
||||||
|
sail_is_not_running
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Initiate a root user Bash shell within the application container...
|
||||||
|
elif [ "$1" == "root-shell" ] || [ "$1" == "root-bash" ]; then
|
||||||
|
shift 1
|
||||||
|
|
||||||
|
if [ "$EXEC" == "yes" ]; then
|
||||||
|
ARGS+=(exec)
|
||||||
|
[ ! -t 0 ] && ARGS+=(-T)
|
||||||
|
ARGS+=("$APP_SERVICE" bash "$@")
|
||||||
|
else
|
||||||
|
sail_is_not_running
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Initiate a Redis CLI terminal session within the "redis" container...
|
||||||
|
elif [ "$1" == "redis" ] ; then
|
||||||
|
shift 1
|
||||||
|
|
||||||
|
if [ "$EXEC" == "yes" ]; then
|
||||||
|
ARGS+=(exec)
|
||||||
|
[ ! -t 0 ] && ARGS+=(-T)
|
||||||
|
ARGS+=(redis redis-cli)
|
||||||
|
else
|
||||||
|
sail_is_not_running
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Share the site...
|
||||||
|
elif [ "$1" == "share" ]; then
|
||||||
|
shift 1
|
||||||
|
|
||||||
|
if [ "$EXEC" == "yes" ]; then
|
||||||
|
docker run --init --rm -p "$SAIL_SHARE_DASHBOARD":4040 -t beyondcodegmbh/expose-server:latest share http://host.docker.internal:"$APP_PORT" \
|
||||||
|
--server-host="$SAIL_SHARE_SERVER_HOST" \
|
||||||
|
--server-port="$SAIL_SHARE_SERVER_PORT" \
|
||||||
|
--auth="$SAIL_SHARE_TOKEN" \
|
||||||
|
--server="$SAIL_SHARE_SERVER" \
|
||||||
|
--subdomain="$SAIL_SHARE_SUBDOMAIN" \
|
||||||
|
--domain="$SAIL_SHARE_DOMAIN" \
|
||||||
|
"$@"
|
||||||
|
|
||||||
|
exit
|
||||||
|
else
|
||||||
|
sail_is_not_running
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Open the site...
|
||||||
|
elif [ "$1" == "open" ]; then
|
||||||
|
shift 1
|
||||||
|
|
||||||
|
if [ "$EXEC" == "yes" ]; then
|
||||||
|
open $APP_URL
|
||||||
|
|
||||||
|
exit
|
||||||
|
else
|
||||||
|
sail_is_not_running
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Pass unknown commands to the "docker-compose" binary...
|
||||||
|
else
|
||||||
|
ARGS+=("$@")
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Run Docker Compose with the defined arguments...
|
||||||
|
"${DOCKER_COMPOSE[@]}" "${ARGS[@]}"
|
||||||
Reference in New Issue
Block a user