fixBankInSlip

This commit is contained in:
lonetrinity
2018-09-12 15:36:49 +08:00
commit ced8c02203
363 changed files with 41654 additions and 0 deletions
+3
View File
@@ -0,0 +1,3 @@
{
"plugins": ["syntax-dynamic-import"]
}
+9
View File
@@ -0,0 +1,9 @@
vendor
node_modules
.git
.idea
.env
storage/framework/cache/**
storage/framework/sessions/**
storage/framework/views/**
+75
View File
@@ -0,0 +1,75 @@
APP_NAME=IZYIM
APP_ENV=local
APP_KEY=base64:Fu2YulXExzm9HJ5LgVmZUmcbRkchHkc82q02MorN5GQ=
APP_DEBUG=true
APP_URL=http://localhost
LOG_CHANNEL=stack
DB_CONNECTION=mysql
DB_HOST=mysql
DB_PORT=3306
DB_DATABASE=default
DB_USERNAME=default
DB_PASSWORD=secret
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=mt1
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
APP_NAME=exchange
APP_ENV=local
APP_KEY=base64:Fu2YulXExzm9HJ5LgVmZUmcbRkchHkc82q02MorN5GQ=
APP_DEBUG=true
APP_URL=http://localhost
LOG_CHANNEL=stack
DB_CONNECTION=mysql
DB_HOST=mysql
DB_PORT=3306
DB_DATABASE=default
DB_USERNAME=default
DB_PASSWORD=secret
BROADCAST_DRIVER=log
CACHE_DRIVER=file
SESSION_DRIVER=file
SESSION_LIFETIME=120
QUEUE_DRIVER=sync
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=mt1
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
JWT_SECRET=FwYZ3SPFgjpEDqAwcaSIV6eEmQiMtGWt
+80
View File
@@ -0,0 +1,80 @@
APP_NAME=IZYIM
APP_ENV=production
APP_KEY=base64:Fu2YulXExzm9HJ5LgVmZUmcbRkchHkc82q02MorN5GQ=
APP_DEBUG=true
APP_URL=http://localhost
LOG_CHANNEL=stack
DB_CONNECTION=mysql
DB_HOST=mysql
DB_PORT=3306
DB_DATABASE=default
DB_USERNAME=default
DB_PASSWORD=secret
BROADCAST_DRIVER=log
CACHE_DRIVER=file
SESSION_DRIVER=file
SESSION_LIFETIME=120
QUEUE_DRIVER=sync
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=mt1
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
APP_NAME=exchange
APP_ENV=local
APP_KEY=base64:Fu2YulXExzm9HJ5LgVmZUmcbRkchHkc82q02MorN5GQ=
APP_DEBUG=true
APP_URL=http://localhost
LOG_CHANNEL=stack
DB_CONNECTION=mysql
DB_HOST=mysql
DB_PORT=3306
DB_DATABASE=default
DB_USERNAME=default
DB_PASSWORD=secret
BROADCAST_DRIVER=log
CACHE_DRIVER=file
SESSION_DRIVER=file
SESSION_LIFETIME=120
QUEUE_DRIVER=sync
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=mt1
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
JWT_SECRET=FwYZ3SPFgjpEDqAwcaSIV6eEmQiMtGWt
+18
View File
@@ -0,0 +1,18 @@
APP_ENV=phpunit
APP_DEBUG=true
APP_KEY=w7VQXeA7U31DCdh1U39lpRz0iD7i0oCI
APP_URL=http://localhost
DB_CONNECTION=mysql
DB_HOST=mysql
DB_PORT=3306
DB_DATABASE=default
DB_USERNAME=default
DB_PASSWORD=secret
CACHE_DRIVER=array
SESSION_DRIVER=array
QUEUE_DRIVER=sync
MAIL_DRIVER=log
JWT_SECRET=FwYx3SPFxjpEDxAwcaSIV6eExQiMtGWx
+15
View File
@@ -0,0 +1,15 @@
{
"root": true,
"parserOptions": {
"parser": "babel-eslint",
"ecmaVersion": 2017,
"sourceType": "module"
},
"extends": [
"plugin:vue/recommended",
"@vue/standard"
],
"rules": {
"vue/max-attributes-per-line": "off"
}
}
+23
View File
@@ -0,0 +1,23 @@
node_modules
public/hot
public/storage
public/js
public/css
public/mix-manifest.json
storage/*.key
vendor/**
.idea
.vscode
.vagrant
/data
vendor/composer
Homestead.json
Homestead.yaml
npm-debug.log
yarn-error.log
.env
.env.prod
vendor/composer/autoload_static.php
vendor/composer/autoload_classmap.php
package-lock.json
composer.lock
+35
View File
@@ -0,0 +1,35 @@
#!/bin/bash
# Install dependencies only for Docker.
[[ ! -e /.dockerenv ]] && exit 0
set -xe
# Update packages and install composer and PHP dependencies.
apt-get update -yqq
apt-get install git libgd-dev libcurl4-gnutls-dev libicu-dev libmcrypt-dev libvpx-dev libjpeg-dev libpng-dev libxpm-dev zlib1g-dev libfreetype6-dev libxml2-dev libexpat1-dev libbz2-dev libgmp3-dev libldap2-dev unixodbc-dev libpq-dev libsqlite3-dev libaspell-dev libsnmp-dev libpcre3-dev libtidy-dev -yqq
# Compile PHP, include these extensions.
docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/
docker-php-ext-install mbstring pdo_mysql curl json intl gd xml zip bz2 opcache
# Install Composer and project dependencies.
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
composer install
# Copy over testing configuration.
cp .env.testing .env
# Install xdebug
#pecl install xdebug && docker-php-ext-enable xdebug
# Generate an application key. Re-cache.
php artisan key:generate
php artisan jwt:secret
php artisan config:cache
php artisan config:clear
# php artisan optimize // remove after laravel 5.6
# Run database migrations with seeder
php artisan migrate:refresh --seed
+34
View File
@@ -0,0 +1,34 @@
before_script:
- bash .gitlab-ci.sh
stages:
- testing
- staging
variables:
MYSQL_DATABASE: default
MYSQL_USER: default
MYSQL_PASSWORD: secret
MYSQL_ROOT_PASSWORD: root
unitTesting:
stage: testing
image: php:7.2.6
services:
- mysql:5.7
script:
- vendor/bin/phpunit --coverage-text --colors=never
staging:
stage: staging
before_script:
- mkdir -p ~/.ssh
- echo -e "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa
- chmod 400 ~/.ssh/id_rsa
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
script:
- ssh admin@exchange-staging.izyim.com "cd exchange && git pull origin master && sudo docker-compose -f docker-prod.yml up -d"
environment:
name: staging
url: https://exchange-staging.izyim.com/
when: manual
BIN
View File
Binary file not shown.
+3
View File
@@ -0,0 +1,3 @@
{
"CurrentProjectSetting": null
}
+7
View File
@@ -0,0 +1,7 @@
{
"ExpandedNodes": [
""
],
"SelectedNode": "\\laradock",
"PreviewInSolutionExplorer": false
}
Binary file not shown.
BIN
View File
Binary file not shown.
+100
View File
@@ -0,0 +1,100 @@
# Changelog
### 1.0.5-alpha 2018-09-03
- Fixed 404 error on downloading PO format
- Fixed admin step 2 404 error
- Fixed all files 404 error
- Updated sorting feature
- Added marking column to admin completed table
### 1.0.4-alpha 2018-08-27
- Updated bank setting dropdown list to [Beneficiary Name : bank name : bank account no]
- Fixed some booking view status 404 error
- Fixed admin completed table view status not clickable
- Migrated to Google Cloud
## 1.0.3-alpha - 2018-08-20
- Added new feature - Rate is realtime now
- Updated active bank setting now with bank account with bank name
- Updated required field on bank setting (acc no, bank name, comp name)
- Removed "Please key in the data in Chinese" note at bank setting
- Fixed completed booking showing in normal booking table
- Fixed booking page not found
- Fixed refresh button for both normal and completed booking
- Temporary removed notification
- Working Progress Feature: Realtime notification, Cancel booking, Sort booking
## 1.0.2-alpha - 2018-08-13
- Added completed booking tab feature
- Removed login remember me checkbox
- Updated blue report with bank name and bank branch
- Fixed marking bug on mobile version
- Fixed step 2 bug
## 1.0.1-alpha - 2018-08-09
- Fixed X2 milestone, now completed at step 5
- Fixed X2 no billing charge
- Fixed forgot password bug
- Updated customer registration marking with auto capital feature
- Updated admin marking setting with auto capital feature
- Added green report info for every page after supplier booking page
## 1.0.0-alpha - 2018-08-02
- Release 1.0.0
## 4.1.0-dev - 2018-03-14
- Upgrade to Laravel 5.6
- Update npm dependencies
- Enabled Mix [esModule](https://github.com/JeffreyWay/laravel-mix/pull/1526#issuecomment-373044182) by default
- Lint with eslint-plugin-vue and eslint-config-standard
## 4.0.0-dev - 2018-01-23
- Brought back the `layout` property in pages that was removed in 3.0. By default it's set to `default` (`~/layouts/default.vue`).
## 3.0.1-dev - 2018-01-22
- Removed middleware from routes, since they don't work when you press the back button. Now you have to use the `middleware` property in pages.
## 3.0.0-dev - 2018-01-22
- Removed `layout` property from pages in favor of explicit layout components
- Improved middleware system, you can either define it on a route or directly on a component
- Reorganized components
- Change jwt token ttl to one day
- Fixed hot module replacement
## 2.2.1-dev - 2018-01-19
- Upgrade to Bootstrap 4
## 2.2.0-dev - 2018-01-16
- Added dynamic import for pages
- Added locale with dynamic import
- Import shakable fontawesome module
## 2.1.0-dev - 2018-01-10
- Simplifyd password reset
- Upgrade to Bootstrap 4 beta3
- Added oauth with popup window
## 2.0.0-dev - 2017-12-19
- Added support for Socialite
- Added dropdown to select the locale
- Added route middleware
- Added Font Awesome 5 icons
- Added user profile photo in navbar
- Added Chinese and Spanish translations
- Upgrade to Bootstrap 4 beta2
- Fixed router scroll behaviour
- Namespaced store modules
- Published project to Packagist
## 1.0.0-dev - 2017-09-02
- Upgrade to Laravel 5.5.
- Upgrade to Bootstrap 4 beta1.
- Rework routing and guards.
+27
View File
@@ -0,0 +1,27 @@
# Build frontend assets
# FROM node as frontend
# WORKDIR /app
# ADD . /app
# RUN npm install
# RUN npm run production
# Build backend
FROM php:7.1.3
RUN apt-get update -y && apt-get install -y openssl zip unzip git zlib1g-dev netcat mysql-client libgd-dev libfreetype6-dev libjpeg62-turbo-dev libpng12-dev
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/
RUN docker-php-ext-install pdo pdo_mysql zip gd
WORKDIR /app
ADD . /app
RUN chmod 755 /app/storage
RUN chmod 777 -R /app/bootstrap/cache
RUN composer install
RUN php artisan clear-compiled
COPY wait.sh /usr/local/bin/wait.sh
RUN chmod +x /usr/local/bin/wait.sh
RUN chown -R www-data:www-data /app
CMD /usr/local/bin/wait.sh && composer update --no-scripts && composer dumpautoload && php artisan migrate && php artisan serve --host=0.0.0.0 --port=8000
EXPOSE 8000
+5
View File
@@ -0,0 +1,5 @@
Copyright (C) CIEF Sdn Bhd - All Rights Reserved
Unauthorized copying of this file, via any medium is strictly prohibited
Proprietary and confidential
Written by Elmer Fudd <jackgoh0@gmail.com>, August 2018
+1
View File
@@ -0,0 +1 @@
web: vendor/bin/heroku-php-apache2 public/ && npm run production
+58
View File
@@ -0,0 +1,58 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Booking extends Model
{
// protected $guarded = [];
protected $hidden = array( "user",
"user_id",
"rate_id",
"rmb_book_amount",
"rmb_book_pay_method",
"rmb_book_account_name",
"rmb_book_bank_name",
"rmb_book_acc_no",
"rmb_book_bank_branch",
"usd_book_amount",
"usd_book_pay_method",
"usd_book_company_name",
"usd_book_company_address",
"usd_book_swift_code",
"usd_book_cnap",
"usd_book_bank_branch");
protected $fillable = ['term', 'rate_id', 'user_id', 'amount', 'account_name', 'account_num', 'bank_name',
'bank_branch', 'company_name'];
public $timestamps = true;
public function user(){
return $this->belongsTo(User::class);
}
public function supplierBooking(){
return $this->hasOne(SupplierBooking::class);
}
public function chinaBankSlip(){
return $this->hasMany(ChinaBankSlip::class);
}
public function userBankSlip(){
return $this->hasOne(UserBankSlip::class);
}
public function purchaseOrder(){
return $this->hasOne(PurchaseOrder::class);
}
public function invoice(){
return $this->hasOne(Invoice::class);
}
}
+15
View File
@@ -0,0 +1,15 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class ChinaBankSlip extends Model
{
protected $fillable = ['actual_transfer_amount','date','details','china_bank_slip_path'];
public function booking()
{
return $this->belongsTo(Booking::class);
}
}
+42
View File
@@ -0,0 +1,42 @@
<?php
namespace App\Console;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
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)
{
// $schedule->command('inspire')
// ->hourly();
}
/**
* Register the commands for the application.
*
* @return void
*/
protected function commands()
{
$this->load(__DIR__.'/Commands');
require base_path('routes/console.php');
}
}
+47
View File
@@ -0,0 +1,47 @@
<?php
namespace App\Events;
use Illuminate\Broadcasting\Channel;
use Illuminate\Queue\SerializesModels;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Broadcasting\PresenceChannel;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
use App\Rate;
class RateUpdated implements ShouldBroadcast
{
use Dispatchable, InteractsWithSockets, SerializesModels;
public $rate;
/**
* Create a new event instance.
*
* @return void
*/
public function __construct(Rate $rate)
{
$this->rate = $rate;
}
/**
* Get the channels the event should broadcast on.
*
* @return \Illuminate\Broadcasting\Channel|array
*/
public function broadcastOn()
{
return new Channel('rate-updated');
//return new PrivateChannel('rate-updated');
}
public function broadcastWith() {
return [
'rate' => $this->rate,
];
}
}
+19
View File
@@ -0,0 +1,19 @@
<?php
namespace App\Exceptions;
use Exception;
class EmailTakenException extends Exception
{
/**
* Render the exception as an HTTP response.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function render($request)
{
return response()->view('oauth.emailTaken', [], 400);
}
}
+61
View File
@@ -0,0 +1,61 @@
<?php
namespace App\Exceptions;
use Exception;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
class Handler extends ExceptionHandler
{
/**
* A list of the exception types that are not reported.
*
* @var array
*/
protected $dontReport = [
//
];
/**
* A list of the inputs that are never flashed for validation exceptions.
*
* @var array
*/
protected $dontFlash = [
'password',
'password_confirmation',
];
/**
* Report or log an exception.
*
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
*
* @param \Exception $exception
* @return void
*/
public function report(Exception $exception)
{
parent::report($exception);
}
/**
* Render an exception into an HTTP response.
*
* @param \Illuminate\Http\Request $request
* @param \Exception $exception
* @return \Illuminate\Http\Response
*/
public function render($request, Exception $exception)
{
// This will replace our 404 response with
// a JSON response.
if ($exception instanceof ModelNotFoundException) {
return response()->json([
'error' => 'Resource not found'
], 404);
}
return parent::render($request, $exception);
}
}
@@ -0,0 +1,52 @@
<?php
namespace App\Http\Controllers\Auth;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
class ForgotPasswordController extends Controller
{
use SendsPasswordResetEmails;
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest');
}
/**
* Get the response for a successful password reset link.
*
* @param string $response
* @return \Illuminate\Http\RedirectResponse
*/
protected function sendResetLink(Request $request)
{
if($request->input('email')) {
$this->sendResetLinkEmail($request);
}
return response()->json([
'error' => false,
'status' => 'We have sent reset password link to '. $request->input('email')
]);
}
/**
* Get the response for a failed password reset link.
*
* @param \Illuminate\Http\Request $request
* @param string $response
* @return \Illuminate\Http\RedirectResponse
*/
protected function sendResetLinkFailedResponse(Request $request, $response)
{
return response()->json(['email' => trans($response)], 400);
}
}
@@ -0,0 +1,72 @@
<?php
namespace App\Http\Controllers\Auth;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
class LoginController extends Controller
{
use AuthenticatesUsers;
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest')->except('logout');
}
/**
* Attempt to log the user into the application.
*
* @param \Illuminate\Http\Request $request
* @return bool
*/
protected function attemptLogin(Request $request)
{
$token = $this->guard()->attempt($this->credentials($request));
if ($token) {
$this->guard()->setToken($token);
return true;
}
return false;
}
/**
* Send the response after the user was authenticated.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
protected function sendLoginResponse(Request $request)
{
$this->clearLoginAttempts($request);
$token = (string) $this->guard()->getToken();
$expiration = $this->guard()->getPayload()->get('exp');
return [
'token' => $token,
'token_type' => 'bearer',
'expires_in' => $expiration - time(),
];
}
/**
* Log the user out of the application.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function logout(Request $request)
{
$this->guard()->logout();
}
}
@@ -0,0 +1,113 @@
<?php
namespace App\Http\Controllers\Auth;
use App\User;
use App\OAuthProvider;
use App\Http\Controllers\Controller;
use App\Exceptions\EmailTakenException;
use Laravel\Socialite\Facades\Socialite;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
use Tymon\JWTAuth\Facades\JWTAuth;
use Tymon\JWTAuth\Exceptions\JWTException;
class OAuthController extends Controller
{
use AuthenticatesUsers;
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
config([
'services.github.redirect' => route('oauth.callback', 'github'),
]);
}
/**
* Redirect the user to the provider authentication page.
*
* @param string $provider
* @return \Illuminate\Http\RedirectResponse
*/
public function redirectToProvider($provider)
{
return [
'url' => Socialite::driver($provider)->stateless()->redirect()->getTargetUrl(),
];
}
/**
* Obtain the user information from the provider.
*
* @param string $driver
* @return \Illuminate\Http\Response
*/
public function handleProviderCallback($provider)
{
$user = Socialite::driver($provider)->stateless()->user();
$user = $this->findOrCreateUser($provider, $user);
$this->guard()->setToken(
$token = $this->guard()->login($user)
);
return view('oauth/callback', [
'token' => $token,
'token_type' => 'bearer',
'expires_in' => $this->guard()->getPayload()->get('exp') - time(),
]);
}
/**
* @param string $provider
* @param \Laravel\Socialite\Contracts\User $sUser
* @return \App\User|false
*/
protected function findOrCreateUser($provider, $user)
{
$oauthProvider = OAuthProvider::where('provider', $provider)
->where('provider_user_id', $user->getId())
->first();
if ($oauthProvider) {
$oauthProvider->update([
'access_token' => $user->token,
'refresh_token' => $user->refreshToken,
]);
return $oauthProvider->user;
}
if (User::where('email', $user->getEmail())->exists()) {
throw new EmailTakenException;
}
return $this->createUser($provider, $user);
}
/**
* @param string $provider
* @param \Laravel\Socialite\Contracts\User $sUser
* @return \App\User
*/
protected function createUser($provider, $sUser)
{
$user = User::create([
'name' => $sUser->getName(),
'email' => $sUser->getEmail(),
]);
$user->oauthProviders()->create([
'provider' => $provider,
'provider_user_id' => $sUser->getId(),
'access_token' => $sUser->token,
'refresh_token' => $sUser->refreshToken,
]);
return $user;
}
}
@@ -0,0 +1,92 @@
<?php
namespace App\Http\Controllers\Auth;
use App\User;
use App\Role;
use App\Marking;
use Illuminate\Support\Facades\Auth;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Validator;
use Illuminate\Foundation\Auth\RegistersUsers;
class RegisterController extends Controller
{
use RegistersUsers;
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest');
}
/**
* The user has been registered.
*
* @param \Illuminate\Http\Request $request
* @param mixed $user
* @return mixed
*/
protected function registered(Request $request, $user)
{
return $user;
}
/**
* 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, [
'marking' => 'required|max:255|unique:markings',
'email' => 'required|email|max:255|unique:users',
'password' => 'required|min:6|confirmed',
]);
}
/**
* Create a new user instance after a valid registration.
*
* @param array $data
* @return User
*/
protected function create(Request $data)
{
$this->validate($data, [
'email' => 'required|email|max:255|unique:users',
'password' => 'required|min:6|confirmed',
]);
$marking = Marking::Where('email',$data['email'])->first();
if(!$marking){
return response()->json(["message"=>"Marking does not exist, please contact sales team to get one"], 400);
}
if($marking->marking != strtoupper($data['marking'])){
return response()->json(["message"=>"Incorrect marking"], 400);
}
if(User::Where('email',$data['email'])->first()){
return response()->json(["message"=>"Email already exist in the system"], 400);
}
$role = Role::where('name','=','member')->first();
$user = new User();
$user->name = $data['name'];
$user->email = $data['email'];
$user->marking = $marking->marking;
$user->password = bcrypt($data['password']);
$user->save();
$user->attachRole($role);
return response()->json($user, 201);
}
}
@@ -0,0 +1,49 @@
<?php
namespace App\Http\Controllers\Auth;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\ResetsPasswords;
class ResetPasswordController extends Controller
{
use ResetsPasswords;
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest');
}
/**
* Get the response for a successful password reset.
*
* @param string $response
* @return \Illuminate\Http\RedirectResponse
*/
protected function sendResetResponse($response)
{
return ['status' => trans($response)];
}
/**
* Get the response for a failed password reset.
*
* @param \Illuminate\Http\Request $request
* @param string $response
* @return \Illuminate\Http\RedirectResponse
*/
protected function sendResetFailedResponse(Request $request, $response)
{
return response()->json(['email' => trans($response)], 400);
}
protected function showResetForm(){
return view('index');
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,180 @@
<?php
namespace App\Http\Controllers;
use Auth;
use App\SupplierBooking;
use App\Booking;
use App\Rate;
use App\User;
use App\UserBankSlip;
use App\SettingBeneficiary;
use App\SupplierBookingItem;
use App\SettingSupplier;
use App\SettingTaxRate;
use App\SettingActiveBank;
use Illuminate\Http\Request;
class BookingSupplierController extends Controller
{
public function index()
{
$bookingsupplier = SupplierBooking::all();
$response = [
'supplier-booking' => $bookingsupplier
];
return response()->json($response, 200);
}
public function show($id)
{
$booking = Booking::where('id', $id)->first();
$bankin_amount = round($booking->amount / $booking->rate, 2);
if (!$booking){
return response()->json(['message' => 'Booking not found'], 404);
}
switch ($booking->term) {
case "x1_cash":
$payment_method = "CASH";
break;
case "x1_cheque":
$payment_method = "CHEQUE";
break;
case "x1_ba":
$payment_method = "BA";
break;
case "x2_cash":
$payment_method = "CASH";
break;
case "x2_cheque":
$payment_method = "CHEQUE";
break;
case "x2_ba":
$payment_method = "BA";
break;
default:
return response()->json([
'success' => false,
'message' => 'Invalid input',
], 422);
break;
}
$supplier_booking = $booking->supplierBooking()->first();
$dt = new \DateTime($supplier_booking->created_at);
$supplier_booking->date = $dt->format('j F Y');
$supplier_booking->marking = $booking->user->marking;
$supplier_booking->payment_for = $booking->payment_for;
$supplier_booking->order_no = $booking->order_no;
$supplier_booking->payment_method = $payment_method;
$active_bank = SettingActiveBank::first();
// if setting is set to use customer's beneficiary
if ($active_bank->beneficiary_id == 0){
$supplier_booking->acc_name = $booking->account_name;
$supplier_booking->acc_no = $booking->account_num; // TODO : standardize acc_no
$supplier_booking->bank_name = $booking->bank_name;
$supplier_booking->bank_branch = $booking->bank_branch;
}
else{
$beneficiary = SettingBeneficiary::find($active_bank->beneficiary_id);
$supplier_booking->acc_name = $beneficiary->company_name;
$supplier_booking->acc_no = $beneficiary->acc_no;
$supplier_booking->bank_name = $beneficiary->bank_name;
$supplier_booking->bank_branch = $beneficiary->bank_branch;
}
return response()->json($supplier_booking ,200);
}
// Only for single booking
// TODO : Multiple booking
public function store(Request $request)
{
//$transfer_amount = $request->input("transfer_amount");
$supplier_id = $request->input("supplier_id");
$booking_id = $request->input("booking_id");
$rate = $request->input('rate'); // costing rate
$rebate = $request->input('rebate');
$supplier = SettingSupplier::find($supplier_id);
$booking = Booking::find($booking_id);
// Calculation (backup)
// $amountInRMB = $transfer_amount * $rate;
// $billing = 0.015 * $transfer_amount;
// $sales_tax = 0.0 * $transfer_amount;
// $gst = 0 * $transfer_amount; // do we still need this ?
// $customerBankInAmount = round($transfer_amount + $gst + $sales_tax + $billing,2);
// $rmbBankAmount = round($customerBankInAmount + $rebate, 2);
// Update: changes in 1.1 according to new supplier booking report
$transfer_amount = $booking->amount;
$amount_in_myr = round($transfer_amount / $rate, 2);
$amountInRMB = $transfer_amount;
$tax_rate = SettingTaxRate::latest()->first()->tax_rate;
$sales_tax = round($tax_rate * $amount_in_myr - $amount_in_myr, 2);
$amount_after_tax = round($amount_in_myr * $tax_rate,2);
//$billing = 0.015 * $transfer_amount;
//
//$gst = 0 * $transfer_amount; // do we still need this ?
//$customerBankInAmount = round($transfer_amount + $gst + $sales_tax + $billing,2);
//$rmbBankAmount = round($customerBankInAmount + $rebate, 2);
// update existing booking supplier if exist
$bookingsupplier = SupplierBooking::where('booking_id', $booking_id)->first();
if (!$bookingsupplier){
$bookingsupplier = new SupplierBooking();
}
$bookingsupplier->supplier_id = $supplier->id;
$bookingsupplier->amountInRMB = $amountInRMB; // TODO : rename to underscore
$bookingsupplier->amount_in_myr = $amount_in_myr;
$bookingsupplier->tax_rate = $tax_rate;
$bookingsupplier->amount_after_tax = $amount_after_tax;
$bookingsupplier->rate = $rate;
$bookingsupplier->rebate = $rebate;
$bookingsupplier->salestax_amount = $sales_tax;
//$bookingsupplier->payment_method = $request->input('payment_method'); // TODO : remove from db
//$bookingsupplier->transfer_amount = $transfer_amount; // TODO : remove from db
//$bookingsupplier->billing_amount = $billing; // TODO : remove from db
//$bookingsupplier->rmbBankAmount = $rmbBankAmount; // TODO : remove from db
$bookingsupplier->booking_id = $booking->id;
$bookingsupplier->save();
// update booking status
$booking->status = 4;
$booking->admin_status = 4;
$booking->save();
return response()->json($bookingsupplier, 201);
}
public function report(Request $request, $id)
{
$supplier_booking = Booking::firstOrFail($id)->supplierBooking()->firstOrFail();
return response()->json($supplier_booking ,200);
}
}
@@ -0,0 +1,87 @@
<?php
namespace App\Http\Controllers;
use App\ChinaBankSlip;
use App\Booking;
use App\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Storage;
use Validator;
class ChinaBankSlipController extends Controller
{
public function store(Request $request, $id)
{
$booking = Booking::where('id',$id)->firstOrFail();
if (!$booking) {
return response()->json(['message'=>'Access denied'], 403);
}
// TODO : put this after check file exist
// validate file format
$validator = Validator::make($request->all(), [
'file' => 'mimes:jpg,jpeg,bmp,png,xls,xlsx,doc,docx,pdf'
]);
if($validator->fails()){
return response()->json(['message'=>'Incorrect format'],400);
}
$validator = Validator::make($request->all(), [
'china_bank_slips' => 'max:10000'
]);
if($validator->fails()){
return response()->json(['message'=>'Image too large, upload files up to 3 MB'], 400);
}
if($bankslip_file = $request->file('file')){
$filename = $bankslip_file->getClientOriginalName();
$ext = $bankslip_file->getClientOriginalExtension();
$unique_name = 'cnbank_slip_' . md5($filename. time()); // probably not a good idea
$unique_image_path = $unique_name. '.' .$ext;
// Upload Image
$upload_path = Storage::disk('public')->putFileAs(
'china_bank_slip', $bankslip_file, $unique_image_path
);
} else {
return response()->json(['message'=>'file not found'],200);
}
$china_bankslip = new ChinaBankSlip;
$china_bankslip->booking_id = $booking->id;
$china_bankslip->china_bank_slip_path = $upload_path;
$china_bankslip->save();
return response()->json(['message'=>'success'], 201);
}
public function update(Request $request, $id){
$booking = Booking::where('id',$id)->first();
$china_bankslip = $booking->chinaBankSlip()->first();
// TODO: first or fail
if(!$china_bankslip){
return response()->json(["message"=> "China bankslip not found. Please upload first."],400);
}
$china_bankslip->actual_transfer_amount = $request->input('actual_transfer_amount');
$china_bankslip->date = $request->input('date');
$china_bankslip->details = $request->input('details');
$china_bankslip->save();
// update booking status
$booking->status = 5;
$booking->admin_status = 6;
$booking->save();
return response()->json(["message"=> "Success"],200);
}
}
+13
View File
@@ -0,0 +1,13 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
class Controller extends BaseController
{
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
}
+28
View File
@@ -0,0 +1,28 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class HomeController extends Controller
{
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('auth');
}
/**
* Show the application dashboard.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
return view('home');
}
}
@@ -0,0 +1,44 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Marking;
class MarkingController extends Controller
{
public function index()
{
return Marking::all();
}
public function show(Marking $marking)
{
return $marking;
}
public function store(Request $request)
{
$marking = new Marking;
$marking->marking = strtoupper($request->input('marking'));
$marking->email = $request->input('email');
$marking->save();
return response()->json($marking, 201);
}
public function update(Request $request, Marking $marking)
{
// TODO : update to upper case
$marking->update($request->all());
return response()->json($marking, 200);
}
public function delete(Marking $marking)
{
$marking->delete();
return response()->json(null, 204);
}
}
@@ -0,0 +1,66 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Notification;
use Illuminate\Support\Facades\DB;
use Auth;
class NotificationController extends Controller
{
public function index()
{
return Notification::all()->orderby('updated_at','desc');
}
public function show(Notification $notification)
{
return $notification;
}
public function store(Request $request)
{
$notification = Notification::create($request->all());
return response()->json($notification, 201);
}
public function update(Request $request, Notification $notification)
{
$notification->update($request->all());
return response()->json($notification, 200);
}
public function delete(Notification $notification)
{
$notification->delete();
return response()->json(null, 204);
}
public function getUserMessage()
{
$user_all_notification = Notification::Where("user_id",Auth::user()->id)
->orderby('updated_at','desc')
->paginate(5);
$user_unread_notification = Notification::Where([["user_id",Auth::user()->id],["is_read",0]])
->orderby('updated_at','desc')
->get();
return response()->json([
"message" =>$user_all_notification,
"unread_message" =>$user_unread_notification
],200);
}
public function readNotification($notification_id){
$affected = DB::table('notifications')
->Where('id', $notification_id)
->update(array('is_read' => 1));
return response()->json("Read message", 200);
}
}
+42
View File
@@ -0,0 +1,42 @@
<?php
namespace App\Http\Controllers;
use App\Rate;
use Illuminate\Http\Request;
class RateController extends Controller
{
public function index()
{
return Rate::all();
}
public function store(Request $request)
{
$rate = Rate::create($request->all());
return response()->json($rate, 201);
}
public function update(Request $request, Rate $rate)
{
$rate->update($request->all());
return response()->json($rate, 200);
}
public function delete(Rate $rate)
{
$rate->delete();
return response()->json(null, 204);
}
public function show()
{
$rate = Rate::latest()->first();
return response()->json($rate, 200);
}
}
@@ -0,0 +1,25 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\SettingActiveBank;
class SettingActiveBankController extends Controller
{
public function index()
{
$active_bank_setting = SettingActiveBank::latest()->first();
return response()->json($active_bank_setting, 200);
}
public function update(Request $request)
{
if($active_bank_setting = SettingActiveBank::latest()->first())
$active_bank_setting->update($request->all());
else
$active_bank_setting = SettingActiveBank::create($request->all());
return response()->json($active_bank_setting, 200);
}
}
@@ -0,0 +1,44 @@
<?php
namespace App\Http\Controllers;
use App\SettingBeneficiary;
use Illuminate\Http\Request;
class SettingBeneficiaryController extends Controller
{
public function index()
{
return SettingBeneficiary::all();
}
public function show($beneficiary)
{
if ($beneficiary == 0){
response()->json(["company_name"=>"123", "account_number"=>"123"] , 201);
}
$beneficiary = SettingBeneficiary::find($beneficiary);
return $beneficiary;
}
public function store(Request $request)
{
$beneficiary = SettingBeneficiary::create($request->all());
return response()->json($beneficiary, 201);
}
public function update(Request $request, SettingBeneficiary $beneficiary)
{
$beneficiary->update($request->all());
return response()->json($beneficiary, 200);
}
public function delete(SettingBeneficiary $beneficiary)
{
$beneficiary->delete();
return response()->json(null, 204);
}
}
@@ -0,0 +1,25 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\SettingBillingCharge;
class SettingBillingChargeController extends Controller
{
public function index()
{
$billing_charge_setting = SettingBillingCharge::latest()->first();
return response()->json($billing_charge_setting, 201);
}
public function update(Request $request)
{
if($billing_charge_setting = SettingBillingCharge::latest()->first())
$billing_charge_setting->update($request->all());
else
$billing_charge_setting = SettingBillingCharge::create($request->all());
return response()->json($billing_charge_setting, 200);
}
}
@@ -0,0 +1,42 @@
<?php
namespace App\Http\Controllers;
use App\SettingCredit;
use Illuminate\Http\Request;
class SettingCreditController extends Controller
{
public function index()
{
$credit_setting = SettingCredit::latest()->first();
return response()->json($credit_setting, 201);
}
public function show(SettingCredit $credit)
{
return $credit;
}
public function store(Request $request)
{
$credit = SettingCredit::create($request->all());
return response()->json($credit, 201);
}
public function update(Request $request)
{
$credit_setting = SettingCredit::latest()->first();
$credit_setting->update($request->all());
return response()->json($credit_setting, 200);
}
public function delete(SettingCredit $credit)
{
$credit->delete();
return response()->json(null, 204);
}
}
@@ -0,0 +1,40 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\SettingMalaysiaBank;
class SettingMalaysiaBankController extends Controller
{
public function index()
{
return SettingMalaysiaBank::all();
}
public function show(SettingMalaysiaBank $malaysiaBank)
{
return $malaysiaBank;
}
public function store(Request $request)
{
$malaysiaBank = SettingMalaysiaBank::create($request->all());
return response()->json($malaysiaBank, 201);
}
public function update(Request $request, SettingMalaysiaBank $malaysiaBank)
{
$malaysiaBank->update($request->all());
return response()->json($malaysiaBank, 200);
}
public function delete(SettingMalaysiaBank $malaysiaBank)
{
$malaysiaBank->delete();
return response()->json(null, 204);
}
}
@@ -0,0 +1,46 @@
<?php
namespace App\Http\Controllers;
use App\SettingSupplier;
use Illuminate\Http\Request;
class SettingSupplierController extends Controller
{
public function index()
{
$suppliers = SettingSupplier::all();
foreach ($suppliers as $supplier) {
$supplier->value = $supplier->id;
$supplier->label = $supplier->company_name;
}
return $suppliers;
}
public function show(SettingSupplier $supplier)
{
return $supplier;
}
public function store(Request $request)
{
$supplier = SettingSupplier::create($request->all());
return response()->json($supplier, 201);
}
public function update(Request $request, SettingSupplier $supplier)
{
$supplier->update($request->all());
return response()->json($supplier, 200);
}
public function delete(SettingSupplier $supplier)
{
$supplier->delete();
return response()->json(null, 204);
}
}
@@ -0,0 +1,25 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\SettingTaxRate;
class SettingTaxRateController extends Controller
{
public function index()
{
$setting_tax = SettingTaxRate::latest()->first();
return response()->json($setting_tax, 201);
}
public function update(Request $request)
{
if($setting_tax = SettingTaxRate::latest()->first())
$setting_tax->update($request->all());
else
$setting_tax = SettingTaxRate::create($request->all());
return response()->json($setting_tax, 200);
}
}
@@ -0,0 +1,26 @@
<?php
namespace App\Http\Controllers\Settings;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
class PasswordController extends Controller
{
/**
* Update the user's password.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function update(Request $request)
{
$this->validate($request, [
'password' => 'required|confirmed|min:6',
]);
$request->user()->update([
'password' => bcrypt($request->password),
]);
}
}
@@ -0,0 +1,27 @@
<?php
namespace App\Http\Controllers\Settings;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
class ProfileController extends Controller
{
/**
* Update the user's profile information.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function update(Request $request)
{
$user = $request->user();
$this->validate($request, [
'name' => 'required',
'email' => 'required|email|unique:users,email,'.$user->id,
]);
return tap($user)->update($request->only('name', 'email'));
}
}
+24
View File
@@ -0,0 +1,24 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Auth;
class UserController extends Controller
{
/**
* Display the specified resource.
*
* @param \App\ChinaBankSlip $chinaBankSlip
* @return \Illuminate\Http\Response
*/
public function show(Request $request)
{
$user = Auth::user();
return $user;
}
}
@@ -0,0 +1,21 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class WelcomeController extends Controller
{
/**
* Display the specified resource.
*
* @param \App\ChinaBankSlip $chinaBankSlip
* @return \Illuminate\Http\Response
*/
public function index()
{
return view('index');
}
}
+67
View File
@@ -0,0 +1,67 @@
<?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 = [
\Illuminate\Foundation\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\SetLocale::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,
],
'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' => \Illuminate\Auth\Middleware\Authenticate::class,
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class,
'can' => \Illuminate\Auth\Middleware\Authorize::class,
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
'ability' => 'App\Http\Middleware\TokenEntrustAbility',
'role' => \Zizaco\Entrust\Middleware\EntrustRole::class,
'permission' => \Zizaco\Entrust\Middleware\EntrustPermission::class,
'jwt' => \App\Http\Middleware\RefreshToken::class,
'ability' => 'App\Http\Middleware\TokenEntrustAbility'
];
}
+17
View File
@@ -0,0 +1,17 @@
<?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 = [
//
];
}
@@ -0,0 +1,26 @@
<?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 response()->json(['error' => 'Already authenticated.'], 400);
}
return $next($request);
}
}
+49
View File
@@ -0,0 +1,49 @@
<?php
namespace App\Http\Middleware;
use Closure;
class SetLocale
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if ($locale = $this->parseLocale($request)) {
app()->setLocale($locale);
}
return $next($request);
}
/**
* @param \Illuminate\Http\Request $request
* @return string|null
*/
protected function parseLocale($request)
{
$locales = config('app.locales');
$locale = $request->server('HTTP_ACCEPT_LANGUAGE');
$locale = substr($locale, 0, strpos($locale, ',') ?: strlen($locale));
if (array_key_exists($locale, $locales)) {
return $locale;
}
if (array_key_exists($locale, $locales)) {
return $locale;
}
$locale = substr($locale, 0, 2);
if (array_key_exists($locale, $locales)) {
return $locale;
}
}
}
@@ -0,0 +1,39 @@
<?php
namespace App\Http\Middleware;
use Closure;
use Tymon\JWTAuth\Exceptions\JWTException;
use Tymon\JWTAuth\Exceptions\TokenExpiredException;
use Tymon\JWTAuth\Http\Middleware\BaseMiddleware;
class TokenEntrustAbility extends BaseMiddleware
{
public function handle($request, Closure $next, $roles, $permissions, $validateAll = false)
{
if (! $token = $this->auth->setRequest($request)->getToken()) {
return $this->respond('tymon.jwt.absent', 'token_not_provided', 400);
}
try {
$user = $this->auth->authenticate($token);
} catch (TokenExpiredException $e) {
return $this->respond('tymon.jwt.expired', 'token_expired', $e->getStatusCode(), [$e]);
} catch (JWTException $e) {
return $this->respond('tymon.jwt.invalid', 'token_invalid', $e->getStatusCode(), [$e]);
}
if (! $user) {
return $this->respond('tymon.jwt.user_not_found', 'user_not_found', 404);
}
if (!$request->user()->ability(explode('|', $roles), explode('|', $permissions), array('validate_all' => $validateAll))) {
return $this->respond('tymon.jwt.invalid', 'token_invalid', 401, 'Unauthorized');
}
$this->events->fire('tymon.jwt.valid', $user);
return $next($request);
}
}
+18
View File
@@ -0,0 +1,18 @@
<?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',
];
}
+23
View File
@@ -0,0 +1,23 @@
<?php
namespace App\Http\Middleware;
use Illuminate\Http\Request;
use Fideloper\Proxy\TrustProxies as Middleware;
class TrustProxies extends Middleware
{
/**
* The trusted proxies for this application.
*
* @var array
*/
protected $proxies;
/**
* The current proxy header mappings.
*
* @var array
*/
protected $headers = Request::HEADER_X_FORWARDED_ALL;
}
+17
View File
@@ -0,0 +1,17 @@
<?php
namespace App\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware;
class VerifyCsrfToken extends Middleware
{
/**
* The URIs that should be excluded from CSRF verification.
*
* @var array
*/
protected $except = [
//
];
}
+14
View File
@@ -0,0 +1,14 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Invoice extends Model
{
protected $fillable = ['invoice_url','amount','booking_id'];
public function booking(){
return $this->hasOne('App\Booking');
}
}
+15
View File
@@ -0,0 +1,15 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Marking extends Model
{
protected $fillable = ['email','marking'];
public function user()
{
return $this->belongsTo('app\User');
}
}
+77
View File
@@ -0,0 +1,77 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Notification extends Model
{
protected $fillable = ['detail','user_id','is_read'];
protected $appends = ['time_interval'];
public function getTimeIntervalAttribute()
{
$created_time = $this->created_at;
date_default_timezone_set('Asia/Kuala_Lumpur'); //Change as per your default time
$str = strtotime($created_time);
$today = strtotime(date('Y-m-d H:i:s'));
// It returns the time difference in Seconds...
$time_differnce = $today-$str;
// To Calculate the time difference in Years...
$years = 60*60*24*365;
// To Calculate the time difference in Months...
$months = 60*60*24*30;
// To Calculate the time difference in Days...
$days = 60*60*24;
// To Calculate the time difference in Hours...
$hours = 60*60;
// To Calculate the time difference in Minutes...
$minutes = 60;
if(intval($time_differnce/$years) > 1)
{
return intval($time_differnce/$years)." years ago";
}else if(intval($time_differnce/$years) > 0)
{
return intval($time_differnce/$years)." year ago";
}else if(intval($time_differnce/$months) > 1)
{
return intval($time_differnce/$months)." months ago";
}else if(intval(($time_differnce/$months)) > 0)
{
return intval(($time_differnce/$months))." month ago";
}else if(intval(($time_differnce/$days)) > 1)
{
return intval(($time_differnce/$days))." days ago";
}else if (intval(($time_differnce/$days)) > 0)
{
return intval(($time_differnce/$days))." day ago";
}else if (intval(($time_differnce/$hours)) > 1)
{
return intval(($time_differnce/$hours))." hours ago";
}else if (intval(($time_differnce/$hours)) > 0)
{
return intval(($time_differnce/$hours))." hour ago";
}else if (intval(($time_differnce/$minutes)) > 1)
{
return intval(($time_differnce/$minutes))." minutes ago";
}else if (intval(($time_differnce/$minutes)) > 0)
{
return intval(($time_differnce/$minutes))." minute ago";
}else if (intval(($time_differnce)) > 1)
{
return intval(($time_differnce))." seconds ago";
}else
{
return "few seconds ago";
}
}
}
+23
View File
@@ -0,0 +1,23 @@
<?php
namespace App\Notifications;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Auth\Notifications\ResetPassword as Notification;
class ResetPassword extends Notification
{
/**
* Build the mail representation of the notification.
*
* @param mixed $notifiable
* @return \Illuminate\Notifications\Messages\MailMessage
*/
public function toMail($notifiable)
{
return (new MailMessage)
->line('You are receiving this email because we received a password reset request for your account.')
->action('Reset Password', url(config('app.url').'/password/reset/'.$this->token).'?email='.urlencode($notifiable->email))
->line('If you did not request a password reset, no further action is required.');
}
}
+39
View File
@@ -0,0 +1,39 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class OAuthProvider extends Model
{
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'oauth_providers';
/**
* The attributes that aren't mass assignable.
*
* @var array
*/
protected $guarded = ['id'];
/**
* The attributes that should be hidden for arrays.
*
* @var array
*/
protected $hidden = [
'access_token', 'refresh_token',
];
/**
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function user()
{
return $this->belongsTo(User::class);
}
}
+21
View File
@@ -0,0 +1,21 @@
<?php
namespace App\Observers;
use App\Rate;
use App\User;
use App\Events\RateUpdated;
class RateObserver
{
/**
* Handle the rate "created" event.
*
* @param \App\Rate $rate
* @return void
*/
public function created(Rate $rate)
{
event(new RateUpdated($rate));
}
}
+7
View File
@@ -0,0 +1,7 @@
<?php namespace App;
use Zizaco\Entrust\EntrustPermission;
class Permission extends EntrustPermission
{
}
+41
View File
@@ -0,0 +1,41 @@
<?php
namespace App\Providers;
use Laravel\Dusk\DuskServiceProvider;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\ServiceProvider;
use App\Observers\RateObserver;
use App\Rate;
class AppServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
/*
if ($this->app->runningUnitTests()) {
Schema::defaultStringLength(191);
}
*/
Rate::observe(RateObserver::class);
Schema::defaultStringLength(191);
}
/**
* Register any application services.
*
* @return void
*/
public function register()
{
if ($this->app->environment('local', 'testing')) {
$this->app->register(DuskServiceProvider::class);
}
}
}
+29
View File
@@ -0,0 +1,29 @@
<?php
namespace App\Providers;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
class AuthServiceProvider extends ServiceProvider
{
/**
* 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();
//
}
}
@@ -0,0 +1,22 @@
<?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();
Broadcast::routes(["middleware" => ["auth:api"]]);
require base_path('routes/channels.php');
}
}
+32
View File
@@ -0,0 +1,32 @@
<?php
namespace App\Providers;
use Illuminate\Support\Facades\Event;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
class EventServiceProvider extends ServiceProvider
{
/**
* The event listener mappings for the application.
*
* @var array
*/
protected $listen = [
'App\Events\Event' => [
'App\Listeners\EventListener',
],
];
/**
* Register any events for your application.
*
* @return void
*/
public function boot()
{
parent::boot();
//
}
}
+73
View File
@@ -0,0 +1,73 @@
<?php
namespace App\Providers;
use Illuminate\Support\Facades\Route;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
class RouteServiceProvider extends ServiceProvider
{
/**
* This namespace is applied to your controller routes.
*
* In addition, it is set as the URL generator's root namespace.
*
* @var string
*/
protected $namespace = 'App\Http\Controllers';
/**
* Define your route model bindings, pattern filters, etc.
*
* @return void
*/
public function boot()
{
//
parent::boot();
}
/**
* Define the routes for the application.
*
* @return void
*/
public function map()
{
$this->mapApiRoutes();
$this->mapWebRoutes();
//
}
/**
* Define the "web" routes for the application.
*
* These routes all receive session state, CSRF protection, etc.
*
* @return void
*/
protected function mapWebRoutes()
{
Route::middleware('web')
->namespace($this->namespace)
->group(base_path('routes/web.php'));
}
/**
* Define the "api" routes for the application.
*
* These routes are typically stateless.
*
* @return void
*/
protected function mapApiRoutes()
{
Route::prefix('api')
->middleware('api')
->namespace($this->namespace)
->group(base_path('routes/api.php'));
}
}
+15
View File
@@ -0,0 +1,15 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class PurchaseOrder extends Model
{
protected $fillable = ['image_url','amount','booking_id'];
public function booking()
{
return $this->belongsTo(Booking::class);
}
}
+11
View File
@@ -0,0 +1,11 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Rate extends Model
{
protected $fillable = ['x1_cash','x1_cheque','x1_ba','x2_cash','x2_cheque','x2_ba'];
protected $hidden = ['id'];
}
+7
View File
@@ -0,0 +1,7 @@
<?php namespace App;
use Zizaco\Entrust\EntrustRole;
class Role extends EntrustRole
{
}
+10
View File
@@ -0,0 +1,10 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class SettingActiveBank extends Model
{
protected $fillable = ['x1_bank_id','x2_bank_id','beneficiary_id'];
}
+10
View File
@@ -0,0 +1,10 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class SettingBeneficiary extends Model
{
protected $fillable = ['company_name','bank_name','acc_no','bank_address','swift','cnap','bank_branch'];
}
+10
View File
@@ -0,0 +1,10 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class SettingBillingCharge extends Model
{
protected $fillable = ['billing_charge_rate'];
}
+10
View File
@@ -0,0 +1,10 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class SettingCredit extends Model
{
protected $fillable = ['rmb_credit_limit','usd_credit_limit','time_limit'];
}
+10
View File
@@ -0,0 +1,10 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class SettingMalaysiaBank extends Model
{
protected $fillable = ['company_name','bank_name','acc_no','bank_address','swift','cnap','bank_branch'];
}
+10
View File
@@ -0,0 +1,10 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class SettingSupplier extends Model
{
protected $fillable = ['company_name','gst_no','supplier_reg_no','bank_name','acc_no'];
}
+10
View File
@@ -0,0 +1,10 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class SettingTaxRate extends Model
{
protected $fillable = ['tax_rate'];
}
+27
View File
@@ -0,0 +1,27 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class SupplierBooking extends Model
{
// protected $guarded = [];
protected $fillable = ['rate','rebate','payment_amount','payment_method'];
public $timestamps = true;
public function user()
{
return $this->belongsTo('app\User');
}
public function booking(){
return $this->belongTo('App\Booking');
}
public function supplierBookingTtem()
{
return $this->hasMany('App\SupplierBookingItem');
}
}
+25
View File
@@ -0,0 +1,25 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class SupplierBookingItem extends Model
{
protected $fillable = [
'id',
'china_bankslip_url',
'book_id',
'bank_in_amount',
'date',
'details',
'supplierbooking_id'
];
public function bookingsupplier()
{
return $this->belongsTo('App\BookingSupplier');
}
}
+109
View File
@@ -0,0 +1,109 @@
<?php
namespace App;
use Tymon\JWTAuth\Contracts\JWTSubject;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
use App\Notifications\ResetPassword as ResetPasswordNotification;
use Zizaco\Entrust\Traits\EntrustUserTrait;
class User extends Authenticatable implements JWTSubject
{
use Notifiable;
use EntrustUserTrait;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'name', 'email', 'password',
];
/**
* The attributes that should be hidden for arrays.
*
* @var array
*/
protected $hidden = [
'password', 'remember_token'
];
/**
* The accessors to append to the model's array form.
*
* @var array
*/
protected $appends = [
'photo_url', 'role'
];
/**
* Get the profile photo URL attribute.
*
* @return string
*/
public function getPhotoUrlAttribute()
{
return 'https://www.gravatar.com/avatar/'.md5(strtolower($this->email)).'.jpg?s=200&d=mm';
}
/**
* Get the role attribute.
*
* @return string
*/
public function getRoleAttribute()
{
return $this->roles->first()->name;
}
/**
* Get the oauth providers.
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function oauthProviders()
{
return $this->hasMany(OAuthProvider::class);
}
/**
* Send the password reset notification.
*
* @param string $token
* @return void
*/
public function sendPasswordResetNotification($token)
{
$this->notify(new ResetPasswordNotification($token));
}
/**
* @return int
*/
public function getJWTIdentifier()
{
return $this->getKey();
}
/**
* @return array
*/
public function getJWTCustomClaims()
{
return [];
}
public function bookings(){
return $this->hasMany(Booking::class);
}
public function marking(){
return $this->hasOne(Booking::class);
}
}
+15
View File
@@ -0,0 +1,15 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class UserBankSlip extends Model
{
protected $fillable = ['bank_slip_type','bankslip_url','transfer_amount','booking_id','cust_marking'];
public function booking()
{
return $this->belongsTo(Booking::class);
}
}
+53
View File
@@ -0,0 +1,53 @@
#!/usr/bin/env php
<?php
define('LARAVEL_START', microtime(true));
/*
|--------------------------------------------------------------------------
| 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 our classes "manually". Feels great to relax.
|
*/
require __DIR__.'/vendor/autoload.php';
$app = require_once __DIR__.'/bootstrap/app.php';
/*
|--------------------------------------------------------------------------
| 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);
+55
View File
@@ -0,0 +1,55 @@
<?php
/*
|--------------------------------------------------------------------------
| Create The Application
|--------------------------------------------------------------------------
|
| 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(
realpath(__DIR__.'/../')
);
/*
|--------------------------------------------------------------------------
| Bind Important Interfaces
|--------------------------------------------------------------------------
|
| 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
| 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;
+2
View File
@@ -0,0 +1,2 @@
*
!.gitignore
+35
View File
@@ -0,0 +1,35 @@
# Save latest Git commit message
MESSAGE=$(git log -1 --pretty=%B)
# Add it as a secret variable on CI environment
git remote set-url origin $REMOTE_REPOSITORY
git config user.email $DEPLOY_GIT_EMAIL
git config user.name $DEPLOY_GIT_USERNAME
if git ls-remote $REMOTE_REPOSITORY | grep -sw "deploy" 2>&1>/dev/null; then
git checkout . && git checkout deploy;
else
git checkout --orphan deploy;
fi
# Remove all files except .git, node_modules and vendor folder
find . -path ./.git -prune -o \( \! -path ./dist \) -prune -o \( \! -path ./vendor \) -exec rm -rf {} \; 2> /dev/null
# Add master branch files
git archive master | tar x -C .
# Generate i18n string for the front-end
composer install -n --prefer-dist
php artisan vue-i18n:generate
# Compile front-end stuff
yarn --pure-lockfile
yarn production
# Those files are ignored on master branch, force add it
git add -f public/css
git add -f public/js
# Push to the deploy branch
git add .
git commit -am "[${CI_COMMIT_SHA:0:8}]: $MESSAGE"
git push -u origin deploy
+35
View File
@@ -0,0 +1,35 @@
https://exchange-staging.izyim.com {
root /var/www/public
fastcgi / 127.0.0.1:9000 php {
index index.php
}
header / {
Cache-Control no-cache
}
# To handle .html extensions with laravel change ext to
# ext / .html
rewrite {
r .*
ext /
to /index.php?{query}
}
gzip
# browse
log stdout
errors stdout
on startup php-fpm --nodaemonize
# Uncomment to enable TLS (HTTPS)
# Change the first list to listen on port 443 when enabling TLS
tls admin@izyim.com
# To use Lets encrpt tls with a DNS provider uncomment these
# lines and change the provider as required
#tls {
# dns cloudflare
#}
}
+20
View File
@@ -0,0 +1,20 @@
FROM php:7.1-fpm
LABEL maintainer="Paul Redmond <paul@bitpress.io>"
# Install application dependencies
RUN curl --silent --show-error --fail --location \
--header "Accept: application/tar+gzip, application/x-gzip, application/octet-stream" -o - \
"https://caddyserver.com/download/linux/amd64?plugins=http.expires,http.realip&license=personal" \
| tar --no-same-owner -C /usr/bin/ -xz caddy \
&& chmod 0755 /usr/bin/caddy \
&& /usr/bin/caddy -version \
&& docker-php-ext-install mbstring pdo pdo_mysql
COPY Caddyfile /etc/Caddyfile
WORKDIR /var/www
RUN mkdir -p /var/www/public/storage
RUN ln -sf /var/www/storage/app/public /var/www/public/storage
RUN chmod -R 777 storage/
CMD ["/usr/bin/caddy", "--conf", "/etc/Caddyfile", "--log", "stdout"]
+67
View File
@@ -0,0 +1,67 @@
{
"name": "IZYIM Exchange",
"description": "A currency exchange system.",
"keywords": ["exchange", "izyim", "vue"],
"license": "MIT",
"type": "project",
"require": {
"php": "^7.1.3",
"doctrine/dbal": "^2.7",
"fideloper/proxy": "^4.0",
"intervention/image": "^2.4",
"laravel/framework": "5.6.*",
"laravel/socialite": "^3.0",
"laravel/tinker": "~1.0",
"laravelcollective/html": "^5.6",
"pusher/pusher-php-server": "~3.0",
"tymon/jwt-auth": "^1.0.0-rc.2",
"zizaco/entrust": "dev-master"
},
"require-dev": {
"filp/whoops": "^2.0",
"fzaninotto/faker": "^1.4",
"laravel/dusk": "^3.0",
"mockery/mockery": "^1.0",
"nunomaduro/collision": "^2.0",
"phpunit/phpunit": "^7.0"
},
"autoload": {
"classmap": [
"database/seeds",
"database/factories"
],
"psr-4": {
"App\\": "app/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"extra": {
"laravel": {
"dont-discover": [
"laravel/dusk"
]
}
},
"scripts": {
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"@php artisan package:discover"
],
"post-create-project-cmd": [
"@php artisan key:generate",
"@php artisan jwt:secret --force"
]
},
"config": {
"preferred-install": "dist",
"sort-packages": true,
"optimize-autoloader": true
}
}
+228
View File
@@ -0,0 +1,228 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Application Name
|--------------------------------------------------------------------------
|
| This value is the name of your application. This value is used when the
| framework needs to place the application's name in a notification or
| any other location as required by the application or its packages.
|
*/
'name' => env('APP_NAME', 'Exchange'),
/*
|--------------------------------------------------------------------------
| Application Environment
|--------------------------------------------------------------------------
|
| This value determines the "environment" your application is currently
| running in. This may determine how you prefer to configure various
| services your application utilizes. Set this in your ".env" file.
|
*/
'env' => env('APP_ENV', 'production'),
/*
|--------------------------------------------------------------------------
| Application Debug Mode
|--------------------------------------------------------------------------
|
| When your application is in debug mode, detailed error messages with
| stack traces will be shown on every error that occurs within your
| application. If disabled, a simple generic error page is shown.
|
*/
'debug' => env('APP_DEBUG', false),
/*
|--------------------------------------------------------------------------
| Application URL
|--------------------------------------------------------------------------
|
| 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
| your application so that it is used when running Artisan tasks.
|
*/
'url' => env('APP_URL', 'http://localhost'),
/*
|--------------------------------------------------------------------------
| Application Timezone
|--------------------------------------------------------------------------
|
| 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
| ahead and set this to a sensible default for you out of the box.
|
*/
'timezone' => 'Asia/Kuala_Lumpur',
/*
|--------------------------------------------------------------------------
| Application Locale Configuration
|--------------------------------------------------------------------------
|
| The application locale determines the default locale that will be used
| by the translation service provider. You are free to set this value
| to any of the locales which will be supported by the application.
|
*/
'locale' => 'en',
'locales' => [
'en' => 'EN',
'zh-CN' => '中文',
'es' => 'ES',
],
/*
|--------------------------------------------------------------------------
| 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',
/*
|--------------------------------------------------------------------------
| Encryption Key
|--------------------------------------------------------------------------
|
| This key is used by the Illuminate encrypter service and should be set
| to a random, 32 character string, otherwise these encrypted strings
| will not be safe. Please do this before deploying an application!
|
*/
'key' => env('APP_KEY'),
'cipher' => 'AES-256-CBC',
/*
|--------------------------------------------------------------------------
| 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' => [
/*
* 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,
Collective\Html\HtmlServiceProvider::class,
/*
* Package Service Providers...
*/
Zizaco\Entrust\EntrustServiceProvider::class,
/*
* Application Service Providers...
*/
App\Providers\AppServiceProvider::class,
App\Providers\AuthServiceProvider::class,
App\Providers\BroadcastServiceProvider::class,
App\Providers\EventServiceProvider::class,
App\Providers\RouteServiceProvider::class,
Tymon\JWTAuth\Providers\LaravelServiceProvider::class
],
/*
|--------------------------------------------------------------------------
| Class Aliases
|--------------------------------------------------------------------------
|
| This array of class aliases will be registered when this application
| is started. However, feel free to register as many as you wish as
| the aliases are "lazy" loaded so they don't hinder performance.
|
*/
'aliases' => [
'App' => Illuminate\Support\Facades\App::class,
'Artisan' => Illuminate\Support\Facades\Artisan::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,
'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,
'Hash' => Illuminate\Support\Facades\Hash::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,
'Queue' => Illuminate\Support\Facades\Queue::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,
'URL' => Illuminate\Support\Facades\URL::class,
'Validator' => Illuminate\Support\Facades\Validator::class,
'View' => Illuminate\Support\Facades\View::class,
'Html' => Collective\Html\HtmlFacade::class,
'Entrust' => Zizaco\Entrust\EntrustFacade::class,
'JWTAuth' => Tymon\JWTAuth\Facades\JWTAuth::class,
'JWTFactory' => Tymon\JWTAuth\Facades\JWTFactory::class,
],
];
+103
View File
@@ -0,0 +1,103 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Authentication Defaults
|--------------------------------------------------------------------------
|
| This option controls the default authentication "guard" and password
| reset options for your application. You may change these defaults
| as required, but they're a perfect start for most applications.
|
*/
'defaults' => [
'guard' => 'api',
'passwords' => 'users',
],
/*
|--------------------------------------------------------------------------
| Authentication Guards
|--------------------------------------------------------------------------
|
| Next, you may define every authentication guard for your application.
| Of course, a great default configuration has been defined for you
| here which uses session storage and the Eloquent user provider.
|
| All authentication drivers have a user provider. This defines how the
| users are actually retrieved out of your database or other storage
| mechanisms used by this application to persist your user's data.
|
| Supported: "session", "token"
|
*/
'guards' => [
'web' => [
'driver' => 'session',
'provider' => 'users',
],
'api' => [
'driver' => 'jwt',
'provider' => 'users',
],
],
/*
|--------------------------------------------------------------------------
| User Providers
|--------------------------------------------------------------------------
|
| All authentication drivers have a user provider. This defines how the
| users are actually retrieved out of your database or other storage
| mechanisms used by this application to persist your user's data.
|
| If you have multiple user tables or models you may configure multiple
| sources which represent each model / table. These sources may then
| be assigned to any extra authentication guards you have defined.
|
| Supported: "database", "eloquent"
|
*/
'providers' => [
'users' => [
'driver' => 'eloquent',
'model' => App\User::class,
'table' => 'users',
],
// 'users' => [
// 'driver' => 'database',
// 'table' => 'users',
// ],
],
/*
|--------------------------------------------------------------------------
| Resetting Passwords
|--------------------------------------------------------------------------
|
| You may specify multiple password reset configurations if you have more
| than one user table or model in the application and you want to have
| separate password reset settings based on the specific user types.
|
| The expire time is the number of minutes that the reset token should be
| considered valid. This security feature keeps tokens short-lived so
| they have less time to be guessed. You may change this as needed.
|
*/
'passwords' => [
'users' => [
'provider' => 'users',
'table' => 'password_resets',
'expire' => 3000,
],
],
];
+59
View File
@@ -0,0 +1,59 @@
<?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'),
'encrypted' => true,
],
],
'redis' => [
'driver' => 'redis',
'connection' => 'default',
],
'log' => [
'driver' => 'log',
],
'null' => [
'driver' => 'null',
],
],
];
+91
View File
@@ -0,0 +1,91 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Cache Store
|--------------------------------------------------------------------------
|
| This option controls the default cache connection that gets used while
| using this caching library. This connection is used when another is
| not explicitly specified when executing a given caching function.
|
| Supported: "apc", "array", "database", "file", "memcached", "redis"
|
*/
'default' => env('CACHE_DRIVER', 'file'),
/*
|--------------------------------------------------------------------------
| Cache Stores
|--------------------------------------------------------------------------
|
| Here you may define all of the cache "stores" for your application as
| well as their drivers. You may even define multiple stores for the
| same cache driver to group types of items stored in your caches.
|
*/
'stores' => [
'apc' => [
'driver' => 'apc',
],
'array' => [
'driver' => 'array',
],
'database' => [
'driver' => 'database',
'table' => 'cache',
'connection' => null,
],
'file' => [
'driver' => 'file',
'path' => storage_path('framework/cache/data'),
],
'memcached' => [
'driver' => 'memcached',
'persistent_id' => env('MEMCACHED_PERSISTENT_ID'),
'sasl' => [
env('MEMCACHED_USERNAME'),
env('MEMCACHED_PASSWORD'),
],
'options' => [
// Memcached::OPT_CONNECT_TIMEOUT => 2000,
],
'servers' => [
[
'host' => env('MEMCACHED_HOST', '127.0.0.1'),
'port' => env('MEMCACHED_PORT', 11211),
'weight' => 100,
],
],
],
'redis' => [
'driver' => 'redis',
'connection' => 'default',
],
],
/*
|--------------------------------------------------------------------------
| Cache Key Prefix
|--------------------------------------------------------------------------
|
| When utilizing a RAM based store such as APC or Memcached, there might
| be other applications utilizing the same cache. So, we'll specify a
| value to get prefixed to all our keys so we can avoid collisions.
|
*/
'prefix' => 'laravel',
];
+135
View File
@@ -0,0 +1,135 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Database Connection Name
|--------------------------------------------------------------------------
|
| Here you may specify which of the database connections below you wish
| to use as your default connection for all database work. Of course
| you may use many connections at once using the Database library.
|
*/
'default' => env('DB_CONNECTION', 'mysql'),
/*
|--------------------------------------------------------------------------
| Database Connections
|--------------------------------------------------------------------------
|
| Here are each of the database connections setup for your application.
| Of course, examples of configuring each database platform that is
| supported by Laravel is shown below to make development simple.
|
|
| 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.
|
*/
'connections' => [
'sqlite' => [
'driver' => 'sqlite',
'database' => env('DB_DATABASE', database_path('database.sqlite')),
'prefix' => '',
],
'mysql' => [
'driver' => 'mysql',
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => '',
'strict' => true,
'engine' => null,
],
'testing' => [
'driver' => 'mysql',
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', '3306'),
'database' => 'phpunit',
'username' => 'default',
'password' => 'secret',
'unix_socket' => env('DB_SOCKET', ''),
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => '',
'strict' => false,
'engine' => null,
],
'pgsql' => [
'driver' => 'pgsql',
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '5432'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'prefix' => '',
'schema' => 'public',
'sslmode' => 'prefer',
],
'sqlsrv' => [
'driver' => 'sqlsrv',
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', '1433'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'prefix' => '',
],
],
/*
|--------------------------------------------------------------------------
| Migration Repository Table
|--------------------------------------------------------------------------
|
| This table keeps track of all the migrations that have already run for
| your application. Using this information, we can determine which of
| the migrations on disk haven't actually been run in the database.
|
*/
'migrations' => 'migrations',
/*
|--------------------------------------------------------------------------
| Redis Databases
|--------------------------------------------------------------------------
|
| Redis is an open source, fast, and advanced key-value store that also
| provides a richer set of commands than a typical key-value systems
| such as APC or Memcached. Laravel makes it easy to dig right in.
|
*/
'redis' => [
'client' => 'predis',
'default' => [
'host' => env('REDIS_HOST', '127.0.0.1'),
'password' => env('REDIS_PASSWORD', null),
'port' => env('REDIS_PORT', 6379),
'database' => 0,
],
],
];
+92
View File
@@ -0,0 +1,92 @@
<?php
/**
* This file is part of Entrust,
* a role & permission management solution for Laravel.
*
* @license MIT
* @package Zizaco\Entrust
*/
return [
/*
|--------------------------------------------------------------------------
| Entrust Role Model
|--------------------------------------------------------------------------
|
| This is the Role model used by Entrust to create correct relations. Update
| the role if it is in a different namespace.
|
*/
'role' => 'App\Role',
/*
|--------------------------------------------------------------------------
| Entrust Roles Table
|--------------------------------------------------------------------------
|
| This is the roles table used by Entrust to save roles to the database.
|
*/
'roles_table' => 'roles',
/*
|--------------------------------------------------------------------------
| Entrust Permission Model
|--------------------------------------------------------------------------
|
| This is the Permission model used by Entrust to create correct relations.
| Update the permission if it is in a different namespace.
|
*/
'permission' => 'App\Permission',
/*
|--------------------------------------------------------------------------
| Entrust Permissions Table
|--------------------------------------------------------------------------
|
| This is the permissions table used by Entrust to save permissions to the
| database.
|
*/
'permissions_table' => 'permissions',
/*
|--------------------------------------------------------------------------
| Entrust permission_role Table
|--------------------------------------------------------------------------
|
| This is the permission_role table used by Entrust to save relationship
| between permissions and roles to the database.
|
*/
'permission_role_table' => 'permission_role',
/*
|--------------------------------------------------------------------------
| Entrust role_user Table
|--------------------------------------------------------------------------
|
| This is the role_user table used by Entrust to save assigned roles to the
| database.
|
*/
'role_user_table' => 'role_user',
/*
|--------------------------------------------------------------------------
| User Foreign key on Entrust's role_user Table (Pivot)
|--------------------------------------------------------------------------
*/
'user_foreign_key' => 'user_id',
/*
|--------------------------------------------------------------------------
| Role Foreign key on Entrust's role_user Table (Pivot)
|--------------------------------------------------------------------------
*/
'role_foreign_key' => 'role_id',
];
+68
View File
@@ -0,0 +1,68 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Filesystem Disk
|--------------------------------------------------------------------------
|
| 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
| based disks are available to your application. Just store away!
|
*/
'default' => env('FILESYSTEM_DRIVER', '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
|--------------------------------------------------------------------------
|
| Here you may configure as many filesystem "disks" as you wish, and you
| may even configure multiple disks of the same driver. Defaults have
| been setup for each driver as an example of the required options.
|
| Supported Drivers: "local", "ftp", "s3", "rackspace"
|
*/
'disks' => [
'local' => [
'driver' => 'local',
'root' => storage_path('app'),
],
'public' => [
'driver' => 'local',
'root' => storage_path('app/public'),
'url' => env('APP_URL').'/storage',
'visibility' => 'public',
],
's3' => [
'driver' => 's3',
'key' => env('AWS_KEY'),
'secret' => env('AWS_SECRET'),
'region' => env('AWS_REGION'),
'bucket' => env('AWS_BUCKET'),
],
],
];
+20
View File
@@ -0,0 +1,20 @@
<?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"
|
*/
'driver' => 'bcrypt',
];
+303
View File
@@ -0,0 +1,303 @@
<?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 in your .env file, as it will be used to sign
| your tokens. A helper command is provided for this:
| `php artisan jwt:secret`
|
| Note: This will be used for Symmetric algorithms only (HMAC),
| since RSA and ECDSA use a private/public key combo (See below).
|
*/
'secret' => env('JWT_SECRET'),
/*
|--------------------------------------------------------------------------
| JWT Authentication Keys
|--------------------------------------------------------------------------
|
| The algorithm you are using, will determine whether your tokens are
| signed with a random string (defined in `JWT_SECRET`) or using the
| following public & private keys.
|
| Symmetric Algorithms:
| HS256, HS384 & HS512 will use `JWT_SECRET`.
|
| Asymmetric Algorithms:
| RS256, RS384 & RS512 / ES256, ES384 & ES512 will use the keys below.
|
*/
'keys' => [
/*
|--------------------------------------------------------------------------
| Public Key
|--------------------------------------------------------------------------
|
| A path or resource to your public key.
|
| E.g. 'file://path/to/public/key'
|
*/
'public' => env('JWT_PUBLIC_KEY'),
/*
|--------------------------------------------------------------------------
| Private Key
|--------------------------------------------------------------------------
|
| A path or resource to your private key.
|
| E.g. 'file://path/to/private/key'
|
*/
'private' => env('JWT_PRIVATE_KEY'),
/*
|--------------------------------------------------------------------------
| Passphrase
|--------------------------------------------------------------------------
|
| The passphrase for your private key. Can be null if none set.
|
*/
'passphrase' => env('JWT_PASSPHRASE'),
],
/*
|--------------------------------------------------------------------------
| JWT time to live
|--------------------------------------------------------------------------
|
| Specify the length of time (in minutes) that the token will be valid for.
| Defaults to 1 hour.
|
| You can also set this to null, to yield a never expiring token.
| Some people may want this behaviour for e.g. a mobile app.
| This is not particularly recommended, so make sure you have appropriate
| systems in place to revoke the token if necessary.
|
*/
'ttl' => env('JWT_TTL', 60 * 12),
/*
|--------------------------------------------------------------------------
| 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.
|
| You can also set this to null, to yield an infinite refresh time.
| Some may want this instead of never expiring tokens for e.g. a mobile app.
| This is not particularly recommended, so make sure you have appropriate
| systems in place to revoke the token if necessary.
|
*/
'refresh_ttl' => env('JWT_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/master/src/Namshi/JOSE/Signer/OpenSSL
| for possible values.
|
*/
'algo' => env('JWT_ALGO', 'HS256'),
/*
|--------------------------------------------------------------------------
| 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',
],
/*
|--------------------------------------------------------------------------
| Persistent Claims
|--------------------------------------------------------------------------
|
| Specify the claim keys to be persisted when refreshing a token.
| `sub` and `iat` will automatically be persisted, in
| addition to the these claims.
|
| Note: If a claim does not exist then it will be ignored.
|
*/
'persistent_claims' => [
// 'foo',
// 'bar',
],
/*
|--------------------------------------------------------------------------
| Lock Subject
|--------------------------------------------------------------------------
|
| This will determine whether a `prv` claim is automatically added to
| the token. The purpose of this is to ensure that if you have multiple
| authentication models e.g. `App\User` & `App\OtherPerson`, then we
| should prevent one authentication request from impersonating another,
| if 2 tokens happen to have the same id across the 2 different models.
|
| Under specific circumstances, you may want to disable this behaviour
| e.g. if you only have one authentication model, then you would save
| a little on token size.
|
*/
'lock_subject' => true,
/*
|--------------------------------------------------------------------------
| Leeway
|--------------------------------------------------------------------------
|
| This property gives the jwt timestamp claims some "leeway".
| Meaning that if you have any unavoidable slight clock skew on
| any of your servers then this will afford you some level of cushioning.
|
| This applies to the claims `iat`, `nbf` and `exp`.
|
| Specify in seconds - only if you know you need it.
|
*/
'leeway' => env('JWT_LEEWAY', 0),
/*
|--------------------------------------------------------------------------
| 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),
/*
| -------------------------------------------------------------------------
| Blacklist Grace Period
| -------------------------------------------------------------------------
|
| When multiple concurrent requests are made with the same JWT,
| it is possible that some of them fail, due to token regeneration
| on every request.
|
| Set grace period in seconds to prevent parallel request failure.
|
*/
'blacklist_grace_period' => env('JWT_BLACKLIST_GRACE_PERIOD', 0),
/*
|--------------------------------------------------------------------------
| Cookies encryption
|--------------------------------------------------------------------------
|
| By default Laravel encrypt cookies for security reason.
| If you decide to not decrypt cookies, you will have to configure Laravel
| to not encrypt your cookie token by adding its name into the $except
| array available in the middleware "EncryptCookies" provided by Laravel.
| see https://laravel.com/docs/master/responses#cookies-and-encryption
| for details.
|
| Set it to true if you want to decrypt cookies.
|
*/
'decrypt_cookies' => false,
/*
|--------------------------------------------------------------------------
| Providers
|--------------------------------------------------------------------------
|
| Specify the various providers used throughout the package.
|
*/
'providers' => [
/*
|--------------------------------------------------------------------------
| JWT Provider
|--------------------------------------------------------------------------
|
| Specify the provider that is used to create and decode the tokens.
|
*/
'jwt' => Tymon\JWTAuth\Providers\JWT\Lcobucci::class,
/*
|--------------------------------------------------------------------------
| Authentication Provider
|--------------------------------------------------------------------------
|
| Specify the provider that is used to authenticate users.
|
*/
'auth' => Tymon\JWTAuth\Providers\Auth\Illuminate::class,
/*
|--------------------------------------------------------------------------
| Storage Provider
|--------------------------------------------------------------------------
|
| Specify the provider that is used to store tokens in the blacklist.
|
*/
'storage' => Tymon\JWTAuth\Providers\Storage\Illuminate::class,
],
];
+70
View File
@@ -0,0 +1,70 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Log Channel
|--------------------------------------------------------------------------
|
| This option defines the default log channel that gets used when writing
| messages to the logs. The name specified in this option should match
| one of the channels defined in the "channels" configuration array.
|
*/
'default' => env('LOG_CHANNEL', 'stack'),
/*
|--------------------------------------------------------------------------
| Log Channels
|--------------------------------------------------------------------------
|
| Here you may configure the log channels for your application. Out of
| the box, Laravel uses the Monolog PHP logging library. This gives
| you a variety of powerful log handlers / formatters to utilize.
|
| Available Drivers: "single", "daily", "slack", "syslog",
| "errorlog", "custom", "stack"
|
*/
'channels' => [
'stack' => [
'driver' => 'stack',
'channels' => ['single'],
],
'single' => [
'driver' => 'single',
'path' => storage_path('logs/laravel.log'),
'level' => 'debug',
],
'daily' => [
'driver' => 'daily',
'path' => storage_path('logs/laravel.log'),
'level' => 'debug',
'days' => 7,
],
'slack' => [
'driver' => 'slack',
'url' => env('LOG_SLACK_WEBHOOK_URL'),
'username' => 'Laravel Log',
'emoji' => ':boom:',
'level' => 'critical',
],
'syslog' => [
'driver' => 'syslog',
'level' => 'debug',
],
'errorlog' => [
'driver' => 'errorlog',
'level' => 'debug',
],
],
];
+123
View File
@@ -0,0 +1,123 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Mail Driver
|--------------------------------------------------------------------------
|
| Laravel supports both SMTP and PHP's "mail" function as drivers for the
| sending of e-mail. You may specify which one you're using throughout
| your application here. By default, Laravel is setup for SMTP mail.
|
| Supported: "smtp", "sendmail", "mailgun", "mandrill", "ses",
| "sparkpost", "log", "array"
|
*/
'driver' => env('MAIL_DRIVER', 'smtp'),
/*
|--------------------------------------------------------------------------
| SMTP Host Address
|--------------------------------------------------------------------------
|
| Here you may provide the host address of the SMTP server used by your
| applications. A default option is provided that is compatible with
| the Mailgun mail service which will provide reliable deliveries.
|
*/
'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
/*
|--------------------------------------------------------------------------
| SMTP Host Port
|--------------------------------------------------------------------------
|
| This is the SMTP port used by your application to deliver e-mails to
| users of the application. Like the host we have set this value to
| stay compatible with the Mailgun e-mail application by default.
|
*/
'port' => env('MAIL_PORT', 587),
/*
|--------------------------------------------------------------------------
| Global "From" Address
|--------------------------------------------------------------------------
|
| You may wish for all e-mails sent by your application to be sent from
| 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.
|
*/
'from' => [
'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'),
'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 -bs',
/*
|--------------------------------------------------------------------------
| 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'),
],
],
];

Some files were not shown because too many files have changed in this diff Show More