Compare commits
10 Commits
d662328903
...
844d509834
Author | SHA1 | Date | |
---|---|---|---|
844d509834 | |||
f458bb19c5 | |||
76d43a81c8 | |||
b3d5bf05a9 | |||
f0ec35f463 | |||
326b1dcfc5 | |||
b6b036e06d | |||
e7ac329d24 | |||
648d941893 | |||
59dc825bf7 |
@ -1,12 +1,13 @@
|
|||||||
|
APP_DEBUG=false
|
||||||
APP_NAME=OSB
|
APP_NAME=OSB
|
||||||
APP_NAME_HTML_LONG="<b>Graytech</b>Hosting"
|
APP_NAME_HTML_LONG="<b>Graytech</b>Hosting"
|
||||||
APP_NAME_HTML_SHORT="<b>G</b>H"
|
APP_NAME_HTML_SHORT="<b>G</b>H"
|
||||||
APP_ENV=production
|
APP_ENV=production
|
||||||
APP_KEY=
|
APP_KEY=
|
||||||
APP_DEBUG=false
|
APP_TIMEZONE=Australia/Melbourne
|
||||||
APP_URL=https://www.graytech.net.au
|
APP_URL=https://www.graytech.net.au
|
||||||
|
|
||||||
LOG_CHANNEL=stack
|
LOG_CHANNEL=daily
|
||||||
|
|
||||||
DB_CONNECTION=pgsql
|
DB_CONNECTION=pgsql
|
||||||
DB_HOST=postgres
|
DB_HOST=postgres
|
||||||
@ -17,7 +18,7 @@ DB_PASSWORD=
|
|||||||
DB_SCHEMA=billing
|
DB_SCHEMA=billing
|
||||||
|
|
||||||
BROADCAST_DRIVER=log
|
BROADCAST_DRIVER=log
|
||||||
CACHE_DRIVER=file
|
CACHE_STORE=file
|
||||||
SESSION_DRIVER=file
|
SESSION_DRIVER=file
|
||||||
SESSION_LIFETIME=120
|
SESSION_LIFETIME=120
|
||||||
QUEUE_CONNECTION=database
|
QUEUE_CONNECTION=database
|
||||||
@ -26,7 +27,7 @@ REDIS_HOST=127.0.0.1
|
|||||||
REDIS_PASSWORD=null
|
REDIS_PASSWORD=null
|
||||||
REDIS_PORT=6379
|
REDIS_PORT=6379
|
||||||
|
|
||||||
MAIL_DRIVER=smtp
|
MAIL_MAILER=smtp
|
||||||
MAIL_HOST=smtp
|
MAIL_HOST=smtp
|
||||||
MAIL_PORT=25
|
MAIL_PORT=25
|
||||||
MAIL_USERNAME=null
|
MAIL_USERNAME=null
|
||||||
|
@ -35,15 +35,17 @@ class InvoiceEmail extends Command
|
|||||||
|
|
||||||
$o = Invoice::findOrFail($this->argument('id'));
|
$o = Invoice::findOrFail($this->argument('id'));
|
||||||
|
|
||||||
Mail::to($o->account->user->email)->send(new \App\Mail\InvoiceEmail($o));
|
$result = Mail::to($o->account->user->email)->send(new \App\Mail\InvoiceEmail($o));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$o->print_status = TRUE;
|
$o->print_status = TRUE;
|
||||||
$o->reminders = $o->reminders('send');
|
//$o->reminders = $o->reminders('send');
|
||||||
$o->save();
|
$o->save();
|
||||||
|
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
dd($e);
|
dd($e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dump($result->getDebug());
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,46 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Console;
|
|
||||||
|
|
||||||
use Illuminate\Console\Scheduling\Schedule;
|
|
||||||
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
|
|
||||||
|
|
||||||
use App\Jobs\BroadbandTraffic;
|
|
||||||
use App\Models\Supplier;
|
|
||||||
|
|
||||||
class Kernel extends ConsoleKernel
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* The Artisan commands provided by your application.
|
|
||||||
*
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
protected $commands = [
|
|
||||||
//
|
|
||||||
];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Define the application's command schedule.
|
|
||||||
*
|
|
||||||
* @param \Illuminate\Console\Scheduling\Schedule $schedule
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
protected function schedule(Schedule $schedule)
|
|
||||||
{
|
|
||||||
// @todo This needs to be more generic and dynamic
|
|
||||||
// Exetel Traffic
|
|
||||||
$schedule->job(new BroadbandTraffic(Supplier::find(1)))->timezone('Australia/Melbourne')->dailyAt('10:00');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Register the commands for the application.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
protected function commands()
|
|
||||||
{
|
|
||||||
$this->load(__DIR__.'/Commands');
|
|
||||||
|
|
||||||
require base_path('routes/console.php');
|
|
||||||
}
|
|
||||||
}
|
|
@ -4,8 +4,7 @@ namespace App\Http\Controllers;
|
|||||||
|
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
|
|
||||||
use App\Models\ProviderOauth;
|
use App\Models\{ProviderOauth,User};
|
||||||
use App\Models\User;
|
|
||||||
|
|
||||||
class AccountingController extends Controller
|
class AccountingController extends Controller
|
||||||
{
|
{
|
||||||
@ -32,8 +31,8 @@ class AccountingController extends Controller
|
|||||||
$api = $to->API();
|
$api = $to->API();
|
||||||
|
|
||||||
return $api->getItems()
|
return $api->getItems()
|
||||||
->pluck('pid','Id')
|
->pluck('pid','Id')
|
||||||
->transform(function($item,$value) { return ['id'=>$value,'value'=>$item]; })
|
->transform(function($item,$value) { return ['id'=>$value,'value'=>$item]; })
|
||||||
->values();
|
->values();
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -13,9 +13,7 @@ use App\Models\{Account,
|
|||||||
Payment,
|
Payment,
|
||||||
PaymentItem,
|
PaymentItem,
|
||||||
Service,
|
Service,
|
||||||
SiteDetail,
|
SiteDetail};
|
||||||
Supplier,
|
|
||||||
SupplierDetail};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The AdminController governs all routes that are prefixed with 'a/'.
|
* The AdminController governs all routes that are prefixed with 'a/'.
|
||||||
@ -27,7 +25,8 @@ class AdminController extends Controller
|
|||||||
// @todo Move to reseller
|
// @todo Move to reseller
|
||||||
public function service(Service $o)
|
public function service(Service $o)
|
||||||
{
|
{
|
||||||
return View('a.service',['o'=>$o]);
|
return view('theme.backend.adminlte.a.service')
|
||||||
|
->with('o',$o);
|
||||||
}
|
}
|
||||||
|
|
||||||
// @todo Move to reseller
|
// @todo Move to reseller
|
||||||
@ -55,18 +54,19 @@ class AdminController extends Controller
|
|||||||
$o->forceFill($request->only(['account_id','charge_at','service_id','quantity','amount','sweep_type','type','taxable','description']));
|
$o->forceFill($request->only(['account_id','charge_at','service_id','quantity','amount','sweep_type','type','taxable','description']));
|
||||||
$o->save();
|
$o->save();
|
||||||
|
|
||||||
return redirect()->back()
|
return redirect()
|
||||||
|
->back()
|
||||||
->with('success','Charge recorded: '.$o->id);
|
->with('success','Charge recorded: '.$o->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
return view('a.charge.addedit')
|
return view('theme.backend.adminlte.a.charge.addedit')
|
||||||
->with('o',$o);
|
->with('o',$o);
|
||||||
}
|
}
|
||||||
|
|
||||||
// @todo Move to reseller
|
// @todo Move to reseller
|
||||||
public function charge_pending_account(Request $request,Account $o)
|
public function charge_pending_account(Request $request,Account $o)
|
||||||
{
|
{
|
||||||
return view('a.charge.widgets.pending')
|
return view('theme.backend.adminlte.a.charge.widgets.pending')
|
||||||
->with('list',$o->charges->where('active',TRUE)->where('processed',NULL)->except($request->exclude));
|
->with('list',$o->charges->where('active',TRUE)->where('processed',NULL)->except($request->exclude));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -78,7 +78,7 @@ class AdminController extends Controller
|
|||||||
// @todo Move to reseller
|
// @todo Move to reseller
|
||||||
public function charge_unprocessed()
|
public function charge_unprocessed()
|
||||||
{
|
{
|
||||||
return view('a.charge.unprocessed');
|
return view('theme.backend.adminlte.a.charge.unprocessed');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -148,11 +148,12 @@ class AdminController extends Controller
|
|||||||
$o->items()->save($oo);
|
$o->items()->save($oo);
|
||||||
}
|
}
|
||||||
|
|
||||||
return redirect()->back()
|
return redirect()
|
||||||
|
->back()
|
||||||
->with('success','Payment recorded: '.$o->id);
|
->with('success','Payment recorded: '.$o->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
return view('a.payment.addedit')
|
return view('theme.backend.adminlte.a.payment.addedit')
|
||||||
->with('o',$o);
|
->with('o',$o);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -164,7 +165,7 @@ class AdminController extends Controller
|
|||||||
// @todo Move to reseller
|
// @todo Move to reseller
|
||||||
public function pay_unapplied()
|
public function pay_unapplied()
|
||||||
{
|
{
|
||||||
return view('a.payment.unapplied');
|
return view('theme.backend.adminlte.a.payment.unapplied');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -177,7 +178,7 @@ class AdminController extends Controller
|
|||||||
// @todo Move to reseller
|
// @todo Move to reseller
|
||||||
public function pay_invoices(Request $request,Account $o)
|
public function pay_invoices(Request $request,Account $o)
|
||||||
{
|
{
|
||||||
return view('a.payment.widgets.invoices')
|
return view('theme.backend.adminlte.a.payment.widgets.invoices')
|
||||||
->with('pid',$request->pid)
|
->with('pid',$request->pid)
|
||||||
->with('o',$o);
|
->with('o',$o);
|
||||||
}
|
}
|
||||||
@ -238,10 +239,11 @@ class AdminController extends Controller
|
|||||||
$site->details()->save($oo);
|
$site->details()->save($oo);
|
||||||
}
|
}
|
||||||
|
|
||||||
return redirect()->back()
|
return redirect()
|
||||||
|
->back()
|
||||||
->with('success','Settings saved');
|
->with('success','Settings saved');
|
||||||
}
|
}
|
||||||
|
|
||||||
return view('a.setup');
|
return view('theme.backend.adminlte.theme.backend.adminlte.a.setup');
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -4,8 +4,6 @@ namespace App\Http\Controllers\Auth;
|
|||||||
|
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
|
use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
|
||||||
use Illuminate\Http\Request;
|
|
||||||
use Illuminate\Support\Facades\Password;
|
|
||||||
|
|
||||||
class ForgotPasswordController extends Controller
|
class ForgotPasswordController extends Controller
|
||||||
{
|
{
|
||||||
@ -21,29 +19,4 @@ class ForgotPasswordController extends Controller
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
use SendsPasswordResetEmails;
|
use SendsPasswordResetEmails;
|
||||||
|
|
||||||
public function showLinkRequestForm()
|
|
||||||
{
|
|
||||||
return view('adminlte::auth.passwords.email');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function sendResetLinkEmail(Request $request)
|
|
||||||
{
|
|
||||||
$this->validateEmail($request);
|
|
||||||
|
|
||||||
// If the account is not active, or doesnt exist, we'll send a fake "sent" message.
|
|
||||||
if (! ($x=$this->broker()->getUser($this->credentials($request))) || (! $x->active))
|
|
||||||
return $this->sendResetLinkResponse($request, Password::RESET_LINK_SENT);
|
|
||||||
|
|
||||||
// We will send the password reset link to this user. Once we have attempted
|
|
||||||
// to send the link, we will examine the response then see the message we
|
|
||||||
// need to show to the user. Finally, we'll send out a proper response.
|
|
||||||
$response = $this->broker()->sendResetLink(
|
|
||||||
$this->credentials($request)
|
|
||||||
);
|
|
||||||
|
|
||||||
return $response == Password::RESET_LINK_SENT
|
|
||||||
? $this->sendResetLinkResponse($request, $response)
|
|
||||||
: $this->sendResetLinkFailedResponse($request, $response);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -3,8 +3,6 @@
|
|||||||
namespace App\Http\Controllers\Auth;
|
namespace App\Http\Controllers\Auth;
|
||||||
|
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Providers\RouteServiceProvider;
|
|
||||||
use Carbon\Carbon;
|
|
||||||
use Illuminate\Foundation\Auth\AuthenticatesUsers;
|
use Illuminate\Foundation\Auth\AuthenticatesUsers;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
@ -12,35 +10,36 @@ use Illuminate\Support\Facades\Schema;
|
|||||||
|
|
||||||
class LoginController extends Controller
|
class LoginController extends Controller
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
| Login Controller
|
| Login Controller
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
|
||||||
| This controller handles authenticating users for the application and
|
| This controller handles authenticating users for the application and
|
||||||
| redirecting them to your home screen. The controller uses a trait
|
| redirecting them to your home screen. The controller uses a trait
|
||||||
| to conveniently provide its functionality to your applications.
|
| to conveniently provide its functionality to your applications.
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use AuthenticatesUsers;
|
use AuthenticatesUsers;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Where to redirect users after login.
|
* Where to redirect users after login.
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $redirectTo = RouteServiceProvider::HOME;
|
protected $redirectTo = '/home';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new controller instance.
|
* Create a new controller instance.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->middleware('guest')->except('logout');
|
$this->middleware('auth')
|
||||||
}
|
->only('logout');
|
||||||
|
}
|
||||||
|
|
||||||
public function login(Request $request)
|
public function login(Request $request)
|
||||||
{
|
{
|
||||||
@ -73,6 +72,7 @@ class LoginController extends Controller
|
|||||||
if (file_exists('login_note.txt'))
|
if (file_exists('login_note.txt'))
|
||||||
$login_note = file_get_contents('login_note.txt');
|
$login_note = file_get_contents('login_note.txt');
|
||||||
|
|
||||||
return view('adminlte::auth.login')->with('login_note',$login_note);
|
return view('adminlte::auth.login')
|
||||||
|
->with('login_note',$login_note);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,89 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Http\Controllers\Auth;
|
|
||||||
|
|
||||||
use App\Http\Controllers\Controller;
|
|
||||||
use App\Providers\RouteServiceProvider;
|
|
||||||
use App\Models\User;
|
|
||||||
use Illuminate\Foundation\Auth\RegistersUsers;
|
|
||||||
use Illuminate\Support\Facades\Hash;
|
|
||||||
use Illuminate\Support\Facades\Validator;
|
|
||||||
|
|
||||||
class RegisterController extends Controller
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| Register Controller
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| This controller handles the registration of new users as well as their
|
|
||||||
| validation and creation. By default this controller uses a trait to
|
|
||||||
| provide this functionality without requiring any additional code.
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
use RegistersUsers;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Where to redirect users after registration.
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
protected $redirectTo = RouteServiceProvider::HOME;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new controller instance.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function __construct()
|
|
||||||
{
|
|
||||||
$this->middleware('guest');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a validator for an incoming registration request.
|
|
||||||
*
|
|
||||||
* @param array $data
|
|
||||||
* @return \Illuminate\Contracts\Validation\Validator
|
|
||||||
*/
|
|
||||||
protected function validator(array $data)
|
|
||||||
{
|
|
||||||
return Validator::make($data, [
|
|
||||||
'name' => ['required', 'string', 'min:3', 'max:255'],
|
|
||||||
'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
|
|
||||||
'password' => ['required', 'string', 'min:8', 'confirmed'],
|
|
||||||
'token' => 'required|doorman:email',
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new user instance after a valid registration.
|
|
||||||
*
|
|
||||||
* @param array $data
|
|
||||||
* @return User
|
|
||||||
*/
|
|
||||||
protected function create(array $data): User
|
|
||||||
{
|
|
||||||
$fields = [
|
|
||||||
'name' => $data['name'],
|
|
||||||
'email' => $data['email'],
|
|
||||||
'password' => Hash::make($data['password']),
|
|
||||||
];
|
|
||||||
|
|
||||||
if (config('auth.providers.users.field','email') === 'username' && isset($data['username'])) {
|
|
||||||
$fields['username'] = $data['username'];
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
Doorman::redeem($data['token'],$data['email']);
|
|
||||||
|
|
||||||
// @todo Want to direct or display an appropriate error message (although the form validation does it anyway).
|
|
||||||
} catch (DoormanException $e) {
|
|
||||||
redirect('/error');
|
|
||||||
abort(403);
|
|
||||||
}
|
|
||||||
|
|
||||||
return User::create($fields);
|
|
||||||
}
|
|
||||||
}
|
|
@ -3,9 +3,7 @@
|
|||||||
namespace App\Http\Controllers\Auth;
|
namespace App\Http\Controllers\Auth;
|
||||||
|
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Providers\RouteServiceProvider;
|
|
||||||
use Illuminate\Foundation\Auth\ResetsPasswords;
|
use Illuminate\Foundation\Auth\ResetsPasswords;
|
||||||
use Illuminate\Http\Request;
|
|
||||||
|
|
||||||
class ResetPasswordController extends Controller
|
class ResetPasswordController extends Controller
|
||||||
{
|
{
|
||||||
@ -27,22 +25,5 @@ class ResetPasswordController extends Controller
|
|||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $redirectTo = RouteServiceProvider::HOME;
|
protected $redirectTo = '/home';
|
||||||
|
}
|
||||||
/**
|
|
||||||
* Create a new controller instance.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function __construct()
|
|
||||||
{
|
|
||||||
$this->middleware('guest');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function showResetForm(Request $request, $token = null)
|
|
||||||
{
|
|
||||||
return view('adminlte::auth.passwords.reset')->with(
|
|
||||||
['token' => $token, 'email' => $request->email]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -12,13 +12,13 @@ use Laravel\Socialite\Facades\Socialite;
|
|||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Mail\SocialLink;
|
use App\Mail\SocialLink;
|
||||||
use App\Models\{ProviderOauth,ProviderToken,User,UserOauth};
|
use App\Models\{ProviderOauth,ProviderToken,User,UserOauth};
|
||||||
use App\Providers\RouteServiceProvider;
|
|
||||||
|
|
||||||
class SocialLoginController extends Controller
|
class SocialLoginController extends Controller
|
||||||
{
|
{
|
||||||
public function redirectToProvider($provider)
|
public function redirectToProvider($provider)
|
||||||
{
|
{
|
||||||
return Socialite::with($provider)->redirect();
|
return Socialite::with($provider)
|
||||||
|
->redirect();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function handleProviderCallback($provider)
|
public function handleProviderCallback($provider)
|
||||||
@ -77,7 +77,8 @@ class SocialLoginController extends Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return redirect()->intended(RouteServiceProvider::HOME);
|
return redirect()
|
||||||
|
->intended('/home');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function handleBearerTokenCallback($provider)
|
public function handleBearerTokenCallback($provider)
|
||||||
@ -101,7 +102,7 @@ class SocialLoginController extends Controller
|
|||||||
$po->tokens()->save($uoo);
|
$po->tokens()->save($uoo);
|
||||||
|
|
||||||
return redirect()
|
return redirect()
|
||||||
->intended(RouteServiceProvider::HOME)
|
->intended('/home')
|
||||||
->with('success','Token refreshed.');
|
->with('success','Token refreshed.');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -141,8 +142,9 @@ class SocialLoginController extends Controller
|
|||||||
|
|
||||||
$aoo->user_id = $uo->id;
|
$aoo->user_id = $uo->id;
|
||||||
$aoo->save();
|
$aoo->save();
|
||||||
Auth::login($uo,FALSE);
|
Auth::login($uo);
|
||||||
|
|
||||||
return redirect()->intended(RouteServiceProvider::HOME);
|
return redirect()
|
||||||
|
->intended('/home');
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -33,7 +33,8 @@ class CheckoutController extends Controller
|
|||||||
return redirect()->back()->withErrors($e->getMessage())->withInput();
|
return redirect()->back()->withErrors($e->getMessage())->withInput();
|
||||||
}
|
}
|
||||||
|
|
||||||
return redirect()->back()
|
return redirect()
|
||||||
|
->back()
|
||||||
->with('success','Payment saved');
|
->with('success','Payment saved');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -44,9 +45,10 @@ class CheckoutController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (! $request->session()->get('invoice.cart'))
|
if (! $request->session()->get('invoice.cart'))
|
||||||
return redirect()->to('u/home');
|
return redirect()
|
||||||
|
->to('u/home');
|
||||||
|
|
||||||
return View('u.invoice.cart')
|
return view('theme.backend.adminlte.u.invoice.cart')
|
||||||
->with('invoices',Invoice::find(array_values($request->session()->get('invoice.cart'))));
|
->with('invoices',Invoice::find(array_values($request->session()->get('invoice.cart'))));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,7 +64,7 @@ class CheckoutController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function home(): View
|
public function home(): View
|
||||||
{
|
{
|
||||||
return View('payment.home');
|
return view('theme.backend.adminlte.payment.home');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function pay(Request $request,Checkout $o)
|
public function pay(Request $request,Checkout $o)
|
||||||
@ -78,6 +80,6 @@ class CheckoutController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function view(Checkout $o): View
|
public function view(Checkout $o): View
|
||||||
{
|
{
|
||||||
return View('payment.view',['o'=>$o]);
|
return view('theme.backend.adminlte.payment.view',['o'=>$o]);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -3,11 +3,9 @@
|
|||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
||||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
|
||||||
use Illuminate\Foundation\Validation\ValidatesRequests;
|
use Illuminate\Foundation\Validation\ValidatesRequests;
|
||||||
use Illuminate\Routing\Controller as BaseController;
|
|
||||||
|
|
||||||
class Controller extends BaseController
|
abstract class Controller extends \Illuminate\Routing\Controller
|
||||||
{
|
{
|
||||||
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
|
use AuthorizesRequests, ValidatesRequests;
|
||||||
}
|
}
|
@ -31,7 +31,8 @@ class HomeController extends Controller
|
|||||||
if (! $o->exists)
|
if (! $o->exists)
|
||||||
$o = Auth::user();
|
$o = Auth::user();
|
||||||
|
|
||||||
return View('home',['o'=>$o]);
|
return view('theme.backend.adminlte.home')
|
||||||
|
->with(['o'=>$o]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use Clarkeash\Doorman\Exceptions\{ExpiredInviteCode,InvalidInviteCode,NotYourInviteCode};
|
||||||
|
use Clarkeash\Doorman\Facades\Doorman;
|
||||||
use Illuminate\View\View;
|
use Illuminate\View\View;
|
||||||
use Barryvdh\Snappy\Facades\SnappyPdf as PDF;
|
use Barryvdh\Snappy\Facades\SnappyPdf as PDF;
|
||||||
|
|
||||||
@ -25,17 +27,29 @@ class InvoiceController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function pdf(Invoice $o)
|
public function pdf(Invoice $o)
|
||||||
{
|
{
|
||||||
return PDF::loadView('u.invoice.home',['o'=>$o])->stream(sprintf('%s.pdf',$o->sid));
|
return PDF::loadView('theme.backend.adminlte.u.invoice.home',['o'=>$o])
|
||||||
|
->stream(sprintf('%s.pdf',$o->sid));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Render a specific invoice for the user
|
* Render a specific invoice for the user
|
||||||
*
|
*
|
||||||
* @param Invoice $o
|
* @param Invoice $o
|
||||||
|
* @param string|null $code
|
||||||
* @return View
|
* @return View
|
||||||
*/
|
*/
|
||||||
public function view(Invoice $o): View
|
public function view(Invoice $o,string $code=NULL): View
|
||||||
{
|
{
|
||||||
return View('invoice.view',['o'=>$o]);
|
if ($code) {
|
||||||
|
try {
|
||||||
|
Doorman::redeem($code,$o->account->user->email);
|
||||||
|
|
||||||
|
} catch (ExpiredInviteCode|InvalidInviteCode|NotYourInviteCode $e) {
|
||||||
|
abort(404);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return view('theme.backend.adminlte.invoice.view')
|
||||||
|
->with('o',$o);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,27 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Http\Controllers;
|
|
||||||
|
|
||||||
use Image;
|
|
||||||
|
|
||||||
class MediaController extends Controller
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Create a generic image
|
|
||||||
*
|
|
||||||
* @param $width
|
|
||||||
* @param $height
|
|
||||||
* @param string $color
|
|
||||||
* @return mixed
|
|
||||||
*/
|
|
||||||
public function image($width,$height,$color='#ccc') {
|
|
||||||
$io = Image::canvas($width,$height,$color);
|
|
||||||
$io->text(sprintf('IMAGE-%sx%s',$width,$height),$width/2,$height/2,function($font) {
|
|
||||||
$font->file(5);
|
|
||||||
$font->align('center');
|
|
||||||
$font->valign('middle');
|
|
||||||
});
|
|
||||||
|
|
||||||
return $io->response();
|
|
||||||
}
|
|
||||||
}
|
|
@ -3,7 +3,6 @@
|
|||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Igaster\LaravelTheme\Facades\Theme;
|
|
||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
use Illuminate\Support\Facades\Mail;
|
use Illuminate\Support\Facades\Mail;
|
||||||
use Illuminate\Support\Facades\Validator;
|
use Illuminate\Support\Facades\Validator;
|
||||||
@ -23,23 +22,21 @@ class OrderController extends Controller
|
|||||||
// @todo To check
|
// @todo To check
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
return view('order.home');
|
return view('theme.backend.adminlte.order.home');
|
||||||
}
|
}
|
||||||
|
|
||||||
// @todo To check
|
// @todo To check
|
||||||
public function product_order(Product $o)
|
public function product_order(Product $o)
|
||||||
{
|
{
|
||||||
Theme::set('metronic-fe');
|
return view('theme.backend.adminlte.order.widget.order')
|
||||||
|
->with('o',$o);
|
||||||
return view('order.widget.order',['o'=>$o]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// @todo To check
|
// @todo To check
|
||||||
public function product_info(Product $o)
|
public function product_info(Product $o)
|
||||||
{
|
{
|
||||||
Theme::set('metronic-fe');
|
return view('theme.backend.adminlte.order.widget.info')
|
||||||
|
->with('o',$o);
|
||||||
return view('order.widget.info',['o'=>$o]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// @todo To check
|
// @todo To check
|
||||||
@ -122,9 +119,11 @@ class OrderController extends Controller
|
|||||||
$order->save();
|
$order->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @todo Move this email to a config item
|
||||||
Mail::to('help@graytech.net.au')
|
Mail::to('help@graytech.net.au')
|
||||||
->queue((new OrderRequest($so,$request->input('options.notes') ?: ''))->onQueue('email')); //@todo Get email from DB.
|
->queue((new OrderRequest($so,$request->input('options.notes') ?: ''))->onQueue('email')); //@todo Get email from DB.
|
||||||
|
|
||||||
return view('order_received',['o'=>$so]);
|
return view('theme.backend.adminlte.order_received')
|
||||||
|
->with('o',$so);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -85,7 +85,7 @@ class ProductController extends Controller
|
|||||||
if (! $o->exists && $request->name)
|
if (! $o->exists && $request->name)
|
||||||
$o = Product::where('name',$request->name)->firstOrNew();
|
$o = Product::where('name',$request->name)->firstOrNew();
|
||||||
|
|
||||||
return view('product.details')
|
return view('theme.backend.adminlte.product.details')
|
||||||
->with('breadcrumb',collect(['Products'=>url('a/product')]))
|
->with('breadcrumb',collect(['Products'=>url('a/product')]))
|
||||||
->with('o',$o);
|
->with('o',$o);
|
||||||
}
|
}
|
||||||
@ -131,7 +131,8 @@ class ProductController extends Controller
|
|||||||
],
|
],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return redirect()->back()
|
return redirect()
|
||||||
|
->back()
|
||||||
->with('success','Product saved');
|
->with('success','Product saved');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -143,6 +144,6 @@ class ProductController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function home()
|
public function home()
|
||||||
{
|
{
|
||||||
return view('product.home');
|
return view('theme.backend.adminlte.product.home');
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -93,6 +93,8 @@ class SearchController extends Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $result->sortBy(function($item) { return $item['category'].$item['name']; })->values();
|
return $result
|
||||||
|
->sortBy(function($item) { return $item['category'].$item['name']; })
|
||||||
|
->values();
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -114,7 +114,7 @@ class ServiceController extends Controller
|
|||||||
return redirect()->to(url('u/service',[$o->id]));
|
return redirect()->to(url('u/service',[$o->id]));
|
||||||
}
|
}
|
||||||
|
|
||||||
return view('service.change_pending')
|
return view('theme.backend.adminlte.service.change_pending')
|
||||||
->with('breadcrumb',collect()->merge($o->account->breadcrumb))
|
->with('breadcrumb',collect()->merge($o->account->breadcrumb))
|
||||||
->with('o',$o)
|
->with('o',$o)
|
||||||
->with('np',$np);
|
->with('np',$np);
|
||||||
@ -149,7 +149,7 @@ class ServiceController extends Controller
|
|||||||
return redirect('u/service/'.$o->id)->with('success','Cancellation lodged');
|
return redirect('u/service/'.$o->id)->with('success','Cancellation lodged');
|
||||||
}
|
}
|
||||||
|
|
||||||
return view('service.cancel_request')
|
return view('theme.backend.adminlte.service.cancel_request')
|
||||||
->with('o',$o);
|
->with('o',$o);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -258,7 +258,7 @@ class ServiceController extends Controller
|
|||||||
|
|
||||||
switch (get_class($o->type)) {
|
switch (get_class($o->type)) {
|
||||||
default:
|
default:
|
||||||
return view('service.change_request')
|
return view('theme.backend.adminlte.service.change_request')
|
||||||
->with('breadcrumb',collect()->merge($o->account->breadcrumb))
|
->with('breadcrumb',collect()->merge($o->account->breadcrumb))
|
||||||
->with('o',$o);
|
->with('o',$o);
|
||||||
}
|
}
|
||||||
@ -279,7 +279,7 @@ class ServiceController extends Controller
|
|||||||
->with(['service.account','registrar'])
|
->with(['service.account','registrar'])
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
return view('service.domain.list')
|
return view('theme.backend.adminlte.service.domain.list')
|
||||||
->with('o',$o);
|
->with('o',$o);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -293,7 +293,7 @@ class ServiceController extends Controller
|
|||||||
->with(['service.account','service.product.type.supplied.supplier_detail.supplier','tld'])
|
->with(['service.account','service.product.type.supplied.supplier_detail.supplier','tld'])
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
return view('service.email.list')
|
return view('theme.backend.adminlte.service.email.list')
|
||||||
->with('o',$o);
|
->with('o',$o);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -305,7 +305,7 @@ class ServiceController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function home(Service $o): View
|
public function home(Service $o): View
|
||||||
{
|
{
|
||||||
return View('service.home')
|
return view('theme.backend.adminlte.service.home')
|
||||||
->with('breadcrumb',collect()->merge($o->account->breadcrumb))
|
->with('breadcrumb',collect()->merge($o->account->breadcrumb))
|
||||||
->with('o',$o);
|
->with('o',$o);
|
||||||
}
|
}
|
||||||
@ -320,7 +320,7 @@ class ServiceController extends Controller
|
|||||||
->with(['service.account','service.product.type.supplied.supplier_detail.supplier','tld'])
|
->with(['service.account','service.product.type.supplied.supplier_detail.supplier','tld'])
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
return view('service.host.list')
|
return view('theme.backend.adminlte.service.host.list')
|
||||||
->with('o',$o);
|
->with('o',$o);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -401,7 +401,7 @@ class ServiceController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function service_change_charges_display(Request $request,Service $o)
|
public function service_change_charges_display(Request $request,Service $o)
|
||||||
{
|
{
|
||||||
return view('a.charge.service_change')
|
return view('theme.backend.adminlte.a.charge.service_change')
|
||||||
->with('charges',$this->service_change_charges($request,$o));
|
->with('charges',$this->service_change_charges($request,$o));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,7 +46,8 @@ class SupplierController extends Controller
|
|||||||
])->filter();
|
])->filter();
|
||||||
$o->detail()->save($oo);
|
$o->detail()->save($oo);
|
||||||
|
|
||||||
return redirect()->back()
|
return redirect()
|
||||||
|
->back()
|
||||||
->with('success','Supplier Saved');
|
->with('success','Supplier Saved');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -60,7 +61,7 @@ class SupplierController extends Controller
|
|||||||
{
|
{
|
||||||
$this->middleware(['auth','wholesaler']);
|
$this->middleware(['auth','wholesaler']);
|
||||||
|
|
||||||
return view('supplier.home');
|
return view('theme.backend.adminlte.supplier.home');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -72,12 +73,14 @@ class SupplierController extends Controller
|
|||||||
public function cost(Cost $o)
|
public function cost(Cost $o)
|
||||||
{
|
{
|
||||||
// @todo Need to add the services that are active that are not on the bill for the supplier.
|
// @todo Need to add the services that are active that are not on the bill for the supplier.
|
||||||
return view('supplier.cost.view',['o'=>$o]);
|
return view('theme.backend.adminlte.supplier.cost.view')
|
||||||
|
->with('o',$o);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function cost_add(Supplier $o)
|
public function cost_add(Supplier $o)
|
||||||
{
|
{
|
||||||
return view('supplier.cost.add',['o'=>$o]);
|
return view('theme.backend.adminlte.supplier.cost.add')
|
||||||
|
->with('o',$o);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function cost_submit(Request $request,Supplier $o)
|
public function cost_submit(Request $request,Supplier $o)
|
||||||
@ -106,7 +109,7 @@ class SupplierController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function product_add()
|
public function product_add()
|
||||||
{
|
{
|
||||||
return view('supplier.product.addedit')
|
return view('theme.backend.adminlte.supplier.product.addedit')
|
||||||
->with('o',new Supplier)
|
->with('o',new Supplier)
|
||||||
->with('oo',NULL);
|
->with('oo',NULL);
|
||||||
}
|
}
|
||||||
@ -176,7 +179,7 @@ class SupplierController extends Controller
|
|||||||
$oo = $o->detail->find($type,$id);
|
$oo = $o->detail->find($type,$id);
|
||||||
$oo->load(['products.product.services.product.type']);
|
$oo->load(['products.product.services.product.type']);
|
||||||
|
|
||||||
return view('supplier.product.addedit')
|
return view('theme.backend.adminlte.supplier.product.addedit')
|
||||||
->with('o',$o)
|
->with('o',$o)
|
||||||
->with('oo',$oo);
|
->with('oo',$oo);
|
||||||
}
|
}
|
||||||
@ -199,7 +202,7 @@ class SupplierController extends Controller
|
|||||||
if ($o)
|
if ($o)
|
||||||
$o->load(['products.product.services']);
|
$o->load(['products.product.services']);
|
||||||
|
|
||||||
return view('supplier.product.widget.'.$type)
|
return view('theme.backend.adminlte.supplier.product.widget.'.$type)
|
||||||
->with('o',$id ? $o : NULL)
|
->with('o',$id ? $o : NULL)
|
||||||
->withErrors($request->errors);
|
->withErrors($request->errors);
|
||||||
}
|
}
|
||||||
@ -214,7 +217,7 @@ class SupplierController extends Controller
|
|||||||
{
|
{
|
||||||
$this->middleware(['auth','wholesaler']);
|
$this->middleware(['auth','wholesaler']);
|
||||||
|
|
||||||
return view('supplier.details')
|
return view('theme.backend.adminlte.supplier.details')
|
||||||
->with('o',$o);
|
->with('o',$o);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -38,6 +38,7 @@ class AccountController extends Controller
|
|||||||
$io->items->push($o);
|
$io->items->push($o);
|
||||||
}
|
}
|
||||||
|
|
||||||
return View('u.invoice.home',['o'=>$io]);
|
return view('theme.backend.adminlte.u.invoice.home')
|
||||||
|
->with('o',$io);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -35,7 +35,9 @@ class UserController extends Controller
|
|||||||
]
|
]
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return redirect()->back()->with('success','Supplier Added');
|
return redirect()
|
||||||
|
->back()
|
||||||
|
->with('success','Supplier Added');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -51,6 +53,8 @@ class UserController extends Controller
|
|||||||
|
|
||||||
$o->suppliers()->detach([$so->id]);
|
$o->suppliers()->detach([$so->id]);
|
||||||
|
|
||||||
return redirect()->back()->with('success','Supplier Deleted');
|
return redirect()
|
||||||
|
->back()
|
||||||
|
->with('success','Supplier Deleted');
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,13 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Http\Controllers;
|
|
||||||
|
|
||||||
use Illuminate\Http\Request;
|
|
||||||
use Illuminate\Support\Facades\Log;
|
|
||||||
|
|
||||||
class WelcomeController extends Controller
|
|
||||||
{
|
|
||||||
public function home() {
|
|
||||||
return view('welcome.home');
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,84 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Http;
|
|
||||||
|
|
||||||
use Illuminate\Foundation\Http\Kernel as HttpKernel;
|
|
||||||
|
|
||||||
class Kernel extends HttpKernel
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* The application's global HTTP middleware stack.
|
|
||||||
*
|
|
||||||
* These middleware are run during every request to your application.
|
|
||||||
*
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
protected $middleware = [
|
|
||||||
\App\Http\Middleware\CheckForMaintenanceMode::class,
|
|
||||||
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
|
|
||||||
\App\Http\Middleware\TrimStrings::class,
|
|
||||||
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
|
|
||||||
\App\Http\Middleware\TrustProxies::class,
|
|
||||||
\App\Http\Middleware\SetSite::class,
|
|
||||||
];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The application's route middleware groups.
|
|
||||||
*
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
protected $middlewareGroups = [
|
|
||||||
'web' => [
|
|
||||||
\App\Http\Middleware\EncryptCookies::class,
|
|
||||||
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
|
|
||||||
\Illuminate\Session\Middleware\StartSession::class,
|
|
||||||
// \Illuminate\Session\Middleware\AuthenticateSession::class,
|
|
||||||
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
|
|
||||||
\App\Http\Middleware\VerifyCsrfToken::class,
|
|
||||||
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
|
||||||
\Laravel\Passport\Http\Middleware\CreateFreshApiToken::class,
|
|
||||||
],
|
|
||||||
|
|
||||||
'api' => [
|
|
||||||
'throttle:60,1',
|
|
||||||
'bindings',
|
|
||||||
],
|
|
||||||
];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The application's route middleware.
|
|
||||||
*
|
|
||||||
* These middleware may be assigned to groups or used individually.
|
|
||||||
*
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
protected $routeMiddleware = [
|
|
||||||
'auth' => \App\Http\Middleware\Authenticate::class,
|
|
||||||
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
|
|
||||||
'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class,
|
|
||||||
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
|
|
||||||
'can' => \Illuminate\Auth\Middleware\Authorize::class,
|
|
||||||
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
|
|
||||||
'role' => \App\Http\Middleware\Role::class,
|
|
||||||
'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
|
|
||||||
'theme' => \Igaster\LaravelTheme\Middleware\setTheme::class,
|
|
||||||
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
|
|
||||||
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
|
|
||||||
];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The priority-sorted list of middleware.
|
|
||||||
*
|
|
||||||
* This forces non-global middleware to always be in the given order.
|
|
||||||
*
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
protected $middlewarePriority = [
|
|
||||||
\Illuminate\Session\Middleware\StartSession::class,
|
|
||||||
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
|
|
||||||
\App\Http\Middleware\Authenticate::class,
|
|
||||||
\Illuminate\Session\Middleware\AuthenticateSession::class,
|
|
||||||
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
|
||||||
\Illuminate\Auth\Middleware\Authorize::class,
|
|
||||||
];
|
|
||||||
}
|
|
@ -1,21 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Http\Middleware;
|
|
||||||
|
|
||||||
use Illuminate\Auth\Middleware\Authenticate as Middleware;
|
|
||||||
|
|
||||||
class Authenticate extends Middleware
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Get the path the user should be redirected to when they are not authenticated.
|
|
||||||
*
|
|
||||||
* @param \Illuminate\Http\Request $request
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
protected function redirectTo($request)
|
|
||||||
{
|
|
||||||
if (! $request->expectsJson()) {
|
|
||||||
return route('login');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,17 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Http\Middleware;
|
|
||||||
|
|
||||||
use Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode as Middleware;
|
|
||||||
|
|
||||||
class CheckForMaintenanceMode extends Middleware
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* The URIs that should be reachable while maintenance mode is enabled.
|
|
||||||
*
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
protected $except = [
|
|
||||||
//
|
|
||||||
];
|
|
||||||
}
|
|
@ -1,17 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Http\Middleware;
|
|
||||||
|
|
||||||
use Illuminate\Cookie\Middleware\EncryptCookies as Middleware;
|
|
||||||
|
|
||||||
class EncryptCookies extends Middleware
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* The names of the cookies that should not be encrypted.
|
|
||||||
*
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
protected $except = [
|
|
||||||
'toggleState',
|
|
||||||
];
|
|
||||||
}
|
|
@ -1,26 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Http\Middleware;
|
|
||||||
|
|
||||||
use Closure;
|
|
||||||
use Illuminate\Support\Facades\Auth;
|
|
||||||
|
|
||||||
class RedirectIfAuthenticated
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Handle an incoming request.
|
|
||||||
*
|
|
||||||
* @param \Illuminate\Http\Request $request
|
|
||||||
* @param \Closure $next
|
|
||||||
* @param string|null $guard
|
|
||||||
* @return mixed
|
|
||||||
*/
|
|
||||||
public function handle($request, Closure $next, $guard = null)
|
|
||||||
{
|
|
||||||
if (Auth::guard($guard)->check()) {
|
|
||||||
return redirect('/home');
|
|
||||||
}
|
|
||||||
|
|
||||||
return $next($request);
|
|
||||||
}
|
|
||||||
}
|
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Http\Middleware;
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
use Closure;
|
use Closure;
|
||||||
|
|
||||||
@ -10,7 +11,7 @@ use Closure;
|
|||||||
*/
|
*/
|
||||||
class Role
|
class Role
|
||||||
{
|
{
|
||||||
public function handle($request, Closure $next, $role)
|
public function handle(Request $request, Closure $next, string $role)
|
||||||
{
|
{
|
||||||
if ($role AND ! Auth::user())
|
if ($role AND ! Auth::user())
|
||||||
abort(403,'Not Authenticated');
|
abort(403,'Not Authenticated');
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Http\Middleware;
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
use Illuminate\Support\Facades\Config;
|
use Illuminate\Support\Facades\Config;
|
||||||
use Illuminate\Support\Facades\View;
|
use Illuminate\Support\Facades\View;
|
||||||
@ -18,13 +19,11 @@ use App\Models\Site;
|
|||||||
class SetSite
|
class SetSite
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Handle an incoming request.
|
* @param Request $request
|
||||||
*
|
* @param Closure $next
|
||||||
* @param \Illuminate\Http\Request $request
|
|
||||||
* @param \Closure $next
|
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function handle($request, Closure $next)
|
public function handle(Request $request,Closure $next)
|
||||||
{
|
{
|
||||||
$so = new Site;
|
$so = new Site;
|
||||||
|
|
||||||
|
@ -1,18 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Http\Middleware;
|
|
||||||
|
|
||||||
use Illuminate\Foundation\Http\Middleware\TrimStrings as Middleware;
|
|
||||||
|
|
||||||
class TrimStrings extends Middleware
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* The names of the attributes that should not be trimmed.
|
|
||||||
*
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
protected $except = [
|
|
||||||
'password',
|
|
||||||
'password_confirmation',
|
|
||||||
];
|
|
||||||
}
|
|
@ -1,28 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Http\Middleware;
|
|
||||||
|
|
||||||
use Illuminate\Http\Request;
|
|
||||||
use Illuminate\Http\Middleware\TrustProxies as Middleware;
|
|
||||||
|
|
||||||
class TrustProxies extends Middleware
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* The trusted proxies for this application.
|
|
||||||
*
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
protected $proxies;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The headers that should be used to detect proxies.
|
|
||||||
*
|
|
||||||
* @var int
|
|
||||||
*/
|
|
||||||
protected $headers =
|
|
||||||
Request::HEADER_X_FORWARDED_FOR |
|
|
||||||
Request::HEADER_X_FORWARDED_HOST |
|
|
||||||
Request::HEADER_X_FORWARDED_PORT |
|
|
||||||
Request::HEADER_X_FORWARDED_PROTO |
|
|
||||||
Request::HEADER_X_FORWARDED_AWS_ELB;
|
|
||||||
}
|
|
@ -1,24 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Http\Middleware;
|
|
||||||
|
|
||||||
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware;
|
|
||||||
|
|
||||||
class VerifyCsrfToken extends Middleware
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Indicates whether the XSRF-TOKEN cookie should be set on the response.
|
|
||||||
*
|
|
||||||
* @var bool
|
|
||||||
*/
|
|
||||||
protected $addHttpCookie = true;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The URIs that should be excluded from CSRF verification.
|
|
||||||
*
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
protected $except = [
|
|
||||||
//
|
|
||||||
];
|
|
||||||
}
|
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Mail;
|
namespace App\Mail;
|
||||||
|
|
||||||
|
use App\Models\Site;
|
||||||
use Illuminate\Bus\Queueable;
|
use Illuminate\Bus\Queueable;
|
||||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
use Illuminate\Mail\Mailable;
|
use Illuminate\Mail\Mailable;
|
||||||
@ -15,6 +16,7 @@ class InvoiceEmail extends Mailable
|
|||||||
use Queueable, SerializesModels;
|
use Queueable, SerializesModels;
|
||||||
|
|
||||||
public $invoice;
|
public $invoice;
|
||||||
|
public $site;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new message instance.
|
* Create a new message instance.
|
||||||
@ -33,10 +35,11 @@ class InvoiceEmail extends Mailable
|
|||||||
*/
|
*/
|
||||||
public function build()
|
public function build()
|
||||||
{
|
{
|
||||||
Config::set('site',$this->invoice->site);
|
Config::set('site',Site::findOrFail($this->invoice->site_id));
|
||||||
|
$this->site = config('site');
|
||||||
|
|
||||||
return $this
|
return $this
|
||||||
->markdown('email.user.invoice')
|
->markdown('email.user.invoice',['site'=>config('site')])
|
||||||
->subject(sprintf( 'Invoice: %s - Total: $%s - Due: %s',
|
->subject(sprintf( 'Invoice: %s - Total: $%s - Due: %s',
|
||||||
$this->invoice->id,
|
$this->invoice->id,
|
||||||
number_format($this->invoice->total,2),
|
number_format($this->invoice->total,2),
|
||||||
|
@ -2,14 +2,14 @@
|
|||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
use Awobaz\Compoships\Compoships;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Support\Collection;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
use Leenooks\Traits\ScopeActive;
|
use Leenooks\Traits\ScopeActive;
|
||||||
|
|
||||||
use App\Models\Scopes\SiteScope;
|
|
||||||
use App\Interfaces\IDs;
|
use App\Interfaces\IDs;
|
||||||
use App\Traits\SiteID;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Account
|
* Class Account
|
||||||
@ -20,12 +20,26 @@ use App\Traits\SiteID;
|
|||||||
* + sid : System ID for account
|
* + sid : System ID for account
|
||||||
* + name : Account Name
|
* + name : Account Name
|
||||||
* + taxes : Taxes Applicable to this account
|
* + taxes : Taxes Applicable to this account
|
||||||
*
|
|
||||||
* @package App\Models
|
|
||||||
*/
|
*/
|
||||||
class Account extends Model implements IDs
|
class Account extends Model implements IDs
|
||||||
{
|
{
|
||||||
use Compoships,HasFactory,ScopeActive,SiteID;
|
use HasFactory,ScopeActive;
|
||||||
|
|
||||||
|
/* STATIC */
|
||||||
|
|
||||||
|
public static function InvoicesCredit(Collection $invoices=NULL): Collection
|
||||||
|
{
|
||||||
|
return (new self)
|
||||||
|
->invoiceSummaryCredit($invoices,TRUE)
|
||||||
|
->get();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function InvoicesDue(Collection $invoices=NULL): Collection
|
||||||
|
{
|
||||||
|
return (new self)
|
||||||
|
->invoiceSummaryDue($invoices,TRUE)
|
||||||
|
->get();
|
||||||
|
}
|
||||||
|
|
||||||
/* INTERFACES */
|
/* INTERFACES */
|
||||||
|
|
||||||
@ -41,13 +55,18 @@ class Account extends Model implements IDs
|
|||||||
|
|
||||||
/* RELATIONS */
|
/* RELATIONS */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Charges assigned to this account
|
||||||
|
*
|
||||||
|
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||||
|
*/
|
||||||
public function charges()
|
public function charges()
|
||||||
{
|
{
|
||||||
return $this->hasMany(Charge::class);
|
return $this->hasMany(Charge::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the country the user belongs to
|
* Country this account belongs to
|
||||||
*/
|
*/
|
||||||
public function country()
|
public function country()
|
||||||
{
|
{
|
||||||
@ -65,28 +84,47 @@ class Account extends Model implements IDs
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return mixed
|
* Invoices created for this account
|
||||||
|
*
|
||||||
* @todo This needs to be optimised, to only return outstanding invoices and invoices for a specific age (eg: 2 years worth)
|
* @todo This needs to be optimised, to only return outstanding invoices and invoices for a specific age (eg: 2 years worth)
|
||||||
*/
|
*/
|
||||||
public function invoices()
|
public function invoices()
|
||||||
{
|
{
|
||||||
return $this->hasMany(Invoice::class)
|
return $this->hasMany(Invoice::class)
|
||||||
->active()
|
|
||||||
->with(['items.taxes','paymentitems.payment']);
|
->with(['items.taxes','paymentitems.payment']);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function language()
|
/**
|
||||||
|
* Relation to only return active invoices
|
||||||
|
*
|
||||||
|
* @todo Only return active invoice_items
|
||||||
|
*/
|
||||||
|
public function invoices_active()
|
||||||
{
|
{
|
||||||
return $this->belongsTo(Language::class);
|
return $this->invoices()
|
||||||
|
->active();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Payments received and assigned to this account
|
||||||
|
*/
|
||||||
public function payments()
|
public function payments()
|
||||||
{
|
{
|
||||||
return $this->hasMany(Payment::class)
|
return $this->hasMany(Payment::class)
|
||||||
->active()
|
|
||||||
->with(['items']);
|
->with(['items']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Relation to only return active payments
|
||||||
|
*
|
||||||
|
* @todo Only return active payment_items
|
||||||
|
*/
|
||||||
|
public function payments_active()
|
||||||
|
{
|
||||||
|
return $this->payments()
|
||||||
|
->active();
|
||||||
|
}
|
||||||
|
|
||||||
public function providers()
|
public function providers()
|
||||||
{
|
{
|
||||||
return $this->belongsToMany(ProviderOauth::class,'account__provider')
|
return $this->belongsToMany(ProviderOauth::class,'account__provider')
|
||||||
@ -94,25 +132,33 @@ class Account extends Model implements IDs
|
|||||||
->withPivot('ref','synctoken','created_at','updated_at');
|
->withPivot('ref','synctoken','created_at','updated_at');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function services($active=FALSE)
|
/**
|
||||||
|
* Services assigned to this account
|
||||||
|
*/
|
||||||
|
public function services()
|
||||||
{
|
{
|
||||||
$query = $this->hasMany(Service::class,['account_id','site_id'],['id','site_id'])
|
return $this->hasMany(Service::class)
|
||||||
->withoutGlobalScope(SiteScope::class)
|
->with(['product.translate','product.type.supplied']);
|
||||||
->with(['product.translate','invoice_items']);
|
|
||||||
|
|
||||||
return $active ? $query->active() : $query;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function site()
|
/**
|
||||||
|
* Relation to only return active services
|
||||||
|
*/
|
||||||
|
public function services_active()
|
||||||
{
|
{
|
||||||
return $this->belongsTo(Site::class);
|
return $this->services()
|
||||||
|
->active();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function taxes()
|
public function taxes()
|
||||||
{
|
{
|
||||||
return $this->hasMany(Tax::class,'country_id','country_id');
|
return $this->hasMany(Tax::class,'country_id','country_id')
|
||||||
|
->select(['id','zone','rate','country_id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* User that owns this account
|
||||||
|
*/
|
||||||
public function user()
|
public function user()
|
||||||
{
|
{
|
||||||
return $this->belongsTo(User::class);
|
return $this->belongsTo(User::class);
|
||||||
@ -149,30 +195,27 @@ class Account extends Model implements IDs
|
|||||||
* Get the address for the account
|
* Get the address for the account
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
|
* @todo Change this to return a collection
|
||||||
*/
|
*/
|
||||||
public function getAddressAttribute(): array
|
public function getAddressAttribute(): array
|
||||||
{
|
{
|
||||||
return [
|
return collect([
|
||||||
$this->address1,
|
'address1' => $this->address1,
|
||||||
$this->address2,
|
'address2' => $this->address2,
|
||||||
sprintf('%s %s %s',$this->city.(($this->state OR $this->zip) ? ',' : ''),$this->state,$this->zip)
|
'location' => sprintf('%s %s %s',
|
||||||
];
|
$this->city.(($this->state || $this->zip) ? ',' : ''),
|
||||||
}
|
$this->state,
|
||||||
|
$this->zip)
|
||||||
/**
|
])
|
||||||
* Account breadcrumb to render on pages
|
->filter()
|
||||||
*
|
->values()
|
||||||
* @return array
|
->toArray();
|
||||||
*/
|
|
||||||
public function getBreadcrumbAttribute(): array
|
|
||||||
{
|
|
||||||
return [$this->name => url('u/home',$this->user_id)];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the account name
|
* Return the account name
|
||||||
*
|
*
|
||||||
* @return mixed|string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getNameAttribute(): string
|
public function getNameAttribute(): string
|
||||||
{
|
{
|
||||||
@ -184,7 +227,7 @@ class Account extends Model implements IDs
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getTypeAttribute()
|
public function getTypeAttribute(): string
|
||||||
{
|
{
|
||||||
return $this->company ? 'Business' : 'Private';
|
return $this->company ? 'Business' : 'Private';
|
||||||
}
|
}
|
||||||
@ -195,6 +238,7 @@ class Account extends Model implements IDs
|
|||||||
* Get the due invoices on an account
|
* Get the due invoices on an account
|
||||||
*
|
*
|
||||||
* @return mixed
|
* @return mixed
|
||||||
|
* @deprecated use invoiceSummary->filter(_balance > 0)
|
||||||
*/
|
*/
|
||||||
public function dueInvoices()
|
public function dueInvoices()
|
||||||
{
|
{
|
||||||
@ -203,6 +247,90 @@ class Account extends Model implements IDs
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List of invoices (summary) for this account
|
||||||
|
*
|
||||||
|
* @param Collection|NULL $invoices
|
||||||
|
* @return Collection
|
||||||
|
*/
|
||||||
|
public function invoiceSummary(Collection $invoices=NULL,bool $all=FALSE): Builder
|
||||||
|
{
|
||||||
|
return (new Invoice)
|
||||||
|
->select([
|
||||||
|
'invoices.account_id',
|
||||||
|
'invoices.id as id',
|
||||||
|
DB::raw('SUM(item) AS _item'),
|
||||||
|
DB::raw('SUM(tax) AS _tax'),
|
||||||
|
DB::raw('SUM(payments) AS _payment'),
|
||||||
|
DB::raw('SUM(discount)+COALESCE(invoices.discount_amt,0) AS _discount'),
|
||||||
|
DB::raw('SUM(item_total) AS _item_total'),
|
||||||
|
DB::raw('SUM(payment_fees) AS _payment_fee'),
|
||||||
|
DB::raw('ROUND(CAST(SUM(item_total)-COALESCE(invoices.discount_amt,0) AS NUMERIC),2) AS _total'),
|
||||||
|
DB::raw('ROUND(CAST(SUM(item_total)-COALESCE(invoices.discount_amt,0)-SUM(payments) AS NUMERIC),2) AS _balance'),
|
||||||
|
'invoices.due_at',
|
||||||
|
'invoices.created_at',
|
||||||
|
])
|
||||||
|
->from(
|
||||||
|
(new Payment)
|
||||||
|
->select([
|
||||||
|
'invoice_id',
|
||||||
|
DB::raw('0 as item'),
|
||||||
|
DB::raw('0 as tax'),
|
||||||
|
DB::raw('0 as discount'),
|
||||||
|
DB::raw('0 as item_total'),
|
||||||
|
DB::raw('SUM(amount) AS payments'),
|
||||||
|
DB::raw('SUM(fees_amt) AS payment_fees'),
|
||||||
|
])
|
||||||
|
->leftjoin('payment_items',['payment_items.payment_id'=>'payments.id'])
|
||||||
|
->where('payments.active',TRUE)
|
||||||
|
->where('payment_items.active',TRUE)
|
||||||
|
->groupBy(['payment_items.invoice_id'])
|
||||||
|
->union(
|
||||||
|
(new InvoiceItem)
|
||||||
|
->select([
|
||||||
|
'invoice_id',
|
||||||
|
DB::raw('ROUND(CAST(SUM(quantity*price_base) AS NUMERIC),2) AS item'),
|
||||||
|
DB::raw('ROUND(CAST(SUM(amount) AS NUMERIC),2) AS tax'),
|
||||||
|
DB::raw('ROUND(CAST(SUM(COALESCE(invoice_items.discount_amt,0)) AS NUMERIC),2) AS discount'),
|
||||||
|
DB::raw('ROUND(CAST(SUM(ROUND(CAST(quantity*price_base AS NUMERIC),2))+SUM(ROUND(CAST(amount AS NUMERIC),2))-SUM(ROUND(CAST(COALESCE(invoice_items.discount_amt,0) AS NUMERIC),2)) AS NUMERIC),2) AS item_total'),
|
||||||
|
DB::raw('0 as payments'),
|
||||||
|
DB::raw('0 as payment_fees'),
|
||||||
|
])
|
||||||
|
->leftjoin('invoice_item_taxes',['invoice_item_taxes.invoice_item_id'=>'invoice_items.id'])
|
||||||
|
->rightjoin('invoices',['invoices.id'=>'invoice_items.invoice_id'])
|
||||||
|
->where('invoice_items.active',TRUE)
|
||||||
|
->where('invoice_item_taxes.active',TRUE)
|
||||||
|
->where('invoices.active',TRUE)
|
||||||
|
->groupBy(['invoice_items.invoice_id']),
|
||||||
|
),'p')
|
||||||
|
->join('invoices',['invoices.id'=>'invoice_id'])
|
||||||
|
->when(($all === FALSE),fn($query)=>$query->where('invoices.account_id',$this->id))
|
||||||
|
->orderBy('due_at')
|
||||||
|
->groupBy(['invoices.account_id','invoices.id','invoices.created_at','invoices.due_at','invoices.discount_amt'])
|
||||||
|
->with(['account']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function invoiceSummaryDue(Collection $invoices=NULL,bool $all=FALSE): Builder
|
||||||
|
{
|
||||||
|
return $this->invoiceSummary($invoices,$all)
|
||||||
|
->havingRaw('ROUND(CAST(SUM(item_total)-COALESCE(invoices.discount_amt,0)-SUM(payments) AS NUMERIC),2) > 0');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function invoiceSummaryCredit(Collection $invoices=NULL,bool $all=FALSE): Builder
|
||||||
|
{
|
||||||
|
return $this->invoiceSummary($invoices,$all)
|
||||||
|
->havingRaw('ROUND(CAST(SUM(item_total)-COALESCE(invoices.discount_amt,0)-SUM(payments) AS NUMERIC),2) < 0');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function invoiceSummaryPast(Collection $invoices=NULL,bool $all=FALSE): Builder
|
||||||
|
{
|
||||||
|
return $this->invoiceSummary($invoices,$all)
|
||||||
|
->join('payment_items',['payment_items.invoice_id'=>'invoices.id'])
|
||||||
|
->join('payments',['payments.id'=>'payment_items.payment_id'])
|
||||||
|
->addSelect(DB::raw('max(paid_at) as _paid_at'))
|
||||||
|
->havingRaw('ROUND(CAST(SUM(item_total)-COALESCE(invoices.discount_amt,0)-SUM(payments) AS NUMERIC),2) <= 0');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the taxed value of a value
|
* Return the taxed value of a value
|
||||||
*
|
*
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
use Awobaz\Compoships\Compoships;
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Support\Arr;
|
use Illuminate\Support\Arr;
|
||||||
|
|
||||||
@ -17,7 +16,7 @@ use App\Traits\SiteID;
|
|||||||
*/
|
*/
|
||||||
class Charge extends Model
|
class Charge extends Model
|
||||||
{
|
{
|
||||||
use Compoships,SiteID;
|
use SiteID;
|
||||||
|
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
'attributes' => 'json',
|
'attributes' => 'json',
|
||||||
@ -58,16 +57,18 @@ class Charge extends Model
|
|||||||
|
|
||||||
/* SCOPES */
|
/* SCOPES */
|
||||||
|
|
||||||
|
/** @deprecated use pending */
|
||||||
public function scopeUnprocessed($query)
|
public function scopeUnprocessed($query)
|
||||||
{
|
{
|
||||||
|
return $this->scopePending();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function scopePending($query) {
|
||||||
return $query
|
return $query
|
||||||
->where('active',TRUE)
|
->active()
|
||||||
->whereNotNull('charge_at')
|
->whereNotNull('charge_at')
|
||||||
->whereNotNull('type')
|
->whereNotNull('type')
|
||||||
->where(function($q) {
|
->where(fn($query)=>$query->where('processed',FALSE)->orWhereNull('processed'));
|
||||||
return $q->where('processed',FALSE)
|
|
||||||
->orWhereNull('processed');
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ATTRIBUTES */
|
/* ATTRIBUTES */
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
use Awobaz\Compoships\Compoships;
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Clarkeash\Doorman\Facades\Doorman;
|
use Clarkeash\Doorman\Facades\Doorman;
|
||||||
use Clarkeash\Doorman\Models\Invite;
|
use Clarkeash\Doorman\Models\Invite;
|
||||||
@ -11,7 +10,7 @@ use Illuminate\Support\Arr;
|
|||||||
use Leenooks\Traits\ScopeActive;
|
use Leenooks\Traits\ScopeActive;
|
||||||
|
|
||||||
use App\Interfaces\IDs;
|
use App\Interfaces\IDs;
|
||||||
use App\Traits\{PushNew,SiteID};
|
use App\Traits\PushNew;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Invoice
|
* Class Invoice
|
||||||
@ -34,14 +33,13 @@ use App\Traits\{PushNew,SiteID};
|
|||||||
*/
|
*/
|
||||||
class Invoice extends Model implements IDs
|
class Invoice extends Model implements IDs
|
||||||
{
|
{
|
||||||
use Compoships,PushNew,ScopeActive,SiteID;
|
use PushNew,ScopeActive;
|
||||||
|
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
|
'created_at' => 'datetime:Y-m-d',
|
||||||
|
'due_at' => 'datetime:Y-m-d',
|
||||||
'reminders'=>'json',
|
'reminders'=>'json',
|
||||||
];
|
'_paid_at' => 'datetime:Y-m-d',
|
||||||
|
|
||||||
protected $dates = [
|
|
||||||
'due_at',
|
|
||||||
];
|
];
|
||||||
|
|
||||||
public const BILL_WEEKLY = 0;
|
public const BILL_WEEKLY = 0;
|
||||||
@ -105,11 +103,6 @@ class Invoice extends Model implements IDs
|
|||||||
];
|
];
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Caching variables
|
|
||||||
private int $_paid = 0;
|
|
||||||
private int $_total = 0;
|
|
||||||
private int $_total_tax = 0;
|
|
||||||
|
|
||||||
/* STATIC METHODS */
|
/* STATIC METHODS */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
use Awobaz\Compoships\Compoships;
|
|
||||||
use Illuminate\Database\Eloquent\Collection;
|
use Illuminate\Database\Eloquent\Collection;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Support\Arr;
|
use Illuminate\Support\Arr;
|
||||||
@ -21,7 +20,7 @@ use App\Traits\PushNew;
|
|||||||
*/
|
*/
|
||||||
class InvoiceItem extends Model
|
class InvoiceItem extends Model
|
||||||
{
|
{
|
||||||
use Compoships,PushNew;
|
use PushNew;
|
||||||
|
|
||||||
protected $dates = [
|
protected $dates = [
|
||||||
'start_at',
|
'start_at',
|
||||||
|
@ -27,8 +27,8 @@ class Payment extends Model implements IDs
|
|||||||
{
|
{
|
||||||
use PushNew,ScopeActive,ProviderRef;
|
use PushNew,ScopeActive,ProviderRef;
|
||||||
|
|
||||||
protected $dates = [
|
protected $casts = [
|
||||||
'paid_at',
|
'paid_at'=>'datetime:Y-m-d',
|
||||||
];
|
];
|
||||||
|
|
||||||
// Array of items that can be updated with PushNew
|
// Array of items that can be updated with PushNew
|
||||||
|
@ -20,13 +20,7 @@ class AccountPolicy
|
|||||||
public function view(User $uo,Account $ao): bool
|
public function view(User $uo,Account $ao): bool
|
||||||
{
|
{
|
||||||
// If this is a service for an account managed by a user.
|
// If this is a service for an account managed by a user.
|
||||||
return ($uo->accounts->pluck('id')->search($ao->id) !== FALSE)
|
return $uo->accounts_all->pluck('id')->contains($ao->id) || $uo->isWholesaler();
|
||||||
|
|
||||||
// The user is the wholesaler
|
|
||||||
OR $uo->isWholesaler()
|
|
||||||
|
|
||||||
// The user has this as one of their accounts
|
|
||||||
OR $uo->accounts->pluck('id')->contains($ao->id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -19,14 +19,7 @@ class InvoicePolicy
|
|||||||
*/
|
*/
|
||||||
public function view(User $uo,Invoice $io): bool
|
public function view(User $uo,Invoice $io): bool
|
||||||
{
|
{
|
||||||
// If this is a service for an account managed by a user.
|
return $uo->accounts_all->pluck('id')->contains($io->account_id) || $uo->isWholesaler();
|
||||||
return ($uo->invoices->pluck('id')->search($io->id) !== FALSE)
|
|
||||||
|
|
||||||
// The user is the wholesaler
|
|
||||||
OR $uo->isWholesaler()
|
|
||||||
|
|
||||||
// The user has this as one of their accounts
|
|
||||||
OR $uo->accounts->pluck('id')->contains($io->account_id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -20,13 +20,7 @@ class ServicePolicy
|
|||||||
public function view(User $uo, Service $so): bool
|
public function view(User $uo, Service $so): bool
|
||||||
{
|
{
|
||||||
// If this is a service for an account managed by a user.
|
// If this is a service for an account managed by a user.
|
||||||
return ($uo->services->pluck('id')->search($so->id) !== FALSE)
|
return $uo->accounts_all->pluck('id')->contains($so->account_id) || $uo->isWholesaler();
|
||||||
|
|
||||||
// The user is the wholesaler
|
|
||||||
OR $uo->isWholesaler()
|
|
||||||
|
|
||||||
// The user has this as one of their accounts
|
|
||||||
OR $uo->accounts->pluck('id')->contains($so->account_id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -15,9 +15,9 @@ class UserPolicy
|
|||||||
*
|
*
|
||||||
* @param User $uo
|
* @param User $uo
|
||||||
* @param string $ability
|
* @param string $ability
|
||||||
* @return bool|null
|
* @return null|bool
|
||||||
*/
|
*/
|
||||||
public function before(User $uo,string $ability): ?bool
|
public function before(User $uo,string $ability): bool|NULL
|
||||||
{
|
{
|
||||||
return $uo->isWholesaler() ?: NULL;
|
return $uo->isWholesaler() ?: NULL;
|
||||||
}
|
}
|
||||||
@ -44,9 +44,6 @@ class UserPolicy
|
|||||||
public function view(User $uo,User $o): bool
|
public function view(User $uo,User $o): bool
|
||||||
{
|
{
|
||||||
// If this is a service for an account managed by a user.
|
// If this is a service for an account managed by a user.
|
||||||
return ($uo->id == $o->id)
|
return ($uo->id == $o->id) || $uo->accounts_all->pluck('user_id')->contains($o->id) || $uo->isWholesaler();
|
||||||
|
|
||||||
// The user has this as one of their accounts
|
|
||||||
OR $uo->accounts->pluck('user')->pluck('id')->unique()->contains($o->id);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
use Awobaz\Compoships\Compoships;
|
|
||||||
use Illuminate\Container\Container;
|
use Illuminate\Container\Container;
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
@ -66,7 +65,7 @@ use App\Traits\{ProductDetails,ProviderRef,SiteID};
|
|||||||
*/
|
*/
|
||||||
class Product extends Model implements IDs
|
class Product extends Model implements IDs
|
||||||
{
|
{
|
||||||
use Compoships,HasFactory,SiteID,ProductDetails,ScopeActive,ProviderRef;
|
use HasFactory,SiteID,ProductDetails,ScopeActive,ProviderRef;
|
||||||
|
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
'pricing'=>'collection',
|
'pricing'=>'collection',
|
||||||
@ -133,7 +132,7 @@ class Product extends Model implements IDs
|
|||||||
return $this->hasOne(ProductTranslate::class)
|
return $this->hasOne(ProductTranslate::class)
|
||||||
->where('language_id',(Auth::user() && Auth::user()->language_id)
|
->where('language_id',(Auth::user() && Auth::user()->language_id)
|
||||||
? Auth::user()->language_id
|
? Auth::user()->language_id
|
||||||
: config('site')->language_id);
|
: config('osb.language_id'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -4,6 +4,7 @@ namespace App\Models;
|
|||||||
|
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Support\Collection;
|
||||||
|
|
||||||
class Rtm extends Model
|
class Rtm extends Model
|
||||||
{
|
{
|
||||||
@ -23,4 +24,20 @@ class Rtm extends Model
|
|||||||
{
|
{
|
||||||
return $this->hasMany(self::class,'parent_id');
|
return $this->hasMany(self::class,'parent_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return all the children RTM records that this record is parent of
|
||||||
|
*
|
||||||
|
* @return Collection
|
||||||
|
*/
|
||||||
|
public function children_all(): Collection
|
||||||
|
{
|
||||||
|
$result = collect();
|
||||||
|
$result->push($this->withoutRelations());
|
||||||
|
|
||||||
|
foreach ($this->children as $o)
|
||||||
|
$result = $result->merge($o->children_all());
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
}
|
}
|
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
use Awobaz\Compoships\Compoships;
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Exception;
|
use Exception;
|
||||||
use Illuminate\Database\Eloquent\Casts\AsCollection;
|
use Illuminate\Database\Eloquent\Casts\AsCollection;
|
||||||
@ -19,10 +18,8 @@ use Symfony\Component\HttpKernel\Exception\HttpException;
|
|||||||
use Leenooks\Carbon as LeenooksCarbon;
|
use Leenooks\Carbon as LeenooksCarbon;
|
||||||
|
|
||||||
use App\Models\Product\Type;
|
use App\Models\Product\Type;
|
||||||
use App\Models\Scopes\SiteScope;
|
|
||||||
use App\Interfaces\IDs;
|
use App\Interfaces\IDs;
|
||||||
use App\Traits\ScopeServiceUserAuthorised;
|
use App\Traits\ScopeServiceUserAuthorised;
|
||||||
use App\Traits\SiteID;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Service
|
* Class Service
|
||||||
@ -60,24 +57,23 @@ use App\Traits\SiteID;
|
|||||||
*/
|
*/
|
||||||
class Service extends Model implements IDs
|
class Service extends Model implements IDs
|
||||||
{
|
{
|
||||||
use HasFactory,ScopeServiceUserAuthorised,SiteID,Compoships;
|
use HasFactory,ScopeServiceUserAuthorised;
|
||||||
|
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
'order_info'=>AsCollection::class,
|
'order_info' => AsCollection::class,
|
||||||
];
|
'invoice_last_at' => 'datetime:Y-m-d', // @todo Can these be removed, since we can work out invoice dynamically now
|
||||||
|
'invoice_next_at' => 'datetime:Y-m-d', // @todo Can these be removed, since we can work out invoice dynamically now
|
||||||
protected $dates = [
|
'stop_at' => 'datetime:Y-m-d',
|
||||||
'invoice_last_at',
|
'start_at' => 'datetime:Y-m-d',
|
||||||
'invoice_next_at',
|
|
||||||
'start_at',
|
|
||||||
'stop_at',
|
|
||||||
];
|
];
|
||||||
|
|
||||||
|
/** @deprecated */
|
||||||
protected $appends = [
|
protected $appends = [
|
||||||
'category_name',
|
'category_name',
|
||||||
'name_short',
|
'name_short',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
/** @deprecated */
|
||||||
protected $visible = [
|
protected $visible = [
|
||||||
// 'account_name',
|
// 'account_name',
|
||||||
// 'admin_service_id_url',
|
// 'admin_service_id_url',
|
||||||
@ -95,8 +91,6 @@ class Service extends Model implements IDs
|
|||||||
];
|
];
|
||||||
|
|
||||||
protected $with = [
|
protected $with = [
|
||||||
//'invoice_items',
|
|
||||||
//'product.type.supplied',
|
|
||||||
'type',
|
'type',
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -323,6 +317,18 @@ class Service extends Model implements IDs
|
|||||||
return sprintf('%02s-%04s.%s',$this->site_id,$this->account_id,$this->getLIDattribute());
|
return sprintf('%02s-%04s.%s',$this->site_id,$this->account_id,$this->getLIDattribute());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* STATIC */
|
||||||
|
|
||||||
|
public static function movements(User $uo): Collection
|
||||||
|
{
|
||||||
|
return (new self)
|
||||||
|
->active()
|
||||||
|
->serviceUserAuthorised($uo)
|
||||||
|
->where('order_status','!=','ACTIVE')
|
||||||
|
->with(['account','product'])
|
||||||
|
->get();
|
||||||
|
}
|
||||||
|
|
||||||
/* RELATIONS */
|
/* RELATIONS */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -332,8 +338,7 @@ class Service extends Model implements IDs
|
|||||||
*/
|
*/
|
||||||
public function account()
|
public function account()
|
||||||
{
|
{
|
||||||
return $this->belongsTo(Account::class,['account_id','site_id'],['id','site_id'])
|
return $this->belongsTo(Account::class);
|
||||||
->withoutGlobalScope(SiteScope::class);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -353,12 +358,31 @@ class Service extends Model implements IDs
|
|||||||
*/
|
*/
|
||||||
public function charges()
|
public function charges()
|
||||||
{
|
{
|
||||||
return $this->hasMany(Charge::class,['service_id','site_id'],['id','site_id'])
|
return $this->hasMany(Charge::class)
|
||||||
->withoutGlobalScope(SiteScope::class)
|
|
||||||
->where('active','=',TRUE)
|
|
||||||
->orderBy('created_at');
|
->orderBy('created_at');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return only the active charges
|
||||||
|
*/
|
||||||
|
public function charges_active()
|
||||||
|
{
|
||||||
|
return $this->charges()
|
||||||
|
->active();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return only the charges not yet processed
|
||||||
|
*/
|
||||||
|
public function charges_pending()
|
||||||
|
{
|
||||||
|
return $this->charges()
|
||||||
|
->pending();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Product changes for this service
|
||||||
|
*/
|
||||||
public function changes()
|
public function changes()
|
||||||
{
|
{
|
||||||
return $this->belongsToMany(Product::class,'service__change','service_id','product_id','id','id')
|
return $this->belongsToMany(Product::class,'service__change','service_id','product_id','id','id')
|
||||||
@ -367,53 +391,80 @@ class Service extends Model implements IDs
|
|||||||
->withTimestamps();
|
->withTimestamps();
|
||||||
}
|
}
|
||||||
|
|
||||||
// @todo changed to invoiced_items
|
/**
|
||||||
|
* @deprecated use invoiced_items
|
||||||
|
*/
|
||||||
public function invoice_items($active=TRUE)
|
public function invoice_items($active=TRUE)
|
||||||
{
|
{
|
||||||
$query = $this->hasMany(InvoiceItem::class,['service_id','site_id'],['id','site_id'])
|
return $this->invoiced_items_active();
|
||||||
->withoutGlobalScope(SiteScope::class)
|
|
||||||
->where('item_type','=',0)
|
|
||||||
->orderBy('start_at');
|
|
||||||
|
|
||||||
// @todo Change to $query->active();
|
|
||||||
if ($active)
|
|
||||||
$query->where('active','=',TRUE);
|
|
||||||
|
|
||||||
return $query;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Invoices for this service
|
* Invoices that this service is itemised on
|
||||||
*/
|
*/
|
||||||
public function invoices($active=TRUE)
|
public function invoiced_items()
|
||||||
{
|
{
|
||||||
$query = $this->hasManyThrough(Invoice::class,InvoiceItem::class,NULL,'id',NULL,'invoice_id')
|
return $this->hasMany(InvoiceItem::class)
|
||||||
->when($this->site_id,function($q) {
|
->with(['taxes']);
|
||||||
return $q->where('invoices.site_id', $this->site_id)
|
|
||||||
->withoutGlobalScope(SiteScope::class);
|
|
||||||
})
|
|
||||||
->distinct('id')
|
|
||||||
->where('invoices.site_id','=',$this->site_id)
|
|
||||||
->where('invoice_items.site_id','=',$this->site_id)
|
|
||||||
->orderBy('created_at')
|
|
||||||
->orderBy('due_at');
|
|
||||||
|
|
||||||
if ($active)
|
|
||||||
$query->where('invoice_items.active','=',TRUE)
|
|
||||||
->where('invoices.active','=',TRUE);
|
|
||||||
|
|
||||||
return $query;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Account that ordered the service
|
* Invoices that this service is itemised on that is active
|
||||||
|
*/
|
||||||
|
public function invoiced_items_active()
|
||||||
|
{
|
||||||
|
return $this->invoiced_items()
|
||||||
|
->where('active',TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the extra charged items for this service (ie: item_type != 0)
|
||||||
|
*/
|
||||||
|
public function invoiced_extra_items()
|
||||||
|
{
|
||||||
|
return $this->hasMany(InvoiceItem::class)
|
||||||
|
->where('item_type','<>',0)
|
||||||
|
->orderBy('service_id')
|
||||||
|
->orderBy('start_at');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return active extra items charged
|
||||||
|
*/
|
||||||
|
public function invoiced_extra_items_active()
|
||||||
|
{
|
||||||
|
return $this->invoiced_extra_items()
|
||||||
|
->where('active',TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the service charged items for this service (ie: item_type == 0)
|
||||||
|
*/
|
||||||
|
public function invoiced_service_items()
|
||||||
|
{
|
||||||
|
return $this->hasMany(InvoiceItem::class)
|
||||||
|
->where('item_type','=',0)
|
||||||
|
->orderBy('service_id')
|
||||||
|
->orderBy('start_at');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return active service items charged
|
||||||
|
*/
|
||||||
|
public function invoiced_service_items_active()
|
||||||
|
{
|
||||||
|
return $this->invoiced_service_items()
|
||||||
|
->where('active',TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* User that ordered the service
|
||||||
*
|
*
|
||||||
* @return BelongsTo
|
* @return BelongsTo
|
||||||
*/
|
*/
|
||||||
public function orderedby()
|
public function orderedby()
|
||||||
{
|
{
|
||||||
return $this->belongsTo(Account::class,['ordered_by','site_id'],['id','site_id'])
|
return $this->belongsTo(User::class);
|
||||||
->withoutGlobalScope(SiteScope::class);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -423,8 +474,7 @@ class Service extends Model implements IDs
|
|||||||
*/
|
*/
|
||||||
public function product()
|
public function product()
|
||||||
{
|
{
|
||||||
return $this->belongsTo(Product::class,['product_id','site_id'],['id','site_id'])
|
return $this->belongsTo(Product::class);
|
||||||
->withoutGlobalScope(SiteScope::class);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -444,10 +494,11 @@ class Service extends Model implements IDs
|
|||||||
*/
|
*/
|
||||||
public function scopeActive($query)
|
public function scopeActive($query)
|
||||||
{
|
{
|
||||||
return $query->where(function () use ($query) {
|
return $query->where(
|
||||||
$query->where($this->getTable().'.active',TRUE)
|
fn($query)=>
|
||||||
->orWhereNotIn('order_status',self::INACTIVE_STATUS);
|
$query->where($this->getTable().'.active',TRUE)
|
||||||
});
|
->orWhereNotIn('order_status',self::INACTIVE_STATUS)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -458,20 +509,11 @@ class Service extends Model implements IDs
|
|||||||
*/
|
*/
|
||||||
public function scopeInActive($query)
|
public function scopeInActive($query)
|
||||||
{
|
{
|
||||||
return $query->where(function () use ($query) {
|
return $query->where(
|
||||||
$query->where($this->getTable().'.active',FALSE)
|
fn($query)=>
|
||||||
->orWhereIn('order_status',self::INACTIVE_STATUS);
|
$query->where($this->getTable().'.active',FALSE)
|
||||||
});
|
->orWhereIn('order_status',self::INACTIVE_STATUS)
|
||||||
}
|
);
|
||||||
|
|
||||||
/**
|
|
||||||
* Enable to perform queries without eager loading
|
|
||||||
*
|
|
||||||
* @param $query
|
|
||||||
* @return mixed
|
|
||||||
*/
|
|
||||||
public function scopeNoEagerLoads($query){
|
|
||||||
return $query->setEagerLoads([]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -723,7 +765,7 @@ class Service extends Model implements IDs
|
|||||||
if (! $this->product->price_recur_strict)
|
if (! $this->product->price_recur_strict)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
$n = $this->invoice_next->diff($this->invoice_next_end)->days+1;
|
$n = round($this->invoice_next->diffInDays($this->invoice_next_end),0);
|
||||||
|
|
||||||
switch ($this->recur_schedule) {
|
switch ($this->recur_schedule) {
|
||||||
case Invoice::BILL_WEEKLY:
|
case Invoice::BILL_WEEKLY:
|
||||||
@ -735,7 +777,7 @@ class Service extends Model implements IDs
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case Invoice::BILL_QUARTERLY:
|
case Invoice::BILL_QUARTERLY:
|
||||||
$d = $this->invoice_next->addQuarter()->startOfQuarter()->diff($this->invoice_next_end->startOfQuarter())->days;
|
$d = round($this->invoice_next_end->startOfQuarter()->diffInDays($this->invoice_next->addQuarter()->startOfQuarter()),1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Invoice::BILL_SEMI_YEARLY:
|
case Invoice::BILL_SEMI_YEARLY:
|
||||||
@ -845,19 +887,15 @@ class Service extends Model implements IDs
|
|||||||
*/
|
*/
|
||||||
public function getPaidToAttribute(): ?Carbon
|
public function getPaidToAttribute(): ?Carbon
|
||||||
{
|
{
|
||||||
if (! $this->invoices->count())
|
// Last paid invoice
|
||||||
return NULL;
|
$lastpaid = $this
|
||||||
|
->invoices()
|
||||||
|
->filter(fn($item)=>$item->_balance <= 0)
|
||||||
|
->last();
|
||||||
|
|
||||||
foreach ($this->invoices->reverse() as $o)
|
return $lastpaid
|
||||||
if ($o->due == 0)
|
? $this->invoiced_service_items_active->where('invoice_id',$lastpaid->id)->where('type',0)->max('stop_at')
|
||||||
break;
|
: NULL;
|
||||||
|
|
||||||
return $o->items
|
|
||||||
->filter(function($item) {
|
|
||||||
return $item->item_type === 0;
|
|
||||||
})
|
|
||||||
->last()
|
|
||||||
->stop_at;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1148,6 +1186,16 @@ class Service extends Model implements IDs
|
|||||||
return $this->product->hasUsage();
|
return $this->product->hasUsage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return this service invoices
|
||||||
|
*/
|
||||||
|
public function invoices()
|
||||||
|
{
|
||||||
|
return $this->account
|
||||||
|
->invoiceSummary($this->invoiced_service_items_active->pluck('invoice_id'))
|
||||||
|
->get();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine if a service is active. It is active, if active=1, or the order_status is not in self::INACTIVE_STATUS[]
|
* Determine if a service is active. It is active, if active=1, or the order_status is not in self::INACTIVE_STATUS[]
|
||||||
*
|
*
|
||||||
|
@ -20,10 +20,6 @@ class Broadband extends Type implements ServiceUsage
|
|||||||
{
|
{
|
||||||
private const LOGKEY = 'MSB';
|
private const LOGKEY = 'MSB';
|
||||||
|
|
||||||
protected $dates = [
|
|
||||||
'connect_at',
|
|
||||||
'expire_at',
|
|
||||||
];
|
|
||||||
protected $table = 'service_broadband';
|
protected $table = 'service_broadband';
|
||||||
|
|
||||||
/* INTERFACES */
|
/* INTERFACES */
|
||||||
|
@ -14,7 +14,9 @@ class Domain extends Type
|
|||||||
use ServiceDomains;
|
use ServiceDomains;
|
||||||
|
|
||||||
protected $table = 'service_domain';
|
protected $table = 'service_domain';
|
||||||
protected $with = ['tld'];
|
protected $with = [
|
||||||
|
'tld',
|
||||||
|
];
|
||||||
|
|
||||||
/* OVERRIDES */
|
/* OVERRIDES */
|
||||||
|
|
||||||
|
@ -13,5 +13,7 @@ class Email extends Type
|
|||||||
use ServiceDomains;
|
use ServiceDomains;
|
||||||
|
|
||||||
protected $table = 'service_email';
|
protected $table = 'service_email';
|
||||||
protected $with = ['tld'];
|
protected $with = [
|
||||||
|
'tld',
|
||||||
|
];
|
||||||
}
|
}
|
@ -14,7 +14,9 @@ class Host extends Type
|
|||||||
use ServiceDomains;
|
use ServiceDomains;
|
||||||
|
|
||||||
protected $table = 'service_host';
|
protected $table = 'service_host';
|
||||||
protected $with = ['tld'];
|
protected $with = [
|
||||||
|
'tld',
|
||||||
|
];
|
||||||
|
|
||||||
/* RELATIONS */
|
/* RELATIONS */
|
||||||
|
|
||||||
|
@ -8,10 +8,6 @@ namespace App\Models\Service;
|
|||||||
*/
|
*/
|
||||||
class Phone extends Type
|
class Phone extends Type
|
||||||
{
|
{
|
||||||
protected $dates = [
|
|
||||||
'connect_at',
|
|
||||||
'expire_at',
|
|
||||||
];
|
|
||||||
protected $table = 'service_phone';
|
protected $table = 'service_phone';
|
||||||
|
|
||||||
/* INTERFACES */
|
/* INTERFACES */
|
||||||
|
@ -14,9 +14,11 @@ abstract class Type extends Model implements ServiceItem
|
|||||||
{
|
{
|
||||||
use ScopeServiceActive,ScopeServiceUserAuthorised;
|
use ScopeServiceActive,ScopeServiceUserAuthorised;
|
||||||
|
|
||||||
protected $dates = [
|
protected $casts = [
|
||||||
'expire_at',
|
'connect_at' => 'datetime:Y-m-d',
|
||||||
|
'expire_at' => 'datetime:Y-m-d',
|
||||||
];
|
];
|
||||||
|
|
||||||
public $timestamps = FALSE;
|
public $timestamps = FALSE;
|
||||||
|
|
||||||
/* RELATIONS */
|
/* RELATIONS */
|
||||||
|
@ -72,11 +72,11 @@ class Site extends Model
|
|||||||
*/
|
*/
|
||||||
public function getAddressAttribute(): array
|
public function getAddressAttribute(): array
|
||||||
{
|
{
|
||||||
return [
|
return array_filter([
|
||||||
$this->site_address1,
|
$this->site_address1,
|
||||||
$this->site_address2,
|
$this->site_address2,
|
||||||
sprintf('%s %s %s',$this->site_city.(($this->site_state OR $this->site_postcode) ? ',' : ''),$this->site_state,$this->site_postcode)
|
sprintf('%s %s %s',$this->site_city.(($this->site_state OR $this->site_postcode) ? ',' : ''),$this->site_state,$this->site_postcode)
|
||||||
];
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -9,7 +9,10 @@ use App\Models\Service\Broadband as ServiceBroadband;
|
|||||||
|
|
||||||
class Broadband extends Model
|
class Broadband extends Model
|
||||||
{
|
{
|
||||||
protected $dates = ['date'];
|
protected $casts = [
|
||||||
|
'date'=>'datetime:Y-m-d',
|
||||||
|
];
|
||||||
|
|
||||||
protected $table = 'usage_broadband';
|
protected $table = 'usage_broadband';
|
||||||
public $timestamps = FALSE;
|
public $timestamps = FALSE;
|
||||||
|
|
||||||
|
@ -7,17 +7,12 @@ use Illuminate\Notifications\Notifiable;
|
|||||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
use Illuminate\Database\Eloquent\Collection as DatabaseCollection;
|
use Illuminate\Database\Eloquent\Collection as DatabaseCollection;
|
||||||
use Illuminate\Support\Facades\Cache;
|
|
||||||
use Illuminate\Support\Facades\DB;
|
|
||||||
use Illuminate\Support\Facades\Session;
|
|
||||||
use Laravel\Passport\HasApiTokens;
|
use Laravel\Passport\HasApiTokens;
|
||||||
use Leenooks\Traits\ScopeActive;
|
use Leenooks\Traits\ScopeActive;
|
||||||
use Leenooks\Traits\UserSwitch;
|
use Leenooks\Traits\UserSwitch;
|
||||||
|
|
||||||
use App\Interfaces\IDs;
|
use App\Interfaces\IDs;
|
||||||
use App\Models\Scopes\SiteScope;
|
|
||||||
use App\Notifications\ResetPassword as ResetPasswordNotification;
|
use App\Notifications\ResetPassword as ResetPasswordNotification;
|
||||||
use App\Traits\{QueryCacheableConfig,SiteID};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class User
|
* Class User
|
||||||
@ -27,14 +22,12 @@ use App\Traits\{QueryCacheableConfig,SiteID};
|
|||||||
*/
|
*/
|
||||||
class User extends Authenticatable implements IDs
|
class User extends Authenticatable implements IDs
|
||||||
{
|
{
|
||||||
use HasFactory,HasApiTokens,Notifiable,UserSwitch,QueryCacheableConfig,SiteID,ScopeActive;
|
use HasFactory,HasApiTokens,Notifiable,UserSwitch,ScopeActive;
|
||||||
|
|
||||||
private const CACHE_TIME = 3600;
|
private const CACHE_TIME = 3600;
|
||||||
|
|
||||||
protected $dates = [
|
protected $casts = [
|
||||||
'created_at',
|
'last_access' => 'datetime:Y-m-d H:i:s',
|
||||||
'updated_at',
|
|
||||||
'last_access'
|
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -96,27 +89,25 @@ class User extends Authenticatable implements IDs
|
|||||||
/* RELATIONS */
|
/* RELATIONS */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The accounts that this user manages
|
* This user's accounts
|
||||||
*
|
|
||||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
|
||||||
* @note This cannot be loaded with "with"?
|
|
||||||
*/
|
*/
|
||||||
public function accounts()
|
public function accounts()
|
||||||
{
|
{
|
||||||
return $this->hasMany(Account::class)
|
return $this->hasMany(Account::class)
|
||||||
->orWhereIn('id',$this->rtm_accounts()->pluck('id'))
|
|
||||||
->active();
|
->active();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This users invoices
|
* The accounts that this user manages
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Database\Eloquent\Relations\HasManyThrough
|
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||||
* @deprecated Accounts have invoices, not users
|
* @note This cannot be preloaded with load() or with() - $this is a blank object
|
||||||
*/
|
*/
|
||||||
public function invoices()
|
public function accounts_all()
|
||||||
{
|
{
|
||||||
return $this->hasManyThrough(Invoice::class,Account::class)
|
return $this->hasMany(Account::class)
|
||||||
|
->when((! is_null($this->rtm) && $this->id),
|
||||||
|
fn($query)=>$query->orWhereIn('rtm_id',$this->rtm?->children_all()->pluck('id')))
|
||||||
->active();
|
->active();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -132,37 +123,20 @@ class User extends Authenticatable implements IDs
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the routes to market account for this user
|
* Return the routes to market account for this user
|
||||||
*
|
|
||||||
* @return \Illuminate\Database\Eloquent\Relations\HasOneThrough
|
|
||||||
*/
|
*/
|
||||||
public function rtm()
|
public function rtm()
|
||||||
{
|
{
|
||||||
return $this->hasOneThrough(Rtm::class,Account::class);
|
return $this->hasOneThrough(Rtm::class,Account::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* The services this user has
|
|
||||||
*
|
|
||||||
* @return \Illuminate\Database\Eloquent\Relations\HasManyThrough
|
|
||||||
* @deprecated Accounts have services, not users
|
|
||||||
*/
|
|
||||||
public function services()
|
|
||||||
{
|
|
||||||
return $this->hasManyThrough(Service::class,Account::class)
|
|
||||||
->with(['product.type'])
|
|
||||||
->active();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Supplier configuration for this user
|
* Supplier configuration for this user
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
|
* @deprecated To move to account->suppliers()
|
||||||
* @deprecated Move to account->suppliers()
|
|
||||||
*/
|
*/
|
||||||
public function suppliers()
|
public function suppliers()
|
||||||
{
|
{
|
||||||
return $this->belongsToMany(Supplier::class)
|
return $this->belongsToMany(Supplier::class)
|
||||||
->where('supplier_user.site_id',$this->site_id)
|
|
||||||
->withPivot('id','created_at');
|
->withPivot('id','created_at');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -179,7 +153,7 @@ class User extends Authenticatable implements IDs
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Logged in users full name
|
* Logged in user's full name
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
@ -188,25 +162,9 @@ class User extends Authenticatable implements IDs
|
|||||||
return sprintf('%s %s',$this->firstname,$this->lastname);
|
return sprintf('%s %s',$this->firstname,$this->lastname);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Return my accounts, but only those accounts with the same group_id
|
|
||||||
*
|
|
||||||
* @note Users can only manage accounts with the same group ID, thereby ensuring they dont see different
|
|
||||||
* pricing options - since prices can be controlled by groups
|
|
||||||
* @return Collection
|
|
||||||
*/
|
|
||||||
public function getMyAccountsAttribute(): Collection
|
|
||||||
{
|
|
||||||
$result = $this->accounts->where('user_id',$this->id);
|
|
||||||
|
|
||||||
if (! $result->count())
|
|
||||||
return $result;
|
|
||||||
|
|
||||||
return $this->isReseller() ? $result : $result->groupBy('group.id')->first();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a friendly string of this persons role
|
* Return a friendly string of this persons role
|
||||||
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getRoleAttribute(): string
|
public function getRoleAttribute(): string
|
||||||
@ -259,22 +217,6 @@ class User extends Authenticatable implements IDs
|
|||||||
|
|
||||||
/* METHODS */
|
/* METHODS */
|
||||||
|
|
||||||
/**
|
|
||||||
* Show this user's clients with service movements
|
|
||||||
*
|
|
||||||
* A service movement, is an active service where the status is not ACTIVE
|
|
||||||
*
|
|
||||||
* @return DatabaseCollection
|
|
||||||
*/
|
|
||||||
public function client_service_movements(): DatabaseCollection
|
|
||||||
{
|
|
||||||
return Service::active()
|
|
||||||
->serviceUserAuthorised($this)
|
|
||||||
->where('order_status','!=','ACTIVE')
|
|
||||||
->with(['account','product'])
|
|
||||||
->get();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine if the user is an admin of the user with $id
|
* Determine if the user is an admin of the user with $id
|
||||||
*
|
*
|
||||||
@ -283,7 +225,11 @@ class User extends Authenticatable implements IDs
|
|||||||
*/
|
*/
|
||||||
public function isAdmin(User $user=NULL): bool
|
public function isAdmin(User $user=NULL): bool
|
||||||
{
|
{
|
||||||
return $user->exists AND $this->isReseller() AND $this->accounts->pluck('user_id')->contains($user->id);
|
return $user->exists
|
||||||
|
&& $this->isReseller()
|
||||||
|
&& $this->accounts_all
|
||||||
|
->pluck('user_id')
|
||||||
|
->contains($user->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -311,9 +257,11 @@ class User extends Authenticatable implements IDs
|
|||||||
*
|
*
|
||||||
* @param bool $future
|
* @param bool $future
|
||||||
* @return DatabaseCollection
|
* @return DatabaseCollection
|
||||||
|
* @deprecated This should be done in accounts
|
||||||
*/
|
*/
|
||||||
public function next_invoice_items(bool $future=FALSE): DatabaseCollection
|
public function next_invoice_items(bool $future=FALSE): Collection
|
||||||
{
|
{
|
||||||
|
return collect();
|
||||||
$result = new DatabaseCollection;
|
$result = new DatabaseCollection;
|
||||||
$this->services->load(['invoice_items.taxes']);
|
$this->services->load(['invoice_items.taxes']);
|
||||||
|
|
||||||
@ -339,117 +287,6 @@ class User extends Authenticatable implements IDs
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Return an SQL query that will return a list of invoices
|
|
||||||
*
|
|
||||||
* @return \Illuminate\Database\Query\Builder
|
|
||||||
*/
|
|
||||||
private function query_invoice_items()
|
|
||||||
{
|
|
||||||
return DB::table('invoice_items')
|
|
||||||
->select([
|
|
||||||
'invoice_id',
|
|
||||||
DB::raw('invoice_items.id AS invoice_item_id'),
|
|
||||||
DB::raw('COALESCE(invoice_items.discount_amt,0) AS discount'),
|
|
||||||
DB::raw('quantity*price_base AS base'),
|
|
||||||
DB::raw('invoice_item_taxes.amount AS tax'),
|
|
||||||
])
|
|
||||||
->leftjoin('invoice_item_taxes',['invoice_item_taxes.invoice_item_id'=>'invoice_items.id'])
|
|
||||||
->where('invoice_items.active',TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return an SQL query that will return payment summaries by invoices.
|
|
||||||
*
|
|
||||||
* @return \Illuminate\Database\Query\Builder
|
|
||||||
*/
|
|
||||||
private function query_payment_items()
|
|
||||||
{
|
|
||||||
return DB::table('payment_items')
|
|
||||||
->select([
|
|
||||||
'payment_id',
|
|
||||||
'invoice_id',
|
|
||||||
DB::raw('SUM(amount) AS allocate'),
|
|
||||||
])
|
|
||||||
->where('amount','>',0)
|
|
||||||
->groupBy(['invoice_id','payment_id']);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return an SQL query that will summarise invoices with payments
|
|
||||||
*
|
|
||||||
* @return \Illuminate\Database\Query\Builder
|
|
||||||
* @todo change this to just return outstanding invoices as a collection.
|
|
||||||
* @deprecated Use account->invoiceSummary
|
|
||||||
*/
|
|
||||||
public function query_invoice_summary()
|
|
||||||
{
|
|
||||||
$invoices = (new Invoice)
|
|
||||||
->select([
|
|
||||||
'invoice_id',
|
|
||||||
DB::raw('SUM(discount) AS discount'),
|
|
||||||
DB::raw('SUM(base) AS base'),
|
|
||||||
DB::raw('SUM(tax) AS tax'),
|
|
||||||
DB::raw('base+tax-discount AS total'),
|
|
||||||
DB::raw('0 AS payments'),
|
|
||||||
DB::raw('0 AS payment_fees'),
|
|
||||||
])
|
|
||||||
->from($this->query_invoice_items(),'II')
|
|
||||||
->join('invoices',['invoices.id'=>'II.invoice_id'])
|
|
||||||
->whereIN('account_id',$this->accounts->pluck('id'))
|
|
||||||
->where('invoices.active',TRUE)
|
|
||||||
->groupBy(['invoice_id','base','tax','discount']);
|
|
||||||
|
|
||||||
$payments = (new Payment)
|
|
||||||
->select([
|
|
||||||
'invoice_id',
|
|
||||||
DB::raw('0 AS discount'),
|
|
||||||
DB::raw('0 AS base'),
|
|
||||||
DB::raw('0 AS tax'),
|
|
||||||
DB::raw('0 AS total'),
|
|
||||||
DB::raw('SUM(allocate) AS payments'),
|
|
||||||
DB::raw('SUM(fees_amt) AS payment_fees'),
|
|
||||||
])
|
|
||||||
->from($this->query_payment_items(),'PI')
|
|
||||||
->join('payments',['payments.id'=>'PI.payment_id'])
|
|
||||||
->whereIN('account_id',$this->accounts->pluck('id'))
|
|
||||||
//->where('payments.active',TRUE) // @todo To implement
|
|
||||||
->groupBy(['invoice_id']);
|
|
||||||
|
|
||||||
$summary = (new Invoice)
|
|
||||||
->withoutGlobalScope(SiteScope::class)
|
|
||||||
->select([
|
|
||||||
'invoice_id',
|
|
||||||
DB::raw('SUM(discount) AS discount'),
|
|
||||||
DB::raw('SUM(base) AS invoice_base'),
|
|
||||||
DB::raw('SUM(tax) AS invoice_tax'),
|
|
||||||
DB::raw('SUM(total) AS invoice_total'),
|
|
||||||
DB::raw('SUM(payments) AS payments'),
|
|
||||||
DB::raw('SUM(payment_fees) AS payment_fees'),
|
|
||||||
])
|
|
||||||
->from($invoices->unionAll($payments),'invoices')
|
|
||||||
->groupBy(['invoice_id']);
|
|
||||||
|
|
||||||
return (new Invoice)
|
|
||||||
->select([
|
|
||||||
'account_id',
|
|
||||||
'id',
|
|
||||||
'due_at',
|
|
||||||
'created_at',
|
|
||||||
'discount',
|
|
||||||
'invoice_base',
|
|
||||||
'invoice_tax',
|
|
||||||
'invoice_total',
|
|
||||||
'payments',
|
|
||||||
'payment_fees',
|
|
||||||
DB::raw('invoice_total-payments AS balance'),
|
|
||||||
])
|
|
||||||
->join('invoices',['invoices.id'=>'invoice_id'])
|
|
||||||
->with(['items.taxes'])
|
|
||||||
->from($summary,'summary')
|
|
||||||
->groupBy(['id','account_id','discount','invoice_base','invoice_tax','invoice_total','payments','payment_fees']);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine what the logged in user's role is
|
* Determine what the logged in user's role is
|
||||||
* + Wholesaler - aka Super User
|
* + Wholesaler - aka Super User
|
||||||
@ -460,67 +297,8 @@ class User extends Authenticatable implements IDs
|
|||||||
*/
|
*/
|
||||||
public function role()
|
public function role()
|
||||||
{
|
{
|
||||||
// Cache our role for this session
|
return $this->rtm
|
||||||
$cache_key = sprintf('%s:%s:%s',$this->id,__METHOD__,Session::getId());
|
? ($this->rtm->parent_id ? 'reseller' : 'wholesaler')
|
||||||
|
: 'customer';
|
||||||
return Cache::remember($cache_key,self::CACHE_TIME,function() {
|
|
||||||
// Get the RTM for our accounts
|
|
||||||
$rtms = Rtm::whereIn('account_id',$this->accounts->pluck('id'))->get();
|
|
||||||
|
|
||||||
// If I have no parent, I am the wholesaler
|
|
||||||
if ($rtms->whereNull('parent_id')->count())
|
|
||||||
return 'wholesaler';
|
|
||||||
|
|
||||||
// If I exist in the RTM table, I'm a reseller
|
|
||||||
else if ($rtms->count())
|
|
||||||
return 'reseller';
|
|
||||||
|
|
||||||
// Otherwise a client
|
|
||||||
else
|
|
||||||
return 'customer';
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the accounts that this user can manage
|
|
||||||
* This method is a helper to User::accounts() - use $user->accounts instead
|
|
||||||
*
|
|
||||||
* @return Collection
|
|
||||||
*/
|
|
||||||
private function rtm_accounts(): Collection
|
|
||||||
{
|
|
||||||
return Account::whereIn('rtm_id',$this->rtm_list()->pluck('id'))
|
|
||||||
->get();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the RTM hierarchy that this user can manage
|
|
||||||
*
|
|
||||||
* @param Rtm|null $rtm
|
|
||||||
* @return Collection
|
|
||||||
*/
|
|
||||||
public function rtm_list(Rtm $rtm=NULL): Collection
|
|
||||||
{
|
|
||||||
// If this user doesnt manage any accounts
|
|
||||||
if (! $this->exists || ! $this->rtm)
|
|
||||||
return collect();
|
|
||||||
|
|
||||||
$list = collect();
|
|
||||||
|
|
||||||
// Add this RTM to the list
|
|
||||||
if (! $rtm) {
|
|
||||||
$list->push($this->rtm);
|
|
||||||
$children = $this->rtm->children;
|
|
||||||
|
|
||||||
} else {
|
|
||||||
$list->push($rtm);
|
|
||||||
$children =$rtm->children;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Capture any children
|
|
||||||
foreach ($children as $child)
|
|
||||||
$list->push($this->rtm_list($child));
|
|
||||||
|
|
||||||
return $rtm ? $list : $list->flatten()->unique(function($item) { return $item->id; });
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
namespace App\Providers;
|
namespace App\Providers;
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Gate;
|
||||||
use Illuminate\Support\ServiceProvider;
|
use Illuminate\Support\ServiceProvider;
|
||||||
use Laravel\Passport\Passport;
|
|
||||||
use Leenooks\Traits\SingleOrFail;
|
use Leenooks\Traits\SingleOrFail;
|
||||||
|
|
||||||
class AppServiceProvider extends ServiceProvider
|
class AppServiceProvider extends ServiceProvider
|
||||||
@ -12,21 +12,25 @@ class AppServiceProvider extends ServiceProvider
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Register any application services.
|
* Register any application services.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function register()
|
public function register(): void
|
||||||
{
|
{
|
||||||
Passport::ignoreMigrations();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bootstrap any application services.
|
* Bootstrap any application services.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function boot()
|
public function boot(): void
|
||||||
{
|
{
|
||||||
SingleOrFail::bootSingleOrfail();
|
self::bootSingleOrfail();
|
||||||
|
|
||||||
|
Gate::define('wholesaler', function ($user) {
|
||||||
|
return $user->isWholesaler();
|
||||||
|
});
|
||||||
|
|
||||||
|
Gate::define('reseller', function ($user) {
|
||||||
|
return $user->isReseller();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,43 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Providers;
|
|
||||||
|
|
||||||
use Intuit\Traits\IntuitSocialite;
|
|
||||||
use Laravel\Passport\Passport;
|
|
||||||
use Illuminate\Support\Facades\Gate;
|
|
||||||
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
|
|
||||||
|
|
||||||
class AuthServiceProvider extends ServiceProvider
|
|
||||||
{
|
|
||||||
use IntuitSocialite;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The policy mappings for the application.
|
|
||||||
*
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
protected $policies = [
|
|
||||||
'App\Model' => 'App\Policies\ModelPolicy',
|
|
||||||
];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Register any authentication / authorization services.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function boot()
|
|
||||||
{
|
|
||||||
$this->registerPolicies();
|
|
||||||
$this->bootIntuitSocialite();
|
|
||||||
Passport::routes();
|
|
||||||
// Passport::enableImplicitGrant();
|
|
||||||
|
|
||||||
Gate::define('wholesaler', function ($user) {
|
|
||||||
return $user->isWholesaler();
|
|
||||||
});
|
|
||||||
|
|
||||||
Gate::define('reseller', function ($user) {
|
|
||||||
return $user->isReseller();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,21 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Providers;
|
|
||||||
|
|
||||||
use Illuminate\Support\ServiceProvider;
|
|
||||||
use Illuminate\Support\Facades\Broadcast;
|
|
||||||
|
|
||||||
class BroadcastServiceProvider extends ServiceProvider
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Bootstrap any application services.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function boot()
|
|
||||||
{
|
|
||||||
Broadcast::routes();
|
|
||||||
|
|
||||||
require base_path('routes/channels.php');
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,36 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Providers;
|
|
||||||
|
|
||||||
use Illuminate\Support\Facades\Event;
|
|
||||||
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
|
|
||||||
|
|
||||||
use App\Listeners\ProviderPaymentCreated;
|
|
||||||
|
|
||||||
class EventServiceProvider extends ServiceProvider
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* The event listener mappings for the application.
|
|
||||||
*
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
protected $listen = [
|
|
||||||
'Illuminate\Mail\Events\MessageSent' => [
|
|
||||||
'App\Listeners\LogSentMessage',
|
|
||||||
],
|
|
||||||
|
|
||||||
\App\Events\ProviderPaymentCreated::class => [
|
|
||||||
ProviderPaymentCreated::class,
|
|
||||||
],
|
|
||||||
];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Register any events for your application.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function boot()
|
|
||||||
{
|
|
||||||
parent::boot();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,63 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Providers;
|
|
||||||
|
|
||||||
use Illuminate\Cache\RateLimiting\Limit;
|
|
||||||
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
|
||||||
use Illuminate\Http\Request;
|
|
||||||
use Illuminate\Support\Facades\RateLimiter;
|
|
||||||
use Illuminate\Support\Facades\Route;
|
|
||||||
|
|
||||||
class RouteServiceProvider extends ServiceProvider
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* The path to the "home" route for your application.
|
|
||||||
*
|
|
||||||
* This is used by Laravel authentication to redirect users after login.
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
public const HOME = '/home';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The controller namespace for the application.
|
|
||||||
*
|
|
||||||
* When present, controller route declarations will automatically be prefixed with this namespace.
|
|
||||||
*
|
|
||||||
* @var string|null
|
|
||||||
*/
|
|
||||||
// protected $namespace = 'App\\Http\\Controllers';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Define your route model bindings, pattern filters, etc.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function boot()
|
|
||||||
{
|
|
||||||
$this->configureRateLimiting();
|
|
||||||
|
|
||||||
$this->routes(function () {
|
|
||||||
Route::prefix('api')
|
|
||||||
->middleware('api')
|
|
||||||
->namespace($this->namespace)
|
|
||||||
->group(base_path('routes/api.php'));
|
|
||||||
|
|
||||||
Route::middleware('web')
|
|
||||||
->namespace($this->namespace)
|
|
||||||
->group(base_path('routes/web.php'));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Configure the rate limiters for the application.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
protected function configureRateLimiting()
|
|
||||||
{
|
|
||||||
RateLimiter::for('api', function (Request $request) {
|
|
||||||
return Limit::perMinute(60)->by(optional($request->user())->id ?: $request->ip());
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
@ -16,6 +16,6 @@ trait ScopeServiceUserAuthorised
|
|||||||
public function scopeServiceUserAuthorised($query,User $uo)
|
public function scopeServiceUserAuthorised($query,User $uo)
|
||||||
{
|
{
|
||||||
return $query
|
return $query
|
||||||
->whereIN('services.account_id',$uo->accounts->pluck('id'));
|
->whereIN('services.account_id',$uo->accounts_all->pluck('id'));
|
||||||
}
|
}
|
||||||
}
|
}
|
50
artisan
50
artisan
@ -1,53 +1,15 @@
|
|||||||
#!/usr/bin/env php
|
#!/usr/bin/env php
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use Symfony\Component\Console\Input\ArgvInput;
|
||||||
|
|
||||||
define('LARAVEL_START', microtime(true));
|
define('LARAVEL_START', microtime(true));
|
||||||
|
|
||||||
/*
|
// Register the Composer autoloader...
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| Register The Auto Loader
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| Composer provides a convenient, automatically generated class loader
|
|
||||||
| for our application. We just need to utilize it! We'll require it
|
|
||||||
| into the script here so that we do not have to worry about the
|
|
||||||
| loading of any of our classes manually. It's great to relax.
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
require __DIR__.'/vendor/autoload.php';
|
require __DIR__.'/vendor/autoload.php';
|
||||||
|
|
||||||
$app = require_once __DIR__.'/bootstrap/app.php';
|
// Bootstrap Laravel and handle the command...
|
||||||
|
$status = (require_once __DIR__.'/bootstrap/app.php')
|
||||||
/*
|
->handleCommand(new ArgvInput);
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| Run The Artisan Application
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| When we run the console application, the current CLI command will be
|
|
||||||
| executed in this console and the response sent back to a terminal
|
|
||||||
| or another output device for the developers. Here goes nothing!
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);
|
|
||||||
|
|
||||||
$status = $kernel->handle(
|
|
||||||
$input = new Symfony\Component\Console\Input\ArgvInput,
|
|
||||||
new Symfony\Component\Console\Output\ConsoleOutput
|
|
||||||
);
|
|
||||||
|
|
||||||
/*
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| Shutdown The Application
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| Once Artisan has finished running, we will fire off the shutdown events
|
|
||||||
| so that any final work may be done by the application before we shut
|
|
||||||
| down the process. This is the last thing to happen to the request.
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
$kernel->terminate($input, $status);
|
|
||||||
|
|
||||||
exit($status);
|
exit($status);
|
||||||
|
@ -1,55 +1,24 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
use Illuminate\Foundation\Application;
|
||||||
|--------------------------------------------------------------------------
|
use Illuminate\Foundation\Configuration\Exceptions;
|
||||||
| Create The Application
|
use Illuminate\Foundation\Configuration\Middleware;
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| The first thing we will do is create a new Laravel application instance
|
|
||||||
| which serves as the "glue" for all the components of Laravel, and is
|
|
||||||
| the IoC container for the system binding all of the various parts.
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
$app = new Illuminate\Foundation\Application(
|
return Application::configure(basePath: dirname(__DIR__))
|
||||||
realpath(__DIR__.'/../')
|
->withRouting(
|
||||||
);
|
web: __DIR__.'/../routes/web.php',
|
||||||
|
commands: __DIR__.'/../routes/console.php',
|
||||||
|
health: '/up',
|
||||||
|
)
|
||||||
|
->withMiddleware(function (Middleware $middleware) {
|
||||||
|
$middleware->append([
|
||||||
|
\App\Http\Middleware\SetSite::class,
|
||||||
|
]);
|
||||||
|
|
||||||
/*
|
$middleware->alias([
|
||||||
|--------------------------------------------------------------------------
|
'role' => \App\Http\Middleware\Role::class,
|
||||||
| Bind Important Interfaces
|
]);
|
||||||
|--------------------------------------------------------------------------
|
})
|
||||||
|
|
->withExceptions(function (Exceptions $exceptions) {
|
||||||
| Next, we need to bind some important interfaces into the container so
|
//
|
||||||
| we will be able to resolve them when needed. The kernels serve the
|
})->create();
|
||||||
| incoming requests to this application from both the web and CLI.
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
$app->singleton(
|
|
||||||
Illuminate\Contracts\Http\Kernel::class,
|
|
||||||
App\Http\Kernel::class
|
|
||||||
);
|
|
||||||
|
|
||||||
$app->singleton(
|
|
||||||
Illuminate\Contracts\Console\Kernel::class,
|
|
||||||
App\Console\Kernel::class
|
|
||||||
);
|
|
||||||
|
|
||||||
$app->singleton(
|
|
||||||
Illuminate\Contracts\Debug\ExceptionHandler::class,
|
|
||||||
App\Exceptions\Handler::class
|
|
||||||
);
|
|
||||||
|
|
||||||
/*
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| Return The Application
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| This script returns the application instance. The instance is given to
|
|
||||||
| the calling script so we can separate the building of the instances
|
|
||||||
| from the actual running of the application and sending responses.
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
return $app;
|
|
||||||
|
5
bootstrap/providers.php
Normal file
5
bootstrap/providers.php
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
App\Providers\AppServiceProvider::class,
|
||||||
|
];
|
@ -2,43 +2,33 @@
|
|||||||
"name": "laravel/laravel",
|
"name": "laravel/laravel",
|
||||||
"type": "project",
|
"type": "project",
|
||||||
"description": "The Laravel Framework.",
|
"description": "The Laravel Framework.",
|
||||||
"keywords": [ "framework", "laravel" ],
|
"keywords": ["laravel", "framework"],
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"require": {
|
"require": {
|
||||||
"php": "^8.0.2",
|
"php": "^8.2|8.3",
|
||||||
"ext-curl": "*",
|
"ext-curl": "*",
|
||||||
"ext-pdo": "*",
|
"ext-pdo": "*",
|
||||||
"ext-zlib": "*",
|
|
||||||
"awobaz/compoships": "^2.1",
|
|
||||||
"barryvdh/laravel-snappy": "^1.0",
|
"barryvdh/laravel-snappy": "^1.0",
|
||||||
"clarkeash/doorman": "^7.0",
|
"clarkeash/doorman": "^9.0",
|
||||||
"doctrine/dbal": "^2.10",
|
|
||||||
"eduardokum/laravel-mail-auto-embed": "^2.0",
|
"eduardokum/laravel-mail-auto-embed": "^2.0",
|
||||||
"fruitcake/laravel-cors": "^2.0",
|
|
||||||
"guzzlehttp/guzzle": "^7.0.1",
|
|
||||||
"intervention/image": "^2.5",
|
|
||||||
"laravel/framework": "^9.0",
|
|
||||||
"laravel/passport": "^10.1",
|
|
||||||
"laravel/socialite": "^5.2",
|
|
||||||
"laravel/ui": "^3.2",
|
|
||||||
"laravel/dreamscape": "^0.1.0",
|
"laravel/dreamscape": "^0.1.0",
|
||||||
|
"laravel/framework": "^11.0",
|
||||||
"laravel/intuit": "^0.1.7",
|
"laravel/intuit": "^0.1.7",
|
||||||
"laravel/leenooks": "^9.2.6",
|
"laravel/leenooks": "^11.0",
|
||||||
"leenooks/laravel-theme": "^v2.0.18",
|
"laravel/passport": "^12.0",
|
||||||
"nunomaduro/laravel-console-summary": "^1.8",
|
"laravel/socialite": "^5.15",
|
||||||
|
"laravel/ui": "^4.5",
|
||||||
"paypal/paypal-checkout-sdk": "^1.0",
|
"paypal/paypal-checkout-sdk": "^1.0",
|
||||||
"rennokki/laravel-eloquent-query-cache": "^3.3",
|
"repat/laravel-job-models": "^0.9",
|
||||||
"repat/laravel-job-models": "^0.7",
|
|
||||||
"romanzipp/laravel-queue-monitor": "^2.0",
|
|
||||||
"web-auth/webauthn-lib": "^4.4"
|
"web-auth/webauthn-lib": "^4.4"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"barryvdh/laravel-debugbar": "^3.6",
|
"barryvdh/laravel-debugbar": "^3.6",
|
||||||
"spatie/laravel-ignition": "^1.0",
|
"fakerphp/faker": "^1.23",
|
||||||
"fakerphp/faker": "^1.9.1",
|
"mockery/mockery": "^1.6",
|
||||||
"mockery/mockery": "^1.4.2",
|
"nunomaduro/collision": "^8.0",
|
||||||
"nunomaduro/collision": "^6.1",
|
"phpunit/phpunit": "^11.0.1",
|
||||||
"phpunit/phpunit": "^9.3.3"
|
"spatie/laravel-ignition": "^2.4"
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
@ -68,10 +58,6 @@
|
|||||||
"type": "vcs",
|
"type": "vcs",
|
||||||
"url": "https://gitea.dege.au/laravel/dreamscape.git"
|
"url": "https://gitea.dege.au/laravel/dreamscape.git"
|
||||||
},
|
},
|
||||||
"laravel-theme": {
|
|
||||||
"type": "vcs",
|
|
||||||
"url": "https://github.com/leenooks/laravel-theme"
|
|
||||||
},
|
|
||||||
"laravel-console-summary": {
|
"laravel-console-summary": {
|
||||||
"type": "vcs",
|
"type": "vcs",
|
||||||
"url": "https://github.com/leenooks/laravel-console-summary"
|
"url": "https://github.com/leenooks/laravel-console-summary"
|
||||||
@ -99,6 +85,6 @@
|
|||||||
"preferred-install": "dist",
|
"preferred-install": "dist",
|
||||||
"sort-packages": true
|
"sort-packages": true
|
||||||
},
|
},
|
||||||
"minimum-stability": "dev",
|
"minimum-stability": "stable",
|
||||||
"prefer-stable": true
|
"prefer-stable": true
|
||||||
}
|
}
|
||||||
|
2995
composer.lock
generated
2995
composer.lock
generated
File diff suppressed because it is too large
Load Diff
177
config/app.php
177
config/app.php
@ -7,9 +7,9 @@ return [
|
|||||||
| Application Name
|
| Application Name
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
|
||||||
| This value is the name of your application. This value is used when the
|
| This value is the name of your application, which will be used when the
|
||||||
| framework needs to place the application's name in a notification or
|
| framework needs to place the application's name in a notification or
|
||||||
| any other location as required by the application or its packages.
|
| other UI elements where an application name needs to be displayed.
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -50,26 +50,24 @@ return [
|
|||||||
|
|
|
|
||||||
| This URL is used by the console to properly generate URLs when using
|
| This URL is used by the console to properly generate URLs when using
|
||||||
| the Artisan command line tool. You should set this to the root of
|
| the Artisan command line tool. You should set this to the root of
|
||||||
| your application so that it is used when running Artisan tasks.
|
| the application so that it's available within Artisan commands.
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'url' => env('APP_URL', 'http://localhost'),
|
'url' => env('APP_URL', 'http://localhost'),
|
||||||
|
|
||||||
'asset_url' => env('ASSET_URL', null),
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
| Application Timezone
|
| Application Timezone
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
|
||||||
| Here you may specify the default timezone for your application, which
|
| Here you may specify the default timezone for your application, which
|
||||||
| will be used by the PHP date and date-time functions. We have gone
|
| will be used by the PHP date and date-time functions. The timezone
|
||||||
| ahead and set this to a sensible default for you out of the box.
|
| is set to "UTC" by default as it is suitable for most use cases.
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'timezone' => 'Australia/Melbourne',
|
'timezone' => env('APP_TIMEZONE', 'UTC'),
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
@ -77,173 +75,54 @@ return [
|
|||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
|
||||||
| The application locale determines the default locale that will be used
|
| The application locale determines the default locale that will be used
|
||||||
| by the translation service provider. You are free to set this value
|
| by Laravel's translation / localization methods. This option can be
|
||||||
| to any of the locales which will be supported by the application.
|
| set to any locale for which you plan to have translation strings.
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'locale' => 'en',
|
'locale' => env('APP_LOCALE', 'en'),
|
||||||
|
|
||||||
/*
|
'fallback_locale' => env('APP_FALLBACK_LOCALE', 'en'),
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| Application Fallback Locale
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| The fallback locale determines the locale to use when the current one
|
|
||||||
| is not available. You may change the value to correspond to any of
|
|
||||||
| the language folders that are provided through your application.
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
'fallback_locale' => 'en',
|
'faker_locale' => env('APP_FAKER_LOCALE', 'en_US'),
|
||||||
|
|
||||||
/*
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| Faker Locale
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| This locale will be used by the Faker PHP library when generating fake
|
|
||||||
| data for your database seeds. For example, this will be used to get
|
|
||||||
| localized telephone numbers, street address information and more.
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
'faker_locale' => 'en_US',
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
| Encryption Key
|
| Encryption Key
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
|
||||||
| This key is used by the Illuminate encrypter service and should be set
|
| This key is utilized by Laravel's encryption services and should be set
|
||||||
| to a random, 32 character string, otherwise these encrypted strings
|
| to a random, 32 character string to ensure that all encrypted values
|
||||||
| will not be safe. Please do this before deploying an application!
|
| are secure. You should do this prior to deploying the application.
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'key' => env('APP_KEY'),
|
|
||||||
|
|
||||||
'cipher' => 'AES-256-CBC',
|
'cipher' => 'AES-256-CBC',
|
||||||
|
|
||||||
/*
|
'key' => env('APP_KEY'),
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| Autoloaded Service Providers
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| The service providers listed here will be automatically loaded on the
|
|
||||||
| request to your application. Feel free to add your own services to
|
|
||||||
| this array to grant expanded functionality to your applications.
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
'providers' => [
|
'previous_keys' => [
|
||||||
|
...array_filter(
|
||||||
/*
|
explode(',', env('APP_PREVIOUS_KEYS', ''))
|
||||||
* Laravel Framework Service Providers...
|
),
|
||||||
*/
|
|
||||||
Illuminate\Auth\AuthServiceProvider::class,
|
|
||||||
Illuminate\Broadcasting\BroadcastServiceProvider::class,
|
|
||||||
Illuminate\Bus\BusServiceProvider::class,
|
|
||||||
Illuminate\Cache\CacheServiceProvider::class,
|
|
||||||
Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class,
|
|
||||||
Illuminate\Cookie\CookieServiceProvider::class,
|
|
||||||
Illuminate\Database\DatabaseServiceProvider::class,
|
|
||||||
Illuminate\Encryption\EncryptionServiceProvider::class,
|
|
||||||
Illuminate\Filesystem\FilesystemServiceProvider::class,
|
|
||||||
Illuminate\Foundation\Providers\FoundationServiceProvider::class,
|
|
||||||
Illuminate\Hashing\HashServiceProvider::class,
|
|
||||||
Illuminate\Mail\MailServiceProvider::class,
|
|
||||||
Illuminate\Notifications\NotificationServiceProvider::class,
|
|
||||||
Illuminate\Pagination\PaginationServiceProvider::class,
|
|
||||||
Illuminate\Pipeline\PipelineServiceProvider::class,
|
|
||||||
Illuminate\Queue\QueueServiceProvider::class,
|
|
||||||
Illuminate\Redis\RedisServiceProvider::class,
|
|
||||||
Illuminate\Auth\Passwords\PasswordResetServiceProvider::class,
|
|
||||||
Illuminate\Session\SessionServiceProvider::class,
|
|
||||||
Illuminate\Translation\TranslationServiceProvider::class,
|
|
||||||
Illuminate\Validation\ValidationServiceProvider::class,
|
|
||||||
Illuminate\View\ViewServiceProvider::class,
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Package Service Providers...
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Application Service Providers...
|
|
||||||
*/
|
|
||||||
App\Providers\AppServiceProvider::class,
|
|
||||||
App\Providers\AuthServiceProvider::class,
|
|
||||||
// App\Providers\BroadcastServiceProvider::class,
|
|
||||||
App\Providers\EventServiceProvider::class,
|
|
||||||
App\Providers\RouteServiceProvider::class,
|
|
||||||
Laravel\Socialite\SocialiteServiceProvider::class,
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Other Service Providers...
|
|
||||||
*/
|
|
||||||
Orchestra\Asset\AssetServiceProvider::class,
|
|
||||||
Collective\Html\HtmlServiceProvider::class,
|
|
||||||
],
|
],
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
| Class Aliases
|
| Maintenance Mode Driver
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
|
||||||
| This array of class aliases will be registered when this application
|
| These configuration options determine the driver used to determine and
|
||||||
| is started. However, feel free to register as many as you wish as
|
| manage Laravel's "maintenance mode" status. The "cache" driver will
|
||||||
| the aliases are "lazy" loaded so they don't hinder performance.
|
| allow maintenance mode to be controlled across multiple machines.
|
||||||
|
|
|
||||||
|
| Supported drivers: "file", "cache"
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'aliases' => [
|
'maintenance' => [
|
||||||
|
'driver' => env('APP_MAINTENANCE_DRIVER', 'file'),
|
||||||
'App' => Illuminate\Support\Facades\App::class,
|
'store' => env('APP_MAINTENANCE_STORE', 'database'),
|
||||||
'Arr' => Illuminate\Support\Arr::class,
|
|
||||||
'Artisan' => Illuminate\Support\Facades\Artisan::class,
|
|
||||||
'Asset' => Orchestra\Support\Facades\Asset::class,
|
|
||||||
'Auth' => Illuminate\Support\Facades\Auth::class,
|
|
||||||
'Blade' => Illuminate\Support\Facades\Blade::class,
|
|
||||||
'Broadcast' => Illuminate\Support\Facades\Broadcast::class,
|
|
||||||
'Bus' => Illuminate\Support\Facades\Bus::class,
|
|
||||||
'Cache' => Illuminate\Support\Facades\Cache::class,
|
|
||||||
'Config' => Illuminate\Support\Facades\Config::class,
|
|
||||||
'Cookie' => Illuminate\Support\Facades\Cookie::class,
|
|
||||||
'Crypt' => Illuminate\Support\Facades\Crypt::class,
|
|
||||||
'Date' => Illuminate\Support\Facades\Date::class,
|
|
||||||
'DB' => Illuminate\Support\Facades\DB::class,
|
|
||||||
'Eloquent' => Illuminate\Database\Eloquent\Model::class,
|
|
||||||
'Event' => Illuminate\Support\Facades\Event::class,
|
|
||||||
'File' => Illuminate\Support\Facades\File::class,
|
|
||||||
'Gate' => Illuminate\Support\Facades\Gate::class,
|
|
||||||
'Gravatar' => Creativeorange\Gravatar\Facades\Gravatar::class,
|
|
||||||
'Hash' => Illuminate\Support\Facades\Hash::class,
|
|
||||||
'Http' => Illuminate\Support\Facades\Http::class,
|
|
||||||
'Lang' => Illuminate\Support\Facades\Lang::class,
|
|
||||||
'Log' => Illuminate\Support\Facades\Log::class,
|
|
||||||
'Mail' => Illuminate\Support\Facades\Mail::class,
|
|
||||||
'Notification' => Illuminate\Support\Facades\Notification::class,
|
|
||||||
'Password' => Illuminate\Support\Facades\Password::class,
|
|
||||||
'PDF' => Barryvdh\Snappy\Facades\SnappyPdf::class,
|
|
||||||
'Queue' => Illuminate\Support\Facades\Queue::class,
|
|
||||||
'RateLimiter' => Illuminate\Support\Facades\RateLimiter::class,
|
|
||||||
'Redirect' => Illuminate\Support\Facades\Redirect::class,
|
|
||||||
'Redis' => Illuminate\Support\Facades\Redis::class,
|
|
||||||
'Request' => Illuminate\Support\Facades\Request::class,
|
|
||||||
'Response' => Illuminate\Support\Facades\Response::class,
|
|
||||||
'Route' => Illuminate\Support\Facades\Route::class,
|
|
||||||
'Schema' => Illuminate\Support\Facades\Schema::class,
|
|
||||||
'Session' => Illuminate\Support\Facades\Session::class,
|
|
||||||
'Storage' => Illuminate\Support\Facades\Storage::class,
|
|
||||||
'Str' => Illuminate\Support\Str::class,
|
|
||||||
'URL' => Illuminate\Support\Facades\URL::class,
|
|
||||||
'Validator' => Illuminate\Support\Facades\Validator::class,
|
|
||||||
'View' => Illuminate\Support\Facades\View::class,
|
|
||||||
|
|
||||||
],
|
],
|
||||||
|
|
||||||
// @todo This needs to move.
|
|
||||||
'invoice_inadvance'=>30,
|
|
||||||
|
|
||||||
'font' => 'Noto Sans TC',
|
|
||||||
];
|
];
|
||||||
|
@ -7,15 +7,15 @@ return [
|
|||||||
| Authentication Defaults
|
| Authentication Defaults
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
|
||||||
| This option controls the default authentication "guard" and password
|
| This option defines the default authentication "guard" and password
|
||||||
| reset options for your application. You may change these defaults
|
| reset "broker" for your application. You may change these values
|
||||||
| as required, but they're a perfect start for most applications.
|
| as required, but they're a perfect start for most applications.
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'defaults' => [
|
'defaults' => [
|
||||||
'guard' => 'web',
|
'guard' => env('AUTH_GUARD', 'web'),
|
||||||
'passwords' => 'users',
|
'passwords' => env('AUTH_PASSWORD_BROKER', 'users'),
|
||||||
],
|
],
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -25,13 +25,13 @@ return [
|
|||||||
|
|
|
|
||||||
| Next, you may define every authentication guard for your application.
|
| Next, you may define every authentication guard for your application.
|
||||||
| Of course, a great default configuration has been defined for you
|
| Of course, a great default configuration has been defined for you
|
||||||
| here which uses session storage and the Eloquent user provider.
|
| which utilizes session storage plus the Eloquent user provider.
|
||||||
|
|
|
|
||||||
| All authentication drivers have a user provider. This defines how the
|
| All authentication guards have a user provider, which defines how the
|
||||||
| users are actually retrieved out of your database or other storage
|
| users are actually retrieved out of your database or other storage
|
||||||
| mechanisms used by this application to persist your user's data.
|
| system used by the application. Typically, Eloquent is utilized.
|
||||||
|
|
|
|
||||||
| Supported: "session", "token"
|
| Supported: "session"
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -40,11 +40,6 @@ return [
|
|||||||
'driver' => 'session',
|
'driver' => 'session',
|
||||||
'provider' => 'users',
|
'provider' => 'users',
|
||||||
],
|
],
|
||||||
|
|
||||||
'api' => [
|
|
||||||
'driver' => 'passport',
|
|
||||||
'provider' => 'users',
|
|
||||||
],
|
|
||||||
],
|
],
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -52,12 +47,12 @@ return [
|
|||||||
| User Providers
|
| User Providers
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
|
||||||
| All authentication drivers have a user provider. This defines how the
|
| All authentication guards have a user provider, which defines how the
|
||||||
| users are actually retrieved out of your database or other storage
|
| users are actually retrieved out of your database or other storage
|
||||||
| mechanisms used by this application to persist your user's data.
|
| system used by the application. Typically, Eloquent is utilized.
|
||||||
|
|
|
|
||||||
| If you have multiple user tables or models you may configure multiple
|
| If you have multiple user tables or models you may configure multiple
|
||||||
| sources which represent each model / table. These sources may then
|
| providers to represent the model / table. These providers may then
|
||||||
| be assigned to any extra authentication guards you have defined.
|
| be assigned to any extra authentication guards you have defined.
|
||||||
|
|
|
|
||||||
| Supported: "database", "eloquent"
|
| Supported: "database", "eloquent"
|
||||||
@ -67,7 +62,7 @@ return [
|
|||||||
'providers' => [
|
'providers' => [
|
||||||
'users' => [
|
'users' => [
|
||||||
'driver' => 'eloquent',
|
'driver' => 'eloquent',
|
||||||
'model' => App\Models\User::class,
|
'model' => env('AUTH_MODEL', App\Models\User::class),
|
||||||
],
|
],
|
||||||
|
|
||||||
// 'users' => [
|
// 'users' => [
|
||||||
@ -81,30 +76,40 @@ return [
|
|||||||
| Resetting Passwords
|
| Resetting Passwords
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
|
||||||
| You may specify multiple password reset configurations if you have more
|
| These configuration options specify the behavior of Laravel's password
|
||||||
| than one user table or model in the application and you want to have
|
| reset functionality, including the table utilized for token storage
|
||||||
| separate password reset settings based on the specific user types.
|
| and the user provider that is invoked to actually retrieve users.
|
||||||
|
|
|
|
||||||
| The expire time is the number of minutes that the reset token should be
|
| The expiry time is the number of minutes that each reset token will be
|
||||||
| considered valid. This security feature keeps tokens short-lived so
|
| considered valid. This security feature keeps tokens short-lived so
|
||||||
| they have less time to be guessed. You may change this as needed.
|
| they have less time to be guessed. You may change this as needed.
|
||||||
|
|
|
|
||||||
|
| The throttle setting is the number of seconds a user must wait before
|
||||||
|
| generating more password reset tokens. This prevents the user from
|
||||||
|
| quickly generating a very large amount of password reset tokens.
|
||||||
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'passwords' => [
|
'passwords' => [
|
||||||
'users' => [
|
'users' => [
|
||||||
'provider' => 'users',
|
'provider' => 'users',
|
||||||
'table' => 'password_resets',
|
'table' => env('AUTH_PASSWORD_RESET_TOKEN_TABLE', 'password_reset_tokens'),
|
||||||
'expire' => 60,
|
'expire' => 60,
|
||||||
|
'throttle' => 60,
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
|
||||||
'social' => [
|
/*
|
||||||
'google' => [
|
|--------------------------------------------------------------------------
|
||||||
'name' => 'Google',
|
| Password Confirmation Timeout
|
||||||
'id' => 'google',
|
|--------------------------------------------------------------------------
|
||||||
'class' => 'btn-danger',
|
|
|
||||||
'icon' => 'fab fa-google',
|
| Here you may define the amount of seconds before a password confirmation
|
||||||
],
|
| window expires and users are asked to re-enter their password via the
|
||||||
],
|
| confirmation screen. By default, the timeout lasts for three hours.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'password_timeout' => env('AUTH_PASSWORD_TIMEOUT', 10800),
|
||||||
|
|
||||||
];
|
];
|
||||||
|
@ -1,59 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
return [
|
|
||||||
|
|
||||||
/*
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| Default Broadcaster
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| This option controls the default broadcaster that will be used by the
|
|
||||||
| framework when an event needs to be broadcast. You may set this to
|
|
||||||
| any of the connections defined in the "connections" array below.
|
|
||||||
|
|
|
||||||
| Supported: "pusher", "redis", "log", "null"
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
'default' => env('BROADCAST_DRIVER', 'null'),
|
|
||||||
|
|
||||||
/*
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| Broadcast Connections
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| Here you may define all of the broadcast connections that will be used
|
|
||||||
| to broadcast events to other systems or over websockets. Samples of
|
|
||||||
| each available type of connection are provided inside this array.
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
'connections' => [
|
|
||||||
|
|
||||||
'pusher' => [
|
|
||||||
'driver' => 'pusher',
|
|
||||||
'key' => env('PUSHER_APP_KEY'),
|
|
||||||
'secret' => env('PUSHER_APP_SECRET'),
|
|
||||||
'app_id' => env('PUSHER_APP_ID'),
|
|
||||||
'options' => [
|
|
||||||
'cluster' => env('PUSHER_APP_CLUSTER'),
|
|
||||||
'useTLS' => true,
|
|
||||||
],
|
|
||||||
],
|
|
||||||
|
|
||||||
'redis' => [
|
|
||||||
'driver' => 'redis',
|
|
||||||
'connection' => 'default',
|
|
||||||
],
|
|
||||||
|
|
||||||
'log' => [
|
|
||||||
'driver' => 'log',
|
|
||||||
],
|
|
||||||
|
|
||||||
'null' => [
|
|
||||||
'driver' => 'null',
|
|
||||||
],
|
|
||||||
|
|
||||||
],
|
|
||||||
|
|
||||||
];
|
|
@ -9,16 +9,13 @@ return [
|
|||||||
| Default Cache Store
|
| Default Cache Store
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
|
||||||
| This option controls the default cache connection that gets used while
|
| This option controls the default cache store that will be used by the
|
||||||
| using this caching library. This connection is used when another is
|
| framework. This connection is utilized if another isn't explicitly
|
||||||
| not explicitly specified when executing a given caching function.
|
| specified when running a cache operation inside the application.
|
||||||
|
|
|
||||||
| Supported: "apc", "array", "database", "file",
|
|
||||||
| "memcached", "redis", "dynamodb"
|
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'default' => env('CACHE_DRIVER', 'file'),
|
'default' => env('CACHE_STORE', 'database'),
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
@ -29,27 +26,30 @@ return [
|
|||||||
| well as their drivers. You may even define multiple stores for the
|
| well as their drivers. You may even define multiple stores for the
|
||||||
| same cache driver to group types of items stored in your caches.
|
| same cache driver to group types of items stored in your caches.
|
||||||
|
|
|
|
||||||
|
| Supported drivers: "array", "database", "file", "memcached",
|
||||||
|
| "redis", "dynamodb", "octane", "null"
|
||||||
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'stores' => [
|
'stores' => [
|
||||||
|
|
||||||
'apc' => [
|
|
||||||
'driver' => 'apc',
|
|
||||||
],
|
|
||||||
|
|
||||||
'array' => [
|
'array' => [
|
||||||
'driver' => 'array',
|
'driver' => 'array',
|
||||||
|
'serialize' => false,
|
||||||
],
|
],
|
||||||
|
|
||||||
'database' => [
|
'database' => [
|
||||||
'driver' => 'database',
|
'driver' => 'database',
|
||||||
'table' => 'cache',
|
'connection' => env('DB_CACHE_CONNECTION'),
|
||||||
'connection' => null,
|
'table' => env('DB_CACHE_TABLE', 'cache'),
|
||||||
|
'lock_connection' => env('DB_CACHE_LOCK_CONNECTION'),
|
||||||
|
'lock_table' => env('DB_CACHE_LOCK_TABLE'),
|
||||||
],
|
],
|
||||||
|
|
||||||
'file' => [
|
'file' => [
|
||||||
'driver' => 'file',
|
'driver' => 'file',
|
||||||
'path' => storage_path('framework/cache/data'),
|
'path' => storage_path('framework/cache/data'),
|
||||||
|
'lock_path' => storage_path('framework/cache/data'),
|
||||||
],
|
],
|
||||||
|
|
||||||
'memcached' => [
|
'memcached' => [
|
||||||
@ -73,7 +73,8 @@ return [
|
|||||||
|
|
||||||
'redis' => [
|
'redis' => [
|
||||||
'driver' => 'redis',
|
'driver' => 'redis',
|
||||||
'connection' => 'cache',
|
'connection' => env('REDIS_CACHE_CONNECTION', 'cache'),
|
||||||
|
'lock_connection' => env('REDIS_CACHE_LOCK_CONNECTION', 'default'),
|
||||||
],
|
],
|
||||||
|
|
||||||
'dynamodb' => [
|
'dynamodb' => [
|
||||||
@ -85,6 +86,10 @@ return [
|
|||||||
'endpoint' => env('DYNAMODB_ENDPOINT'),
|
'endpoint' => env('DYNAMODB_ENDPOINT'),
|
||||||
],
|
],
|
||||||
|
|
||||||
|
'octane' => [
|
||||||
|
'driver' => 'octane',
|
||||||
|
],
|
||||||
|
|
||||||
],
|
],
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -92,12 +97,12 @@ return [
|
|||||||
| Cache Key Prefix
|
| Cache Key Prefix
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
|
||||||
| When utilizing a RAM based store such as APC or Memcached, there might
|
| When utilizing the APC, database, memcached, Redis, and DynamoDB cache
|
||||||
| be other applications utilizing the same cache. So, we'll specify a
|
| stores, there might be other applications using the same cache. For
|
||||||
| value to get prefixed to all our keys so we can avoid collisions.
|
| that reason, you may prefix every cache key to avoid collisions.
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache'),
|
'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache_'),
|
||||||
|
|
||||||
];
|
];
|
||||||
|
@ -1,34 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
return [
|
|
||||||
|
|
||||||
/*
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| Cross-Origin Resource Sharing (CORS) Configuration
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| Here you may configure your settings for cross-origin resource sharing
|
|
||||||
| or "CORS". This determines what cross-origin operations may execute
|
|
||||||
| in web browsers. You are free to adjust these settings as needed.
|
|
||||||
|
|
|
||||||
| To learn more: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
'paths' => ['api/*', 'sanctum/csrf-cookie'],
|
|
||||||
|
|
||||||
'allowed_methods' => ['*'],
|
|
||||||
|
|
||||||
'allowed_origins' => ['*'],
|
|
||||||
|
|
||||||
'allowed_origins_patterns' => [],
|
|
||||||
|
|
||||||
'allowed_headers' => ['*'],
|
|
||||||
|
|
||||||
'exposed_headers' => [],
|
|
||||||
|
|
||||||
'max_age' => 0,
|
|
||||||
|
|
||||||
'supports_credentials' => false,
|
|
||||||
|
|
||||||
];
|
|
@ -10,26 +10,22 @@ return [
|
|||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
|
||||||
| Here you may specify which of the database connections below you wish
|
| Here you may specify which of the database connections below you wish
|
||||||
| to use as your default connection for all database work. Of course
|
| to use as your default connection for database operations. This is
|
||||||
| you may use many connections at once using the Database library.
|
| the connection which will be utilized unless another connection
|
||||||
|
| is explicitly specified when you execute a query / statement.
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'default' => env('DB_CONNECTION', 'mysql'),
|
'default' => env('DB_CONNECTION', 'sqlite'),
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
| Database Connections
|
| Database Connections
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
|
||||||
| Here are each of the database connections setup for your application.
|
| Below are all of the database connections defined for your application.
|
||||||
| Of course, examples of configuring each database platform that is
|
| An example configuration is provided for each database system which
|
||||||
| supported by Laravel is shown below to make development simple.
|
| is supported by Laravel. You're free to add / remove connections.
|
||||||
|
|
|
||||||
|
|
|
||||||
| All database work in Laravel is done through the PHP PDO facilities
|
|
||||||
| so make sure you have the driver for your particular database of
|
|
||||||
| choice installed on your machine before you begin development.
|
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -37,7 +33,7 @@ return [
|
|||||||
|
|
||||||
'sqlite' => [
|
'sqlite' => [
|
||||||
'driver' => 'sqlite',
|
'driver' => 'sqlite',
|
||||||
'url' => env('DATABASE_URL'),
|
'url' => env('DB_URL'),
|
||||||
'database' => env('DB_DATABASE', database_path('database.sqlite')),
|
'database' => env('DB_DATABASE', database_path('database.sqlite')),
|
||||||
'prefix' => '',
|
'prefix' => '',
|
||||||
'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true),
|
'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true),
|
||||||
@ -45,15 +41,35 @@ return [
|
|||||||
|
|
||||||
'mysql' => [
|
'mysql' => [
|
||||||
'driver' => 'mysql',
|
'driver' => 'mysql',
|
||||||
'url' => env('DATABASE_URL'),
|
'url' => env('DB_URL'),
|
||||||
'host' => env('DB_HOST', '127.0.0.1'),
|
'host' => env('DB_HOST', '127.0.0.1'),
|
||||||
'port' => env('DB_PORT', '3306'),
|
'port' => env('DB_PORT', '3306'),
|
||||||
'database' => env('DB_DATABASE', 'forge'),
|
'database' => env('DB_DATABASE', 'laravel'),
|
||||||
'username' => env('DB_USERNAME', 'forge'),
|
'username' => env('DB_USERNAME', 'root'),
|
||||||
'password' => env('DB_PASSWORD', ''),
|
'password' => env('DB_PASSWORD', ''),
|
||||||
'unix_socket' => env('DB_SOCKET', ''),
|
'unix_socket' => env('DB_SOCKET', ''),
|
||||||
'charset' => 'utf8mb4',
|
'charset' => env('DB_CHARSET', 'utf8mb4'),
|
||||||
'collation' => 'utf8mb4_unicode_ci',
|
'collation' => env('DB_COLLATION', 'utf8mb4_unicode_ci'),
|
||||||
|
'prefix' => '',
|
||||||
|
'prefix_indexes' => true,
|
||||||
|
'strict' => true,
|
||||||
|
'engine' => null,
|
||||||
|
'options' => extension_loaded('pdo_mysql') ? array_filter([
|
||||||
|
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
|
||||||
|
]) : [],
|
||||||
|
],
|
||||||
|
|
||||||
|
'mariadb' => [
|
||||||
|
'driver' => 'mariadb',
|
||||||
|
'url' => env('DB_URL'),
|
||||||
|
'host' => env('DB_HOST', '127.0.0.1'),
|
||||||
|
'port' => env('DB_PORT', '3306'),
|
||||||
|
'database' => env('DB_DATABASE', 'laravel'),
|
||||||
|
'username' => env('DB_USERNAME', 'root'),
|
||||||
|
'password' => env('DB_PASSWORD', ''),
|
||||||
|
'unix_socket' => env('DB_SOCKET', ''),
|
||||||
|
'charset' => env('DB_CHARSET', 'utf8mb4'),
|
||||||
|
'collation' => env('DB_COLLATION', 'utf8mb4_unicode_ci'),
|
||||||
'prefix' => '',
|
'prefix' => '',
|
||||||
'prefix_indexes' => true,
|
'prefix_indexes' => true,
|
||||||
'strict' => true,
|
'strict' => true,
|
||||||
@ -65,30 +81,32 @@ return [
|
|||||||
|
|
||||||
'pgsql' => [
|
'pgsql' => [
|
||||||
'driver' => 'pgsql',
|
'driver' => 'pgsql',
|
||||||
'url' => env('DATABASE_URL'),
|
'url' => env('DB_URL'),
|
||||||
'host' => env('DB_HOST', '127.0.0.1'),
|
'host' => env('DB_HOST', '127.0.0.1'),
|
||||||
'port' => env('DB_PORT', '5432'),
|
'port' => env('DB_PORT', '5432'),
|
||||||
'database' => env('DB_DATABASE', 'forge'),
|
'database' => env('DB_DATABASE', 'laravel'),
|
||||||
'username' => env('DB_USERNAME', 'forge'),
|
'username' => env('DB_USERNAME', 'root'),
|
||||||
'password' => env('DB_PASSWORD', ''),
|
'password' => env('DB_PASSWORD', ''),
|
||||||
'charset' => 'utf8',
|
'charset' => env('DB_CHARSET', 'utf8'),
|
||||||
'prefix' => '',
|
'prefix' => '',
|
||||||
'prefix_indexes' => true,
|
'prefix_indexes' => true,
|
||||||
'schema' => env('DB_SCHEMA', 'public'),
|
'search_path' => env('DB_SCHEMA', 'public'),
|
||||||
'sslmode' => 'prefer',
|
'sslmode' => 'prefer',
|
||||||
],
|
],
|
||||||
|
|
||||||
'sqlsrv' => [
|
'sqlsrv' => [
|
||||||
'driver' => 'sqlsrv',
|
'driver' => 'sqlsrv',
|
||||||
'url' => env('DATABASE_URL'),
|
'url' => env('DB_URL'),
|
||||||
'host' => env('DB_HOST', 'localhost'),
|
'host' => env('DB_HOST', 'localhost'),
|
||||||
'port' => env('DB_PORT', '1433'),
|
'port' => env('DB_PORT', '1433'),
|
||||||
'database' => env('DB_DATABASE', 'forge'),
|
'database' => env('DB_DATABASE', 'laravel'),
|
||||||
'username' => env('DB_USERNAME', 'forge'),
|
'username' => env('DB_USERNAME', 'root'),
|
||||||
'password' => env('DB_PASSWORD', ''),
|
'password' => env('DB_PASSWORD', ''),
|
||||||
'charset' => 'utf8',
|
'charset' => env('DB_CHARSET', 'utf8'),
|
||||||
'prefix' => '',
|
'prefix' => '',
|
||||||
'prefix_indexes' => true,
|
'prefix_indexes' => true,
|
||||||
|
// 'encrypt' => env('DB_ENCRYPT', 'yes'),
|
||||||
|
// 'trust_server_certificate' => env('DB_TRUST_SERVER_CERTIFICATE', 'false'),
|
||||||
],
|
],
|
||||||
|
|
||||||
],
|
],
|
||||||
@ -100,11 +118,14 @@ return [
|
|||||||
|
|
|
|
||||||
| This table keeps track of all the migrations that have already run for
|
| This table keeps track of all the migrations that have already run for
|
||||||
| your application. Using this information, we can determine which of
|
| your application. Using this information, we can determine which of
|
||||||
| the migrations on disk haven't actually been run in the database.
|
| the migrations on disk haven't actually been run on the database.
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'migrations' => 'migrations',
|
'migrations' => [
|
||||||
|
'table' => 'migrations',
|
||||||
|
'update_date_on_publish' => true,
|
||||||
|
],
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
@ -113,7 +134,7 @@ return [
|
|||||||
|
|
|
|
||||||
| Redis is an open source, fast, and advanced key-value store that also
|
| Redis is an open source, fast, and advanced key-value store that also
|
||||||
| provides a richer body of commands than a typical key-value system
|
| provides a richer body of commands than a typical key-value system
|
||||||
| such as APC or Memcached. Laravel makes it easy to dig right in.
|
| such as Memcached. You may define your connection settings here.
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -129,17 +150,19 @@ return [
|
|||||||
'default' => [
|
'default' => [
|
||||||
'url' => env('REDIS_URL'),
|
'url' => env('REDIS_URL'),
|
||||||
'host' => env('REDIS_HOST', '127.0.0.1'),
|
'host' => env('REDIS_HOST', '127.0.0.1'),
|
||||||
'password' => env('REDIS_PASSWORD', null),
|
'username' => env('REDIS_USERNAME'),
|
||||||
'port' => env('REDIS_PORT', 6379),
|
'password' => env('REDIS_PASSWORD'),
|
||||||
'database' => env('REDIS_DB', 0),
|
'port' => env('REDIS_PORT', '6379'),
|
||||||
|
'database' => env('REDIS_DB', '0'),
|
||||||
],
|
],
|
||||||
|
|
||||||
'cache' => [
|
'cache' => [
|
||||||
'url' => env('REDIS_URL'),
|
'url' => env('REDIS_URL'),
|
||||||
'host' => env('REDIS_HOST', '127.0.0.1'),
|
'host' => env('REDIS_HOST', '127.0.0.1'),
|
||||||
'password' => env('REDIS_PASSWORD', null),
|
'username' => env('REDIS_USERNAME'),
|
||||||
'port' => env('REDIS_PORT', 6379),
|
'password' => env('REDIS_PASSWORD'),
|
||||||
'database' => env('REDIS_CACHE_DB', 1),
|
'port' => env('REDIS_PORT', '6379'),
|
||||||
|
'database' => env('REDIS_CACHE_DB', '1'),
|
||||||
],
|
],
|
||||||
|
|
||||||
],
|
],
|
||||||
|
@ -1,34 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
return [
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This is the master switch to enable demo mode.
|
|
||||||
*/
|
|
||||||
'enabled' => env('DEMO_MODE_ENABLED', false),
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Visitors browsing a protected url will be redirected to this path.
|
|
||||||
*/
|
|
||||||
'redirect_unauthorized_users_to_url' => '/under-construction',
|
|
||||||
|
|
||||||
/*
|
|
||||||
* After having gained access, visitors will be redirected to this path.
|
|
||||||
*/
|
|
||||||
'redirect_authorized_users_to_url' => '/',
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The following IP's will automatically gain access to the
|
|
||||||
* app without having to visit the `demoAccess` route.
|
|
||||||
*/
|
|
||||||
'authorized_ips' => [
|
|
||||||
//
|
|
||||||
],
|
|
||||||
|
|
||||||
/*
|
|
||||||
* When strict mode is enabled, only IP's listed in `authorized_ips` will gain access.
|
|
||||||
* Visitors won't be able to gain access by visiting the `demoAccess` route anymore.
|
|
||||||
*/
|
|
||||||
'strict_mode' => false,
|
|
||||||
|
|
||||||
];
|
|
@ -9,35 +9,22 @@ return [
|
|||||||
|
|
|
|
||||||
| Here you may specify the default filesystem disk that should be used
|
| Here you may specify the default filesystem disk that should be used
|
||||||
| by the framework. The "local" disk, as well as a variety of cloud
|
| by the framework. The "local" disk, as well as a variety of cloud
|
||||||
| based disks are available to your application. Just store away!
|
| based disks are available to your application for file storage.
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'default' => env('FILESYSTEM_DRIVER', 'local'),
|
'default' => env('FILESYSTEM_DISK', 'local'),
|
||||||
|
|
||||||
/*
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| Default Cloud Filesystem Disk
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| Many applications store files both locally and in the cloud. For this
|
|
||||||
| reason, you may specify a default "cloud" driver here. This driver
|
|
||||||
| will be bound as the Cloud disk implementation in the container.
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
'cloud' => env('FILESYSTEM_CLOUD', 's3'),
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
| Filesystem Disks
|
| Filesystem Disks
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
|
||||||
| Here you may configure as many filesystem "disks" as you wish, and you
|
| Below you may configure as many filesystem disks as necessary, and you
|
||||||
| may even configure multiple disks of the same driver. Defaults have
|
| may even configure multiple disks for the same driver. Examples for
|
||||||
| been setup for each driver as an example of the required options.
|
| most supported storage drivers are configured here for reference.
|
||||||
|
|
|
|
||||||
| Supported Drivers: "local", "ftp", "sftp", "s3"
|
| Supported drivers: "local", "ftp", "sftp", "s3"
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -46,6 +33,7 @@ return [
|
|||||||
'local' => [
|
'local' => [
|
||||||
'driver' => 'local',
|
'driver' => 'local',
|
||||||
'root' => storage_path('app'),
|
'root' => storage_path('app'),
|
||||||
|
'throw' => false,
|
||||||
],
|
],
|
||||||
|
|
||||||
'public' => [
|
'public' => [
|
||||||
@ -53,6 +41,7 @@ return [
|
|||||||
'root' => storage_path('app/public'),
|
'root' => storage_path('app/public'),
|
||||||
'url' => env('APP_URL').'/storage',
|
'url' => env('APP_URL').'/storage',
|
||||||
'visibility' => 'public',
|
'visibility' => 'public',
|
||||||
|
'throw' => false,
|
||||||
],
|
],
|
||||||
|
|
||||||
's3' => [
|
's3' => [
|
||||||
@ -62,8 +51,26 @@ return [
|
|||||||
'region' => env('AWS_DEFAULT_REGION'),
|
'region' => env('AWS_DEFAULT_REGION'),
|
||||||
'bucket' => env('AWS_BUCKET'),
|
'bucket' => env('AWS_BUCKET'),
|
||||||
'url' => env('AWS_URL'),
|
'url' => env('AWS_URL'),
|
||||||
|
'endpoint' => env('AWS_ENDPOINT'),
|
||||||
|
'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false),
|
||||||
|
'throw' => false,
|
||||||
],
|
],
|
||||||
|
|
||||||
],
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Symbolic Links
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here you may configure the symbolic links that will be created when the
|
||||||
|
| `storage:link` Artisan command is executed. The array keys should be
|
||||||
|
| the locations of the links and the values should be their targets.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'links' => [
|
||||||
|
public_path('storage') => storage_path('app/public'),
|
||||||
|
],
|
||||||
|
|
||||||
];
|
];
|
||||||
|
@ -1,34 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
return array(
|
|
||||||
'default' => array(
|
|
||||||
|
|
||||||
// By default, images are presented at 80px by 80px if no size parameter is supplied.
|
|
||||||
// You may request a specific image size, which will be dynamically delivered from Gravatar
|
|
||||||
// by passing a single pixel dimension (since the images are square):
|
|
||||||
'size' => 80,
|
|
||||||
|
|
||||||
// the fallback image, can be a string or a url
|
|
||||||
// for more info, visit: http://en.gravatar.com/site/implement/images/#default-image
|
|
||||||
'fallback' => 'mm',
|
|
||||||
|
|
||||||
// would you like to return a https://... image
|
|
||||||
'secure' => true,
|
|
||||||
|
|
||||||
// Gravatar allows users to self-rate their images so that they can indicate if an image
|
|
||||||
// is appropriate for a certain audience. By default, only 'G' rated images are displayed
|
|
||||||
// unless you indicate that you would like to see higher ratings.
|
|
||||||
// Available options:
|
|
||||||
// g: suitable for display on all websites with any audience type.
|
|
||||||
// pg: may contain rude gestures, provocatively dressed individuals, the lesser swear words, or mild violence.
|
|
||||||
// r: may contain such things as harsh profanity, intense violence, nudity, or hard drug use.
|
|
||||||
// x: may contain hardcore sexual imagery or extremely disturbing violence.
|
|
||||||
'maximumRating' => 'g',
|
|
||||||
|
|
||||||
// If for some reason you wanted to force the default image to always load, you can do that setting this to true
|
|
||||||
'forceDefault' => false,
|
|
||||||
|
|
||||||
// If you require a file-type extension (some places do) then you may also add an (optional) .jpg extension to that URL
|
|
||||||
'forceExtension' => 'jpg',
|
|
||||||
)
|
|
||||||
);
|
|
@ -1,52 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
return [
|
|
||||||
|
|
||||||
/*
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| Default Hash Driver
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| This option controls the default hash driver that will be used to hash
|
|
||||||
| passwords for your application. By default, the bcrypt algorithm is
|
|
||||||
| used; however, you remain free to modify this option if you wish.
|
|
||||||
|
|
|
||||||
| Supported: "bcrypt", "argon", "argon2id"
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
'driver' => 'bcrypt',
|
|
||||||
|
|
||||||
/*
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| Bcrypt Options
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| Here you may specify the configuration options that should be used when
|
|
||||||
| passwords are hashed using the Bcrypt algorithm. This will allow you
|
|
||||||
| to control the amount of time it takes to hash the given password.
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
'bcrypt' => [
|
|
||||||
'rounds' => env('BCRYPT_ROUNDS', 10),
|
|
||||||
],
|
|
||||||
|
|
||||||
/*
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| Argon Options
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| Here you may specify the configuration options that should be used when
|
|
||||||
| passwords are hashed using the Argon algorithm. These will allow you
|
|
||||||
| to control the amount of time it takes to hash the given password.
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
'argon' => [
|
|
||||||
'memory' => 1024,
|
|
||||||
'threads' => 2,
|
|
||||||
'time' => 2,
|
|
||||||
],
|
|
||||||
|
|
||||||
];
|
|
177
config/jwt.php
177
config/jwt.php
@ -1,177 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This file is part of jwt-auth.
|
|
||||||
*
|
|
||||||
* (c) Sean Tymon <tymon148@gmail.com>
|
|
||||||
*
|
|
||||||
* For the full copyright and license information, please view the LICENSE
|
|
||||||
* file that was distributed with this source code.
|
|
||||||
*/
|
|
||||||
|
|
||||||
return [
|
|
||||||
|
|
||||||
/*
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| JWT Authentication Secret
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| Don't forget to set this, as it will be used to sign your tokens.
|
|
||||||
| A helper command is provided for this: `php artisan jwt:generate`
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
'secret' => env('JWT_SECRET',
|
|
||||||
(file_exists(base_path('.jwt.'.env('APP_ENV').'.crt'))
|
|
||||||
? file_get_contents(base_path('.jwt.'.env('APP_ENV').'.crt'))
|
|
||||||
: 'changeme')
|
|
||||||
),
|
|
||||||
|
|
||||||
/*
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| JWT time to live
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| Specify the length of time (in minutes) that the token will be valid for.
|
|
||||||
| Defaults to 1 hour
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
'ttl' => 60,
|
|
||||||
|
|
||||||
/*
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| Refresh time to live
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| Specify the length of time (in minutes) that the token can be refreshed
|
|
||||||
| within. I.E. The user can refresh their token within a 2 week window of
|
|
||||||
| the original token being created until they must re-authenticate.
|
|
||||||
| Defaults to 2 weeks
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
'refresh_ttl' => 20160,
|
|
||||||
|
|
||||||
/*
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| JWT hashing algorithm
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| Specify the hashing algorithm that will be used to sign the token.
|
|
||||||
|
|
|
||||||
| See here: https://github.com/namshi/jose/tree/2.2.0/src/Namshi/JOSE/Signer
|
|
||||||
| for possible values
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
'algo' => 'RS256',
|
|
||||||
|
|
||||||
/*
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| User Model namespace
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| Specify the full namespace to your User model.
|
|
||||||
| e.g. 'Acme\Entities\User'
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
'user' => \App\Models\User::class,
|
|
||||||
|
|
||||||
/*
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| User identifier
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| Specify a unique property of the user that will be added as the 'sub'
|
|
||||||
| claim of the token payload.
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
'identifier' => 'id',
|
|
||||||
|
|
||||||
/*
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| Required Claims
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| Specify the required claims that must exist in any token.
|
|
||||||
| A TokenInvalidException will be thrown if any of these claims are not
|
|
||||||
| present in the payload.
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
'required_claims' => ['iss', 'iat', 'exp', 'nbf', 'sub', 'jti'],
|
|
||||||
|
|
||||||
/*
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| Blacklist Enabled
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| In order to invalidate tokens, you must have the blacklist enabled.
|
|
||||||
| If you do not want or need this functionality, then set this to false.
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
'blacklist_enabled' => env('JWT_BLACKLIST_ENABLED', true),
|
|
||||||
|
|
||||||
/*
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| Providers
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| Specify the various providers used throughout the package.
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
'providers' => [
|
|
||||||
|
|
||||||
/*
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| User Provider
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| Specify the provider that is used to find the user based
|
|
||||||
| on the subject claim
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
'user' => 'Tymon\JWTAuth\Providers\User\EloquentUserAdapter',
|
|
||||||
|
|
||||||
/*
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| JWT Provider
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| Specify the provider that is used to create and decode the tokens.
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
'jwt' => 'Tymon\JWTAuth\Providers\JWT\NamshiAdapter',
|
|
||||||
|
|
||||||
/*
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| Authentication Provider
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| Specify the provider that is used to authenticate users.
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
'auth' => 'Tymon\JWTAuth\Providers\Auth\IlluminateAuthAdapter',
|
|
||||||
|
|
||||||
/*
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| Storage Provider
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| Specify the provider that is used to store tokens in the blacklist
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
'storage' => 'Tymon\JWTAuth\Providers\Storage\IlluminateCacheAdapter',
|
|
||||||
|
|
||||||
],
|
|
||||||
|
|
||||||
];
|
|
@ -1,50 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
return [
|
|
||||||
|
|
||||||
/*
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| Hide Commands
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| This option allows to hide certain commands from the summary output.
|
|
||||||
| They will still be available in your application. Wildcards are supported
|
|
||||||
|
|
|
||||||
| Examples: "make:*", "list"
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
'hide' => [
|
|
||||||
'cache:*',
|
|
||||||
'completion',
|
|
||||||
'config:*',
|
|
||||||
'db:*',
|
|
||||||
'debugbar:*',
|
|
||||||
'event:*',
|
|
||||||
'ide-helper:*',
|
|
||||||
'inspire',
|
|
||||||
'key:generate',
|
|
||||||
'list',
|
|
||||||
'make:*',
|
|
||||||
'migrate:*',
|
|
||||||
'model:prune',
|
|
||||||
'notifications:table',
|
|
||||||
'optimize:*',
|
|
||||||
'package:discover',
|
|
||||||
'passport:*',
|
|
||||||
'queue:*',
|
|
||||||
'route:*',
|
|
||||||
'serve',
|
|
||||||
'schedule:*',
|
|
||||||
'schema:dump',
|
|
||||||
'session:table',
|
|
||||||
'storage:link',
|
|
||||||
'stub:publish',
|
|
||||||
'test',
|
|
||||||
'theme:*',
|
|
||||||
'ui:*',
|
|
||||||
'vendor:publish',
|
|
||||||
'view:*',
|
|
||||||
],
|
|
||||||
|
|
||||||
];
|
|
@ -3,6 +3,7 @@
|
|||||||
use Monolog\Handler\NullHandler;
|
use Monolog\Handler\NullHandler;
|
||||||
use Monolog\Handler\StreamHandler;
|
use Monolog\Handler\StreamHandler;
|
||||||
use Monolog\Handler\SyslogUdpHandler;
|
use Monolog\Handler\SyslogUdpHandler;
|
||||||
|
use Monolog\Processor\PsrLogMessageProcessor;
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
|
||||||
@ -11,33 +12,49 @@ return [
|
|||||||
| Default Log Channel
|
| Default Log Channel
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
|
||||||
| This option defines the default log channel that gets used when writing
|
| This option defines the default log channel that is utilized to write
|
||||||
| messages to the logs. The name specified in this option should match
|
| messages to your logs. The value provided here should match one of
|
||||||
| one of the channels defined in the "channels" configuration array.
|
| the channels present in the list of "channels" configured below.
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'default' => env('LOG_CHANNEL', 'stack'),
|
'default' => env('LOG_CHANNEL', 'stack'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Deprecations Log Channel
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This option controls the log channel that should be used to log warnings
|
||||||
|
| regarding deprecated PHP and library features. This allows you to get
|
||||||
|
| your application ready for upcoming major versions of dependencies.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'deprecations' => [
|
||||||
|
'channel' => env('LOG_DEPRECATIONS_CHANNEL', 'null'),
|
||||||
|
'trace' => env('LOG_DEPRECATIONS_TRACE', false),
|
||||||
|
],
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
| Log Channels
|
| Log Channels
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
|
||||||
| Here you may configure the log channels for your application. Out of
|
| Here you may configure the log channels for your application. Laravel
|
||||||
| the box, Laravel uses the Monolog PHP logging library. This gives
|
| utilizes the Monolog PHP logging library, which includes a variety
|
||||||
| you a variety of powerful log handlers / formatters to utilize.
|
| of powerful log handlers and formatters that you're free to use.
|
||||||
|
|
|
|
||||||
| Available Drivers: "single", "daily", "slack", "syslog",
|
| Available drivers: "single", "daily", "slack", "syslog",
|
||||||
| "errorlog", "monolog",
|
| "errorlog", "monolog", "custom", "stack"
|
||||||
| "custom", "stack"
|
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'channels' => [
|
'channels' => [
|
||||||
|
|
||||||
'stack' => [
|
'stack' => [
|
||||||
'driver' => 'stack',
|
'driver' => 'stack',
|
||||||
'channels' => ['daily'],
|
'channels' => explode(',', env('LOG_STACK', 'single')),
|
||||||
'ignore_exceptions' => false,
|
'ignore_exceptions' => false,
|
||||||
],
|
],
|
||||||
|
|
||||||
@ -45,37 +62,36 @@ return [
|
|||||||
'driver' => 'single',
|
'driver' => 'single',
|
||||||
'path' => storage_path('logs/laravel.log'),
|
'path' => storage_path('logs/laravel.log'),
|
||||||
'level' => env('LOG_LEVEL', 'debug'),
|
'level' => env('LOG_LEVEL', 'debug'),
|
||||||
|
'replace_placeholders' => true,
|
||||||
],
|
],
|
||||||
|
|
||||||
'daily' => [
|
'daily' => [
|
||||||
'driver' => 'daily',
|
'driver' => 'daily',
|
||||||
'path' => storage_path('logs/laravel.log'),
|
'path' => storage_path('logs/laravel.log'),
|
||||||
'level' => env('LOG_LEVEL', 'debug'),
|
'level' => env('LOG_LEVEL', 'debug'),
|
||||||
'days' => 14,
|
'days' => env('LOG_DAILY_DAYS', 14),
|
||||||
],
|
'replace_placeholders' => true,
|
||||||
|
|
||||||
'webhook' => [
|
|
||||||
'driver' => 'daily',
|
|
||||||
'path' => storage_path('logs/webhook.log'),
|
|
||||||
'level' => env('LOG_LEVEL', 'debug'),
|
|
||||||
],
|
],
|
||||||
|
|
||||||
'slack' => [
|
'slack' => [
|
||||||
'driver' => 'slack',
|
'driver' => 'slack',
|
||||||
'url' => env('LOG_SLACK_WEBHOOK_URL'),
|
'url' => env('LOG_SLACK_WEBHOOK_URL'),
|
||||||
'username' => 'Laravel Log',
|
'username' => env('LOG_SLACK_USERNAME', 'Laravel Log'),
|
||||||
'emoji' => ':boom:',
|
'emoji' => env('LOG_SLACK_EMOJI', ':boom:'),
|
||||||
'level' => env('LOG_LEVEL', 'critical'),
|
'level' => env('LOG_LEVEL', 'critical'),
|
||||||
|
'replace_placeholders' => true,
|
||||||
],
|
],
|
||||||
|
|
||||||
'papertrail' => [
|
'papertrail' => [
|
||||||
'driver' => 'monolog',
|
'driver' => 'monolog',
|
||||||
'level' => env('LOG_LEVEL', 'debug'),
|
'level' => env('LOG_LEVEL', 'debug'),
|
||||||
'handler' => SyslogUdpHandler::class,
|
'handler' => env('LOG_PAPERTRAIL_HANDLER', SyslogUdpHandler::class),
|
||||||
'handler_with' => [
|
'handler_with' => [
|
||||||
'host' => env('PAPERTRAIL_URL'),
|
'host' => env('PAPERTRAIL_URL'),
|
||||||
'port' => env('PAPERTRAIL_PORT'),
|
'port' => env('PAPERTRAIL_PORT'),
|
||||||
|
'connectionString' => 'tls://'.env('PAPERTRAIL_URL').':'.env('PAPERTRAIL_PORT'),
|
||||||
],
|
],
|
||||||
|
'processors' => [PsrLogMessageProcessor::class],
|
||||||
],
|
],
|
||||||
|
|
||||||
'stderr' => [
|
'stderr' => [
|
||||||
@ -86,16 +102,20 @@ return [
|
|||||||
'with' => [
|
'with' => [
|
||||||
'stream' => 'php://stderr',
|
'stream' => 'php://stderr',
|
||||||
],
|
],
|
||||||
|
'processors' => [PsrLogMessageProcessor::class],
|
||||||
],
|
],
|
||||||
|
|
||||||
'syslog' => [
|
'syslog' => [
|
||||||
'driver' => 'syslog',
|
'driver' => 'syslog',
|
||||||
'level' => env('LOG_LEVEL', 'debug'),
|
'level' => env('LOG_LEVEL', 'debug'),
|
||||||
|
'facility' => env('LOG_SYSLOG_FACILITY', LOG_USER),
|
||||||
|
'replace_placeholders' => true,
|
||||||
],
|
],
|
||||||
|
|
||||||
'errorlog' => [
|
'errorlog' => [
|
||||||
'driver' => 'errorlog',
|
'driver' => 'errorlog',
|
||||||
'level' => env('LOG_LEVEL', 'debug'),
|
'level' => env('LOG_LEVEL', 'debug'),
|
||||||
|
'replace_placeholders' => true,
|
||||||
],
|
],
|
||||||
|
|
||||||
'null' => [
|
'null' => [
|
||||||
@ -106,6 +126,7 @@ return [
|
|||||||
'emergency' => [
|
'emergency' => [
|
||||||
'path' => storage_path('logs/laravel.log'),
|
'path' => storage_path('logs/laravel.log'),
|
||||||
],
|
],
|
||||||
|
|
||||||
],
|
],
|
||||||
|
|
||||||
];
|
];
|
||||||
|
183
config/mail.php
183
config/mail.php
@ -4,54 +4,108 @@ return [
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
| Mail Driver
|
| Default Mailer
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
|
||||||
| Laravel supports both SMTP and PHP's "mail" function as drivers for the
|
| This option controls the default mailer that is used to send all email
|
||||||
| sending of e-mail. You may specify which one you're using throughout
|
| messages unless another mailer is explicitly specified when sending
|
||||||
| your application here. By default, Laravel is setup for SMTP mail.
|
| the message. All additional mailers can be configured within the
|
||||||
|
|
| "mailers" array. Examples of each type of mailer are provided.
|
||||||
| Supported: "smtp", "sendmail", "mailgun", "ses",
|
|
||||||
| "postmark", "log", "array"
|
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'driver' => env('MAIL_DRIVER', 'smtp'),
|
'default' => env('MAIL_MAILER', 'log'),
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
| SMTP Host Address
|
| Mailer Configurations
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
|
||||||
| Here you may provide the host address of the SMTP server used by your
|
| Here you may configure all of the mailers used by your application plus
|
||||||
| applications. A default option is provided that is compatible with
|
| their respective settings. Several examples have been configured for
|
||||||
| the Mailgun mail service which will provide reliable deliveries.
|
| you and you are free to add your own as your application requires.
|
||||||
|
|
|
||||||
|
| Laravel supports a variety of mail "transport" drivers that can be used
|
||||||
|
| when delivering an email. You may specify which one you're using for
|
||||||
|
| your mailers below. You may also add additional mailers if needed.
|
||||||
|
|
|
||||||
|
| Supported: "smtp", "sendmail", "mailgun", "ses", "ses-v2",
|
||||||
|
| "postmark", "resend", "log", "array",
|
||||||
|
| "failover", "roundrobin"
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
|
'mailers' => [
|
||||||
|
|
||||||
/*
|
'smtp' => [
|
||||||
|--------------------------------------------------------------------------
|
'transport' => 'smtp',
|
||||||
| SMTP Host Port
|
'url' => env('MAIL_URL'),
|
||||||
|--------------------------------------------------------------------------
|
'host' => env('MAIL_HOST', '127.0.0.1'),
|
||||||
|
|
'port' => env('MAIL_PORT', 2525),
|
||||||
| This is the SMTP port used by your application to deliver e-mails to
|
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
|
||||||
| users of the application. Like the host we have set this value to
|
'username' => env('MAIL_USERNAME'),
|
||||||
| stay compatible with the Mailgun e-mail application by default.
|
'password' => env('MAIL_PASSWORD'),
|
||||||
|
|
'timeout' => null,
|
||||||
*/
|
'local_domain' => env('MAIL_EHLO_DOMAIN', parse_url(env('APP_URL', 'http://localhost'), PHP_URL_HOST)),
|
||||||
|
'verify_peer' => false,
|
||||||
|
],
|
||||||
|
|
||||||
'port' => env('MAIL_PORT', 587),
|
'ses' => [
|
||||||
|
'transport' => 'ses',
|
||||||
|
],
|
||||||
|
|
||||||
|
'postmark' => [
|
||||||
|
'transport' => 'postmark',
|
||||||
|
// 'message_stream_id' => env('POSTMARK_MESSAGE_STREAM_ID'),
|
||||||
|
// 'client' => [
|
||||||
|
// 'timeout' => 5,
|
||||||
|
// ],
|
||||||
|
],
|
||||||
|
|
||||||
|
'resend' => [
|
||||||
|
'transport' => 'resend',
|
||||||
|
],
|
||||||
|
|
||||||
|
'sendmail' => [
|
||||||
|
'transport' => 'sendmail',
|
||||||
|
'path' => env('MAIL_SENDMAIL_PATH', '/usr/sbin/sendmail -bs -i'),
|
||||||
|
],
|
||||||
|
|
||||||
|
'log' => [
|
||||||
|
'transport' => 'log',
|
||||||
|
'channel' => env('MAIL_LOG_CHANNEL'),
|
||||||
|
],
|
||||||
|
|
||||||
|
'array' => [
|
||||||
|
'transport' => 'array',
|
||||||
|
],
|
||||||
|
|
||||||
|
'failover' => [
|
||||||
|
'transport' => 'failover',
|
||||||
|
'mailers' => [
|
||||||
|
'smtp',
|
||||||
|
'log',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
'roundrobin' => [
|
||||||
|
'transport' => 'roundrobin',
|
||||||
|
'mailers' => [
|
||||||
|
'ses',
|
||||||
|
'postmark',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
| Global "From" Address
|
| Global "From" Address
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
|
||||||
| You may wish for all e-mails sent by your application to be sent from
|
| You may wish for all emails sent by your application to be sent from
|
||||||
| the same address. Here, you may specify a name and address that is
|
| the same address. Here you may specify a name and address that is
|
||||||
| used globally for all e-mails that are sent by your application.
|
| used globally for all emails that are sent by your application.
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -60,79 +114,4 @@ return [
|
|||||||
'name' => env('MAIL_FROM_NAME', 'Example'),
|
'name' => env('MAIL_FROM_NAME', 'Example'),
|
||||||
],
|
],
|
||||||
|
|
||||||
/*
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| E-Mail Encryption Protocol
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| Here you may specify the encryption protocol that should be used when
|
|
||||||
| the application send e-mail messages. A sensible default using the
|
|
||||||
| transport layer security protocol should provide great security.
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
|
|
||||||
|
|
||||||
/*
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| SMTP Server Username
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| If your SMTP server requires a username for authentication, you should
|
|
||||||
| set it here. This will get used to authenticate with your server on
|
|
||||||
| connection. You may also set the "password" value below this one.
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
'username' => env('MAIL_USERNAME'),
|
|
||||||
|
|
||||||
'password' => env('MAIL_PASSWORD'),
|
|
||||||
|
|
||||||
/*
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| Sendmail System Path
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| When using the "sendmail" driver to send e-mails, we will need to know
|
|
||||||
| the path to where Sendmail lives on this server. A default path has
|
|
||||||
| been provided here, which will work well on most of your systems.
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
'sendmail' => '/usr/sbin/sendmail -t',
|
|
||||||
|
|
||||||
/*
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| Markdown Mail Settings
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| If you are using Markdown based email rendering, you may configure your
|
|
||||||
| theme and component paths here, allowing you to customize the design
|
|
||||||
| of the emails. Or, you may simply stick with the Laravel defaults!
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
'markdown' => [
|
|
||||||
'theme' => 'default',
|
|
||||||
|
|
||||||
'paths' => [
|
|
||||||
resource_path('views/vendor/mail'),
|
|
||||||
],
|
|
||||||
],
|
|
||||||
|
|
||||||
/*
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| Log Channel
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| If you are using the "log" driver, you may specify the logging channel
|
|
||||||
| if you prefer to keep mail messages separate from other log entries
|
|
||||||
| for simpler reading. Otherwise, the default channel will be used.
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
'log_channel' => env('MAIL_LOG_CHANNEL'),
|
|
||||||
'local_domain' => env('HOSTNAME'),
|
|
||||||
|
|
||||||
'verify_peer' => false,
|
|
||||||
];
|
];
|
||||||
|
5
config/osb.php
Normal file
5
config/osb.php
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
'language_id' => 1,
|
||||||
|
];
|
@ -7,22 +7,22 @@ return [
|
|||||||
| Default Queue Connection Name
|
| Default Queue Connection Name
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
|
||||||
| Laravel's queue API supports an assortment of back-ends via a single
|
| Laravel's queue supports a variety of backends via a single, unified
|
||||||
| API, giving you convenient access to each back-end using the same
|
| API, giving you convenient access to each backend using identical
|
||||||
| syntax for every one. Here you may define a default connection.
|
| syntax for each. The default queue connection is defined below.
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'default' => env('QUEUE_CONNECTION', 'sync'),
|
'default' => env('QUEUE_CONNECTION', 'database'),
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
| Queue Connections
|
| Queue Connections
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
|
||||||
| Here you may configure the connection information for each server that
|
| Here you may configure the connection options for every queue backend
|
||||||
| is used by your application. A default configuration has been added
|
| used by your application. An example configuration is provided for
|
||||||
| for each back-end shipped with Laravel. You are free to add more.
|
| each backend supported by Laravel. You're also free to add more.
|
||||||
|
|
|
|
||||||
| Drivers: "sync", "database", "beanstalkd", "sqs", "redis", "null"
|
| Drivers: "sync", "database", "beanstalkd", "sqs", "redis", "null"
|
||||||
|
|
|
|
||||||
@ -36,17 +36,20 @@ return [
|
|||||||
|
|
||||||
'database' => [
|
'database' => [
|
||||||
'driver' => 'database',
|
'driver' => 'database',
|
||||||
'table' => 'jobs',
|
'connection' => env('DB_QUEUE_CONNECTION'),
|
||||||
'queue' => 'default',
|
'table' => env('DB_QUEUE_TABLE', 'jobs'),
|
||||||
'retry_after' => 90,
|
'queue' => env('DB_QUEUE', 'default'),
|
||||||
|
'retry_after' => (int) env('DB_QUEUE_RETRY_AFTER', 90),
|
||||||
|
'after_commit' => false,
|
||||||
],
|
],
|
||||||
|
|
||||||
'beanstalkd' => [
|
'beanstalkd' => [
|
||||||
'driver' => 'beanstalkd',
|
'driver' => 'beanstalkd',
|
||||||
'host' => 'localhost',
|
'host' => env('BEANSTALKD_QUEUE_HOST', 'localhost'),
|
||||||
'queue' => 'default',
|
'queue' => env('BEANSTALKD_QUEUE', 'default'),
|
||||||
'retry_after' => 90,
|
'retry_after' => (int) env('BEANSTALKD_QUEUE_RETRY_AFTER', 90),
|
||||||
'block_for' => 0,
|
'block_for' => 0,
|
||||||
|
'after_commit' => false,
|
||||||
],
|
],
|
||||||
|
|
||||||
'sqs' => [
|
'sqs' => [
|
||||||
@ -54,34 +57,55 @@ return [
|
|||||||
'key' => env('AWS_ACCESS_KEY_ID'),
|
'key' => env('AWS_ACCESS_KEY_ID'),
|
||||||
'secret' => env('AWS_SECRET_ACCESS_KEY'),
|
'secret' => env('AWS_SECRET_ACCESS_KEY'),
|
||||||
'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'),
|
'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'),
|
||||||
'queue' => env('SQS_QUEUE', 'your-queue-name'),
|
'queue' => env('SQS_QUEUE', 'default'),
|
||||||
|
'suffix' => env('SQS_SUFFIX'),
|
||||||
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
|
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
|
||||||
|
'after_commit' => false,
|
||||||
],
|
],
|
||||||
|
|
||||||
'redis' => [
|
'redis' => [
|
||||||
'driver' => 'redis',
|
'driver' => 'redis',
|
||||||
'connection' => 'default',
|
'connection' => env('REDIS_QUEUE_CONNECTION', 'default'),
|
||||||
'queue' => env('REDIS_QUEUE', 'default'),
|
'queue' => env('REDIS_QUEUE', 'default'),
|
||||||
'retry_after' => 90,
|
'retry_after' => (int) env('REDIS_QUEUE_RETRY_AFTER', 90),
|
||||||
'block_for' => null,
|
'block_for' => null,
|
||||||
|
'after_commit' => false,
|
||||||
],
|
],
|
||||||
|
|
||||||
],
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Job Batching
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| The following options configure the database and table that store job
|
||||||
|
| batching information. These options can be updated to any database
|
||||||
|
| connection and table which has been defined by your application.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'batching' => [
|
||||||
|
'database' => env('DB_CONNECTION', 'sqlite'),
|
||||||
|
'table' => 'job_batches',
|
||||||
|
],
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
| Failed Queue Jobs
|
| Failed Queue Jobs
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
|
||||||
| These options configure the behavior of failed queue job logging so you
|
| These options configure the behavior of failed queue job logging so you
|
||||||
| can control which database and table are used to store the jobs that
|
| can control how and where failed jobs are stored. Laravel ships with
|
||||||
| have failed. You may change them to any database / table you wish.
|
| support for storing failed jobs in a simple file or in a database.
|
||||||
|
|
|
||||||
|
| Supported drivers: "database-uuids", "dynamodb", "file", "null"
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'failed' => [
|
'failed' => [
|
||||||
'driver' => env('QUEUE_FAILED_DRIVER', 'database'),
|
'driver' => env('QUEUE_FAILED_DRIVER', 'database-uuids'),
|
||||||
'database' => env('DB_CONNECTION', 'mysql'),
|
'database' => env('DB_CONNECTION', 'sqlite'),
|
||||||
'table' => 'failed_jobs',
|
'table' => 'failed_jobs',
|
||||||
],
|
],
|
||||||
|
|
||||||
|
@ -14,12 +14,6 @@ return [
|
|||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'mailgun' => [
|
|
||||||
'domain' => env('MAILGUN_DOMAIN'),
|
|
||||||
'secret' => env('MAILGUN_SECRET'),
|
|
||||||
'endpoint' => env('MAILGUN_ENDPOINT', 'api.mailgun.net'),
|
|
||||||
],
|
|
||||||
|
|
||||||
'postmark' => [
|
'postmark' => [
|
||||||
'token' => env('POSTMARK_TOKEN'),
|
'token' => env('POSTMARK_TOKEN'),
|
||||||
],
|
],
|
||||||
@ -30,30 +24,35 @@ return [
|
|||||||
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
|
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
|
||||||
],
|
],
|
||||||
|
|
||||||
'ezypay' => [
|
'resend' => [
|
||||||
'plugin' => 'DD_EZYPAY',
|
'key' => env('RESEND_KEY'),
|
||||||
'base_uri' => 'https://api.ezypay.com/api/v1/',
|
|
||||||
'token_user' => env('EZYPAY_TOKEN'),
|
|
||||||
'guid' => env('EZYPAY_GUID'),
|
|
||||||
],
|
],
|
||||||
|
|
||||||
'google' => [
|
'slack' => [
|
||||||
'client_id' => env('AUTH_GOOGLE_CLIENT_ID'),
|
'notifications' => [
|
||||||
'client_secret' => env('AUTH_GOOGLE_SECRET'),
|
'bot_user_oauth_token' => env('SLACK_BOT_USER_OAUTH_TOKEN'),
|
||||||
'redirect' => '/auth/google/callback',
|
'channel' => env('SLACK_BOT_USER_DEFAULT_CHANNEL'),
|
||||||
],
|
|
||||||
|
|
||||||
'provider' => [
|
|
||||||
'intuit' => [
|
|
||||||
'api'=> \Intuit\API::class,
|
|
||||||
'verifytoken' => env('INTUIT_VERIFYTOKEN'),
|
|
||||||
]
|
|
||||||
],
|
|
||||||
|
|
||||||
'supplier' => [
|
|
||||||
'crazydomain' => [
|
|
||||||
'api'=> \Dreamscape\API::class,
|
|
||||||
'registrar' => 'crazydomain', // Key in the domain_registrars table
|
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
|
||||||
|
'ezypay' => [
|
||||||
|
'plugin' => 'DD_EZYPAY',
|
||||||
|
'base_uri' => 'https://api.ezypay.com/api/v1/',
|
||||||
|
'token_user' => env('EZYPAY_TOKEN'),
|
||||||
|
'guid' => env('EZYPAY_GUID'),
|
||||||
|
],
|
||||||
|
|
||||||
|
'provider' => [
|
||||||
|
'intuit' => [
|
||||||
|
'api'=> \Intuit\API::class,
|
||||||
|
'verifytoken' => env('INTUIT_VERIFYTOKEN'),
|
||||||
|
]
|
||||||
|
],
|
||||||
|
|
||||||
|
'supplier' => [
|
||||||
|
'crazydomain' => [
|
||||||
|
'api'=> \Dreamscape\API::class,
|
||||||
|
'registrar' => 'crazydomain', // Key in the domain_registrars table
|
||||||
|
],
|
||||||
|
],
|
||||||
];
|
];
|
||||||
|
@ -9,16 +9,16 @@ return [
|
|||||||
| Default Session Driver
|
| Default Session Driver
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
|
||||||
| This option controls the default session "driver" that will be used on
|
| This option determines the default session driver that is utilized for
|
||||||
| requests. By default, we will use the lightweight native driver but
|
| incoming requests. Laravel supports a variety of storage options to
|
||||||
| you may specify any of the other wonderful drivers provided here.
|
| persist session data. Database storage is a great default choice.
|
||||||
|
|
|
|
||||||
| Supported: "file", "cookie", "database", "apc",
|
| Supported: "file", "cookie", "database", "apc",
|
||||||
| "memcached", "redis", "dynamodb", "array"
|
| "memcached", "redis", "dynamodb", "array"
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'driver' => env('SESSION_DRIVER', 'file'),
|
'driver' => env('SESSION_DRIVER', 'database'),
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
@ -27,13 +27,14 @@ return [
|
|||||||
|
|
|
|
||||||
| Here you may specify the number of minutes that you wish the session
|
| Here you may specify the number of minutes that you wish the session
|
||||||
| to be allowed to remain idle before it expires. If you want them
|
| to be allowed to remain idle before it expires. If you want them
|
||||||
| to immediately expire on the browser closing, set that option.
|
| to expire immediately when the browser is closed then you may
|
||||||
|
| indicate that via the expire_on_close configuration option.
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'lifetime' => env('SESSION_LIFETIME', 120),
|
'lifetime' => env('SESSION_LIFETIME', 120),
|
||||||
|
|
||||||
'expire_on_close' => false,
|
'expire_on_close' => env('SESSION_EXPIRE_ON_CLOSE', false),
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
@ -41,21 +42,21 @@ return [
|
|||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
|
||||||
| This option allows you to easily specify that all of your session data
|
| This option allows you to easily specify that all of your session data
|
||||||
| should be encrypted before it is stored. All encryption will be run
|
| should be encrypted before it's stored. All encryption is performed
|
||||||
| automatically by Laravel and you can use the Session like normal.
|
| automatically by Laravel and you may use the session like normal.
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'encrypt' => false,
|
'encrypt' => env('SESSION_ENCRYPT', false),
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
| Session File Location
|
| Session File Location
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
|
||||||
| When using the native session driver, we need a location where session
|
| When utilizing the "file" session driver, the session files are placed
|
||||||
| files may be stored. A default has been set for you but a different
|
| on disk. The default storage location is defined here; however, you
|
||||||
| location may be specified. This is only needed for file sessions.
|
| are free to provide another location where they should be stored.
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -72,33 +73,35 @@ return [
|
|||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'connection' => env('SESSION_CONNECTION', null),
|
'connection' => env('SESSION_CONNECTION'),
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
| Session Database Table
|
| Session Database Table
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
|
||||||
| When using the "database" session driver, you may specify the table we
|
| When using the "database" session driver, you may specify the table to
|
||||||
| should use to manage the sessions. Of course, a sensible default is
|
| be used to store sessions. Of course, a sensible default is defined
|
||||||
| provided for you; however, you are free to change this as needed.
|
| for you; however, you're welcome to change this to another table.
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'table' => 'sessions',
|
'table' => env('SESSION_TABLE', 'sessions'),
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
| Session Cache Store
|
| Session Cache Store
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
|
||||||
| When using the "apc", "memcached", or "dynamodb" session drivers you may
|
| When using one of the framework's cache driven session backends, you may
|
||||||
| list a cache store that should be used for these sessions. This value
|
| define the cache store which should be used to store the session data
|
||||||
| must match with one of the application's configured cache "stores".
|
| between requests. This must match one of your defined cache stores.
|
||||||
|
|
|
||||||
|
| Affects: "apc", "dynamodb", "memcached", "redis"
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'store' => env('SESSION_STORE', null),
|
'store' => env('SESSION_STORE'),
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
@ -118,9 +121,9 @@ return [
|
|||||||
| Session Cookie Name
|
| Session Cookie Name
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
|
||||||
| Here you may change the name of the cookie used to identify a session
|
| Here you may change the name of the session cookie that is created by
|
||||||
| instance by ID. The name specified here will get used every time a
|
| the framework. Typically, you should not need to change this value
|
||||||
| new session cookie is created by the framework for every driver.
|
| since doing so does not grant a meaningful security improvement.
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -136,24 +139,24 @@ return [
|
|||||||
|
|
|
|
||||||
| The session cookie path determines the path for which the cookie will
|
| The session cookie path determines the path for which the cookie will
|
||||||
| be regarded as available. Typically, this will be the root path of
|
| be regarded as available. Typically, this will be the root path of
|
||||||
| your application but you are free to change this when necessary.
|
| your application, but you're free to change this when necessary.
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'path' => '/',
|
'path' => env('SESSION_PATH', '/'),
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
| Session Cookie Domain
|
| Session Cookie Domain
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
|
||||||
| Here you may change the domain of the cookie used to identify a session
|
| This value determines the domain and subdomains the session cookie is
|
||||||
| in your application. This will determine which domains the cookie is
|
| available to. By default, the cookie will be available to the root
|
||||||
| available to in your application. A sensible default has been set.
|
| domain and all subdomains. Typically, this shouldn't be changed.
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'domain' => env('SESSION_DOMAIN', null),
|
'domain' => env('SESSION_DOMAIN'),
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
@ -162,11 +165,11 @@ return [
|
|||||||
|
|
|
|
||||||
| By setting this option to true, session cookies will only be sent back
|
| By setting this option to true, session cookies will only be sent back
|
||||||
| to the server if the browser has a HTTPS connection. This will keep
|
| to the server if the browser has a HTTPS connection. This will keep
|
||||||
| the cookie from being sent to you if it can not be done securely.
|
| the cookie from being sent to you when it can't be done securely.
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'secure' => env('SESSION_SECURE_COOKIE', false),
|
'secure' => env('SESSION_SECURE_COOKIE'),
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
@ -175,11 +178,11 @@ return [
|
|||||||
|
|
|
|
||||||
| Setting this value to true will prevent JavaScript from accessing the
|
| Setting this value to true will prevent JavaScript from accessing the
|
||||||
| value of the cookie and the cookie will only be accessible through
|
| value of the cookie and the cookie will only be accessible through
|
||||||
| the HTTP protocol. You are free to modify this option if needed.
|
| the HTTP protocol. It's unlikely you should disable this option.
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'http_only' => true,
|
'http_only' => env('SESSION_HTTP_ONLY', true),
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
@ -188,12 +191,27 @@ return [
|
|||||||
|
|
|
|
||||||
| This option determines how your cookies behave when cross-site requests
|
| This option determines how your cookies behave when cross-site requests
|
||||||
| take place, and can be used to mitigate CSRF attacks. By default, we
|
| take place, and can be used to mitigate CSRF attacks. By default, we
|
||||||
| do not enable this as other CSRF protection services are in place.
|
| will set this value to "lax" to permit secure cross-site requests.
|
||||||
|
|
|
|
||||||
| Supported: "lax", "strict"
|
| See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#samesitesamesite-value
|
||||||
|
|
|
||||||
|
| Supported: "lax", "strict", "none", null
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'same_site' => 'lax',
|
'same_site' => env('SESSION_SAME_SITE', 'lax'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Partitioned Cookies
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Setting this value to true will tie the cookie to the top-level site for
|
||||||
|
| a cross-site context. Partitioned cookies are accepted by the browser
|
||||||
|
| when flagged "secure" and the Same-Site attribute is set to "none".
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'partitioned' => env('SESSION_PARTITIONED_COOKIE', false),
|
||||||
|
|
||||||
];
|
];
|
||||||
|
@ -1,19 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
return [
|
|
||||||
'pdf' => array(
|
|
||||||
'enabled' => true,
|
|
||||||
'binary' => '/usr/local/bin/wkhtmltopdf',
|
|
||||||
'timeout' => false,
|
|
||||||
'options' => array('print-media-type' => true),
|
|
||||||
'env' => array(),
|
|
||||||
),
|
|
||||||
|
|
||||||
'image' => array(
|
|
||||||
'enabled' => false,
|
|
||||||
'binary' => '/usr/local/bin/wkhtmltoimage',
|
|
||||||
'timeout' => false,
|
|
||||||
'options' => array(),
|
|
||||||
'env' => array(),
|
|
||||||
),
|
|
||||||
];
|
|
@ -1,36 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
return [
|
|
||||||
|
|
||||||
/*
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| View Storage Paths
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| Most templating systems load templates from disk. Here you may specify
|
|
||||||
| an array of paths that should be checked for your views. Of course
|
|
||||||
| the usual Laravel view path has already been registered for you.
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
'paths' => [
|
|
||||||
resource_path('views'),
|
|
||||||
],
|
|
||||||
|
|
||||||
/*
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| Compiled View Path
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| This option determines where all the compiled Blade templates will be
|
|
||||||
| stored for your application. Typically, this is within the storage
|
|
||||||
| directory. However, as usual, you are free to change this value.
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
'compiled' => env(
|
|
||||||
'VIEW_COMPILED_PATH',
|
|
||||||
realpath(storage_path('framework/views'))
|
|
||||||
),
|
|
||||||
|
|
||||||
];
|
|
@ -25,23 +25,23 @@
|
|||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
@switch($o->order_status)
|
@switch($o->order_status)
|
||||||
@case('ORDER-SUBMIT')
|
@case('ORDER-SUBMIT')
|
||||||
@include('a.widgets.service.order.submit')
|
@include('theme.backend.adminlte.a.widgets.service.order.submit')
|
||||||
@break
|
@break
|
||||||
|
|
||||||
@case('ORDER-HOLD')
|
@case('ORDER-HOLD')
|
||||||
@case('ORDER-SENT')
|
@case('ORDER-SENT')
|
||||||
@case('ORDERED')
|
@case('ORDERED')
|
||||||
@include('a.widgets.service.order.sent')
|
@include('theme.backend.adminlte.a.widgets.service.order.sent')
|
||||||
@break
|
@break
|
||||||
|
|
||||||
@default
|
@default
|
||||||
@include('u.widgets.service.info')
|
@include('theme.backend.adminlte.u.widgets.service.info')
|
||||||
@endswitch
|
@endswitch
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@if($o->order_status == 'ORDER-REQUEST')
|
@if($o->order_status == 'ORDER-REQUEST')
|
||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
@include('a.widgets.service_order-request')
|
@include('theme.backend.adminlte.a.widgets.service_order-request')
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
@if ($user->accounts->count())
|
@if ($x=$user->accounts_all->count())
|
||||||
<table class="table table-striped table-hover" id="accounts">
|
<table class="table table-striped table-hover" id="accounts">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@ -14,10 +14,10 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@foreach ($user->accounts as $ao)
|
@foreach ($user->accounts_all as $ao)
|
||||||
<tr>
|
<tr>
|
||||||
<td><a href="{{ url('r/switch/start',$ao->user_id) }}"><i class="fas fa-external-link-alt"></i></a></td>
|
<td><a href="{{ url('r/switch/start',$ao->user_id) }}"><i class="fas fa-external-link-alt"></i></a></td>
|
||||||
<td>{{ $ao->name }}</td>
|
<td>{{ $ao->name }}</td>
|
||||||
<td class="text-right">{{ $ao->services->where('active',TRUE)->count() }} <small>/{{ $ao->services->count() }}</small></td>
|
<td class="text-right">{{ $ao->services->where('active',TRUE)->count() }} <small>/{{ $ao->services->count() }}</small></td>
|
||||||
</tr>
|
</tr>
|
||||||
@endforeach
|
@endforeach
|
||||||
@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
<tfoot>
|
<tfoot>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Count {{ $user->accounts->count() }}</th>
|
<th>Count {{ $x }}</th>
|
||||||
<th colspan="2"> </th>
|
<th colspan="2"> </th>
|
||||||
</tr>
|
</tr>
|
||||||
</tfoot>
|
</tfoot>
|
||||||
@ -37,8 +37,11 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@section('page-scripts')
|
@section('page-styles')
|
||||||
@css(datatables,bootstrap4)
|
@css(datatables,bootstrap4)
|
||||||
|
@append
|
||||||
|
|
||||||
|
@section('page-scripts')
|
||||||
@js(datatables,bootstrap4)
|
@js(datatables,bootstrap4)
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
@ -50,10 +53,6 @@
|
|||||||
order: [1,'asc'],
|
order: [1,'asc'],
|
||||||
pageLength: 10
|
pageLength: 10
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#accounts tbody').on('click','tr', function () {
|
|
||||||
$(this).toggleClass('selected');
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
@append
|
@append
|
@ -0,0 +1,16 @@
|
|||||||
|
<!-- $o = Account::class -->
|
||||||
|
<!-- Show outstanding invoices -->
|
||||||
|
<div class="card card-warning">
|
||||||
|
<div class="card-header">
|
||||||
|
<h3 class="card-title">Invoices Due</h3>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card-body">
|
||||||
|
@if(($list=$o->invoiceSummaryDue()->get())->count())
|
||||||
|
@include('theme.backend.adminlte.invoice.widget.due',['type'=>'account'])
|
||||||
|
|
||||||
|
@else
|
||||||
|
<p>No invoice due</p>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
</div>
|
@ -6,7 +6,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
@if(($x=$o->invoices->where('created_at','>',\Carbon\Carbon::now()->subMonths(12))->where('due','<=',0))->count())
|
@if(($list=$o->invoiceSummaryPast()->where('invoices.created_at','>=',\Carbon\Carbon::now()->subYears(2)->startOfYear())->get())->count())
|
||||||
<table class="table table-bordered w-100" id="invoices_past_{{ $o->id }}">
|
<table class="table table-bordered w-100" id="invoices_past_{{ $o->id }}">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@ -19,13 +19,13 @@
|
|||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
<tbody>
|
<tbody>
|
||||||
@foreach ($x as $oo)
|
@foreach ($list as $oo)
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ $oo->account->name }}</td>
|
<td>{{ $oo->account->name }}</td>
|
||||||
<td><a href="{{ url('u/invoice',$oo->id) }}">{{ $oo->sid }}</a></td>
|
<td><a href="{{ url('u/invoice',$oo->id) }}">{{ $oo->lid }}</a></td>
|
||||||
<td>{{ $oo->created_at->format('Y-m-d') }}</td>
|
<td>{{ $oo->created_at->format('Y-m-d') }}</td>
|
||||||
<td>{{ $oo->paid_date ? $oo->paid_date->format('Y-m-d') : '' }}</td>
|
<td>{{ $oo->_paid_at?->format('Y-m-d') }}</td>
|
||||||
<td class="text-right">${{ number_format($oo->total,2) }}</td>
|
<td class="text-right">${{ number_format($oo->_total,2) }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
@endforeach
|
@endforeach
|
||||||
</tbody>
|
</tbody>
|
||||||
@ -37,12 +37,15 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@section('page-scripts')
|
@section('page-styles')
|
||||||
@css(datatables,bootstrap4|rowgroup)
|
@css(datatables,bootstrap4|rowgroup)
|
||||||
|
@append
|
||||||
|
|
||||||
|
@section('page-scripts')
|
||||||
@js(datatables,bootstrap4|rowgroup)
|
@js(datatables,bootstrap4|rowgroup)
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
@if ($x->count())
|
@if ($list->count())
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$('#invoices_past_{{ $o->id }}').DataTable({
|
$('#invoices_past_{{ $o->id }}').DataTable({
|
||||||
order: [[2,'desc'],[0,'asc']],
|
order: [[2,'desc'],[0,'asc']],
|
@ -20,13 +20,13 @@
|
|||||||
|
|
||||||
<tbody>
|
<tbody>
|
||||||
@foreach ($x as $so)
|
@foreach ($x as $so)
|
||||||
<tr>
|
<tr>
|
||||||
<td><a href="{{ url('u/service',[$so->id]) }}">{{ $so->sid }}</a></td>
|
<td><a href="{{ url('u/service',[$so->id]) }}">{{ $so->sid }}</a></td>
|
||||||
<td>{{ $so->product->category_name }}</td>
|
<td>{{ $so->product->category_name }}</td>
|
||||||
<td>{{ $so->name_short }}</td>
|
<td>{{ $so->name_short }}</td>
|
||||||
<td>{{ $so->product->name }}</td>
|
<td>{{ $so->product->name }}</td>
|
||||||
<td>{{ $so->external_billing ? '-' : $so->invoice_next->format('Y-m-d') }}</td>
|
<td>{{ $so->external_billing ? '-' : $so->invoice_next->format('Y-m-d') }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
@endforeach
|
@endforeach
|
||||||
</tbody>
|
</tbody>
|
||||||
<tfoot>
|
<tfoot>
|
||||||
@ -43,8 +43,11 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@section('page-scripts')
|
@section('page-styles')
|
||||||
@css(datatables,bootstrap4|rowgroup)
|
@css(datatables,bootstrap4|rowgroup)
|
||||||
|
@append
|
||||||
|
|
||||||
|
@section('page-scripts')
|
||||||
@js(datatables,bootstrap4|rowgroup)
|
@js(datatables,bootstrap4|rowgroup)
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
@ -64,10 +67,6 @@
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#services_active_{{ $ao->id }} tbody').on('click','tr', function () {
|
|
||||||
$(this).toggleClass('selected');
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
@append
|
@append
|
@ -1,27 +1,25 @@
|
|||||||
@if(Auth::user()->isReseller() && $o->my_accounts->count() <= 2 && $o->my_accounts->pluck('providers')->flatten()->count())
|
@if($user->isReseller() && ($o->accounts->count() <= 2) && ($x=$o->accounts->pluck('providers')->flatten())->count())
|
||||||
<div class="col-12 col-sm-4 col-md-2">
|
<div class="col-12 col-sm-4 col-md-2">
|
||||||
<div class="info-box">
|
<div class="info-box">
|
||||||
<span class="info-box-icon bg-dark elevation-1"><i class="fas fa-file-invoice"></i></span>
|
<span class="info-box-icon bg-dark elevation-1"><i class="fas fa-file-invoice"></i></span>
|
||||||
<div class="info-box-content">
|
<div class="info-box-content">
|
||||||
<span class="info-box-text">Accounting</span>
|
<span class="info-box-text">Accounting</span>
|
||||||
@foreach ($o->my_accounts as $ao)
|
@foreach($x as $po)
|
||||||
@foreach($ao->providers as $po)
|
<span class="info-box-number"><a href="{{ url(($po->api_class())::url().'/customerdetail?nameId='.$po->pivot->ref) }}" target="{{ $po->name }}">{{ ucfirst($po->name) }}</a></span>
|
||||||
<span class="info-box-number"><a href="{{ url(($po->api_class())::url().'/customerdetail?nameId='.$po->pivot->ref) }}" target="{{ $po->name }}">{{ ucfirst($po->name) }}</a></span>
|
|
||||||
@endforeach
|
|
||||||
@endforeach
|
@endforeach
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
@if ($o->accounts->count() > 1)
|
@if ($o->accounts_all->count() > 1)
|
||||||
<div class="col-12 col-sm-4 col-md-2">
|
<div class="col-12 col-sm-4 col-md-2">
|
||||||
<div class="info-box">
|
<div class="info-box">
|
||||||
<span class="info-box-icon bg-primary elevation-1"><i class="fas fa-user"></i></span>
|
<span class="info-box-icon bg-primary elevation-1"><i class="fas fa-user"></i></span>
|
||||||
|
|
||||||
<div class="info-box-content">
|
<div class="info-box-content">
|
||||||
<span class="info-box-text">Linked Accounts</span>
|
<span class="info-box-text">Linked Accounts</span>
|
||||||
<span class="info-box-number">{{ number_format($o->my_accounts->count()) }}</span>
|
<span class="info-box-number">{{ number_format($o->accounts_all->count()) }}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -33,8 +31,7 @@
|
|||||||
|
|
||||||
<div class="info-box-content">
|
<div class="info-box-content">
|
||||||
<span class="info-box-text">Active Services</span>
|
<span class="info-box-text">Active Services</span>
|
||||||
<!-- @todo This should count of inactive services too -->
|
<span class="info-box-number">{{ $o->accounts_all->map(fn($item)=>$item->services->where('active',TRUE)->count())->sum() }} <small>/{{ $o->accounts_all->map(fn($item)=>$item->services->count())->sum() }}</small></span>
|
||||||
<span class="info-box-number">{{ $o->services->count() }} <small>/{{ $o->services->count() }}</small></span>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -45,7 +42,7 @@
|
|||||||
|
|
||||||
<div class="info-box-content">
|
<div class="info-box-content">
|
||||||
<span class="info-box-text">Account Balance</span>
|
<span class="info-box-text">Account Balance</span>
|
||||||
<span class="info-box-number"><small>$</small> {{ number_format(($x=$o->invoices()->with(['items.taxes','paymentitems.payment','account'])->get()->where('due','>',0))->sum('due'),2) }}</span>
|
<span class="info-box-number"><small>$</small> {{ number_format(($x=$o->accounts_all->map(fn($item)=>$item->invoiceSummaryDue()->get()->pluck('_balance'))->flatten())->sum(),2) }}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
@ -17,14 +17,14 @@
|
|||||||
@section('main-content')
|
@section('main-content')
|
||||||
<!-- Our Summary Home Page Boxes -->
|
<!-- Our Summary Home Page Boxes -->
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@include('common.account.widget.summary')
|
@include('theme.backend.adminlte.account.widget.summary_boxes')
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="card card-light card-tabs">
|
<div class="card card-light card-tabs">
|
||||||
<div class="card-header p-0 pt-1">
|
<div class="card-header p-0 pt-1">
|
||||||
<ul class="nav nav-tabs" id="accounts-tab" role="tablist">
|
<ul class="nav nav-tabs" id="accounts-tab" role="tablist">
|
||||||
<li class="pt-2 px-3"><h3 class="card-title">Accounts</h3></li>
|
<li class="pt-2 px-3"><h3 class="card-title">Accounts</h3></li>
|
||||||
@foreach($o->my_accounts as $ao)
|
@foreach($o->accounts as $ao)
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link @if(! $loop->index)active @endif" href="#account_{{ $ao->id }}" data-toggle="tab" aria-controls="account_{{ $ao->id }}" aria-selected="true">{{ $ao->name }}</a>
|
<a class="nav-link @if(! $loop->index)active @endif" href="#account_{{ $ao->id }}" data-toggle="tab" aria-controls="account_{{ $ao->id }}" aria-selected="true">{{ $ao->name }}</a>
|
||||||
</li>
|
</li>
|
||||||
@ -42,21 +42,19 @@
|
|||||||
|
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<div class="tab-content" id="accounts-tab-content">
|
<div class="tab-content" id="accounts-tab-content">
|
||||||
@foreach($o->my_accounts as $ao)
|
@foreach($o->accounts as $ao)
|
||||||
<div class="tab-pane fade @if(! $loop->index)show active @endif" id="account_{{ $ao->id }}" role="tabpanel" aria-labelledby="account_{{ $ao->id }}">
|
<div class="tab-pane fade @if(! $loop->index)show active @endif" id="account_{{ $ao->id }}" role="tabpanel" aria-labelledby="account_{{ $ao->id }}">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<div class="card-header bg-white">
|
<div class="card-header bg-white">
|
||||||
<ul class="nav nav-pills">
|
<ul class="nav nav-pills">
|
||||||
<li class="nav-item"><a class="nav-link {{ (! session()->has('supplier_update')) ? 'active' : '' }}" href="#tab-services" data-toggle="tab">Services</a></li>
|
<li class="nav-item"><a class="nav-link {{ (! session()->has('supplier_update')) ? 'active' : '' }}" href="#tab-services" data-toggle="tab">Services</a></li>
|
||||||
{{--
|
|
||||||
<!-- @todo this is not working -->
|
|
||||||
<li class="nav-item"><a class="nav-link" href="#tab-nextinvoice" data-toggle="tab">Next Invoice</a></li>
|
|
||||||
--}}
|
|
||||||
<li class="nav-item"><a class="nav-link" href="#tab-futureinvoice" data-toggle="tab">Future Invoice</a></li>
|
<li class="nav-item"><a class="nav-link" href="#tab-futureinvoice" data-toggle="tab">Future Invoice</a></li>
|
||||||
|
@canany('reseller','wholesaler')
|
||||||
<li class="nav-item ml-auto">
|
<li class="nav-item ml-auto">
|
||||||
<a class="nav-link {{ session()->has('supplier_update') ? 'active' : '' }}" href="#tab-supplier" data-toggle="tab">Supplier</a>
|
<a class="nav-link {{ session()->has('supplier_update') ? 'active' : '' }}" href="#tab-supplier" data-toggle="tab">Supplier</a>
|
||||||
</li>
|
</li>
|
||||||
|
@endcanany
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -65,41 +63,27 @@
|
|||||||
<div class="tab-pane {{ (! session()->has('supplier_update')) ? 'active' : '' }}" id="tab-services">
|
<div class="tab-pane {{ (! session()->has('supplier_update')) ? 'active' : '' }}" id="tab-services">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12 col-xl-7">
|
<div class="col-12 col-xl-7">
|
||||||
@include('service.widget.active',['o'=>$ao])
|
@include('theme.backend.adminlte.account.widget.service_active',['o'=>$ao])
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-12 col-xl-5">
|
<div class="col-12 col-xl-5">
|
||||||
@include('invoice.widget.due',['o'=>$ao])
|
@include('theme.backend.adminlte.account.widget.invoice_due',['o'=>$ao])
|
||||||
|
@include('theme.backend.adminlte.account.widget.invoice_past',['o'=>$ao])
|
||||||
@include('invoice.widget.list',['o'=>$ao])
|
|
||||||
|
|
||||||
@include('payment.widget.list',['o'=>$ao])
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{--
|
|
||||||
<!-- @todo this is not working -->
|
|
||||||
<div class="tab-pane" id="tab-nextinvoice">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-12">
|
|
||||||
@include('u.invoice.widgets.next',['future'=>FALSE])
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
--}}
|
|
||||||
|
|
||||||
<div class="tab-pane" id="tab-futureinvoice">
|
<div class="tab-pane" id="tab-futureinvoice">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12 col-xl-9">
|
<div class="col-12 col-xl-9">
|
||||||
@include('invoice.widget.next',['future'=>TRUE])
|
@include('theme.backend.adminlte.invoice.widget.next',['future'=>TRUE])
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@canany('reseller','wholesaler')
|
@canany('reseller','wholesaler')
|
||||||
<div class="tab-pane {{ session()->pull('supplier_update') ? 'active' : '' }}" id="tab-supplier" role="tabpanel">
|
<div class="tab-pane {{ session()->pull('supplier_update') ? 'active' : '' }}" id="tab-supplier" role="tabpanel">
|
||||||
@include('user.widget.supplier')
|
@include('theme.backend.adminlte.user.widget.supplier')
|
||||||
</div>
|
</div>
|
||||||
@endcanany
|
@endcanany
|
||||||
</div>
|
</div>
|
||||||
@ -109,28 +93,14 @@
|
|||||||
</div>
|
</div>
|
||||||
@endforeach
|
@endforeach
|
||||||
|
|
||||||
@if ($o == $user)
|
@if($o==$user)
|
||||||
@canany('reseller','wholesaler')
|
@canany('reseller','wholesaler')
|
||||||
<div class="tab-pane" id="tab-reseller" role="tabpanel">
|
<div class="tab-pane" id="tab-reseller" role="tabpanel">
|
||||||
@include('r.home.widgets.home')
|
@include('theme.backend.adminlte.widget.admin.reseller')
|
||||||
</div>
|
</div>
|
||||||
@endcanany
|
@endcanany
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@endsection
|
@endsection
|
||||||
|
|
||||||
@section('page-scripts')
|
|
||||||
<script>
|
|
||||||
$(document).ready(function() {
|
|
||||||
$('body')
|
|
||||||
.addClass('sidebar-collapse')
|
|
||||||
.delay(500)
|
|
||||||
.queue(function () {
|
|
||||||
window.dispatchEvent(new Event('resize'));
|
|
||||||
$(this).dequeue();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
@append
|
|
@ -148,7 +148,7 @@
|
|||||||
<td style="width: 50px;"><i class="fa-2x fa-fw {{ $cho->icon }}"></i></td>
|
<td style="width: 50px;"><i class="fa-2x fa-fw {{ $cho->icon }}"></i></td>
|
||||||
<td>{{ $cho->name }}</td>
|
<td>{{ $cho->name }}</td>
|
||||||
<td>{{ $cho->description }}</td>
|
<td>{{ $cho->description }}</td>
|
||||||
<td class="w-25">@includeIf('payment.widget.plugin.'.strtolower($cho->plugin),['o'=>$cho])</td>
|
<td class="w-25">@includeIf('theme.backend.adminlte.payment.widget.plugin.'.strtolower($cho->plugin),['o'=>$cho])</td>
|
||||||
</tr>
|
</tr>
|
||||||
@endforeach
|
@endforeach
|
||||||
</table>
|
</table>
|
||||||
|
@ -0,0 +1,58 @@
|
|||||||
|
<!-- Show outstanding invoices -->
|
||||||
|
<table class="table table-bordered w-100" id="invoices_credit_{{$type}}">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Account</th>
|
||||||
|
<th>#</th>
|
||||||
|
<th>Due</th>
|
||||||
|
<th class="text-right">Items</th>
|
||||||
|
<th class="text-right">Discounts</th>
|
||||||
|
<th class="text-right">Total</th>
|
||||||
|
<th class="text-right">Payments</th>
|
||||||
|
<th class="text-right">Balance</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
|
||||||
|
<tbody>
|
||||||
|
@foreach($list as $oo)
|
||||||
|
<tr>
|
||||||
|
<td>{{ $oo->account->name }}</td>
|
||||||
|
<td><a href="{{ url('u/invoice',$oo->id) }}">{{ $oo->lid }}</a></td>
|
||||||
|
<td>{{ $oo->due_at->format('Y-m-d') }}</td>
|
||||||
|
<td class="text-right">${{ number_format($oo->_item+$oo->_tax,2) }}</td>
|
||||||
|
<td class="text-right">${{ number_format($oo->_discount,2) }}</td>
|
||||||
|
<td class="text-right">${{ number_format($oo->_total,2) }}</td>
|
||||||
|
<td class="text-right">${{ number_format($oo->_payment,2) }}</td>
|
||||||
|
<td class="text-right">${{ number_format($oo->_balance,2) }}</td>
|
||||||
|
</tr>
|
||||||
|
@endforeach
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
@section('page-styles')
|
||||||
|
@css(datatables,bootstrap4|rowgroup)
|
||||||
|
@append
|
||||||
|
|
||||||
|
@section('page-scripts')
|
||||||
|
@js(datatables,bootstrap4|rowgroup)
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
@if($list->count())
|
||||||
|
$(document).ready(function() {
|
||||||
|
$('#invoices_credit_{{$type}}').DataTable({
|
||||||
|
// If we have more than 1 account id, order by account
|
||||||
|
order: [[0,'asc'],[2,'asc'],[1,'desc']],
|
||||||
|
rowGroup: {
|
||||||
|
dataSrc: 0,
|
||||||
|
},
|
||||||
|
columnDefs: [
|
||||||
|
{
|
||||||
|
targets: [0],
|
||||||
|
visible: false,
|
||||||
|
}
|
||||||
|
],
|
||||||
|
});
|
||||||
|
});
|
||||||
|
@endif
|
||||||
|
</script>
|
||||||
|
@append
|
@ -0,0 +1,15 @@
|
|||||||
|
<!-- Show outstanding invoices for all clients -->
|
||||||
|
<div class="card card-warning">
|
||||||
|
<div class="card-header">
|
||||||
|
<h3 class="card-title">Invoices Due</h3>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card-body">
|
||||||
|
@if(($list=\App\Models\Account::InvoicesDue())->count())
|
||||||
|
@include('theme.backend.adminlte.invoice.widget.due',['type'=>'all'])
|
||||||
|
|
||||||
|
@else
|
||||||
|
<p>No invoice due</p>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
</div>
|
@ -1,62 +1,53 @@
|
|||||||
<!-- $o = Account::class -->
|
<!-- $list = Collection[Invoice::class] -->
|
||||||
<!-- Show outstanding invoices -->
|
<!-- Show outstanding invoices -->
|
||||||
<div class="card card-warning">
|
<table class="table table-bordered w-100" id="invoices_due_{{$type}}">
|
||||||
<div class="card-header">
|
<thead>
|
||||||
<h3 class="card-title">Invoices Due</h3>
|
<tr>
|
||||||
</div>
|
<th>Account</th>
|
||||||
|
<th>#</th>
|
||||||
|
<th>Due</th>
|
||||||
|
<th class="text-right">Total</th>
|
||||||
|
<th class="text-right">Outstanding</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
|
||||||
<div class="card-body">
|
<tbody>
|
||||||
@if(($x=$o->invoices->where('due','>',0))->count())
|
@foreach($list as $oo)
|
||||||
<table class="table table-bordered w-100" id="invoices_due_{{ $o->id }}">
|
<tr @if($oo->due_at->isPast()) class="table-danger" @endif>
|
||||||
<thead>
|
<td>{{ $oo->account->name }}</td>
|
||||||
<tr>
|
<td><a href="{{ url('u/invoice',$oo->id) }}">{{ $oo->lid }}</a></td>
|
||||||
<th>Account</th>
|
<td>{{ $oo->due_at->format('Y-m-d') }}</td>
|
||||||
<th>#</th>
|
<td class="text-right">${{ number_format($oo->_total,2) }}</td>
|
||||||
<th>Due</th>
|
<td class="text-right">${{ number_format($oo->_balance,2) }}</td>
|
||||||
<th class="text-right">Total</th>
|
</tr>
|
||||||
<th class="text-right">Outstanding</th>
|
@endforeach
|
||||||
</tr>
|
</tbody>
|
||||||
</thead>
|
</table>
|
||||||
|
|
||||||
<tbody>
|
@section('page-styles')
|
||||||
@foreach ($x as $oo)
|
@css(datatables,bootstrap4|rowgroup)
|
||||||
<tr @if ($oo->due_at->isPast()) class="table-danger" @endif>
|
@append
|
||||||
<td>{{ $oo->account->name }}</td>
|
|
||||||
<td><a href="{{ url('u/invoice',$oo->id) }}">{{ $oo->lid }}</a></td>
|
|
||||||
<td>{{ $oo->due_at->format('Y-m-d') }}</td>
|
|
||||||
<td class="text-right">${{ number_format($oo->total,2) }}</td>
|
|
||||||
<td class="text-right">${{ number_format($oo->due,2) }}</td>
|
|
||||||
</tr>
|
|
||||||
@endforeach
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
@else
|
|
||||||
<p>No invoice due</p>
|
|
||||||
@endif
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
@section('page-scripts')
|
@section('page-scripts')
|
||||||
@css(datatables,bootstrap4|rowgroup)
|
|
||||||
@js(datatables,bootstrap4|rowgroup)
|
@js(datatables,bootstrap4|rowgroup)
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
@if ($x->count())
|
@if($list->count())
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$('#invoices_due_{{ $o->id }}').DataTable({
|
$('#invoices_due_{{$type}}').DataTable({
|
||||||
order: [[0,'asc'],[3,'desc']],
|
// If we have more than 1 account id, order by account
|
||||||
rowGroup: {
|
order: [[0,'asc'],[2,'asc'],[1,'desc']],
|
||||||
dataSrc: 0,
|
rowGroup: {
|
||||||
},
|
dataSrc: 0,
|
||||||
columnDefs: [
|
},
|
||||||
{
|
columnDefs: [
|
||||||
targets: [0],
|
{
|
||||||
visible: false,
|
targets: [0],
|
||||||
}
|
visible: false,
|
||||||
],
|
}
|
||||||
});
|
],
|
||||||
});
|
});
|
||||||
|
});
|
||||||
@endif
|
@endif
|
||||||
</script>
|
</script>
|
||||||
@append
|
@append
|
@ -1,11 +1,11 @@
|
|||||||
<!-- @todo These needs to be optimised, and change for $o = Account::class -->
|
<!-- @todo These needs to be optimised, and change for $o = Account::class -->
|
||||||
<!-- Show next items for an invoice -->
|
<!-- Show next items for an invoice -->
|
||||||
@if ($o->next_invoice_items($future)->count())
|
@if (($x=$o->next_invoice_items($future))->count())
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<table class="table">
|
<table class="table">
|
||||||
<!-- Group by Account -->
|
<!-- Group by Account -->
|
||||||
@foreach (($x=$o->next_invoice_items($future))->groupBy('product_id') as $id => $oo)
|
@foreach ($x->groupBy('product_id') as $id => $oo)
|
||||||
<tr>
|
<tr>
|
||||||
<th colspan="4">{{ $oo->first()->product->name }}</th>
|
<th colspan="4">{{ $oo->first()->product->name }}</th>
|
||||||
<th class="text-right">${{ number_format($oo->sum('total'),2) }}</th>
|
<th class="text-right">${{ number_format($oo->sum('total'),2) }}</th>
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<div class="tab-content">
|
<div class="tab-content">
|
||||||
<div class="tab-pane fade active show" id="details" role="tabpanel">
|
<div class="tab-pane fade active show" id="details" role="tabpanel">
|
||||||
@include('payment.widget.detail')
|
@include('theme.backend.adminlte.payment.widget.detail')
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,71 +0,0 @@
|
|||||||
<!-- $o = Account::class -->
|
|
||||||
<!-- Show past 12 months payments -->
|
|
||||||
<div class="card card-success">
|
|
||||||
<div class="card-header">
|
|
||||||
<h3 class="card-title">Past Payments</h3>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="card-body">
|
|
||||||
@if(($x=$o->payments->where('created_at','>',\Carbon\Carbon::now()->subMonths(12)))->count())
|
|
||||||
<table class="table table-bordered w-100" id="payments_past">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>Account</th>
|
|
||||||
<th>#</th>
|
|
||||||
<th>Received</th>
|
|
||||||
<th class="text-right">Total</th>
|
|
||||||
{{--<th class="text-right">Balance</th>--}}
|
|
||||||
<th>Invoice(s)</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
|
|
||||||
<tbody>
|
|
||||||
@foreach ($x as $oo)
|
|
||||||
<tr>
|
|
||||||
<td>{{ $oo->account->name }}</td>
|
|
||||||
<td>{{ $oo->lid }}</td>
|
|
||||||
<td>{{ $oo->paid_at->format('Y-m-d') }}</td>
|
|
||||||
<td class="text-right">${{ number_format($oo->total,2) }}</td>
|
|
||||||
{{--<td class="text-right">${{ number_format($oo->balance,2) }}</td>--}}
|
|
||||||
<td>
|
|
||||||
{!! join(', ',$oo->items
|
|
||||||
->filter(function($item) { return $item->invoice_id; })
|
|
||||||
->transform(function($item) { return sprintf('<a href="%s">%s</a>',url('u/invoice',$item->invoice_id),$item->invoice_id); })
|
|
||||||
->toArray()) !!}
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
@endforeach
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
@else
|
|
||||||
<p>No payments to list</p>
|
|
||||||
@endif
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
@section('page-scripts')
|
|
||||||
@css(datatables,bootstrap4|rowgroup)
|
|
||||||
@js(datatables,bootstrap4|rowgroup)
|
|
||||||
|
|
||||||
<script type="text/javascript">
|
|
||||||
$(document).ready(function() {
|
|
||||||
$('#payments_past').DataTable({
|
|
||||||
order: [2,'desc'],
|
|
||||||
rowGroup: {
|
|
||||||
dataSrc: 0,
|
|
||||||
},
|
|
||||||
columnDefs: [
|
|
||||||
{
|
|
||||||
targets: [0],
|
|
||||||
visible: false,
|
|
||||||
}
|
|
||||||
],
|
|
||||||
});
|
|
||||||
|
|
||||||
$('#payments_past tbody').on('click','tr', function () {
|
|
||||||
$(this).toggleClass('selected');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
@append
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user