Commit ec0d5e2f authored by Vipul Basapati's avatar Vipul Basapati

conflicts resolved with upstream master

parents cb8aab30 ac405436
# laravel-adminpanel # laravel-adminpanel
[![License](https://img.shields.io/badge/License-MIT-red.svg)](https://github.com/viralsolani/laravel-adminpanel/blob/master/LICENSE.txtl) [![License](https://img.shields.io/badge/License-MIT-red.svg)](https://github.com/viralsolani/laravel-adminpanel/blob/master/LICENSE.txtl)
[![StyleCI](https://styleci.io/repos/30171828/shield?style=plastic)](https://styleci.io/repos/105789824/shield?style=plastic)
## Introduction ## Introduction
...@@ -16,6 +17,7 @@ For Laravel 5 Boilerplate Features : [Features](https://github.com/rappasoft/lar ...@@ -16,6 +17,7 @@ For Laravel 5 Boilerplate Features : [Features](https://github.com/rappasoft/lar
* Email Template Module * Email Template Module
* Blog Module * Blog Module
* FAQ Module * FAQ Module
* API Boilerplate - Coming Soon.
Give your project a Head Start by using [laravel-adminpanel](https://github.com/viralsolani/laravel-adminpanel). Give your project a Head Start by using [laravel-adminpanel](https://github.com/viralsolani/laravel-adminpanel).
......
<?php <?php
use App\Exceptions\GeneralException; use App\Exceptions\GeneralException;
use App\Helpers\uuid;
use App\Http\Utilities\SendEmail; use App\Http\Utilities\SendEmail;
use App\Models\Notification\Notification; use App\Models\Notification\Notification;
use App\Models\Settings\Setting; use App\Models\Settings\Setting;
use Carbon\Carbon as Carbon; use Carbon\Carbon as Carbon;
/**
* Henerate UUID.
*
* @return uuid
*/
function generateUuid()
{
return uuid::uuid4();
}
/* /*
* Global helpers file with misc functions. * Global helpers file with misc functions.
*/ */
......
<?php
/**
* Represents a universally unique identifier (UUID), according to RFC 4122.
*
* This class provides the static methods `uuid3()`, `uuid4()`, and
* `uuid5()` for generating version 3, 4, and 5 UUIDs as specified in RFC 4122.
*
* If all you want is a unique ID, you should call `uuid4()`.
*
* @link http://tools.ietf.org/html/rfc4122
* @link http://en.wikipedia.org/wiki/Universally_unique_identifier
* @link http://www.php.net/manual/en/function.uniqid.php#94959
*/
namespace App\Helpers;
class uuid
{
/**
* When this namespace is specified, the name string is a fully-qualified domain name.
*
* @link http://tools.ietf.org/html/rfc4122#appendix-C
*/
const NAMESPACE_DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8';
/**
* When this namespace is specified, the name string is a URL.
*
* @link http://tools.ietf.org/html/rfc4122#appendix-C
*/
const NAMESPACE_URL = '6ba7b811-9dad-11d1-80b4-00c04fd430c8';
/**
* When this namespace is specified, the name string is an ISO OID.
*
* @link http://tools.ietf.org/html/rfc4122#appendix-C
*/
const NAMESPACE_OID = '6ba7b812-9dad-11d1-80b4-00c04fd430c8';
/**
* When this namespace is specified, the name string is an X.500 DN in DER or a text output format.
*
* @link http://tools.ietf.org/html/rfc4122#appendix-C
*/
const NAMESPACE_X500 = '6ba7b814-9dad-11d1-80b4-00c04fd430c8';
/**
* The nil UUID is special form of UUID that is specified to have all 128 bits set to zero.
*
* @link http://tools.ietf.org/html/rfc4122#section-4.1.7
*/
const NIL = '00000000-0000-0000-0000-000000000000';
private static function getBytes($uuid)
{
if (!self::isValid($uuid)) {
throw new InvalidArgumentException('Invalid UUID string: '.$uuid);
}
// Get hexadecimal components of UUID
$uhex = str_replace([
'urn:',
'uuid:',
'-',
'{',
'}',
], '', $uuid);
// Binary Value
$ustr = '';
// Convert UUID to bits
for ($i = 0; $i < strlen($uhex); $i += 2) {
$ustr .= chr(hexdec($uhex[$i].$uhex[$i + 1]));
}
return $ustr;
}
private static function uuidFromHash($hash, $version)
{
return sprintf('%08s-%04s-%04x-%04x-%12s',
// 32 bits for "time_low"
substr($hash, 0, 8),
// 16 bits for "time_mid"
substr($hash, 8, 4),
// 16 bits for "time_hi_and_version",
// four most significant bits holds version number
(hexdec(substr($hash, 12, 4)) & 0x0fff) | $version << 12,
// 16 bits, 8 bits for "clk_seq_hi_res",
// 8 bits for "clk_seq_low",
// two most significant bits holds zero and one for variant DCE1.1
(hexdec(substr($hash, 16, 4)) & 0x3fff) | 0x8000,
// 48 bits for "node"
substr($hash, 20, 12));
}
/**
* Generate a version 3 UUID based on the MD5 hash of a namespace identifier
* (which is a UUID) and a name (which is a string).
*
* @param string $namespace The UUID namespace in which to create the named UUID
* @param string $name The name to create a UUID for
*
* @return string
*/
public static function uuid3($namespace, $name)
{
$nbytes = self::getBytes($namespace);
// Calculate hash value
$hash = md5($nbytes.$name);
return self::uuidFromHash($hash, 3);
}
/**
* Generate a version 4 (random) UUID.
*
* @return string
*/
public static function uuid4()
{
$bytes = function_exists('random_bytes') ? random_bytes(16) : openssl_random_pseudo_bytes(16);
$hash = bin2hex($bytes);
return self::uuidFromHash($hash, 4);
}
/**
* Generate a version 5 UUID based on the SHA-1 hash of a namespace
* identifier (which is a UUID) and a name (which is a string).
*
* @param string $namespace The UUID namespace in which to create the named UUID
* @param string $name The name to create a UUID for
*
* @return string
*/
public static function uuid5($namespace, $name)
{
$nbytes = self::getBytes($namespace);
// Calculate hash value
$hash = sha1($nbytes.$name);
return self::uuidFromHash($hash, 5);
}
/**
* Check if a string is a valid UUID.
*
* @param string $uuid The string UUID to test
*
* @return bool
*/
public static function isValid($uuid)
{
return preg_match('/^(urn:)?(uuid:)?(\{)?[0-9a-f]{8}\-?[0-9a-f]{4}\-?[0-9a-f]{4}\-?[0-9a-f]{4}\-?[0-9a-f]{12}(?(3)\}|)$/i', $uuid) === 1;
}
/**
* Check if two UUIDs are equal.
*
* @param string $uuid1 The first UUID to test
* @param string $uuid2 The second UUID to test
*
* @return bool
*/
public static function equals($uuid1, $uuid2)
{
return self::getBytes($uuid1) === self::getBytes($uuid2);
}
}
<?php
namespace App\Http\Controllers\API\V1;
use App\Http\Controllers\Controller;
use Illuminate\Http\Response as IlluminateResponse;
use Response;
/**
* Base API Controller.
*/
class APIController extends Controller
{
/**
* default status code.
*
* @var int
*/
protected $statusCode = 200;
/**
* get the status code.
*
* @return statuscode
*/
public function getStatusCode()
{
return $this->statusCode;
}
/**
* set the status code.
*
* @param [type] $statusCode [description]
*
* @return mix
*/
public function setStatusCode($statusCode)
{
$this->statusCode = $statusCode;
return $this;
}
/**
* responsd not found.
*
* @param string $message
*
* @return mix
*/
public function respondNotFound($message = 'Not Found')
{
return $this->setStatusCode(IlluminateResponse::HTTP_NOT_FOUND)->respondWithError($message);
}
/**
* Respond with error.
*
* @param string $message
*
* @return mix
*/
public function respondInternalError($message = 'Internal Error')
{
return $this->setStatusCode('500')->respondWithError($message);
}
/**
* Respond.
*
* @param array $data
* @param array $headers
*
* @return mix
*/
public function respond($data, $headers = [])
{
return response()->json($data, $this->getStatusCode(), $headers);
}
/**
* respond with pagincation.
*
* @param Paginator $items
* @param array $data
*
* @return mix
*/
public function respondWithPagination($items, $data)
{
$data = array_merge($data, [
'paginator' => [
'total_count' => $items->total(),
'total_pages' => ceil($items->total() / $items->perPage()),
'current_page' => $items->currentPage(),
'limit' => $items->perPage(),
],
]);
return $this->respond($data);
}
/**
* respond with error.
*
* @param $message
*
* @return mix
*/
public function respondWithError($message)
{
return $this->respond([
'error' => [
'message' => $message,
'status_code' => $this->getStatusCode(),
],
]);
}
/**
* Respond Created.
*
* @param string $message
*
* @return mix
*/
public function respondCreated($message)
{
return $this->setStatusCode(201)->respond([
'message' => $message,
]);
}
/**
* Throw Validation.
*
* @param string $message
*
* @return mix
*/
public function throwValidation($message)
{
return $this->setStatusCode(422)
->respondWithError($message);
}
}
<?php
namespace App\Http\Controllers\Api\V1;
use App\Models\Access\User\User;
use App\Notifications\Activated;
use App\Notifications\Activation;
use App\Notifications\PasswordReset;
use App\Notifications\PasswordResetted;
use Illuminate\Http\Request;
use JWTAuth;
use Tymon\JWTAuth\Exceptions\JWTException;
use Validator;
/**
* AuthController.
*/
class AuthController extends APIController
{
/**
* Authenticate User.
*
* @param Request $request
*
* @return \Illuminate\Http\JsonResponse
*/
public function authenticate(Request $request)
{
$credentials = $request->only('email', 'password');
try {
if (!$token = JWTAuth::attempt($credentials)) {
return $this->throwValidation('Invalid Credentials! Please try again.');
}
} catch (JWTException $e) {
return $this->respondInternalError('This is something wrong. Please try again!');
}
$user = User::whereEmail(request('email'))->first();
if ($user->status != 1) {
return $this->throwValidation('Your account hasn\'t been activated. Please check your email & activate account.');
}
return $this->respond([
'message' => 'You are successfully logged in!',
'token' => $token,
]);
}
/**
* Check if user is authenticated or not.
*
* @return \Illuminate\Http\JsonResponse
*/
public function check()
{
try {
JWTAuth::parseToken()->authenticate();
} catch (JWTException $e) {
return $this->respond([
'authenticated' => false,
]);
}
return $this->respond([
'authenticated' => true,
]);
}
/**
* Log Out.
*
* @return \Illuminate\Http\JsonResponse
*/
public function logout()
{
try {
$token = JWTAuth::getToken();
if ($token) {
JWTAuth::invalidate($token);
}
} catch (JWTException $e) {
return $this->respondInternalError('This is something wrong. Please try again!');
}
return $this->respond([
'message' => 'You are successfully logged out!',
]);
}
/**
* Register User.
*
* @param Request $request
*
* @return \Illuminate\Http\JsonResponse
*/
public function register(Request $request)
{
$validation = Validator::make($request->all(), [
'first_name' => 'required',
'last_name' => 'required',
'email' => 'required|email|unique:users',
'password' => 'required|min:6',
'password_confirmation' => 'required|same:password',
]);
if ($validation->fails()) {
return $this->throwValidation($validation->messages()->first());
}
$user = User::create([
'first_name' => request('first_name'),
'last_name' => request('last_name'),
'email' => request('email'),
'status' => '0',
'password' => bcrypt(request('password')),
'country_id' => 1,
'state_id' => 1,
'city_id' => 1,
'zip_code' => 1,
'ssn' => 123456789,
'created_by' => 1,
]);
$user->confirmation_code = generateUuid();
$user->save();
$user->notify(new Activation($user));
return $this->respondCreated([
'You have registered successfully. Please check your email for activation!',
]);
}
/**
* Activate User.
*
* @param $activation_token [description]
*
* @return \Illuminate\Http\JsonResponse
*/
public function activate($activation_token)
{
$user = User::whereConfirmationCode($activation_token)->first();
if (!$user) {
return $this->throwValidation('Invalid activation token!');
}
if ($user->status == 1) {
return $this->throwValidation('Your account has already been activated!');
}
$user->confirmed = 1;
$user->status = 1;
$user->save();
$user->notify(new Activated($user));
return $this->respond([
'message' => 'Your account has been activated!',
]);
}
public function password(Request $request)
{
$validation = Validator::make($request->all(), [
'email' => 'required|email',
]);
if ($validation->fails()) {
return response()->json(['message' => $validation->messages()->first()], 422);
}
$user = User::whereEmail(request('email'))->first();
if (!$user) {
return response()->json(['message' => 'We couldn\'t found any user with this email. Please try again!'], 422);
}
$token = generateUuid();
\DB::table('password_resets')->insert([
'email' => request('email'),
'token' => $token,
]);
$user->notify(new PasswordReset($user, $token));
return response()->json(['message' => 'We have sent reminder email. Please check your inbox!']);
}
public function validatePasswordReset(Request $request)
{
$validate_password_request = \DB::table('password_resets')->where('token', '=', request('token'))->first();
if (!$validate_password_request) {
return response()->json(['message' => 'Invalid password reset token!'], 422);
}
if (date('Y-m-d H:i:s', strtotime($validate_password_request->created_at.'+30 minutes')) < date('Y-m-d H:i:s')) {
return response()->json(['message' => 'Password reset token is expired. Please request reset password again!'], 422);
}
return response()->json(['message' => '']);
}
public function reset(Request $request)
{
$validation = Validator::make($request->all(), [
'email' => 'required|email',
'password' => 'required|min:6',
'password_confirmation' => 'required|same:password',
]);
if ($validation->fails()) {
return response()->json(['message' => $validation->messages()->first()], 422);
}
$user = User::whereEmail(request('email'))->first();
if (!$user) {
return response()->json(['message' => 'We couldn\'t found any user with this email. Please try again!'], 422);
}
$validate_password_request = \DB::table('password_resets')->where('email', '=', request('email'))->where('token', '=', request('token'))->first();
if (!$validate_password_request) {
return response()->json(['message' => 'Invalid password reset token!'], 422);
}
if (date('Y-m-d H:i:s', strtotime($validate_password_request->created_at.'+30 minutes')) < date('Y-m-d H:i:s')) {
return response()->json(['message' => 'Password reset token is expired. Please request reset password again!'], 422);
}
$user->password = bcrypt(request('password'));
$user->save();
$user->notify(new PasswordResetted($user));
return response()->json(['message' => 'Your password has been reset. Please login again!']);
}
public function changePassword(Request $request)
{
if (env('IS_DEMO')) {
return response()->json(['message' => 'You are not allowed to perform this action in this mode.'], 422);
}
$validation = Validator::make($request->all(), [
'current_password' => 'required',
'new_password' => 'required|confirmed|different:current_password|min:6',
'new_password_confirmation' => 'required|same:new_password',
]);
if ($validation->fails()) {
return response()->json(['message' => $validation->messages()->first()], 422);
}
$user = JWTAuth::parseToken()->authenticate();
if (!\Hash::check(request('current_password'), $user->password)) {
return response()->json(['message' => 'Old password does not match! Please try again!'], 422);
}
$user->password = bcrypt(request('new_password'));
$user->save();
return response()->json(['message' => 'Your password has been changed successfully!']);
}
}
<?php
namespace App\Api\V1\Controllers;
use App\Http\Controllers\Controller;
use App\Repositories\Api\CmsPage\CmsPageRepository;
class CmsPageController extends Controller
{
public function __construct(CmsPageRepository $cmsgpage)
{
$this->cmsgpage = $cmsgpage;
}
public function showCmsPage($page_slug)
{
$result = $this->cmsgpage->findBySlug($page_slug);
return response()
->json([
'status' => 'ok',
'data' => $result,
]);
}
}
<?php
namespace App\Api\V1\Controllers;
use App\Api\V1\Requests\ForgotPasswordRequest;
use App\Http\Controllers\Controller;
use App\Mail\ForgotPasswordMail;
use App\Repositories\Api\User\PasswordResetRepository;
use App\Repositories\Api\User\UserRepository;
use Carbon\Carbon;
use Illuminate\Support\Facades\Password;
use Symfony\Component\HttpKernel\Exception\HttpException;
/**
* Class ForgotPasswordController.
*/
class ForgotPasswordController extends Controller
{
/**
* @var UserRepository
*/
protected $user;
/**
* ForgotPasswordController constructor.
*
* @param UserRepository $user
*/
public function __construct(UserRepository $user, PasswordResetRepository $passwordreset)
{
$this->user = $user;
$this->passwordreset = $passwordreset;
}
/**
* Recovery password api.
*/
public function forgotpassword(ForgotPasswordRequest $request)
{
$check_user = $this->user->checkUser($request->get('email'));
if (!(empty($check_user))) {
$otp = $this->user->generateOTP();
$attributes = [
'email' => $request->get('email'),
'token' => $otp,
'created_at' => Carbon::now(),
];
$check_reset = $this->passwordreset->getByEmail($request->get('email'));
if (empty($check_reset)) {
$token = $this->passwordreset->create($attributes);
} else {
$token = $this->passwordreset->update($attributes);
}
$forgot_mail = \Mail::to($request->get('email'))->send(new ForgotPasswordMail($otp));
return response()->json([
'status' => 'ok',
'data' => ['token' => $otp],
], 200);
}
throw new HttpException(500, trans('validation.api.forgotpassword.email_not_valid'));
}
}
<?php
namespace App\Api\V1\Controllers;
use App\Api\V1\Requests\LoginRequest;
use App\http\Controllers\Controller;
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
use Tymon\JWTAuth\Exceptions\JWTException;
use Tymon\JWTAuth\JWTAuth;
/**
* Class LoginController.
*/
class LoginController extends Controller
{
/*
* Login api for user
*/
public function login(LoginRequest $request, JWTAuth $JWTAuth)
{
$credentials = [
'email' => $request->email,
'password' => $request->password,
];
try {
/**
* check credentials valid or not.
*/
$token = $JWTAuth->attempt($credentials);
if (!$token) {
throw new AccessDeniedHttpException(trans('validation.api.login.username_password_didnt_match'));
}
} catch (JWTException $e) {
throw new HttpException(500);
}
return response()
->json([
'status' => 'ok',
'token' => $token,
]);
}
}
<?php
namespace App\Api\V1\Controllers;
use App\Api\V1\Requests\ConfirmAccountRequest;
use App\Api\V1\Requests\RegisterRequest;
use App\Http\Controllers\Controller;
use App\Repositories\Api\User\UserRepository;
use Symfony\Component\HttpKernel\Exception\HttpException;
/**
* Class RegisterController.
*/
class RegisterController extends Controller
{
/**
* @var UserRepository
*/
protected $user;
/**
* RegisterController constructor.
*
* @param UserRepository $user
*/
public function __construct(UserRepository $user)
{
$this->user = $user;
}
/*
* Register api.
*/
public function Register(RegisterRequest $request)
{
$user = $this->user->create($request->all());
return response()
->json([
'status' => 'ok',
]);
}
/*
* Confirm account api
*/
public function confirmAccount(ConfirmAccountRequest $request)
{
$user = $this->user->checkUser($request->get('email'));
if (!(empty($user))) {
if ($user[0]['confirmation_code'] != '') {
if (md5($request->get('otp')) == $user[0]['confirmation_code']) {
$checkconfirmation = $this->user->checkconfirmation($request->get('email'));
if ($checkconfirmation[0]['confirmed'] == 0) {
$confirmuser = $this->user->confirmUser($request->get('email'));
} else {
throw new HttpException(500, trans('validation.api.confirmaccount.already_confirmed'));
}
} else {
throw new HttpException(500, trans('validation.api.confirmaccount.invalid_otp'));
}
}
} else {
throw new HttpException(500, trans('validation.api.confirmaccount.invalid_email'));
}
return response()
->json([
'status' => 'ok',
]);
}
}
<?php
namespace App\Api\V1\Controllers;
use App\Api\V1\Requests\ResetPasswordRequest;
use App\Http\Controllers\Controller;
use App\Repositories\Api\User\PasswordResetRepository;
use App\Repositories\Api\User\UserRepository;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Password;
use Symfony\Component\HttpKernel\Exception\HttpException;
/**
* Class ResetPasswordController.
*/
class ResetPasswordController extends Controller
{
/**
* @var UserRepository
*/
protected $user;
/**
* ResetPasswordController constructor.
*
* @param UserRepository $user
*/
public function __construct(UserRepository $user, PasswordResetRepository $passwordreset)
{
$this->user = $user;
$this->passwordreset = $passwordreset;
}
/**
* Resetpassword api.
*/
public function resetpassword(ResetPasswordRequest $request)
{
$check_user = $this->user->checkUser($request->get('email'));
if (!(empty($check_user))) {
$response = $this->passwordreset->checkUser($this->credentials($request));
if (!(empty($response))) {
$resetpassword = $this->user->resetpassword($this->credentials($request));
$remove_token = $this->passwordreset->delete($this->credentials($request));
return response()
->json([
'status' => 'ok',
]);
}
throw new HttpException(500, trans('validation.api.resetpassword.token_not_valid'));
}
throw new HttpException(500, trans('validation.api.resetpassword.email_not_valid'));
}
/**
* Get the password reset credentials from the request.
*
* @param ResetPasswordRequest $request
*
* @return array
*/
protected function credentials(ResetPasswordRequest $request)
{
return $request->all(
'email', 'password', 'password_confirmation', 'token'
);
}
}
<?php
namespace App\Api\V1\Controllers;
use App\http\Controllers\Controller;
use App\Repositories\Api\User\UserRepository;
use Dingo\Api\Routing\Helpers;
use Illuminate\Http\Request;
use JWTAuth;
/**
* Class UserDetailController.
*/
class UserDetailController extends Controller
{
use Helpers;
/**
* @var UserRepository
*/
protected $user;
/**
* ResetPasswordController constructor.
*
* @param UserRepository $user
*/
public function __construct(UserRepository $user)
{
$this->user = $user;
}
/*
* User details api
*/
public function userDetails(Request $request)
{
$currentUser = JWTAuth::parseToken()->authenticate();
$user = $this->user->getById($currentUser->id);
return response()
->json([
'status' => 'ok',
'data' => $user,
]);
}
}
...@@ -73,6 +73,8 @@ class Kernel extends HttpKernel ...@@ -73,6 +73,8 @@ class Kernel extends HttpKernel
*/ */
'access.routeNeedsRole' => \App\Http\Middleware\RouteNeedsRole::class, 'access.routeNeedsRole' => \App\Http\Middleware\RouteNeedsRole::class,
'access.routeNeedsPermission' => \App\Http\Middleware\RouteNeedsPermission::class, 'access.routeNeedsPermission' => \App\Http\Middleware\RouteNeedsPermission::class,
'jwt.auth' => \App\Http\Middleware\VerifyJWTToken::class, //'jwt.auth' => \App\Http\Middleware\VerifyJWTToken::class,
'jwt.auth' => \Tymon\JWTAuth\Middleware\GetUserFromToken::class,
'jwt.refresh' => \Tymon\JWTAuth\Middleware\RefreshToken::class,
]; ];
} }
...@@ -35,7 +35,22 @@ class User extends Authenticatable ...@@ -35,7 +35,22 @@ class User extends Authenticatable
* *
* @var array * @var array
*/ */
protected $fillable = ['first_name', 'last_name', 'email', 'password', 'address', 'country_id', 'state_id', 'city_id', 'zip_code', 'ssn', 'status', 'confirmation_code', 'confirmed', 'created_by']; protected $fillable = [
'first_name',
'last_name',
'email',
'password',
'address',
'country_id',
'state_id',
'city_id',
'zip_code',
'ssn',
'status',
'confirmation_code',
'confirmed',
'created_by',
];
/** /**
* The attributes that should be hidden for arrays. * The attributes that should be hidden for arrays.
......
<?php
namespace App\Notifications;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
class Activated extends Notification
{
use Queueable;
/**
* Create a new notification instance.
*
* @return void
*/
protected $user;
public function __construct($user)
{
$this->user = $user;
}
/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
*
* @return array
*/
public function via($notifiable)
{
return ['mail'];
}
/**
* Get the mail representation of the notification.
*
* @param mixed $notifiable
*
* @return \Illuminate\Notifications\Messages\MailMessage
*/
public function toMail($notifiable)
{
$url = url('/');
return (new MailMessage())
->greeting('Hello!')
->line('Your account has been activated.')
->line('Click on the below link to go to our application!')
->action('Proceed', $url)
->line('Thank you for using our application!');
}
/**
* Get the array representation of the notification.
*
* @param mixed $notifiable
*
* @return array
*/
public function toArray($notifiable)
{
return [
//
];
}
}
<?php
namespace App\Notifications;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
class Activation extends Notification
{
use Queueable;
/**
* Create a new notification instance.
*
* @return void
*/
protected $user;
public function __construct($user)
{
$this->user = $user;
}
/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
*
* @return array
*/
public function via($notifiable)
{
return ['mail'];
}
/**
* Get the mail representation of the notification.
*
* @param mixed $notifiable
*
* @return \Illuminate\Notifications\Messages\MailMessage
*/
public function toMail($notifiable)
{
$url = url('/auth/'.$this->user->confirmation_code.'/activate');
return (new MailMessage())
->greeting('Hello!')
->line('Thank you for registering an account with us.')
->line('Click on the below link to verify your email!')
->action('Verify now!', $url)
->line('Thank you for using our application!');
}
/**
* Get the array representation of the notification.
*
* @param mixed $notifiable
*
* @return array
*/
public function toArray($notifiable)
{
return [
//
];
}
}
<?php
namespace App\Notifications;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
class PasswordReset extends Notification
{
use Queueable;
/**
* Create a new notification instance.
*
* @return void
*/
protected $user;
protected $token;
public function __construct($user, $token)
{
$this->user = $user;
$this->token = $token;
}
/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
*
* @return array
*/
public function via($notifiable)
{
return ['mail'];
}
/**
* Get the mail representation of the notification.
*
* @param mixed $notifiable
*
* @return \Illuminate\Notifications\Messages\MailMessage
*/
public function toMail($notifiable)
{
$url = url('/password/reset/'.$this->token);
return (new MailMessage())
->greeting('Hello!')
->line('We have recevied password reset request from you!')
->line('Click on the below link to reset your password.')
->action('Reset Password', $url)
->line('If you haven\'t requested for password reset, please ignore this email.')
->line('Thank you!');
}
/**
* Get the array representation of the notification.
*
* @param mixed $notifiable
*
* @return array
*/
public function toArray($notifiable)
{
return [
//
];
}
}
<?php
namespace App\Notifications;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
class PasswordResetted extends Notification
{
use Queueable;
/**
* Create a new notification instance.
*
* @return void
*/
protected $user;
public function __construct($user)
{
$this->user = $user;
}
/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
*
* @return array
*/
public function via($notifiable)
{
return ['mail'];
}
/**
* Get the mail representation of the notification.
*
* @param mixed $notifiable
*
* @return \Illuminate\Notifications\Messages\MailMessage
*/
public function toMail($notifiable)
{
$url = url('/');
return (new MailMessage())
->greeting('Hello!')
->line('Your password has been reset successfully!')
->line('Click on the below link to continue login.')
->action('Login', $url)
->line('If you haven\'t changed your password, please contact administrator.')
->line('Thank you!');
}
/**
* Get the array representation of the notification.
*
* @param mixed $notifiable
*
* @return array
*/
public function toArray($notifiable)
{
return [
//
];
}
}
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
"App\\": "app/" "App\\": "app/"
}, },
"files": [ "files": [
"app/helpers.php" "app/Helpers/helpers.php"
] ]
}, },
"autoload-dev": { "autoload-dev": {
......
This diff is collapsed.
...@@ -69,7 +69,7 @@ return [ ...@@ -69,7 +69,7 @@ return [
'providers' => [ 'providers' => [
'users' => [ 'users' => [
'driver' => 'eloquent', 'driver' => 'eloquent',
'model' => App\Models\Access\User\User::class, 'model' => User::class,
], ],
// 'users' => [ // 'users' => [
......
...@@ -56,7 +56,7 @@ return [ ...@@ -56,7 +56,7 @@ return [
*/ */
'from' => [ 'from' => [
'address' => env('MAIL_FROM_ADDRESS', 'cygnet.dnjoshi1997@gmail.com'), 'address' => env('MAIL_USERNAME', 'viral.solani@gmail.com'),
'name' => env('MAIL_FROM_NAME', 'Admin'), 'name' => env('MAIL_FROM_NAME', 'Admin'),
], ],
......
{ {
"/js/frontend.js": "/js/frontend.70ee44a92d84e7318a9d.js", "/js/frontend.js": "/js/frontend.2bea3bf4ad584622eb6b.js",
"/js/backend.js": "/js/backend.9cdae6ab449e701ce881.js", "/js/backend.js": "/js/backend.321ce1e5ca635759765f.js",
"/mix.js": "/mix.247ab120fe7680658924.js", "/mix.js": "/mix.247ab120fe7680658924.js",
"/css/frontend.css": "/css/frontend.3af0a6cbd7d1d8d042f2a37e97008b7c.css", "/css/frontend.css": "/css/frontend.3af0a6cbd7d1d8d042f2a37e97008b7c.css",
"/css/backend.css": "/css/backend.f8550f50504e5b8ef6055285205f223a.css", "/css/backend.css": "/css/backend.f8550f50504e5b8ef6055285205f223a.css",
......
<?php
/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/
Route::group(['namespace' => 'Api\V1', 'prefix' => 'v1', 'as' => 'v1.'], function () {
Route::group(['prefix' => 'auth'], function () {
Route::post('/login', 'AuthController@authenticate');
Route::post('/logout', 'AuthController@logout');
Route::post('/check', 'AuthController@check');
Route::post('/register', 'AuthController@register');
Route::get('/activate/{token}', 'AuthController@activate');
Route::post('/password', 'AuthController@password');
Route::post('/validate-password-reset', 'AuthController@validatePasswordReset');
Route::post('/reset', 'AuthController@reset');
});
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment