mirror of
https://gitlab.com/signalytic/client-external/streamline/streamline-emr.git
synced 2026-09-11 18:51:31 +00:00
Build modified streamline images
The official image from streamline does not currently work for the arm64 platform. As a temporary measure, the source code and docker build scripts have been lifted from the official images and are used to build locally. Some additional modifications are made to reduce overall image size, these are documented in docker/README.md
This commit is contained in:
+73
@@ -0,0 +1,73 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="container">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-8">
|
||||
<div class="card">
|
||||
<div class="card-header">{{ __('Login') }}</div>
|
||||
|
||||
<div class="card-body">
|
||||
<form method="POST" action="{{ route('login') }}">
|
||||
@csrf
|
||||
|
||||
<div class="row mb-3">
|
||||
<label for="email" class="col-md-4 col-form-label text-md-end">{{ __('Email Address') }}</label>
|
||||
|
||||
<div class="col-md-6">
|
||||
<input id="email" type="email" class="form-control @error('email') is-invalid @enderror" name="email" value="{{ old('email') }}" required autocomplete="email" autofocus>
|
||||
|
||||
@error('email')
|
||||
<span class="invalid-feedback" role="alert">
|
||||
<strong>{{ $message }}</strong>
|
||||
</span>
|
||||
@enderror
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<label for="password" class="col-md-4 col-form-label text-md-end">{{ __('Password') }}</label>
|
||||
|
||||
<div class="col-md-6">
|
||||
<input id="password" type="password" class="form-control @error('password') is-invalid @enderror" name="password" required autocomplete="current-password">
|
||||
|
||||
@error('password')
|
||||
<span class="invalid-feedback" role="alert">
|
||||
<strong>{{ $message }}</strong>
|
||||
</span>
|
||||
@enderror
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<div class="col-md-6 offset-md-4">
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" name="remember" id="remember" {{ old('remember') ? 'checked' : '' }}>
|
||||
|
||||
<label class="form-check-label" for="remember">
|
||||
{{ __('Remember Me') }}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-0">
|
||||
<div class="col-md-8 offset-md-4">
|
||||
<button type="submit" class="btn btn-primary">
|
||||
{{ __('Login') }}
|
||||
</button>
|
||||
|
||||
@if (Route::has('password.request'))
|
||||
<a class="btn btn-link" href="{{ route('password.request') }}">
|
||||
{{ __('Forgot Your Password?') }}
|
||||
</a>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
Vendored
+49
@@ -0,0 +1,49 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="container">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-8">
|
||||
<div class="card">
|
||||
<div class="card-header">{{ __('Confirm Password') }}</div>
|
||||
|
||||
<div class="card-body">
|
||||
{{ __('Please confirm your password before continuing.') }}
|
||||
|
||||
<form method="POST" action="{{ route('password.confirm') }}">
|
||||
@csrf
|
||||
|
||||
<div class="row mb-3">
|
||||
<label for="password" class="col-md-4 col-form-label text-md-end">{{ __('Password') }}</label>
|
||||
|
||||
<div class="col-md-6">
|
||||
<input id="password" type="password" class="form-control @error('password') is-invalid @enderror" name="password" required autocomplete="current-password">
|
||||
|
||||
@error('password')
|
||||
<span class="invalid-feedback" role="alert">
|
||||
<strong>{{ $message }}</strong>
|
||||
</span>
|
||||
@enderror
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-0">
|
||||
<div class="col-md-8 offset-md-4">
|
||||
<button type="submit" class="btn btn-primary">
|
||||
{{ __('Confirm Password') }}
|
||||
</button>
|
||||
|
||||
@if (Route::has('password.request'))
|
||||
<a class="btn btn-link" href="{{ route('password.request') }}">
|
||||
{{ __('Forgot Your Password?') }}
|
||||
</a>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="container">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-8">
|
||||
<div class="card">
|
||||
<div class="card-header">{{ __('Reset Password') }}</div>
|
||||
|
||||
<div class="card-body">
|
||||
@if (session('status'))
|
||||
<div class="alert alert-success" role="alert">
|
||||
{{ session('status') }}
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<form method="POST" action="{{ route('password.email') }}">
|
||||
@csrf
|
||||
|
||||
<div class="row mb-3">
|
||||
<label for="email" class="col-md-4 col-form-label text-md-end">{{ __('Email Address') }}</label>
|
||||
|
||||
<div class="col-md-6">
|
||||
<input id="email" type="email" class="form-control @error('email') is-invalid @enderror" name="email" value="{{ old('email') }}" required autocomplete="email" autofocus>
|
||||
|
||||
@error('email')
|
||||
<span class="invalid-feedback" role="alert">
|
||||
<strong>{{ $message }}</strong>
|
||||
</span>
|
||||
@enderror
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-0">
|
||||
<div class="col-md-6 offset-md-4">
|
||||
<button type="submit" class="btn btn-primary">
|
||||
{{ __('Send Password Reset Link') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="container">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-8">
|
||||
<div class="card">
|
||||
<div class="card-header">{{ __('Reset Password') }}</div>
|
||||
|
||||
<div class="card-body">
|
||||
<form method="POST" action="{{ route('password.update') }}">
|
||||
@csrf
|
||||
|
||||
<input type="hidden" name="token" value="{{ $token }}">
|
||||
|
||||
<div class="row mb-3">
|
||||
<label for="email" class="col-md-4 col-form-label text-md-end">{{ __('Email Address') }}</label>
|
||||
|
||||
<div class="col-md-6">
|
||||
<input id="email" type="email" class="form-control @error('email') is-invalid @enderror" name="email" value="{{ $email ?? old('email') }}" required autocomplete="email" autofocus>
|
||||
|
||||
@error('email')
|
||||
<span class="invalid-feedback" role="alert">
|
||||
<strong>{{ $message }}</strong>
|
||||
</span>
|
||||
@enderror
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<label for="password" class="col-md-4 col-form-label text-md-end">{{ __('Password') }}</label>
|
||||
|
||||
<div class="col-md-6">
|
||||
<input id="password" type="password" class="form-control @error('password') is-invalid @enderror" name="password" required autocomplete="new-password">
|
||||
|
||||
@error('password')
|
||||
<span class="invalid-feedback" role="alert">
|
||||
<strong>{{ $message }}</strong>
|
||||
</span>
|
||||
@enderror
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<label for="password-confirm" class="col-md-4 col-form-label text-md-end">{{ __('Confirm Password') }}</label>
|
||||
|
||||
<div class="col-md-6">
|
||||
<input id="password-confirm" type="password" class="form-control" name="password_confirmation" required autocomplete="new-password">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-0">
|
||||
<div class="col-md-6 offset-md-4">
|
||||
<button type="submit" class="btn btn-primary">
|
||||
{{ __('Reset Password') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
+77
@@ -0,0 +1,77 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="container">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-8">
|
||||
<div class="card">
|
||||
<div class="card-header">{{ __('Register') }}</div>
|
||||
|
||||
<div class="card-body">
|
||||
<form method="POST" action="{{ route('register') }}">
|
||||
@csrf
|
||||
|
||||
<div class="row mb-3">
|
||||
<label for="name" class="col-md-4 col-form-label text-md-end">{{ __('Name') }}</label>
|
||||
|
||||
<div class="col-md-6">
|
||||
<input id="name" type="text" class="form-control @error('name') is-invalid @enderror" name="name" value="{{ old('name') }}" required autocomplete="name" autofocus>
|
||||
|
||||
@error('name')
|
||||
<span class="invalid-feedback" role="alert">
|
||||
<strong>{{ $message }}</strong>
|
||||
</span>
|
||||
@enderror
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<label for="email" class="col-md-4 col-form-label text-md-end">{{ __('Email Address') }}</label>
|
||||
|
||||
<div class="col-md-6">
|
||||
<input id="email" type="email" class="form-control @error('email') is-invalid @enderror" name="email" value="{{ old('email') }}" required autocomplete="email">
|
||||
|
||||
@error('email')
|
||||
<span class="invalid-feedback" role="alert">
|
||||
<strong>{{ $message }}</strong>
|
||||
</span>
|
||||
@enderror
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<label for="password" class="col-md-4 col-form-label text-md-end">{{ __('Password') }}</label>
|
||||
|
||||
<div class="col-md-6">
|
||||
<input id="password" type="password" class="form-control @error('password') is-invalid @enderror" name="password" required autocomplete="new-password">
|
||||
|
||||
@error('password')
|
||||
<span class="invalid-feedback" role="alert">
|
||||
<strong>{{ $message }}</strong>
|
||||
</span>
|
||||
@enderror
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<label for="password-confirm" class="col-md-4 col-form-label text-md-end">{{ __('Confirm Password') }}</label>
|
||||
|
||||
<div class="col-md-6">
|
||||
<input id="password-confirm" type="password" class="form-control" name="password_confirmation" required autocomplete="new-password">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-0">
|
||||
<div class="col-md-6 offset-md-4">
|
||||
<button type="submit" class="btn btn-primary">
|
||||
{{ __('Register') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="container">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-8">
|
||||
<div class="card">
|
||||
<div class="card-header">{{ __('Verify Your Email Address') }}</div>
|
||||
|
||||
<div class="card-body">
|
||||
@if (session('resent'))
|
||||
<div class="alert alert-success" role="alert">
|
||||
{{ __('A fresh verification link has been sent to your email address.') }}
|
||||
</div>
|
||||
@endif
|
||||
|
||||
{{ __('Before proceeding, please check your email for a verification link.') }}
|
||||
{{ __('If you did not receive the email') }},
|
||||
<form class="d-inline" method="POST" action="{{ route('verification.resend') }}">
|
||||
@csrf
|
||||
<button type="submit" class="btn btn-link p-0 m-0 align-baseline">{{ __('click here to request another') }}</button>.
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
@@ -0,0 +1,23 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="container">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-8">
|
||||
<div class="card">
|
||||
<div class="card-header">{{ __('Dashboard') }}</div>
|
||||
|
||||
<div class="card-body">
|
||||
@if (session('status'))
|
||||
<div class="alert alert-success" role="alert">
|
||||
{{ session('status') }}
|
||||
</div>
|
||||
@endif
|
||||
|
||||
{{ __('You are logged in!') }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
+80
@@ -0,0 +1,80 @@
|
||||
<!doctype html>
|
||||
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
<!-- CSRF Token -->
|
||||
<meta name="csrf-token" content="{{ csrf_token() }}">
|
||||
|
||||
<title>{{ config('app.name', 'Laravel') }}</title>
|
||||
|
||||
<!-- Fonts -->
|
||||
<link rel="dns-prefetch" href="//fonts.bunny.net">
|
||||
<link href="https://fonts.bunny.net/css?family=Nunito" rel="stylesheet">
|
||||
|
||||
<!-- Scripts -->
|
||||
@vite(['resources/sass/app.scss', 'resources/js/app.js'])
|
||||
</head>
|
||||
<body>
|
||||
<div id="app">
|
||||
<nav class="navbar navbar-expand-md navbar-light bg-white shadow-sm">
|
||||
<div class="container">
|
||||
<a class="navbar-brand" href="{{ url('/') }}">
|
||||
{{ config('app.name', 'Laravel') }}
|
||||
</a>
|
||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="{{ __('Toggle navigation') }}">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
|
||||
<div class="collapse navbar-collapse" id="navbarSupportedContent">
|
||||
<!-- Left Side Of Navbar -->
|
||||
<ul class="navbar-nav me-auto">
|
||||
|
||||
</ul>
|
||||
|
||||
<!-- Right Side Of Navbar -->
|
||||
<ul class="navbar-nav ms-auto">
|
||||
<!-- Authentication Links -->
|
||||
@guest
|
||||
@if (Route::has('login'))
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{{ route('login') }}">{{ __('Login') }}</a>
|
||||
</li>
|
||||
@endif
|
||||
|
||||
@if (Route::has('register'))
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{{ route('register') }}">{{ __('Register') }}</a>
|
||||
</li>
|
||||
@endif
|
||||
@else
|
||||
<li class="nav-item dropdown">
|
||||
<a id="navbarDropdown" class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false" v-pre>
|
||||
{{ Auth::user()->name }}
|
||||
</a>
|
||||
|
||||
<div class="dropdown-menu dropdown-menu-end" aria-labelledby="navbarDropdown">
|
||||
<a class="dropdown-item" href="{{ route('logout') }}"
|
||||
onclick="event.preventDefault();
|
||||
document.getElementById('logout-form').submit();">
|
||||
{{ __('Logout') }}
|
||||
</a>
|
||||
|
||||
<form id="logout-form" action="{{ route('logout') }}" method="POST" class="d-none">
|
||||
@csrf
|
||||
</form>
|
||||
</div>
|
||||
</li>
|
||||
@endguest
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<main class="py-4">
|
||||
@yield('content')
|
||||
</main>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace {{namespace}}Http\Controllers;
|
||||
|
||||
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
||||
use Illuminate\Foundation\Validation\ValidatesRequests;
|
||||
use Illuminate\Routing\Controller as BaseController;
|
||||
|
||||
class Controller extends BaseController
|
||||
{
|
||||
use AuthorizesRequests, ValidatesRequests;
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace {{namespace}}Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class HomeController extends Controller
|
||||
{
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the application dashboard.
|
||||
*
|
||||
* @return \Illuminate\Contracts\Support\Renderable
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
return view('home');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
|
||||
Auth::routes();
|
||||
|
||||
Route::get('/home', [App\Http\Controllers\HomeController::class, 'index'])->name('home');
|
||||
@@ -0,0 +1,177 @@
|
||||
<?php
|
||||
|
||||
namespace Laravel\Ui;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use InvalidArgumentException;
|
||||
|
||||
class AuthCommand extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'ui:auth
|
||||
{ type=bootstrap : The preset type (bootstrap) }
|
||||
{--views : Only scaffold the authentication views}
|
||||
{--force : Overwrite existing views by default}';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Scaffold basic login and registration views and routes';
|
||||
|
||||
/**
|
||||
* The views that need to be exported.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $views = [
|
||||
'auth/login.stub' => 'auth/login.blade.php',
|
||||
'auth/passwords/confirm.stub' => 'auth/passwords/confirm.blade.php',
|
||||
'auth/passwords/email.stub' => 'auth/passwords/email.blade.php',
|
||||
'auth/passwords/reset.stub' => 'auth/passwords/reset.blade.php',
|
||||
'auth/register.stub' => 'auth/register.blade.php',
|
||||
'auth/verify.stub' => 'auth/verify.blade.php',
|
||||
'home.stub' => 'home.blade.php',
|
||||
'layouts/app.stub' => 'layouts/app.blade.php',
|
||||
];
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
if (static::hasMacro($this->argument('type'))) {
|
||||
return call_user_func(static::$macros[$this->argument('type')], $this);
|
||||
}
|
||||
|
||||
if (! in_array($this->argument('type'), ['bootstrap'])) {
|
||||
throw new InvalidArgumentException('Invalid preset.');
|
||||
}
|
||||
|
||||
$this->ensureDirectoriesExist();
|
||||
$this->exportViews();
|
||||
|
||||
if (! $this->option('views')) {
|
||||
$this->exportBackend();
|
||||
}
|
||||
|
||||
$this->components->info('Authentication scaffolding generated successfully.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the directories for the files.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function ensureDirectoriesExist()
|
||||
{
|
||||
if (! is_dir($directory = $this->getViewPath('layouts'))) {
|
||||
mkdir($directory, 0755, true);
|
||||
}
|
||||
|
||||
if (! is_dir($directory = $this->getViewPath('auth/passwords'))) {
|
||||
mkdir($directory, 0755, true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Export the authentication views.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function exportViews()
|
||||
{
|
||||
foreach ($this->views as $key => $value) {
|
||||
if (file_exists($view = $this->getViewPath($value)) && ! $this->option('force')) {
|
||||
if (! $this->components->confirm("The [$value] view already exists. Do you want to replace it?")) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
copy(
|
||||
__DIR__.'/Auth/'.$this->argument('type').'-stubs/'.$key,
|
||||
$view
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Export the authentication backend.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function exportBackend()
|
||||
{
|
||||
$this->callSilent('ui:controllers');
|
||||
|
||||
$controller = app_path('Http/Controllers/HomeController.php');
|
||||
|
||||
if (file_exists($controller) && ! $this->option('force')) {
|
||||
if ($this->components->confirm("The [HomeController.php] file already exists. Do you want to replace it?")) {
|
||||
file_put_contents($controller, $this->compileStub('controllers/HomeController'));
|
||||
}
|
||||
} else {
|
||||
file_put_contents($controller, $this->compileStub('controllers/HomeController'));
|
||||
}
|
||||
|
||||
$baseController = app_path('Http/Controllers/Controller.php');
|
||||
|
||||
if (file_exists($baseController) && ! $this->option('force')) {
|
||||
if ($this->components->confirm("The [Controller.php] file already exists. Do you want to replace it?")) {
|
||||
file_put_contents($baseController, $this->compileStub('controllers/Controller'));
|
||||
}
|
||||
} else {
|
||||
file_put_contents($baseController, $this->compileStub('controllers/Controller'));
|
||||
}
|
||||
|
||||
if (! file_exists(database_path('migrations/0001_01_01_000000_create_users_table.php'))) {
|
||||
copy(
|
||||
__DIR__.'/../stubs/migrations/2014_10_12_100000_create_password_resets_table.php',
|
||||
base_path('database/migrations/2014_10_12_100000_create_password_resets_table.php')
|
||||
);
|
||||
}
|
||||
|
||||
file_put_contents(
|
||||
base_path('routes/web.php'),
|
||||
file_get_contents(__DIR__.'/Auth/stubs/routes.stub'),
|
||||
FILE_APPEND
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Compiles the given stub.
|
||||
*
|
||||
* @param string $stub
|
||||
* @return string
|
||||
*/
|
||||
protected function compileStub($stub)
|
||||
{
|
||||
return str_replace(
|
||||
'{{namespace}}',
|
||||
$this->laravel->getNamespace(),
|
||||
file_get_contents(__DIR__.'/Auth/stubs/'.$stub.'.stub')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get full view path relative to the application's configured view path.
|
||||
*
|
||||
* @param string $path
|
||||
* @return string
|
||||
*/
|
||||
protected function getViewPath($path)
|
||||
{
|
||||
return implode(DIRECTORY_SEPARATOR, [
|
||||
config('view.paths')[0] ?? resource_path('views'), $path,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
<?php
|
||||
|
||||
namespace Laravel\Ui;
|
||||
|
||||
class AuthRouteMethods
|
||||
{
|
||||
/**
|
||||
* Register the typical authentication routes for an application.
|
||||
*
|
||||
* @param array $options
|
||||
* @return callable
|
||||
*/
|
||||
public function auth()
|
||||
{
|
||||
return function ($options = []) {
|
||||
$namespace = class_exists($this->prependGroupNamespace('Auth\LoginController')) ? null : 'App\Http\Controllers';
|
||||
|
||||
$this->group(['namespace' => $namespace], function() use($options) {
|
||||
// Login Routes...
|
||||
if ($options['login'] ?? true) {
|
||||
$this->get('login', 'Auth\LoginController@showLoginForm')->name('login');
|
||||
$this->post('login', 'Auth\LoginController@login');
|
||||
}
|
||||
|
||||
// Logout Routes...
|
||||
if ($options['logout'] ?? true) {
|
||||
$this->post('logout', 'Auth\LoginController@logout')->name('logout');
|
||||
}
|
||||
|
||||
// Registration Routes...
|
||||
if ($options['register'] ?? true) {
|
||||
$this->get('register', 'Auth\RegisterController@showRegistrationForm')->name('register');
|
||||
$this->post('register', 'Auth\RegisterController@register');
|
||||
}
|
||||
|
||||
// Password Reset Routes...
|
||||
if ($options['reset'] ?? true) {
|
||||
$this->resetPassword();
|
||||
}
|
||||
|
||||
// Password Confirmation Routes...
|
||||
if ($options['confirm'] ??
|
||||
class_exists($this->prependGroupNamespace('Auth\ConfirmPasswordController'))) {
|
||||
$this->confirmPassword();
|
||||
}
|
||||
|
||||
// Email Verification Routes...
|
||||
if ($options['verify'] ?? false) {
|
||||
$this->emailVerification();
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the typical reset password routes for an application.
|
||||
*
|
||||
* @return callable
|
||||
*/
|
||||
public function resetPassword()
|
||||
{
|
||||
return function () {
|
||||
$this->get('password/reset', 'Auth\ForgotPasswordController@showLinkRequestForm')->name('password.request');
|
||||
$this->post('password/email', 'Auth\ForgotPasswordController@sendResetLinkEmail')->name('password.email');
|
||||
$this->get('password/reset/{token}', 'Auth\ResetPasswordController@showResetForm')->name('password.reset');
|
||||
$this->post('password/reset', 'Auth\ResetPasswordController@reset')->name('password.update');
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the typical confirm password routes for an application.
|
||||
*
|
||||
* @return callable
|
||||
*/
|
||||
public function confirmPassword()
|
||||
{
|
||||
return function () {
|
||||
$this->get('password/confirm', 'Auth\ConfirmPasswordController@showConfirmForm')->name('password.confirm');
|
||||
$this->post('password/confirm', 'Auth\ConfirmPasswordController@confirm');
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the typical email verification routes for an application.
|
||||
*
|
||||
* @return callable
|
||||
*/
|
||||
public function emailVerification()
|
||||
{
|
||||
return function () {
|
||||
$this->get('email/verify', 'Auth\VerificationController@show')->name('verification.notice');
|
||||
$this->get('email/verify/{id}/{hash}', 'Auth\VerificationController@verify')->name('verification.verify');
|
||||
$this->post('email/resend', 'Auth\VerificationController@resend')->name('verification.resend');
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace Laravel\Ui;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Filesystem\Filesystem;
|
||||
use Illuminate\Support\Str;
|
||||
use Symfony\Component\Finder\SplFileInfo;
|
||||
|
||||
class ControllersCommand extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'ui:controllers';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Scaffold the authentication controllers';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
if (! is_dir($directory = app_path('Http/Controllers/Auth'))) {
|
||||
mkdir($directory, 0755, true);
|
||||
}
|
||||
|
||||
$filesystem = new Filesystem;
|
||||
|
||||
collect($filesystem->allFiles(__DIR__.'/../stubs/Auth'))
|
||||
->each(function (SplFileInfo $file) use ($filesystem) {
|
||||
$filesystem->copy(
|
||||
$file->getPathname(),
|
||||
app_path('Http/Controllers/Auth/'.Str::replaceLast('.stub', '.php', $file->getFilename()))
|
||||
);
|
||||
});
|
||||
|
||||
$this->components->info('Authentication scaffolding generated successfully.');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
namespace Laravel\Ui\Presets;
|
||||
|
||||
use Illuminate\Filesystem\Filesystem;
|
||||
|
||||
class Bootstrap extends Preset
|
||||
{
|
||||
/**
|
||||
* Install the preset.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function install()
|
||||
{
|
||||
static::updatePackages();
|
||||
static::updateViteConfiguration();
|
||||
static::updateSass();
|
||||
static::updateBootstrapping();
|
||||
static::removeNodeModules();
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the given package array.
|
||||
*
|
||||
* @param array $packages
|
||||
* @return array
|
||||
*/
|
||||
protected static function updatePackageArray(array $packages)
|
||||
{
|
||||
return [
|
||||
'bootstrap' => '^5.2.3',
|
||||
'@popperjs/core' => '^2.11.6',
|
||||
'sass' => '^1.56.1',
|
||||
] + $packages;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the Vite configuration.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected static function updateViteConfiguration()
|
||||
{
|
||||
copy(__DIR__.'/bootstrap-stubs/vite.config.js', base_path('vite.config.js'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the Sass files for the application.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected static function updateSass()
|
||||
{
|
||||
(new Filesystem)->ensureDirectoryExists(resource_path('sass'));
|
||||
|
||||
copy(__DIR__.'/bootstrap-stubs/_variables.scss', resource_path('sass/_variables.scss'));
|
||||
copy(__DIR__.'/bootstrap-stubs/app.scss', resource_path('sass/app.scss'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the bootstrapping files.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected static function updateBootstrapping()
|
||||
{
|
||||
copy(__DIR__.'/bootstrap-stubs/bootstrap.js', resource_path('js/bootstrap.js'));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
namespace Laravel\Ui\Presets;
|
||||
|
||||
use Illuminate\Filesystem\Filesystem;
|
||||
|
||||
class Preset
|
||||
{
|
||||
/**
|
||||
* Ensure the component directories we need exist.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected static function ensureComponentDirectoryExists()
|
||||
{
|
||||
$filesystem = new Filesystem;
|
||||
|
||||
if (! $filesystem->isDirectory($directory = resource_path('js/components'))) {
|
||||
$filesystem->makeDirectory($directory, 0755, true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the "package.json" file.
|
||||
*
|
||||
* @param bool $dev
|
||||
* @return void
|
||||
*/
|
||||
protected static function updatePackages($dev = true)
|
||||
{
|
||||
if (! file_exists(base_path('package.json'))) {
|
||||
return;
|
||||
}
|
||||
|
||||
$configurationKey = $dev ? 'devDependencies' : 'dependencies';
|
||||
|
||||
$packages = json_decode(file_get_contents(base_path('package.json')), true);
|
||||
|
||||
$packages[$configurationKey] = static::updatePackageArray(
|
||||
array_key_exists($configurationKey, $packages) ? $packages[$configurationKey] : [],
|
||||
$configurationKey
|
||||
);
|
||||
|
||||
ksort($packages[$configurationKey]);
|
||||
|
||||
file_put_contents(
|
||||
base_path('package.json'),
|
||||
json_encode($packages, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT).PHP_EOL
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the installed Node modules.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected static function removeNodeModules()
|
||||
{
|
||||
tap(new Filesystem, function ($files) {
|
||||
$files->deleteDirectory(base_path('node_modules'));
|
||||
|
||||
$files->delete(base_path('yarn.lock'));
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
<?php
|
||||
|
||||
namespace Laravel\Ui\Presets;
|
||||
|
||||
use Illuminate\Filesystem\Filesystem;
|
||||
use Illuminate\Support\Arr;
|
||||
|
||||
class React extends Preset
|
||||
{
|
||||
/**
|
||||
* Install the preset.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function install()
|
||||
{
|
||||
static::ensureComponentDirectoryExists();
|
||||
static::updatePackages();
|
||||
static::updateViteConfiguration();
|
||||
static::updateBootstrapping();
|
||||
static::updateComponent();
|
||||
static::addViteReactRefreshDirective();
|
||||
static::removeNodeModules();
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the given package array.
|
||||
*
|
||||
* @param array $packages
|
||||
* @return array
|
||||
*/
|
||||
protected static function updatePackageArray(array $packages)
|
||||
{
|
||||
return [
|
||||
'@vitejs/plugin-react' => '^4.2.0',
|
||||
'react' => '^18.2.0',
|
||||
'react-dom' => '^18.2.0',
|
||||
] + Arr::except($packages, [
|
||||
'@vitejs/plugin-vue',
|
||||
'vue'
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the Vite configuration.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected static function updateViteConfiguration()
|
||||
{
|
||||
copy(__DIR__.'/react-stubs/vite.config.js', base_path('vite.config.js'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the example component.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected static function updateComponent()
|
||||
{
|
||||
(new Filesystem)->delete(
|
||||
resource_path('js/components/ExampleComponent.vue')
|
||||
);
|
||||
|
||||
copy(
|
||||
__DIR__.'/react-stubs/Example.jsx',
|
||||
resource_path('js/components/Example.jsx')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the bootstrapping files.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected static function updateBootstrapping()
|
||||
{
|
||||
copy(__DIR__.'/react-stubs/app.js', resource_path('js/app.js'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Add Vite's React Refresh Runtime
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected static function addViteReactRefreshDirective()
|
||||
{
|
||||
$view = static::getViewPath('layouts/app.blade.php');
|
||||
|
||||
if (! file_exists($view)) {
|
||||
return;
|
||||
}
|
||||
|
||||
file_put_contents(
|
||||
$view,
|
||||
str_replace('@vite(', '@viteReactRefresh'.PHP_EOL.' @vite(', file_get_contents($view))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get full view path relative to the application's configured view path.
|
||||
*
|
||||
* @param string $path
|
||||
* @return string
|
||||
*/
|
||||
protected static function getViewPath($path)
|
||||
{
|
||||
return implode(DIRECTORY_SEPARATOR, [
|
||||
config('view.paths')[0] ?? resource_path('views'), $path,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
<?php
|
||||
|
||||
namespace Laravel\Ui\Presets;
|
||||
|
||||
use Illuminate\Filesystem\Filesystem;
|
||||
use Illuminate\Support\Arr;
|
||||
|
||||
class Vue extends Preset
|
||||
{
|
||||
/**
|
||||
* Install the preset.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function install()
|
||||
{
|
||||
static::ensureComponentDirectoryExists();
|
||||
static::updatePackages();
|
||||
static::updateViteConfiguration();
|
||||
static::updateBootstrapping();
|
||||
static::updateComponent();
|
||||
static::removeNodeModules();
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the given package array.
|
||||
*
|
||||
* @param array $packages
|
||||
* @return array
|
||||
*/
|
||||
protected static function updatePackageArray(array $packages)
|
||||
{
|
||||
return [
|
||||
'@vitejs/plugin-vue' => '^4.5.0',
|
||||
'vue' => '^3.2.37',
|
||||
] + Arr::except($packages, [
|
||||
'@vitejs/plugin-react',
|
||||
'react',
|
||||
'react-dom',
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the Vite configuration.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected static function updateViteConfiguration()
|
||||
{
|
||||
copy(__DIR__.'/vue-stubs/vite.config.js', base_path('vite.config.js'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the example component.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected static function updateComponent()
|
||||
{
|
||||
(new Filesystem)->delete(
|
||||
resource_path('js/components/Example.js')
|
||||
);
|
||||
|
||||
copy(
|
||||
__DIR__.'/vue-stubs/ExampleComponent.vue',
|
||||
resource_path('js/components/ExampleComponent.vue')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the bootstrapping files.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected static function updateBootstrapping()
|
||||
{
|
||||
copy(__DIR__.'/vue-stubs/app.js', resource_path('js/app.js'));
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// Body
|
||||
$body-bg: #f8fafc;
|
||||
|
||||
// Typography
|
||||
$font-family-sans-serif: 'Nunito', sans-serif;
|
||||
$font-size-base: 0.9rem;
|
||||
$line-height-base: 1.6;
|
||||
@@ -0,0 +1,8 @@
|
||||
// Fonts
|
||||
@import url('https://fonts.bunny.net/css?family=Nunito');
|
||||
|
||||
// Variables
|
||||
@import 'variables';
|
||||
|
||||
// Bootstrap
|
||||
@import 'bootstrap/scss/bootstrap';
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
import 'bootstrap';
|
||||
|
||||
/**
|
||||
* We'll load the axios HTTP library which allows us to easily issue requests
|
||||
* to our Laravel back-end. This library automatically handles sending the
|
||||
* CSRF token as a header based on the value of the "XSRF" token cookie.
|
||||
*/
|
||||
|
||||
import axios from 'axios';
|
||||
window.axios = axios;
|
||||
|
||||
window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
|
||||
|
||||
/**
|
||||
* Echo exposes an expressive API for subscribing to channels and listening
|
||||
* for events that are broadcast by Laravel. Echo and event broadcasting
|
||||
* allows your team to easily build robust real-time web applications.
|
||||
*/
|
||||
|
||||
// import Echo from 'laravel-echo';
|
||||
|
||||
// import Pusher from 'pusher-js';
|
||||
// window.Pusher = Pusher;
|
||||
|
||||
// window.Echo = new Echo({
|
||||
// broadcaster: 'pusher',
|
||||
// key: import.meta.env.VITE_PUSHER_APP_KEY,
|
||||
// cluster: import.meta.env.VITE_PUSHER_APP_CLUSTER ?? 'mt1',
|
||||
// wsHost: import.meta.env.VITE_PUSHER_HOST ?? `ws-${import.meta.env.VITE_PUSHER_APP_CLUSTER}.pusher.com`,
|
||||
// wsPort: import.meta.env.VITE_PUSHER_PORT ?? 80,
|
||||
// wssPort: import.meta.env.VITE_PUSHER_PORT ?? 443,
|
||||
// forceTLS: (import.meta.env.VITE_PUSHER_SCHEME ?? 'https') === 'https',
|
||||
// enabledTransports: ['ws', 'wss'],
|
||||
// });
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
import { defineConfig } from 'vite';
|
||||
import laravel from 'laravel-vite-plugin';
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [
|
||||
laravel({
|
||||
input: [
|
||||
'resources/sass/app.scss',
|
||||
'resources/js/app.js',
|
||||
],
|
||||
refresh: true,
|
||||
}),
|
||||
],
|
||||
});
|
||||
@@ -0,0 +1,30 @@
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom/client';
|
||||
|
||||
function Example() {
|
||||
return (
|
||||
<div className="container">
|
||||
<div className="row justify-content-center">
|
||||
<div className="col-md-8">
|
||||
<div className="card">
|
||||
<div className="card-header">Example Component</div>
|
||||
|
||||
<div className="card-body">I'm an example component!</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default Example;
|
||||
|
||||
if (document.getElementById('example')) {
|
||||
const Index = ReactDOM.createRoot(document.getElementById("example"));
|
||||
|
||||
Index.render(
|
||||
<React.StrictMode>
|
||||
<Example/>
|
||||
</React.StrictMode>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
/**
|
||||
* First we will load all of this project's JavaScript dependencies which
|
||||
* includes React and other helpers. It's a great starting point while
|
||||
* building robust, powerful web applications using React + Laravel.
|
||||
*/
|
||||
|
||||
import './bootstrap';
|
||||
|
||||
/**
|
||||
* Next, we will create a fresh React component instance and attach it to
|
||||
* the page. Then, you may begin adding components to this application
|
||||
* or customize the JavaScript scaffolding to fit your unique needs.
|
||||
*/
|
||||
|
||||
import './components/Example';
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
import { defineConfig } from 'vite';
|
||||
import laravel from 'laravel-vite-plugin';
|
||||
import react from '@vitejs/plugin-react';
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [
|
||||
laravel({
|
||||
input: [
|
||||
'resources/sass/app.scss',
|
||||
'resources/js/app.js',
|
||||
],
|
||||
refresh: true,
|
||||
}),
|
||||
react(),
|
||||
],
|
||||
});
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
<template>
|
||||
<div class="container">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-8">
|
||||
<div class="card">
|
||||
<div class="card-header">Example Component</div>
|
||||
|
||||
<div class="card-body">
|
||||
I'm an example component.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
mounted() {
|
||||
console.log('Component mounted.')
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
* First we will load all of this project's JavaScript dependencies which
|
||||
* includes Vue and other libraries. It is a great starting point when
|
||||
* building robust, powerful web applications using Vue and Laravel.
|
||||
*/
|
||||
|
||||
import './bootstrap';
|
||||
import { createApp } from 'vue';
|
||||
|
||||
/**
|
||||
* Next, we will create a fresh Vue application instance. You may then begin
|
||||
* registering components with the application instance so they are ready
|
||||
* to use in your application's views. An example is included for you.
|
||||
*/
|
||||
|
||||
const app = createApp({});
|
||||
|
||||
import ExampleComponent from './components/ExampleComponent.vue';
|
||||
app.component('example-component', ExampleComponent);
|
||||
|
||||
/**
|
||||
* The following block of code may be used to automatically register your
|
||||
* Vue components. It will recursively scan this directory for the Vue
|
||||
* components and automatically register them with their "basename".
|
||||
*
|
||||
* Eg. ./components/ExampleComponent.vue -> <example-component></example-component>
|
||||
*/
|
||||
|
||||
// Object.entries(import.meta.glob('./**/*.vue', { eager: true })).forEach(([path, definition]) => {
|
||||
// app.component(path.split('/').pop().replace(/\.\w+$/, ''), definition.default);
|
||||
// });
|
||||
|
||||
/**
|
||||
* Finally, we will attach the application instance to a HTML element with
|
||||
* an "id" attribute of "app". This element is included with the "auth"
|
||||
* scaffolding. Otherwise, you will need to add an element yourself.
|
||||
*/
|
||||
|
||||
app.mount('#app');
|
||||
@@ -0,0 +1,28 @@
|
||||
import { defineConfig } from 'vite';
|
||||
import laravel from 'laravel-vite-plugin';
|
||||
import vue from '@vitejs/plugin-vue';
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [
|
||||
laravel({
|
||||
input: [
|
||||
'resources/sass/app.scss',
|
||||
'resources/js/app.js',
|
||||
],
|
||||
refresh: true,
|
||||
}),
|
||||
vue({
|
||||
template: {
|
||||
transformAssetUrls: {
|
||||
base: null,
|
||||
includeAbsolute: false,
|
||||
},
|
||||
},
|
||||
}),
|
||||
],
|
||||
resolve: {
|
||||
alias: {
|
||||
vue: 'vue/dist/vue.esm-bundler.js',
|
||||
},
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,91 @@
|
||||
<?php
|
||||
|
||||
namespace Laravel\Ui;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use InvalidArgumentException;
|
||||
|
||||
class UiCommand extends Command
|
||||
{
|
||||
/**
|
||||
* The console command signature.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'ui
|
||||
{ type : The preset type (bootstrap, vue, react) }
|
||||
{ --auth : Install authentication UI scaffolding }
|
||||
{ --option=* : Pass an option to the preset command }';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Swap the front-end scaffolding for the application';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
if (static::hasMacro($this->argument('type'))) {
|
||||
return call_user_func(static::$macros[$this->argument('type')], $this);
|
||||
}
|
||||
|
||||
if (! in_array($this->argument('type'), ['bootstrap', 'vue', 'react'])) {
|
||||
throw new InvalidArgumentException('Invalid preset.');
|
||||
}
|
||||
|
||||
if ($this->option('auth')) {
|
||||
$this->call('ui:auth');
|
||||
}
|
||||
|
||||
$this->{$this->argument('type')}();
|
||||
}
|
||||
|
||||
/**
|
||||
* Install the "bootstrap" preset.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function bootstrap()
|
||||
{
|
||||
Presets\Bootstrap::install();
|
||||
|
||||
$this->components->info('Bootstrap scaffolding installed successfully.');
|
||||
$this->components->warn('Please run [npm install && npm run dev] to compile your fresh scaffolding.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Install the "vue" preset.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function vue()
|
||||
{
|
||||
Presets\Bootstrap::install();
|
||||
Presets\Vue::install();
|
||||
|
||||
$this->components->info('Vue scaffolding installed successfully.');
|
||||
$this->components->warn('Please run [npm install && npm run dev] to compile your fresh scaffolding.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Install the "react" preset.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function react()
|
||||
{
|
||||
Presets\Bootstrap::install();
|
||||
Presets\React::install();
|
||||
|
||||
$this->components->info('React scaffolding installed successfully.');
|
||||
$this->components->warn('Please run [npm install && npm run dev] to compile your fresh scaffolding.');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace Laravel\Ui;
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class UiServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Register the package services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
if ($this->app->runningInConsole()) {
|
||||
$this->commands([
|
||||
AuthCommand::class,
|
||||
ControllersCommand::class,
|
||||
UiCommand::class,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Bootstrap any application services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
Route::mixin(new AuthRouteMethods);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user