diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..5657f6e --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +vendor \ No newline at end of file diff --git a/.gitignore b/.gitignore index 67c0aea..e283f19 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ /.idea /.vscode /.vagrant +/data Homestead.json Homestead.yaml npm-debug.log diff --git a/Dockerfile b/Dockerfile index 4c4eaed..4e1d56e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,5 @@ FROM php:7 +<<<<<<< HEAD WORKDIR /app COPY . /app @@ -8,4 +9,14 @@ RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local RUN docker-php-ext-install pdo pdo_mysql RUN composer install CMD php artisan serve --host=0.0.0.0 --port=8000 -EXPOSE 8000 \ No newline at end of file +EXPOSE 8000 +======= +RUN apt-get update -y && apt-get install -y openssl zip unzip git netcat +RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer +RUN docker-php-ext-install pdo pdo_mysql +WORKDIR /app +COPY . /app +RUN composer update +ADD start.sh /start.sh +CMD ["/start.sh"] +>>>>>>> 47c12e5e97af74f362bd15035d51420c4d9dd4ae diff --git a/app/Company.php b/app/Company.php index af4bf8d..0257c46 100644 --- a/app/Company.php +++ b/app/Company.php @@ -9,4 +9,13 @@ class Company extends Model // protected $fillable = ['company_profile', 'reg_cert', 'company_name', 'registration_no', 'tax_no', 'tel_no', 'fax', 'address', 'city', 'postcode', 'state', 'country', 'contact_person']; //protected $guarded = []; + + + public function Contact() + + { + + return $this->hasMany(Contact::class); + + } } diff --git a/app/Contact.php b/app/Contact.php index 302d52c..43e73f2 100644 --- a/app/Contact.php +++ b/app/Contact.php @@ -6,5 +6,25 @@ use Illuminate\Database\Eloquent\Model; class Contact extends Model { - protected $fillable = ['user_id','company_id']; + protected $fillable = ['company_id']; + + + + public function User() + + { + + return $this->belongsTo(User::class); + + } + public function Company() + + { + + return $this->belongsTo(Company::class); + + } + + + } diff --git a/app/Http/Controllers/AuthController.php b/app/Http/Controllers/AuthController.php index b355764..6ab2d0e 100644 --- a/app/Http/Controllers/AuthController.php +++ b/app/Http/Controllers/AuthController.php @@ -2,47 +2,133 @@ namespace App\Http\Controllers; use Illuminate\Http\Request; use App\User; +use App\UserVerification; +use App\PasswordResets; use JWTAuth; +use Auth; +use Aloha\Twilio\Twilio; use Tymon\JWTAuth\Exceptions\JWTException; use Validator, DB, Hash, Mail, Illuminate\Support\Facades\Password; +use Illuminate\Auth\Passwords\TokenRepositoryInterface; +use Illuminate\Contracts\Hashing\Hasher as HasherContract; class AuthController extends Controller { + protected $hasher; + public function __construct(HasherContract $hasher) + { + $this->hasher = $hasher; + } + /** + * API Send verification code + * + * @param Request $request + * @return \Illuminate\Http\JsonResponse + */ + public function sendVerification(Request $request){ + $credentials = $request->only('phone'); + $rules = [ + 'phone' => 'required|digits:10|unique:users' + ]; + $validator = Validator::make($credentials, $rules); + + // create user if not exist + $user = User::firstOrNew([ + 'phone' => $request->phone + ]); + $user->save(); + + // create token if not exist, update if exist + $token = mt_rand(0000,9999); + $user_verification = $user->phoneVerification()->firstOrNew([ + 'user_id' => $user->id, + ]); + $user_verification->token = $token; + $user_verification->save(); + + // send token to phone + // ** switching to nexmo ** + //$message = "IZYIM verification code : ". $token; + //$twilio = new Twilio(env('TWILIO_ACC'), env('TWILIO_TOKEN'), env('TWILIO_NUMBER')); + //$twilio->message($request->phone, $message); + return response()->json(['success'=> true, 'message'=> 'A verification code has been send to your mobile number.' ]); + + } + + /** + * API Verify User + * + * @param Request $request + * @return \Illuminate\Http\JsonResponse + */ + public function verifyUser(Request $request) + { + $credentials = $request->only('phone', 'token'); + + // check if user already verified + $check_user = User::where('phone', $request->phone)->first(); + if(!is_null($check_user)){ + if($check_user->is_verified == 1){ + return response()->json([ + 'success'=> true, + 'message'=> 'Account already verified.' + ]); + } + } + else{ + return response()->json([ + 'success'=> false, + 'message'=> 'Please contact support.' + ]); + } + + // check and verify valid token + $check_token = $check_user->phoneVerification()->where('token', $request->token)->first(); + if(!is_null($check_token)){ + $check_user->is_verified = 1; + $check_user->save(); + $check_token->delete(); + + if (!$userToken=JWTAuth::fromUser($check_user)) { + return response()->json(['error' => 'invalid_credentials'], 401); + } + // all good so return the token + return response()->json(['success' => true, 'data'=> [ 'token' => $userToken ]]); + } + return response()->json(['success'=> false, 'error'=> "Verification code is invalid."]); + } + /** * API Register * * @param Request $request * @return \Illuminate\Http\JsonResponse */ - public function register(Request $request) + public function updateUser(Request $request) { - $credentials = $request->only('name', 'email', 'password'); + $credentials = $request->only('role', 'name', 'password', 'password_confirmation'); $rules = [ 'name' => 'required|max:255', - 'email' => 'required|email|max:255|unique:users' + 'role' => 'required', + 'password' => 'required|confirmed|min:6' ]; + $validator = Validator::make($credentials, $rules); if($validator->fails()) { return response()->json(['success'=> false, 'error'=> $validator->messages()]); } + $name = $request->name; - $email = $request->email; $password = $request->password; - $user = User::create(['name' => $name, 'email' => $email, 'password' => Hash::make($password)]); - $verification_code = str_random(30); //Generate verification code - DB::table('user_verifications')->insert(['user_id'=>$user->id,'token'=>$verification_code]); - $subject = "Please verify your email address."; - Mail::send('email.verify', ['name' => $name, 'verification_code' => $verification_code], - function($mail) use ($email, $name, $subject){ - $mail->from(getenv('FROM_EMAIL_ADDRESS'), "From User/Company Name Goes Here"); - $mail->to($email, $name); - $mail->subject($subject); - }); - return response()->json(['success'=> true, 'message'=> 'Thanks for signing up! Please check your email to complete your registration.']); + $user = Auth::user(); + $user->update(['name' => $name, 'password' => Hash::make($password)]); + + return response()->json(['success'=> true, 'message'=> 'Profile updated.']); } + /** * API Login, on success return JWT Auth token * @@ -51,10 +137,10 @@ class AuthController extends Controller */ public function login(Request $request) { - $credentials = $request->only('email', 'password'); + $credentials = $request->only('phone', 'password'); $rules = [ - 'email' => 'required|email', + 'phone' => 'required|digits:11', 'password' => 'required', ]; $validator = Validator::make($credentials, $rules); @@ -104,50 +190,76 @@ class AuthController extends Controller */ public function recover(Request $request) { - $user = User::where('email', $request->email)->first(); - if (!$user) { - $error_message = "Your email address was not found."; - return response()->json(['success' => false, 'error' => ['email'=> $error_message]], 401); + + $credentials = $request->only('phone'); + + $rules = [ + 'phone'=> 'required', + ]; + + $validator = Validator::make($credentials, $rules); + if($validator->fails()) { + return response()->json(['success'=> false, 'error'=> $validator->messages()]); } - try { - Password::sendResetLink($request->only('email'), function (Message $message) { - $message->subject('Your Password Reset Link'); - }); - } catch (\Exception $e) { - //Return with error - $error_message = $e->getMessage(); - return response()->json(['success' => false, 'error' => $error_message], 401); + + $user = User::where('phone', $request->phone)->first(); + + if ($user){ + $token = str_random(64); + DB::table(config('auth.passwords.users.table'))->insert([ + 'phone' => $user->phone, + 'token' => $token + ]); + return response()->json([ + 'success' => true, 'data'=> ['message'=> 'A reset link has been send to your mobile phone.'] + ]); } + + /* + todo + + send SMS + */ + return response()->json([ - 'success' => true, 'data'=> ['message'=> 'A reset email has been sent! Please check your email.'] + 'success' => false, 'data'=> ['message'=> 'Fail to recover your account.'] ]); } /** - * API Verify User + * Reset the given user's password. * - * @param Request $request - * @return \Illuminate\Http\JsonResponse + * @param \Illuminate\Http\Request $request + * @return \Illuminate\Http\Response */ - public function verifyUser($verification_code) + public function reset(Request $request) { - $check = DB::table('user_verifications')->where('token',$verification_code)->first(); - if(!is_null($check)){ - $user = User::find($check->user_id); - if($user->is_verified == 1){ - return response()->json([ - 'success'=> true, - 'message'=> 'Account already verified..' - ]); - } - $user->update(['is_verified' => 1]); - DB::table('user_verifications')->where('token',$verification_code)->delete(); + + $credentials = $request->only('token', 'password', 'password_confirmation'); + + $rules = [ + 'token' => 'required', + 'password' => 'required|confirmed|min:6' + ]; + + $validator = Validator::make($credentials, $rules); + if($validator->fails()) { + return response()->json(['success'=> false, 'error'=> $validator->messages()]); + } + $token = $request->get('token'); + $password = $request->get('password'); + $reset = PasswordResets::where('token', $token)->first(); + if($reset) { + $user = User::where('phone', '=', $reset->phone)->first(); + $user->password = Hash::make($password); + $user->save(); + $reset->delete(); return response()->json([ - 'success'=> true, - 'message'=> 'You have successfully verified your email address.' + 'success' => false, 'data'=> ['message'=> 'Reset success'] ]); } - return response()->json(['success'=> false, 'error'=> "Verification code is invalid."]); + return response()->json([ + 'success' => false, 'data'=> ['message'=> 'Invalid token or email or expired code'] + ]); } - } \ No newline at end of file diff --git a/app/Http/Controllers/ContactController.php b/app/Http/Controllers/ContactController.php index 26e20b9..72b44a0 100644 --- a/app/Http/Controllers/ContactController.php +++ b/app/Http/Controllers/ContactController.php @@ -3,6 +3,7 @@ namespace App\Http\Controllers; use App\Contact; +use App\Company; use Illuminate\Http\Request; class ContactController extends Controller @@ -43,17 +44,22 @@ class ContactController extends Controller */ public function store(Request $request) { - // get company id from request ex: $request->input('company_id') - // $company_id = $request->input('company_id')) + // get company id from request ex: + //$request->input('company_id'); + $company_id = $request->input('company_id'); // query to find company asisng to $company - // $company = Comapny::find($company_id) + $company = Company::find($company_id); - // get user from session $request->user(); - // $user = $request->user(); + // get user from session + //$request->user(); + $user = $request->user(); // prepare query - + $contact = new Contact(); + $contact->company_id = $company->id; + $contact->user_id = $user->id; + $contact->save(); // insert into database diff --git a/app/Http/Controllers/ForgotPasswordController.php b/app/Http/Controllers/ForgotPasswordController.php new file mode 100644 index 0000000..ba5fb2d --- /dev/null +++ b/app/Http/Controllers/ForgotPasswordController.php @@ -0,0 +1,10 @@ + \App\Http\Middleware\RedirectIfAuthenticated::class, 'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class, 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class, - 'jwt.auth' => 'Tymon\JWTAuth\Middleware\GetUserFromToken', + //'jwt.auth' => \Tymon\JWTAuth\Middleware\GetUserFromToken::class, + 'jwt.auth' => \Tymon\JWTAuth\Http\Middleware\Authenticate::class, 'jwt.refresh' => 'Tymon\JWTAuth\Middleware\RefreshToken', + ]; } diff --git a/app/PasswordResets.php b/app/PasswordResets.php new file mode 100644 index 0000000..ee4f91b --- /dev/null +++ b/app/PasswordResets.php @@ -0,0 +1,10 @@ +hasOne('App\UserVerification', 'user_id'); + } + + public function Contact() + + { + + return $this->hasMany(Contact::class); + + } + } diff --git a/app/UserVerification.php b/app/UserVerification.php new file mode 100644 index 0000000..8d4b9a9 --- /dev/null +++ b/app/UserVerification.php @@ -0,0 +1,18 @@ +belongsTo('App\User', 'user_id'); + } + +} diff --git a/composer.json b/composer.json index 2443b2c..3e005f9 100644 --- a/composer.json +++ b/composer.json @@ -6,12 +6,19 @@ "type": "project", "require": { "php": "^7.1.3", - "doctrine/dbal": "^2.7", + + + + "aloha/twilio": "^4.0", + "doctrine/dbal": "~2.3", + "fideloper/proxy": "^4.0", "intervention/image": "^2.4", "laravel/framework": "5.6.*", "laravel/tinker": "^1.0", - "tymon/jwt-auth": "dev-develop" + "santigarcor/laratrust": "5.0.*", + "tymon/jwt-auth": "1.0.*", + "zizaco/entrust": "5.2.x-dev" }, "require-dev": { "filp/whoops": "^2.0", diff --git a/composer.lock b/composer.lock index f304a85..71bee4f 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,76 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], + "content-hash": "ad4497779e1657228811439be2faf961", + + "content-hash": "cede893a42c764bea70b46adc91247ad", + "packages": [ + { + "name": "aloha/twilio", + "version": "4.0.0", + "source": { + "type": "git", + "url": "https://github.com/aloha/laravel-twilio.git", + "reference": "0fd74d541116b0641f815bb59b8323cfe1d6004f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/aloha/laravel-twilio/zipball/0fd74d541116b0641f815bb59b8323cfe1d6004f", + "reference": "0fd74d541116b0641f815bb59b8323cfe1d6004f", + "shasum": "" + }, + "require": { + "php": ">=5.5.0", + "twilio/sdk": "5.*" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^1.9", + "illuminate/console": "~4||~5", + "illuminate/support": "~4||~5", + "phpunit/phpunit": "~4.5" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "Aloha\\Twilio\\Support\\Laravel\\ServiceProvider" + ], + "aliases": { + "Twilio": "Aloha\\Twilio\\Support\\Laravel\\Facade" + } + } + }, + "autoload": { + "psr-4": { + "Aloha\\Twilio\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Hannes Van De Vreken", + "email": "vandevreken.hannes@gmail.com" + }, + { + "name": "Travis J Ryan", + "email": "travisjryan@gmail.com" + } + ], + "description": "Twilio API for Laravel", + "homepage": "https://github.com/aloha/laravel-twilio", + "keywords": [ + "ivr", + "laravel", + "sms", + "twilio" + ], + "time": "2018-04-23T14:59:03+00:00" + }, { "name": "dnoegel/php-xdg-base-dir", "version": "0.1", @@ -945,6 +1013,51 @@ ], "time": "2015-04-20T18:58:01+00:00" }, + { + "name": "kkszymanowski/traitor", + "version": "0.2.5", + "source": { + "type": "git", + "url": "https://github.com/KKSzymanowski/Traitor.git", + "reference": "9770fc7de72ff585601dc9c42b31715d9fc40a24" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/KKSzymanowski/Traitor/zipball/9770fc7de72ff585601dc9c42b31715d9fc40a24", + "reference": "9770fc7de72ff585601dc9c42b31715d9fc40a24", + "shasum": "" + }, + "require": { + "nikic/php-parser": "^1.0|^2.0|^3.0|^4.0", + "php": ">=5.4" + }, + "require-dev": { + "phpunit/phpunit": "~4.1" + }, + "type": "library", + "autoload": { + "psr-4": { + "Traitor\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Kuba Szymanowski", + "email": "kuba.szymanowski@inf24.pl" + } + ], + "description": "Add a trait use statement to existing PHP class", + "keywords": [ + "add", + "php", + "trait" + ], + "time": "2018-04-19T12:24:36+00:00" + }, { "name": "laravel/framework", "version": "v5.6.18", @@ -1928,6 +2041,75 @@ ], "time": "2018-01-20T00:28:24+00:00" }, + { + "name": "santigarcor/laratrust", + "version": "5.0.9", + "source": { + "type": "git", + "url": "https://github.com/santigarcor/laratrust.git", + "reference": "526cc3e8970c35b97c71a7a6d8b63c2073568bb1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/santigarcor/laratrust/zipball/526cc3e8970c35b97c71a7a6d8b63c2073568bb1", + "reference": "526cc3e8970c35b97c71a7a6d8b63c2073568bb1", + "shasum": "" + }, + "require": { + "illuminate/auth": "~5.2", + "illuminate/cache": "~5.2", + "illuminate/console": "~5.2", + "illuminate/database": "^5.2.32", + "illuminate/support": "~5.2", + "kkszymanowski/traitor": "^0.2.0", + "php": ">=5.5.9" + }, + "require-dev": { + "mockery/mockery": ">=0.9.9", + "orchestra/testbench": "~3.2", + "phpunit/phpunit": ">=4.1" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "Laratrust\\LaratrustServiceProvider" + ], + "aliases": { + "Laratrust": "Laratrust\\LaratrustFacade" + } + } + }, + "autoload": { + "psr-4": { + "Laratrust\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Santiago Garcia", + "homepage": "http://santigarcor.me" + } + ], + "description": "This package provides a flexible way to add Role-based Permissions to Laravel", + "keywords": [ + "Teams", + "acl", + "authorization", + "laratrust", + "laravel", + "multiusers", + "permissions", + "php", + "rbac", + "roles" + ], + "time": "2018-03-05T13:21:52+00:00" + }, { "name": "swiftmailer/swiftmailer", "version": "v6.0.2", @@ -2945,17 +3127,63 @@ "time": "2017-11-27T11:13:29+00:00" }, { - "name": "tymon/jwt-auth", - "version": "dev-develop", + "name": "twilio/sdk", + "version": "5.17.1", "source": { "type": "git", - "url": "https://github.com/tymondesigns/jwt-auth.git", - "reference": "2b79229235d83523a05069ccb9c97cd5ec0b8123" + "url": "https://github.com/twilio/twilio-php.git", + "reference": "ae3477ccf88a0efb5bbe8928274c4a2046aec0c1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/tymondesigns/jwt-auth/zipball/2b79229235d83523a05069ccb9c97cd5ec0b8123", - "reference": "2b79229235d83523a05069ccb9c97cd5ec0b8123", + "url": "https://api.github.com/repos/twilio/twilio-php/zipball/ae3477ccf88a0efb5bbe8928274c4a2046aec0c1", + "reference": "ae3477ccf88a0efb5bbe8928274c4a2046aec0c1", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "require-dev": { + "apigen/apigen": "^4.1", + "phpunit/phpunit": "4.5.*" + }, + "type": "library", + "autoload": { + "psr-4": { + "Twilio\\": "Twilio/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Twilio API Team", + "email": "api@twilio.com" + } + ], + "description": "A PHP wrapper for Twilio's API", + "homepage": "http://github.com/twilio/twilio-php", + "keywords": [ + "api", + "sms", + "twilio" + ], + "time": "2018-04-20T23:40:08+00:00" + }, + { + "name": "tymon/jwt-auth", + "version": "1.0.0-rc.2", + "source": { + "type": "git", + "url": "https://github.com/tymondesigns/jwt-auth.git", + "reference": "d5220f6a84cbb8300f6f2f0f20aa908d072b4e4b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/tymondesigns/jwt-auth/zipball/d5220f6a84cbb8300f6f2f0f20aa908d072b4e4b", + "reference": "d5220f6a84cbb8300f6f2f0f20aa908d072b4e4b", "shasum": "" }, "require": { @@ -3017,7 +3245,7 @@ "jwt", "laravel" ], - "time": "2018-03-10T22:14:03+00:00" + "time": "2018-02-07T20:55:14+00:00" }, { "name": "vlucas/phpdotenv", @@ -3068,6 +3296,74 @@ "environment" ], "time": "2016-09-01T10:05:43+00:00" + }, + { + "name": "zizaco/entrust", + "version": "5.2.x-dev", + "source": { + "type": "git", + "url": "https://github.com/Zizaco/entrust.git", + "reference": "3623cc052937d9e62543402b50f24065720d44b9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Zizaco/entrust/zipball/3623cc052937d9e62543402b50f24065720d44b9", + "reference": "3623cc052937d9e62543402b50f24065720d44b9", + "shasum": "" + }, + "require": { + "illuminate/cache": "~5.0", + "illuminate/console": "~5.0", + "illuminate/support": "~5.0", + "php": ">=5.5.0" + }, + "require-dev": { + "illuminate/database": "~5.0", + "mockery/mockery": "dev-master", + "phpunit/phpunit": "~4.1", + "sami/sami": "dev-master" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/commands" + ], + "psr-4": { + "Zizaco\\Entrust\\": "src/Entrust/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Andrew Elkins", + "homepage": "http://andrewelkins.com" + }, + { + "name": "Zizaco Zizuini", + "email": "zizaco@gmail.com" + }, + { + "name": "Ben Batschelet", + "homepage": "http://github.com/bbatsche" + }, + { + "name": "Michele Angioni", + "email": "michele.angioni@gmail.com" + } + ], + "description": "This package provides a flexible way to add Role-based Permissions to Laravel", + "keywords": [ + "acl", + "auth", + "illuminate", + "laravel", + "permission", + "roles" + ], + "time": "2016-12-29T06:25:06+00:00" } ], "packages-dev": [ @@ -4815,7 +5111,7 @@ "aliases": [], "minimum-stability": "dev", "stability-flags": { - "tymon/jwt-auth": 20 + "zizaco/entrust": 20 }, "prefer-stable": true, "prefer-lowest": false, diff --git a/config/app.php b/config/app.php index 849a78f..6828bef 100644 --- a/config/app.php +++ b/config/app.php @@ -150,6 +150,8 @@ return [ * Package Service Providers... */ Tymon\JWTAuth\Providers\LaravelServiceProvider::class, + Aloha\Twilio\Support\Laravel\ServiceProvider::class, + Laratrust\LaratrustServiceProvider::class, /* * Application Service Providers... @@ -159,7 +161,8 @@ return [ // App\Providers\BroadcastServiceProvider::class, App\Providers\EventServiceProvider::class, App\Providers\RouteServiceProvider::class, - Intervention\Image\ImageServiceProvider::class + Intervention\Image\ImageServiceProvider::class, + //Aloha\Twilio\Support\Laravel\ServiceProvider::class ], /* @@ -210,7 +213,13 @@ return [ 'View' => Illuminate\Support\Facades\View::class, 'JWTAuth' => Tymon\JWTAuth\Facades\JWTAuth::class, 'JWTFactory' => Tymon\JWTAuth\Facades\JWTFactory::class, - 'Image' => Intervention\Image\Facades\Image::class +//<<< HEAD + 'Image' => Intervention\Image\Facades\Image::class, +//======= + 'Twilio' => Aloha\Twilio\Support\Laravel\Facade::class, + 'Laratrust' => Laratrust\LaratrustFacade::class, + 'auth.password.broker' => Illuminate\Auth\Passwords\TokenRepositoryInterface::class +//>>>>>>> 47c12e5e97af74f362bd15035d51420c4d9dd4ae ], ]; diff --git a/config/jwt.php b/config/jwt.php new file mode 100644 index 0000000..26bc2f0 --- /dev/null +++ b/config/jwt.php @@ -0,0 +1,303 @@ + + * + * 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', 20160), // one week + + /* + |-------------------------------------------------------------------------- + | 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, + + ], + +]; diff --git a/config/laratrust.php b/config/laratrust.php new file mode 100644 index 0000000..cd9f05a --- /dev/null +++ b/config/laratrust.php @@ -0,0 +1,210 @@ + false, + + /* + |-------------------------------------------------------------------------- + | Use cache in the package + |-------------------------------------------------------------------------- + | + | Defines if Laratrust will use Laravel's Cache to cache the roles and permissions. + | + */ + 'use_cache' => true, + + /* + |-------------------------------------------------------------------------- + | Use teams feature in the package + |-------------------------------------------------------------------------- + | + | Defines if Laratrust will use the teams feature. + | Please check the docs to see what you need to do in case you have the package already configured. + | + */ + 'use_teams' => true, + + /* + |-------------------------------------------------------------------------- + | Strict check for roles/permissions inside teams + |-------------------------------------------------------------------------- + | + | Determines if a strict check should be done when checking if a role or permission + | is attached inside a team. + | If it's false, when checking a role/permission without specifying the team, + | it will check only if the user has attached that role/permission ignoring the team. + | + */ + 'teams_strict_check' => false, + + /* + |-------------------------------------------------------------------------- + | Laratrust User Models + |-------------------------------------------------------------------------- + | + | This is the array that contains the information of the user models. + | This information is used in the add-trait command, and for the roles and + | permissions relationships with the possible user models. + | + | The key in the array is the name of the relationship inside the roles and permissions. + | + */ + 'user_models' => [ + 'users' => 'App\User', + ], + + /* + |-------------------------------------------------------------------------- + | Laratrust Models + |-------------------------------------------------------------------------- + | + | These are the models used by Laratrust to define the roles, permissions and teams. + | If you want the Laratrust models to be in a different namespace or + | to have a different name, you can do it here. + | + */ + 'models' => [ + /** + * Role model + */ + 'role' => 'App\Role', + + /** + * Permission model + */ + 'permission' => 'App\Permission', + + /** + * Team model + */ + 'team' => 'App\Team', + + ], + + /* + |-------------------------------------------------------------------------- + | Laratrust Tables + |-------------------------------------------------------------------------- + | + | These are the tables used by Laratrust to store all the authorization data. + | + */ + 'tables' => [ + /** + * Roles table. + */ + 'roles' => 'roles', + + /** + * Permissions table. + */ + 'permissions' => 'permissions', + + /** + * Teams table. + */ + 'teams' => 'teams', + + /** + * Role - User intermediate table. + */ + 'role_user' => 'role_user', + + /** + * Permission - User intermediate table. + */ + 'permission_user' => 'permission_user', + + /** + * Permission - Role intermediate table. + */ + 'permission_role' => 'permission_role', + + ], + + /* + |-------------------------------------------------------------------------- + | Laratrust Foreign Keys + |-------------------------------------------------------------------------- + | + | These are the foreign keys used by laratrust in the intermediate tables. + | + */ + 'foreign_keys' => [ + /** + * User foreign key on Laratrust's role_user and permission_user tables. + */ + 'user' => 'user_id', + + /** + * Role foreign key on Laratrust's role_user and permission_role tables. + */ + 'role' => 'role_id', + + /** + * Role foreign key on Laratrust's permission_user and permission_role tables. + */ + 'permission' => 'permission_id', + + /** + * Role foreign key on Laratrust's role_user and permission_user tables. + */ + 'team' => 'team_id', + + ], + + /* + |-------------------------------------------------------------------------- + | Laratrust Middleware + |-------------------------------------------------------------------------- + | + | This configuration helps to customize the Laratrust middleware behavior. + | + */ + 'middleware' => [ + /** + * Define if the laratrust middleware are registered automatically in the service provider + */ + 'register' => true, + + /** + * Method to be called in the middleware return case. + * Available: abort|redirect + */ + 'handling' => 'abort', + + /** + * Parameter passed to the middleware_handling method + */ + 'params' => '403', + + ], + + /* + |-------------------------------------------------------------------------- + | Laratrust Magic 'can' Method + |-------------------------------------------------------------------------- + | + | Supported cases for the magic can method (Refer to the docs). + | Available: camel_case|snake_case|kebab_case + | + */ + 'magic_can_method_case' => 'kebab_case', +]; diff --git a/config/laratrust_seeder.php b/config/laratrust_seeder.php new file mode 100644 index 0000000..094c597 --- /dev/null +++ b/config/laratrust_seeder.php @@ -0,0 +1,29 @@ + [ + 'administrator' => [ + 'users' => 'c,r,u,d', + 'acl' => 'c,r,u,d', + 'profile' => 'r,u' + ], + 'freightforwarder' => [ + 'users' => 'c,r,u,d', + 'profile' => 'r,u' + ], + 'importer' => [ + 'profile' => 'r,u' + ], + ], + 'permission_structure' => [ + 'cru_user' => [ + 'profile' => 'c,r,u' + ], + ], + 'permissions_map' => [ + 'c' => 'create', + 'r' => 'read', + 'u' => 'update', + 'd' => 'delete' + ] +]; diff --git a/data/mysql/auto.cnf b/data/mysql/auto.cnf deleted file mode 100644 index a425e35..0000000 --- a/data/mysql/auto.cnf +++ /dev/null @@ -1,2 +0,0 @@ -[auto] -server-uuid=ff897b63-45fb-11e8-a5e1-0242ac120002 diff --git a/data/mysql/default/db.opt b/data/mysql/default/db.opt deleted file mode 100644 index 4ed6015..0000000 --- a/data/mysql/default/db.opt +++ /dev/null @@ -1,2 +0,0 @@ -default-character-set=utf8 -default-collation=utf8_general_ci diff --git a/data/mysql/default/migrations.frm b/data/mysql/default/migrations.frm deleted file mode 100644 index 6da308a..0000000 Binary files a/data/mysql/default/migrations.frm and /dev/null differ diff --git a/data/mysql/default/migrations.ibd b/data/mysql/default/migrations.ibd deleted file mode 100644 index 255cfbf..0000000 Binary files a/data/mysql/default/migrations.ibd and /dev/null differ diff --git a/data/mysql/default/password_resets.frm b/data/mysql/default/password_resets.frm deleted file mode 100644 index 37a6eee..0000000 Binary files a/data/mysql/default/password_resets.frm and /dev/null differ diff --git a/data/mysql/default/password_resets.ibd b/data/mysql/default/password_resets.ibd deleted file mode 100644 index 999d31c..0000000 Binary files a/data/mysql/default/password_resets.ibd and /dev/null differ diff --git a/data/mysql/default/user_verifications.frm b/data/mysql/default/user_verifications.frm deleted file mode 100644 index af307a1..0000000 Binary files a/data/mysql/default/user_verifications.frm and /dev/null differ diff --git a/data/mysql/default/user_verifications.ibd b/data/mysql/default/user_verifications.ibd deleted file mode 100644 index 55c62e6..0000000 Binary files a/data/mysql/default/user_verifications.ibd and /dev/null differ diff --git a/data/mysql/default/users.frm b/data/mysql/default/users.frm deleted file mode 100644 index 2cd2671..0000000 Binary files a/data/mysql/default/users.frm and /dev/null differ diff --git a/data/mysql/default/users.ibd b/data/mysql/default/users.ibd deleted file mode 100644 index 75e4613..0000000 Binary files a/data/mysql/default/users.ibd and /dev/null differ diff --git a/data/mysql/ib_logfile0 b/data/mysql/ib_logfile0 deleted file mode 100644 index d7c183a..0000000 Binary files a/data/mysql/ib_logfile0 and /dev/null differ diff --git a/data/mysql/ib_logfile1 b/data/mysql/ib_logfile1 deleted file mode 100644 index 274bba0..0000000 Binary files a/data/mysql/ib_logfile1 and /dev/null differ diff --git a/data/mysql/ibdata1 b/data/mysql/ibdata1 deleted file mode 100644 index 998da9d..0000000 Binary files a/data/mysql/ibdata1 and /dev/null differ diff --git a/data/mysql/mysql/columns_priv.MYD b/data/mysql/mysql/columns_priv.MYD deleted file mode 100644 index e69de29..0000000 diff --git a/data/mysql/mysql/columns_priv.MYI b/data/mysql/mysql/columns_priv.MYI deleted file mode 100644 index efbc3d8..0000000 Binary files a/data/mysql/mysql/columns_priv.MYI and /dev/null differ diff --git a/data/mysql/mysql/columns_priv.frm b/data/mysql/mysql/columns_priv.frm deleted file mode 100644 index 0db4610..0000000 Binary files a/data/mysql/mysql/columns_priv.frm and /dev/null differ diff --git a/data/mysql/mysql/db.MYD b/data/mysql/mysql/db.MYD deleted file mode 100644 index 4eff705..0000000 --- a/data/mysql/mysql/db.MYD +++ /dev/null @@ -1 +0,0 @@ -ÿ% test ÿ% test\_% ÿ% default default  \ No newline at end of file diff --git a/data/mysql/mysql/db.MYI b/data/mysql/mysql/db.MYI deleted file mode 100644 index f371954..0000000 Binary files a/data/mysql/mysql/db.MYI and /dev/null differ diff --git a/data/mysql/mysql/db.frm b/data/mysql/mysql/db.frm deleted file mode 100644 index dd0803e..0000000 Binary files a/data/mysql/mysql/db.frm and /dev/null differ diff --git a/data/mysql/mysql/event.MYD b/data/mysql/mysql/event.MYD deleted file mode 100644 index e69de29..0000000 diff --git a/data/mysql/mysql/event.MYI b/data/mysql/mysql/event.MYI deleted file mode 100644 index c871ddc..0000000 Binary files a/data/mysql/mysql/event.MYI and /dev/null differ diff --git a/data/mysql/mysql/event.frm b/data/mysql/mysql/event.frm deleted file mode 100644 index 342ed98..0000000 Binary files a/data/mysql/mysql/event.frm and /dev/null differ diff --git a/data/mysql/mysql/func.MYD b/data/mysql/mysql/func.MYD deleted file mode 100644 index e69de29..0000000 diff --git a/data/mysql/mysql/func.MYI b/data/mysql/mysql/func.MYI deleted file mode 100644 index 9a77c3c..0000000 Binary files a/data/mysql/mysql/func.MYI and /dev/null differ diff --git a/data/mysql/mysql/func.frm b/data/mysql/mysql/func.frm deleted file mode 100644 index fb31a3c..0000000 Binary files a/data/mysql/mysql/func.frm and /dev/null differ diff --git a/data/mysql/mysql/general_log.CSM b/data/mysql/mysql/general_log.CSM deleted file mode 100644 index 8d08b8d..0000000 Binary files a/data/mysql/mysql/general_log.CSM and /dev/null differ diff --git a/data/mysql/mysql/general_log.CSV b/data/mysql/mysql/general_log.CSV deleted file mode 100644 index e69de29..0000000 diff --git a/data/mysql/mysql/general_log.frm b/data/mysql/mysql/general_log.frm deleted file mode 100644 index e53350e..0000000 Binary files a/data/mysql/mysql/general_log.frm and /dev/null differ diff --git a/data/mysql/mysql/help_category.MYD b/data/mysql/mysql/help_category.MYD deleted file mode 100644 index 9af2446..0000000 Binary files a/data/mysql/mysql/help_category.MYD and /dev/null differ diff --git a/data/mysql/mysql/help_category.MYI b/data/mysql/mysql/help_category.MYI deleted file mode 100644 index d270c23..0000000 Binary files a/data/mysql/mysql/help_category.MYI and /dev/null differ diff --git a/data/mysql/mysql/help_category.frm b/data/mysql/mysql/help_category.frm deleted file mode 100644 index f769ea0..0000000 Binary files a/data/mysql/mysql/help_category.frm and /dev/null differ diff --git a/data/mysql/mysql/help_keyword.MYD b/data/mysql/mysql/help_keyword.MYD deleted file mode 100644 index 2f41ea4..0000000 Binary files a/data/mysql/mysql/help_keyword.MYD and /dev/null differ diff --git a/data/mysql/mysql/help_keyword.MYI b/data/mysql/mysql/help_keyword.MYI deleted file mode 100644 index e2ed4d1..0000000 Binary files a/data/mysql/mysql/help_keyword.MYI and /dev/null differ diff --git a/data/mysql/mysql/help_keyword.frm b/data/mysql/mysql/help_keyword.frm deleted file mode 100644 index 999b370..0000000 Binary files a/data/mysql/mysql/help_keyword.frm and /dev/null differ diff --git a/data/mysql/mysql/help_relation.MYD b/data/mysql/mysql/help_relation.MYD deleted file mode 100644 index 65296e1..0000000 Binary files a/data/mysql/mysql/help_relation.MYD and /dev/null differ diff --git a/data/mysql/mysql/help_relation.MYI b/data/mysql/mysql/help_relation.MYI deleted file mode 100644 index 54b3f8a..0000000 Binary files a/data/mysql/mysql/help_relation.MYI and /dev/null differ diff --git a/data/mysql/mysql/help_relation.frm b/data/mysql/mysql/help_relation.frm deleted file mode 100644 index 9ac0a57..0000000 Binary files a/data/mysql/mysql/help_relation.frm and /dev/null differ diff --git a/data/mysql/mysql/help_topic.MYD b/data/mysql/mysql/help_topic.MYD deleted file mode 100644 index 8e69aa5..0000000 Binary files a/data/mysql/mysql/help_topic.MYD and /dev/null differ diff --git a/data/mysql/mysql/help_topic.MYI b/data/mysql/mysql/help_topic.MYI deleted file mode 100644 index 4d51703..0000000 Binary files a/data/mysql/mysql/help_topic.MYI and /dev/null differ diff --git a/data/mysql/mysql/help_topic.frm b/data/mysql/mysql/help_topic.frm deleted file mode 100644 index 0959b93..0000000 Binary files a/data/mysql/mysql/help_topic.frm and /dev/null differ diff --git a/data/mysql/mysql/innodb_index_stats.frm b/data/mysql/mysql/innodb_index_stats.frm deleted file mode 100644 index 2f49e19..0000000 Binary files a/data/mysql/mysql/innodb_index_stats.frm and /dev/null differ diff --git a/data/mysql/mysql/innodb_index_stats.ibd b/data/mysql/mysql/innodb_index_stats.ibd deleted file mode 100644 index 3340649..0000000 Binary files a/data/mysql/mysql/innodb_index_stats.ibd and /dev/null differ diff --git a/data/mysql/mysql/innodb_table_stats.frm b/data/mysql/mysql/innodb_table_stats.frm deleted file mode 100644 index c642051..0000000 Binary files a/data/mysql/mysql/innodb_table_stats.frm and /dev/null differ diff --git a/data/mysql/mysql/innodb_table_stats.ibd b/data/mysql/mysql/innodb_table_stats.ibd deleted file mode 100644 index cf6d773..0000000 Binary files a/data/mysql/mysql/innodb_table_stats.ibd and /dev/null differ diff --git a/data/mysql/mysql/ndb_binlog_index.MYD b/data/mysql/mysql/ndb_binlog_index.MYD deleted file mode 100644 index e69de29..0000000 diff --git a/data/mysql/mysql/ndb_binlog_index.MYI b/data/mysql/mysql/ndb_binlog_index.MYI deleted file mode 100644 index 170e8d2..0000000 Binary files a/data/mysql/mysql/ndb_binlog_index.MYI and /dev/null differ diff --git a/data/mysql/mysql/ndb_binlog_index.frm b/data/mysql/mysql/ndb_binlog_index.frm deleted file mode 100644 index 87d7af2..0000000 Binary files a/data/mysql/mysql/ndb_binlog_index.frm and /dev/null differ diff --git a/data/mysql/mysql/plugin.MYD b/data/mysql/mysql/plugin.MYD deleted file mode 100644 index e69de29..0000000 diff --git a/data/mysql/mysql/plugin.MYI b/data/mysql/mysql/plugin.MYI deleted file mode 100644 index 4260d04..0000000 Binary files a/data/mysql/mysql/plugin.MYI and /dev/null differ diff --git a/data/mysql/mysql/plugin.frm b/data/mysql/mysql/plugin.frm deleted file mode 100644 index a784284..0000000 Binary files a/data/mysql/mysql/plugin.frm and /dev/null differ diff --git a/data/mysql/mysql/proc.MYD b/data/mysql/mysql/proc.MYD deleted file mode 100644 index e69de29..0000000 diff --git a/data/mysql/mysql/proc.MYI b/data/mysql/mysql/proc.MYI deleted file mode 100644 index 17c863b..0000000 Binary files a/data/mysql/mysql/proc.MYI and /dev/null differ diff --git a/data/mysql/mysql/proc.frm b/data/mysql/mysql/proc.frm deleted file mode 100644 index 671c542..0000000 Binary files a/data/mysql/mysql/proc.frm and /dev/null differ diff --git a/data/mysql/mysql/procs_priv.MYD b/data/mysql/mysql/procs_priv.MYD deleted file mode 100644 index e69de29..0000000 diff --git a/data/mysql/mysql/procs_priv.MYI b/data/mysql/mysql/procs_priv.MYI deleted file mode 100644 index 53b97a0..0000000 Binary files a/data/mysql/mysql/procs_priv.MYI and /dev/null differ diff --git a/data/mysql/mysql/procs_priv.frm b/data/mysql/mysql/procs_priv.frm deleted file mode 100644 index c31a351..0000000 Binary files a/data/mysql/mysql/procs_priv.frm and /dev/null differ diff --git a/data/mysql/mysql/proxies_priv.MYD b/data/mysql/mysql/proxies_priv.MYD deleted file mode 100644 index 79e0fb5..0000000 --- a/data/mysql/mysql/proxies_priv.MYD +++ /dev/null @@ -1 +0,0 @@ -ÿlocalhost root  ZÜ4õÿe4506dd5b9b1 root  ZÜ4õ \ No newline at end of file diff --git a/data/mysql/mysql/proxies_priv.MYI b/data/mysql/mysql/proxies_priv.MYI deleted file mode 100644 index 4353e83..0000000 Binary files a/data/mysql/mysql/proxies_priv.MYI and /dev/null differ diff --git a/data/mysql/mysql/proxies_priv.frm b/data/mysql/mysql/proxies_priv.frm deleted file mode 100644 index 6420bbf..0000000 Binary files a/data/mysql/mysql/proxies_priv.frm and /dev/null differ diff --git a/data/mysql/mysql/servers.MYD b/data/mysql/mysql/servers.MYD deleted file mode 100644 index e69de29..0000000 diff --git a/data/mysql/mysql/servers.MYI b/data/mysql/mysql/servers.MYI deleted file mode 100644 index 7df8811..0000000 Binary files a/data/mysql/mysql/servers.MYI and /dev/null differ diff --git a/data/mysql/mysql/servers.frm b/data/mysql/mysql/servers.frm deleted file mode 100644 index 556a331..0000000 Binary files a/data/mysql/mysql/servers.frm and /dev/null differ diff --git a/data/mysql/mysql/slave_master_info.frm b/data/mysql/mysql/slave_master_info.frm deleted file mode 100644 index a66f1c2..0000000 Binary files a/data/mysql/mysql/slave_master_info.frm and /dev/null differ diff --git a/data/mysql/mysql/slave_master_info.ibd b/data/mysql/mysql/slave_master_info.ibd deleted file mode 100644 index d34578c..0000000 Binary files a/data/mysql/mysql/slave_master_info.ibd and /dev/null differ diff --git a/data/mysql/mysql/slave_relay_log_info.frm b/data/mysql/mysql/slave_relay_log_info.frm deleted file mode 100644 index 20d9655..0000000 Binary files a/data/mysql/mysql/slave_relay_log_info.frm and /dev/null differ diff --git a/data/mysql/mysql/slave_relay_log_info.ibd b/data/mysql/mysql/slave_relay_log_info.ibd deleted file mode 100644 index 7b28689..0000000 Binary files a/data/mysql/mysql/slave_relay_log_info.ibd and /dev/null differ diff --git a/data/mysql/mysql/slave_worker_info.frm b/data/mysql/mysql/slave_worker_info.frm deleted file mode 100644 index 9b4610d..0000000 Binary files a/data/mysql/mysql/slave_worker_info.frm and /dev/null differ diff --git a/data/mysql/mysql/slave_worker_info.ibd b/data/mysql/mysql/slave_worker_info.ibd deleted file mode 100644 index 806a4a4..0000000 Binary files a/data/mysql/mysql/slave_worker_info.ibd and /dev/null differ diff --git a/data/mysql/mysql/slow_log.CSM b/data/mysql/mysql/slow_log.CSM deleted file mode 100644 index 8d08b8d..0000000 Binary files a/data/mysql/mysql/slow_log.CSM and /dev/null differ diff --git a/data/mysql/mysql/slow_log.CSV b/data/mysql/mysql/slow_log.CSV deleted file mode 100644 index e69de29..0000000 diff --git a/data/mysql/mysql/slow_log.frm b/data/mysql/mysql/slow_log.frm deleted file mode 100644 index ff56097..0000000 Binary files a/data/mysql/mysql/slow_log.frm and /dev/null differ diff --git a/data/mysql/mysql/tables_priv.MYD b/data/mysql/mysql/tables_priv.MYD deleted file mode 100644 index e69de29..0000000 diff --git a/data/mysql/mysql/tables_priv.MYI b/data/mysql/mysql/tables_priv.MYI deleted file mode 100644 index 5f6525a..0000000 Binary files a/data/mysql/mysql/tables_priv.MYI and /dev/null differ diff --git a/data/mysql/mysql/tables_priv.frm b/data/mysql/mysql/tables_priv.frm deleted file mode 100644 index 828f188..0000000 Binary files a/data/mysql/mysql/tables_priv.frm and /dev/null differ diff --git a/data/mysql/mysql/time_zone.MYD b/data/mysql/mysql/time_zone.MYD deleted file mode 100644 index 54eb88f..0000000 Binary files a/data/mysql/mysql/time_zone.MYD and /dev/null differ diff --git a/data/mysql/mysql/time_zone.MYI b/data/mysql/mysql/time_zone.MYI deleted file mode 100644 index 3dca088..0000000 Binary files a/data/mysql/mysql/time_zone.MYI and /dev/null differ diff --git a/data/mysql/mysql/time_zone.frm b/data/mysql/mysql/time_zone.frm deleted file mode 100644 index 7bd62bc..0000000 Binary files a/data/mysql/mysql/time_zone.frm and /dev/null differ diff --git a/data/mysql/mysql/time_zone_leap_second.MYD b/data/mysql/mysql/time_zone_leap_second.MYD deleted file mode 100644 index e69de29..0000000 diff --git a/data/mysql/mysql/time_zone_leap_second.MYI b/data/mysql/mysql/time_zone_leap_second.MYI deleted file mode 100644 index 7b877b6..0000000 Binary files a/data/mysql/mysql/time_zone_leap_second.MYI and /dev/null differ diff --git a/data/mysql/mysql/time_zone_leap_second.frm b/data/mysql/mysql/time_zone_leap_second.frm deleted file mode 100644 index f07f30e..0000000 Binary files a/data/mysql/mysql/time_zone_leap_second.frm and /dev/null differ diff --git a/data/mysql/mysql/time_zone_name.MYD b/data/mysql/mysql/time_zone_name.MYD deleted file mode 100644 index 3f510be..0000000 Binary files a/data/mysql/mysql/time_zone_name.MYD and /dev/null differ diff --git a/data/mysql/mysql/time_zone_name.MYI b/data/mysql/mysql/time_zone_name.MYI deleted file mode 100644 index a9db986..0000000 Binary files a/data/mysql/mysql/time_zone_name.MYI and /dev/null differ diff --git a/data/mysql/mysql/time_zone_name.frm b/data/mysql/mysql/time_zone_name.frm deleted file mode 100644 index 25d8759..0000000 Binary files a/data/mysql/mysql/time_zone_name.frm and /dev/null differ diff --git a/data/mysql/mysql/time_zone_transition.MYD b/data/mysql/mysql/time_zone_transition.MYD deleted file mode 100644 index d6929ad..0000000 Binary files a/data/mysql/mysql/time_zone_transition.MYD and /dev/null differ diff --git a/data/mysql/mysql/time_zone_transition.MYI b/data/mysql/mysql/time_zone_transition.MYI deleted file mode 100644 index 6f78781..0000000 Binary files a/data/mysql/mysql/time_zone_transition.MYI and /dev/null differ diff --git a/data/mysql/mysql/time_zone_transition.frm b/data/mysql/mysql/time_zone_transition.frm deleted file mode 100644 index 2e72fdc..0000000 Binary files a/data/mysql/mysql/time_zone_transition.frm and /dev/null differ diff --git a/data/mysql/mysql/time_zone_transition_type.MYD b/data/mysql/mysql/time_zone_transition_type.MYD deleted file mode 100644 index 00d11d1..0000000 Binary files a/data/mysql/mysql/time_zone_transition_type.MYD and /dev/null differ diff --git a/data/mysql/mysql/time_zone_transition_type.MYI b/data/mysql/mysql/time_zone_transition_type.MYI deleted file mode 100644 index e172b0e..0000000 Binary files a/data/mysql/mysql/time_zone_transition_type.MYI and /dev/null differ diff --git a/data/mysql/mysql/time_zone_transition_type.frm b/data/mysql/mysql/time_zone_transition_type.frm deleted file mode 100644 index 83e5828..0000000 Binary files a/data/mysql/mysql/time_zone_transition_type.frm and /dev/null differ diff --git a/data/mysql/mysql/user.MYD b/data/mysql/mysql/user.MYD deleted file mode 100644 index adf534e..0000000 Binary files a/data/mysql/mysql/user.MYD and /dev/null differ diff --git a/data/mysql/mysql/user.MYI b/data/mysql/mysql/user.MYI deleted file mode 100644 index 996b335..0000000 Binary files a/data/mysql/mysql/user.MYI and /dev/null differ diff --git a/data/mysql/mysql/user.frm b/data/mysql/mysql/user.frm deleted file mode 100644 index a96aa11..0000000 Binary files a/data/mysql/mysql/user.frm and /dev/null differ diff --git a/data/mysql/performance_schema/accounts.frm b/data/mysql/performance_schema/accounts.frm deleted file mode 100644 index 9a30736..0000000 Binary files a/data/mysql/performance_schema/accounts.frm and /dev/null differ diff --git a/data/mysql/performance_schema/cond_instances.frm b/data/mysql/performance_schema/cond_instances.frm deleted file mode 100644 index 079acd1..0000000 Binary files a/data/mysql/performance_schema/cond_instances.frm and /dev/null differ diff --git a/data/mysql/performance_schema/db.opt b/data/mysql/performance_schema/db.opt deleted file mode 100644 index 4ed6015..0000000 --- a/data/mysql/performance_schema/db.opt +++ /dev/null @@ -1,2 +0,0 @@ -default-character-set=utf8 -default-collation=utf8_general_ci diff --git a/data/mysql/performance_schema/events_stages_current.frm b/data/mysql/performance_schema/events_stages_current.frm deleted file mode 100644 index daf2d5c..0000000 Binary files a/data/mysql/performance_schema/events_stages_current.frm and /dev/null differ diff --git a/data/mysql/performance_schema/events_stages_history.frm b/data/mysql/performance_schema/events_stages_history.frm deleted file mode 100644 index daf2d5c..0000000 Binary files a/data/mysql/performance_schema/events_stages_history.frm and /dev/null differ diff --git a/data/mysql/performance_schema/events_stages_history_long.frm b/data/mysql/performance_schema/events_stages_history_long.frm deleted file mode 100644 index daf2d5c..0000000 Binary files a/data/mysql/performance_schema/events_stages_history_long.frm and /dev/null differ diff --git a/data/mysql/performance_schema/events_stages_summary_by_account_by_event_name.frm b/data/mysql/performance_schema/events_stages_summary_by_account_by_event_name.frm deleted file mode 100644 index 61e7d94..0000000 Binary files a/data/mysql/performance_schema/events_stages_summary_by_account_by_event_name.frm and /dev/null differ diff --git a/data/mysql/performance_schema/events_stages_summary_by_host_by_event_name.frm b/data/mysql/performance_schema/events_stages_summary_by_host_by_event_name.frm deleted file mode 100644 index 40741ca..0000000 Binary files a/data/mysql/performance_schema/events_stages_summary_by_host_by_event_name.frm and /dev/null differ diff --git a/data/mysql/performance_schema/events_stages_summary_by_thread_by_event_name.frm b/data/mysql/performance_schema/events_stages_summary_by_thread_by_event_name.frm deleted file mode 100644 index 3aed7bc..0000000 Binary files a/data/mysql/performance_schema/events_stages_summary_by_thread_by_event_name.frm and /dev/null differ diff --git a/data/mysql/performance_schema/events_stages_summary_by_user_by_event_name.frm b/data/mysql/performance_schema/events_stages_summary_by_user_by_event_name.frm deleted file mode 100644 index 544d1a0..0000000 Binary files a/data/mysql/performance_schema/events_stages_summary_by_user_by_event_name.frm and /dev/null differ diff --git a/data/mysql/performance_schema/events_stages_summary_global_by_event_name.frm b/data/mysql/performance_schema/events_stages_summary_global_by_event_name.frm deleted file mode 100644 index d207d22..0000000 Binary files a/data/mysql/performance_schema/events_stages_summary_global_by_event_name.frm and /dev/null differ diff --git a/data/mysql/performance_schema/events_statements_current.frm b/data/mysql/performance_schema/events_statements_current.frm deleted file mode 100644 index 81c2c1c..0000000 Binary files a/data/mysql/performance_schema/events_statements_current.frm and /dev/null differ diff --git a/data/mysql/performance_schema/events_statements_history.frm b/data/mysql/performance_schema/events_statements_history.frm deleted file mode 100644 index 81c2c1c..0000000 Binary files a/data/mysql/performance_schema/events_statements_history.frm and /dev/null differ diff --git a/data/mysql/performance_schema/events_statements_history_long.frm b/data/mysql/performance_schema/events_statements_history_long.frm deleted file mode 100644 index 81c2c1c..0000000 Binary files a/data/mysql/performance_schema/events_statements_history_long.frm and /dev/null differ diff --git a/data/mysql/performance_schema/events_statements_summary_by_account_by_event_name.frm b/data/mysql/performance_schema/events_statements_summary_by_account_by_event_name.frm deleted file mode 100644 index f56b74a..0000000 Binary files a/data/mysql/performance_schema/events_statements_summary_by_account_by_event_name.frm and /dev/null differ diff --git a/data/mysql/performance_schema/events_statements_summary_by_digest.frm b/data/mysql/performance_schema/events_statements_summary_by_digest.frm deleted file mode 100644 index ea8e027..0000000 Binary files a/data/mysql/performance_schema/events_statements_summary_by_digest.frm and /dev/null differ diff --git a/data/mysql/performance_schema/events_statements_summary_by_host_by_event_name.frm b/data/mysql/performance_schema/events_statements_summary_by_host_by_event_name.frm deleted file mode 100644 index dedc38b..0000000 Binary files a/data/mysql/performance_schema/events_statements_summary_by_host_by_event_name.frm and /dev/null differ diff --git a/data/mysql/performance_schema/events_statements_summary_by_thread_by_event_name.frm b/data/mysql/performance_schema/events_statements_summary_by_thread_by_event_name.frm deleted file mode 100644 index 77aa9f2..0000000 Binary files a/data/mysql/performance_schema/events_statements_summary_by_thread_by_event_name.frm and /dev/null differ diff --git a/data/mysql/performance_schema/events_statements_summary_by_user_by_event_name.frm b/data/mysql/performance_schema/events_statements_summary_by_user_by_event_name.frm deleted file mode 100644 index 51f69e6..0000000 Binary files a/data/mysql/performance_schema/events_statements_summary_by_user_by_event_name.frm and /dev/null differ diff --git a/data/mysql/performance_schema/events_statements_summary_global_by_event_name.frm b/data/mysql/performance_schema/events_statements_summary_global_by_event_name.frm deleted file mode 100644 index 8719392..0000000 Binary files a/data/mysql/performance_schema/events_statements_summary_global_by_event_name.frm and /dev/null differ diff --git a/data/mysql/performance_schema/events_waits_current.frm b/data/mysql/performance_schema/events_waits_current.frm deleted file mode 100644 index a2430ec..0000000 Binary files a/data/mysql/performance_schema/events_waits_current.frm and /dev/null differ diff --git a/data/mysql/performance_schema/events_waits_history.frm b/data/mysql/performance_schema/events_waits_history.frm deleted file mode 100644 index a2430ec..0000000 Binary files a/data/mysql/performance_schema/events_waits_history.frm and /dev/null differ diff --git a/data/mysql/performance_schema/events_waits_history_long.frm b/data/mysql/performance_schema/events_waits_history_long.frm deleted file mode 100644 index a2430ec..0000000 Binary files a/data/mysql/performance_schema/events_waits_history_long.frm and /dev/null differ diff --git a/data/mysql/performance_schema/events_waits_summary_by_account_by_event_name.frm b/data/mysql/performance_schema/events_waits_summary_by_account_by_event_name.frm deleted file mode 100644 index 61e7d94..0000000 Binary files a/data/mysql/performance_schema/events_waits_summary_by_account_by_event_name.frm and /dev/null differ diff --git a/data/mysql/performance_schema/events_waits_summary_by_host_by_event_name.frm b/data/mysql/performance_schema/events_waits_summary_by_host_by_event_name.frm deleted file mode 100644 index 40741ca..0000000 Binary files a/data/mysql/performance_schema/events_waits_summary_by_host_by_event_name.frm and /dev/null differ diff --git a/data/mysql/performance_schema/events_waits_summary_by_instance.frm b/data/mysql/performance_schema/events_waits_summary_by_instance.frm deleted file mode 100644 index 0b8b599..0000000 Binary files a/data/mysql/performance_schema/events_waits_summary_by_instance.frm and /dev/null differ diff --git a/data/mysql/performance_schema/events_waits_summary_by_thread_by_event_name.frm b/data/mysql/performance_schema/events_waits_summary_by_thread_by_event_name.frm deleted file mode 100644 index 3aed7bc..0000000 Binary files a/data/mysql/performance_schema/events_waits_summary_by_thread_by_event_name.frm and /dev/null differ diff --git a/data/mysql/performance_schema/events_waits_summary_by_user_by_event_name.frm b/data/mysql/performance_schema/events_waits_summary_by_user_by_event_name.frm deleted file mode 100644 index 544d1a0..0000000 Binary files a/data/mysql/performance_schema/events_waits_summary_by_user_by_event_name.frm and /dev/null differ diff --git a/data/mysql/performance_schema/events_waits_summary_global_by_event_name.frm b/data/mysql/performance_schema/events_waits_summary_global_by_event_name.frm deleted file mode 100644 index d207d22..0000000 Binary files a/data/mysql/performance_schema/events_waits_summary_global_by_event_name.frm and /dev/null differ diff --git a/data/mysql/performance_schema/file_instances.frm b/data/mysql/performance_schema/file_instances.frm deleted file mode 100644 index 437a96c..0000000 Binary files a/data/mysql/performance_schema/file_instances.frm and /dev/null differ diff --git a/data/mysql/performance_schema/file_summary_by_event_name.frm b/data/mysql/performance_schema/file_summary_by_event_name.frm deleted file mode 100644 index 8ad5a96..0000000 Binary files a/data/mysql/performance_schema/file_summary_by_event_name.frm and /dev/null differ diff --git a/data/mysql/performance_schema/file_summary_by_instance.frm b/data/mysql/performance_schema/file_summary_by_instance.frm deleted file mode 100644 index 3b51a2b..0000000 Binary files a/data/mysql/performance_schema/file_summary_by_instance.frm and /dev/null differ diff --git a/data/mysql/performance_schema/host_cache.frm b/data/mysql/performance_schema/host_cache.frm deleted file mode 100644 index 5984e01..0000000 Binary files a/data/mysql/performance_schema/host_cache.frm and /dev/null differ diff --git a/data/mysql/performance_schema/hosts.frm b/data/mysql/performance_schema/hosts.frm deleted file mode 100644 index d4801c9..0000000 Binary files a/data/mysql/performance_schema/hosts.frm and /dev/null differ diff --git a/data/mysql/performance_schema/mutex_instances.frm b/data/mysql/performance_schema/mutex_instances.frm deleted file mode 100644 index bbf7f1e..0000000 Binary files a/data/mysql/performance_schema/mutex_instances.frm and /dev/null differ diff --git a/data/mysql/performance_schema/objects_summary_global_by_type.frm b/data/mysql/performance_schema/objects_summary_global_by_type.frm deleted file mode 100644 index 18dcc41..0000000 Binary files a/data/mysql/performance_schema/objects_summary_global_by_type.frm and /dev/null differ diff --git a/data/mysql/performance_schema/performance_timers.frm b/data/mysql/performance_schema/performance_timers.frm deleted file mode 100644 index 7c90b57..0000000 Binary files a/data/mysql/performance_schema/performance_timers.frm and /dev/null differ diff --git a/data/mysql/performance_schema/rwlock_instances.frm b/data/mysql/performance_schema/rwlock_instances.frm deleted file mode 100644 index cf86c45..0000000 Binary files a/data/mysql/performance_schema/rwlock_instances.frm and /dev/null differ diff --git a/data/mysql/performance_schema/session_account_connect_attrs.frm b/data/mysql/performance_schema/session_account_connect_attrs.frm deleted file mode 100644 index 153b54f..0000000 Binary files a/data/mysql/performance_schema/session_account_connect_attrs.frm and /dev/null differ diff --git a/data/mysql/performance_schema/session_connect_attrs.frm b/data/mysql/performance_schema/session_connect_attrs.frm deleted file mode 100644 index b4208ec..0000000 Binary files a/data/mysql/performance_schema/session_connect_attrs.frm and /dev/null differ diff --git a/data/mysql/performance_schema/setup_actors.frm b/data/mysql/performance_schema/setup_actors.frm deleted file mode 100644 index ff88491..0000000 Binary files a/data/mysql/performance_schema/setup_actors.frm and /dev/null differ diff --git a/data/mysql/performance_schema/setup_consumers.frm b/data/mysql/performance_schema/setup_consumers.frm deleted file mode 100644 index 7e8fc08..0000000 Binary files a/data/mysql/performance_schema/setup_consumers.frm and /dev/null differ diff --git a/data/mysql/performance_schema/setup_instruments.frm b/data/mysql/performance_schema/setup_instruments.frm deleted file mode 100644 index 10669af..0000000 Binary files a/data/mysql/performance_schema/setup_instruments.frm and /dev/null differ diff --git a/data/mysql/performance_schema/setup_objects.frm b/data/mysql/performance_schema/setup_objects.frm deleted file mode 100644 index cc0dd16..0000000 Binary files a/data/mysql/performance_schema/setup_objects.frm and /dev/null differ diff --git a/data/mysql/performance_schema/setup_timers.frm b/data/mysql/performance_schema/setup_timers.frm deleted file mode 100644 index ced9dd6..0000000 Binary files a/data/mysql/performance_schema/setup_timers.frm and /dev/null differ diff --git a/data/mysql/performance_schema/socket_instances.frm b/data/mysql/performance_schema/socket_instances.frm deleted file mode 100644 index 26aa0ab..0000000 Binary files a/data/mysql/performance_schema/socket_instances.frm and /dev/null differ diff --git a/data/mysql/performance_schema/socket_summary_by_event_name.frm b/data/mysql/performance_schema/socket_summary_by_event_name.frm deleted file mode 100644 index fb3cd4e..0000000 Binary files a/data/mysql/performance_schema/socket_summary_by_event_name.frm and /dev/null differ diff --git a/data/mysql/performance_schema/socket_summary_by_instance.frm b/data/mysql/performance_schema/socket_summary_by_instance.frm deleted file mode 100644 index 1be56a6..0000000 Binary files a/data/mysql/performance_schema/socket_summary_by_instance.frm and /dev/null differ diff --git a/data/mysql/performance_schema/table_io_waits_summary_by_index_usage.frm b/data/mysql/performance_schema/table_io_waits_summary_by_index_usage.frm deleted file mode 100644 index a386460..0000000 Binary files a/data/mysql/performance_schema/table_io_waits_summary_by_index_usage.frm and /dev/null differ diff --git a/data/mysql/performance_schema/table_io_waits_summary_by_table.frm b/data/mysql/performance_schema/table_io_waits_summary_by_table.frm deleted file mode 100644 index ef24530..0000000 Binary files a/data/mysql/performance_schema/table_io_waits_summary_by_table.frm and /dev/null differ diff --git a/data/mysql/performance_schema/table_lock_waits_summary_by_table.frm b/data/mysql/performance_schema/table_lock_waits_summary_by_table.frm deleted file mode 100644 index dbe88e0..0000000 Binary files a/data/mysql/performance_schema/table_lock_waits_summary_by_table.frm and /dev/null differ diff --git a/data/mysql/performance_schema/threads.frm b/data/mysql/performance_schema/threads.frm deleted file mode 100644 index ec4e2e2..0000000 Binary files a/data/mysql/performance_schema/threads.frm and /dev/null differ diff --git a/data/mysql/performance_schema/users.frm b/data/mysql/performance_schema/users.frm deleted file mode 100644 index edcef6f..0000000 Binary files a/data/mysql/performance_schema/users.frm and /dev/null differ diff --git a/database/migrations/2018_04_25_084609_change_email_to_mobile_from_user.php b/database/migrations/2018_04_25_084609_change_email_to_mobile_from_user.php new file mode 100644 index 0000000..b8f59c1 --- /dev/null +++ b/database/migrations/2018_04_25_084609_change_email_to_mobile_from_user.php @@ -0,0 +1,30 @@ +renameColumn('email', 'phone'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + $table->renameColumn('phone', 'email'); + } +} diff --git a/database/migrations/2018_04_25_145608_add_timestamp_to_verification.php b/database/migrations/2018_04_25_145608_add_timestamp_to_verification.php new file mode 100644 index 0000000..7730bd9 --- /dev/null +++ b/database/migrations/2018_04_25_145608_add_timestamp_to_verification.php @@ -0,0 +1,30 @@ +timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + // + } +} diff --git a/database/migrations/2018_04_26_020634_change_nullable_in_user_table.php b/database/migrations/2018_04_26_020634_change_nullable_in_user_table.php new file mode 100644 index 0000000..b3c6069 --- /dev/null +++ b/database/migrations/2018_04_26_020634_change_nullable_in_user_table.php @@ -0,0 +1,32 @@ +string('name')->nullable()->change(); + $table->string('password')->nullable()->change(); + }); + + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + // + } +} diff --git a/database/migrations/2018_04_26_055706_laratrust_setup_tables.php b/database/migrations/2018_04_26_055706_laratrust_setup_tables.php new file mode 100644 index 0000000..c8be723 --- /dev/null +++ b/database/migrations/2018_04_26_055706_laratrust_setup_tables.php @@ -0,0 +1,83 @@ +increments('id'); + $table->string('name')->unique(); + $table->string('display_name')->nullable(); + $table->string('description')->nullable(); + $table->timestamps(); + }); + + // Create table for storing permissions + Schema::create('permissions', function (Blueprint $table) { + $table->increments('id'); + $table->string('name')->unique(); + $table->string('display_name')->nullable(); + $table->string('description')->nullable(); + $table->timestamps(); + }); + + // Create table for associating roles to users and teams (Many To Many Polymorphic) + Schema::create('role_user', function (Blueprint $table) { + $table->unsignedInteger('role_id'); + $table->unsignedInteger('user_id'); + $table->string('user_type'); + + $table->foreign('role_id')->references('id')->on('roles') + ->onUpdate('cascade')->onDelete('cascade'); + + $table->primary(['user_id', 'role_id', 'user_type']); + }); + + // Create table for associating permissions to users (Many To Many Polymorphic) + Schema::create('permission_user', function (Blueprint $table) { + $table->unsignedInteger('permission_id'); + $table->unsignedInteger('user_id'); + $table->string('user_type'); + + $table->foreign('permission_id')->references('id')->on('permissions') + ->onUpdate('cascade')->onDelete('cascade'); + + $table->primary(['user_id', 'permission_id', 'user_type']); + }); + + // Create table for associating permissions to roles (Many-to-Many) + Schema::create('permission_role', function (Blueprint $table) { + $table->unsignedInteger('permission_id'); + $table->unsignedInteger('role_id'); + + $table->foreign('permission_id')->references('id')->on('permissions') + ->onUpdate('cascade')->onDelete('cascade'); + $table->foreign('role_id')->references('id')->on('roles') + ->onUpdate('cascade')->onDelete('cascade'); + + $table->primary(['permission_id', 'role_id']); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('permission_user'); + Schema::dropIfExists('permission_role'); + Schema::dropIfExists('permissions'); + Schema::dropIfExists('role_user'); + Schema::dropIfExists('roles'); + } +} diff --git a/database/migrations/2018_04_26_060746_laratrust_setup_teams.php b/database/migrations/2018_04_26_060746_laratrust_setup_teams.php new file mode 100644 index 0000000..2551d62 --- /dev/null +++ b/database/migrations/2018_04_26_060746_laratrust_setup_teams.php @@ -0,0 +1,67 @@ +increments('id'); + $table->string('name')->unique(); + $table->string('display_name')->nullable(); + $table->string('description')->nullable(); + $table->timestamps(); + }); + + Schema::table('role_user', function (Blueprint $table) { + // Drop role foreign key and primary key + $table->dropForeign(['role_id']); + $table->dropPrimary(['user_id', 'role_id', 'user_type']); + + // Add team_id column + $table->unsignedInteger('team_id')->nullable(); + + // Create foreign keys + $table->foreign('role_id')->references('id')->on('roles') + ->onUpdate('cascade')->onDelete('cascade'); + $table->foreign('team_id')->references('id')->on('teams') + ->onUpdate('cascade')->onDelete('cascade'); + + // Create a unique key + $table->unique(['user_id', 'role_id', 'user_type', 'team_id']); + }); + + Schema::table('permission_user', function (Blueprint $table) { + // Drop permission foreign key and primary key + $table->dropForeign(['permission_id']); + $table->dropPrimary(['permission_id', 'user_id', 'user_type']); + + $table->foreign('permission_id')->references('id')->on('permissions') + ->onUpdate('cascade')->onDelete('cascade'); + + // Add team_id column + $table->unsignedInteger('team_id')->nullable(); + + $table->foreign('team_id')->references('id')->on('teams') + ->onUpdate('cascade')->onDelete('cascade'); + + $table->unique(['user_id', 'permission_id', 'user_type', 'team_id']); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + } +} diff --git a/database/migrations/2018_04_26_082810_change_email_to_phone_from_passwordreset_table.php b/database/migrations/2018_04_26_082810_change_email_to_phone_from_passwordreset_table.php new file mode 100644 index 0000000..7739e7f --- /dev/null +++ b/database/migrations/2018_04_26_082810_change_email_to_phone_from_passwordreset_table.php @@ -0,0 +1,32 @@ +renameColumn('email', 'phone'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('password_resets', function (Blueprint $table) { + $table->renameColumn('phone', 'email'); + }); + } +} diff --git a/database/migrations/2018_04_27_021807_add_id_to_password_reset.php b/database/migrations/2018_04_27_021807_add_id_to_password_reset.php new file mode 100644 index 0000000..c5a2e68 --- /dev/null +++ b/database/migrations/2018_04_27_021807_add_id_to_password_reset.php @@ -0,0 +1,30 @@ +increments('id'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + // + } +} diff --git a/database/seeds/DatabaseSeeder.php b/database/seeds/DatabaseSeeder.php index e119db6..4a81932 100644 --- a/database/seeds/DatabaseSeeder.php +++ b/database/seeds/DatabaseSeeder.php @@ -11,6 +11,7 @@ class DatabaseSeeder extends Seeder */ public function run() { - // $this->call(UsersTableSeeder::class); + $this->call(LaratrustSeeder::class); + $this->call(UsersTableSeeder::class); } } diff --git a/database/seeds/LaratrustSeeder.php b/database/seeds/LaratrustSeeder.php new file mode 100644 index 0000000..b4506e0 --- /dev/null +++ b/database/seeds/LaratrustSeeder.php @@ -0,0 +1,118 @@ +command->info('Truncating User, Role and Permission tables'); + $this->truncateLaratrustTables(); + + $config = config('laratrust_seeder.role_structure'); + $userPermission = config('laratrust_seeder.permission_structure'); + $mapPermission = collect(config('laratrust_seeder.permissions_map')); + + foreach ($config as $key => $modules) { + + // Create a new role + $role = \App\Role::create([ + 'name' => $key, + 'display_name' => ucwords(str_replace('_', ' ', $key)), + 'description' => ucwords(str_replace('_', ' ', $key)) + ]); + $permissions = []; + + $this->command->info('Creating Role '. strtoupper($key)); + + // Reading role permission modules + foreach ($modules as $module => $value) { + + foreach (explode(',', $value) as $p => $perm) { + + $permissionValue = $mapPermission->get($perm); + + $permissions[] = \App\Permission::firstOrCreate([ + 'name' => $permissionValue . '-' . $module, + 'display_name' => ucfirst($permissionValue) . ' ' . ucfirst($module), + 'description' => ucfirst($permissionValue) . ' ' . ucfirst($module), + ])->id; + + $this->command->info('Creating Permission to '.$permissionValue.' for '. $module); + } + } + + // Attach all permissions to the role + $role->permissions()->sync($permissions); + + $this->command->info("Creating '{$key}' user"); + + // Create default user for each role + $user = \App\User::create([ + 'name' => ucwords(str_replace('_', ' ', $key)), + 'phone' => $key, + 'password' => bcrypt('password') + ]); + + $user->attachRole($role); + } + + // Creating user with permissions + if (!empty($userPermission)) { + + foreach ($userPermission as $key => $modules) { + + foreach ($modules as $module => $value) { + + // Create default user for each permission set + $user = \App\User::create([ + 'name' => ucwords(str_replace('_', ' ', $key)), + 'phone' => $key, + 'password' => bcrypt('password'), + 'remember_token' => str_random(10), + ]); + $permissions = []; + + foreach (explode(',', $value) as $p => $perm) { + + $permissionValue = $mapPermission->get($perm); + + $permissions[] = \App\Permission::firstOrCreate([ + 'name' => $permissionValue . '-' . $module, + 'display_name' => ucfirst($permissionValue) . ' ' . ucfirst($module), + 'description' => ucfirst($permissionValue) . ' ' . ucfirst($module), + ])->id; + + $this->command->info('Creating Permission to '.$permissionValue.' for '. $module); + } + } + + // Attach all permissions to the user + $user->permissions()->sync($permissions); + } + } + } + + /** + * Truncates all the laratrust tables and the users table + * + * @return void + */ + public function truncateLaratrustTables() + { + Schema::disableForeignKeyConstraints(); + DB::table('permission_role')->truncate(); + DB::table('permission_user')->truncate(); + DB::table('role_user')->truncate(); + \App\User::truncate(); + \App\Role::truncate(); + \App\Permission::truncate(); + Schema::enableForeignKeyConstraints(); + } +} diff --git a/database/seeds/UsersTableSeeder.php b/database/seeds/UsersTableSeeder.php new file mode 100644 index 0000000..179e87e --- /dev/null +++ b/database/seeds/UsersTableSeeder.php @@ -0,0 +1,21 @@ +insert([ + 'name' => str_random(10), + 'phone' => "01234567890", + 'password' => bcrypt('secret'), + 'is_verified' => true + ]); + } +} diff --git a/routes/api.php b/routes/api.php index 96683eb..b716fa9 100644 --- a/routes/api.php +++ b/routes/api.php @@ -17,8 +17,9 @@ use App\Company; // return $request->user(); //}); -Route::post('register', 'AuthController@register'); +//Route::post('register', 'AuthController@register'); Route::post('login', 'AuthController@login'); + //Route::post('recover', 'AuthController@recover'); // //Route::group(['middleware' => ['jwt.auth']], function() { @@ -35,14 +36,25 @@ Route :: get('/warehouse','WarehouseController@index'); -Route :: delete('/contacts/{ff_id}','ContactController@destroy'); +Route :: delete('/contacts/{contacts_id}','ContactController@destroy'); Route :: get('/contacts','ContactController@index'); -Route :: post('/contacts','ContactController@store'); +//Route :: post('/contacts','ContactController@store'); + + +Route::post('password/recover', 'AuthController@recover'); +Route::post('password/reset', 'AuthController@reset'); + + +Route::post('send-verification', 'AuthController@sendVerification'); +Route::post('verify', 'AuthController@verifyUser'); + Route::group(['middleware' => ['jwt.auth']], function() { Route::get('logout', 'AuthController@logout'); - Route::get('test', function(){ - return response()->json(['foo'=>'bar']); + Route :: post('/contacts','ContactController@store'); + Route::put('user', 'AuthController@updateUser'); + Route::get('test', function(Request $request){ + return response()->json(['user'=> $request->user()]); }); }); diff --git a/start.sh b/start.sh new file mode 100644 index 0000000..f7da8d5 --- /dev/null +++ b/start.sh @@ -0,0 +1,3 @@ +#!/bin/bash +while ! nc -z db 3306; do sleep 3; done +php artisan serve --host=0.0.0.0 --port=8000 \ No newline at end of file diff --git a/tests/Feature/LoginTest.php b/tests/Feature/LoginTest.php new file mode 100644 index 0000000..005d4aa --- /dev/null +++ b/tests/Feature/LoginTest.php @@ -0,0 +1,26 @@ +json('POST', '/api/login', ['phone' => '01234567899','password' => '123']); + + $response + ->assertStatus(201) + ->assertJson([ + 'created' => true, + ]); + } +} diff --git a/tests/Feature/RegisterTest.php b/tests/Feature/RegisterTest.php new file mode 100644 index 0000000..af24b74 --- /dev/null +++ b/tests/Feature/RegisterTest.php @@ -0,0 +1,26 @@ +json('POST', '/api/register', ['name' => 'Sally']); + + $response + ->assertStatus(201) + ->assertJson([ + 'created' => true, + ]); + } +} diff --git a/tests/TestCase.php b/tests/TestCase.php index 2932d4a..44aacc0 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -7,4 +7,12 @@ use Illuminate\Foundation\Testing\TestCase as BaseTestCase; abstract class TestCase extends BaseTestCase { use CreatesApplication; + + protected function headers($user = null) + { + $token = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC8xMjcuMC4wLjE6ODAwMFwvYXBpXC9sb2dpbiIsImlhdCI6MTUyNjQ1ODExMiwiZXhwIjoxNTI3NjY3NzEyLCJuYmYiOjE1MjY0NTgxMTIsImp0aSI6InVnOFJnellnbzlVNWxWQ1kiLCJzdWIiOjUsInBydiI6Ijg3ZTBhZjFlZjlmZDE1ODEyZmRlYzk3MTUzYTE0ZTBiMDQ3NTQ2YWEifQ.NosAWtXlIPzGVYYz46CoPhseo0WQPQZpuR1t9mCwvX0"; + $headers = ['HTTP_Authorization' => 'Bearer '.$token]; + + return $headers; + } } diff --git a/tests/Unit/contactTest.php b/tests/Unit/contactTest.php index a149a58..35ef645 100644 --- a/tests/Unit/contactTest.php +++ b/tests/Unit/contactTest.php @@ -10,111 +10,22 @@ use Illuminate\Foundation\Testing\WithoutMiddleware; class contactTest extends TestCase { - /** - * A basic test example. - * - * @return void - */ - public function testBasicExample() - { - $response = $this->json('POST', '/api/contacts', ['ff_id' => '14']); - - $response - ->assertStatus(201); -// ->assertJson( -// [ -// 'success' => true, -// 'message' => 'Success' -// //'response' => [ -// // 'id' => $contacts->ff_id, -// // ] -// ]); - } public function testGet() -// { -// $response = $this->json('GET', '/api/contacts'); -// -// $response -// ->assertStatus(200); -// -// } + { + $response = $this->json('GET', '/api/company/search/cief'); + + $response + ->assertStatus(200); + + } + + public function testStoreId() { - $response = $this->get('/api/contacts'); - - $response->assertStatus(200); - } - -// public function testUPdate() -// { -// -// $response = $this->json('PUT', '/api/warehouse/{war_id}' . $article->id, $payload, $headers) -// ->assertStatus(200) -// ->assertJson([ -// 'id' => 1, -// 'title' => 'Lorem', -// 'body' => 'Ipsum' -// ]); -// } - -// public function testPostWarehouse() -// { -// $response = $this->json('POST', '/api/warehouse', [ -// -// 'address'=> '2d', -// 'city'=>'cj ', -// 'zip'=>' 123', -// 'state' =>' sl', -// 'contact_person' =>'asif ', -// 'contact_person_no' =>'1212122 ', -// 'branch'=>'yap ', -// 'country' =>' ba', -// 'company_id' =>'1212 ' -// -// -// -// -// -// -// ]); -// -// $response -// ->assertStatus(201); -//// ->assertJson([ -//// 'created' => true, -// // ] -// //); -// } - - public function testPutWarehouse() - { - $response = $this->json('PUT', '/api/warehouse/6', [ - - 'address'=> '2g', - 'city'=>'cj ', - 'zip'=>' 123', - 'state' =>' sl', - 'contact_person' =>'tuytguy', - 'contact_person_no' =>'1212122 ', - 'branch'=>'yap ', - 'country' =>' ba', - 'company_id' =>'1212 ' - - - - - - - ]); - + $response = $this->json('POST', '/api/contacts', ['company_id' => '1'], $this->headers()); $response - ->assertStatus(200); -// ->assertJson([ -// -// ] -// ); + ->assertStatus(201); + } - - } diff --git a/tests/warehouseTest.php b/tests/warehouseTest.php new file mode 100644 index 0000000..a2247c1 --- /dev/null +++ b/tests/warehouseTest.php @@ -0,0 +1,120 @@ +json('POST', '/api/contacts', ['ff_id' => '14']); + + $response + ->assertStatus(201); +// ->assertJson( +// [ +// 'success' => true, +// 'message' => 'Success' +// //'response' => [ +// // 'id' => $contacts->ff_id, +// // ] +// ]); + } + + + public function testGet() +// { +// $response = $this->json('GET', '/api/contacts'); +// +// $response +// ->assertStatus(200); +// +// } + { + $response = $this->get('/api/contacts'); + + $response->assertStatus(200); + } + +// public function testUPdate() +// { +// +// $response = $this->json('PUT', '/api/warehouse/{war_id}' . $article->id, $payload, $headers) +// ->assertStatus(200) +// ->assertJson([ +// 'id' => 1, +// 'title' => 'Lorem', +// 'body' => 'Ipsum' +// ]); +// } + +// public function testPostWarehouse() +// { +// $response = $this->json('POST', '/api/warehouse', [ +// +// 'address'=> '2d', +// 'city'=>'cj ', +// 'zip'=>' 123', +// 'state' =>' sl', +// 'contact_person' =>'asif ', +// 'contact_person_no' =>'1212122 ', +// 'branch'=>'yap ', +// 'country' =>' ba', +// 'company_id' =>'1212 ' +// +// +// +// +// +// +// ]); +// +// $response +// ->assertStatus(201); +//// ->assertJson([ +//// 'created' => true, +// // ] +// //); +// } + + public function testPutWarehouse() + { + $response = $this->json('PUT', '/api/warehouse/6', [ + + 'address'=> '2g', + 'city'=>'cj ', + 'zip'=>' 123', + 'state' =>' sl', + 'contact_person' =>'tuytguy', + 'contact_person_no' =>'1212122 ', + 'branch'=>'yap ', + 'country' =>' ba', + 'company_id' =>'1212 ' + + + + + + + ]); + + $response + ->assertStatus(200); +// ->assertJson([ +// +// ] +// ); + } + + +}