Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
laravel-adminpanel
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
laravel-adminpanel
Commits
98b8ff6c
Commit
98b8ff6c
authored
Nov 27, 2017
by
Viral Solani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove unwante API Repos
parent
b0204f64
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
0 additions
and
286 deletions
+0
-286
CmsPageRepository.php
app/Repositories/Api/CmsPage/CmsPageRepository.php
+0
-32
RoleRepository.php
app/Repositories/Api/Role/RoleRepository.php
+0
-29
PasswordResetRepository.php
app/Repositories/Api/User/PasswordResetRepository.php
+0
-69
UserRepository.php
app/Repositories/Api/User/UserRepository.php
+0
-156
No files found.
app/Repositories/Api/CmsPage/CmsPageRepository.php
deleted
100755 → 0
View file @
b0204f64
<?php
namespace
App\Repositories\Api\CmsPage
;
use
App\Exceptions\GeneralException
;
use
App\Models\CMSPages\CMSPage
;
use
App\Repositories\BaseRepository
;
/**
* Class CmsPageRepository.
*/
class
CmsPageRepository
extends
BaseRepository
{
/**
* Associated Repository Model.
*/
const
MODEL
=
CMSPage
::
class
;
/**
* Check given user is exist or not.
*
* @return mixed
*/
public
function
findBySlug
(
$page_slug
)
{
if
(
count
(
$this
->
query
()
->
wherePage_slug
(
$page_slug
)
->
get
())
>
0
)
{
return
$this
->
query
()
->
wherePage_slug
(
$page_slug
)
->
get
()
->
toArray
();
}
throw
new
GeneralException
(
trans
(
'exceptions.api.cmspage.not_found'
));
}
}
app/Repositories/Api/Role/RoleRepository.php
deleted
100755 → 0
View file @
b0204f64
<?php
namespace
App\Repositories\Api\Role
;
use
App\Models\Access\Role\Role
;
use
App\Repositories\BaseRepository
;
/**
* Class RoleRepository.
*/
class
RoleRepository
extends
BaseRepository
{
/**
* Associated Repository Model.
*/
const
MODEL
=
Role
::
class
;
/**
* @return mixed
*/
public
function
getDefaultUserRole
()
{
if
(
is_numeric
(
config
(
'access.users.default_role'
)))
{
return
$this
->
query
()
->
where
(
'id'
,
(
int
)
config
(
'access.users.default_role'
))
->
first
();
}
return
$this
->
query
()
->
where
(
'name'
,
config
(
'access.users.default_role'
))
->
first
();
}
}
app/Repositories/Api/User/PasswordResetRepository.php
deleted
100755 → 0
View file @
b0204f64
<?php
namespace
App\Repositories\Api\User
;
use
App\Models\Access\PasswordReset\PasswordReset
;
use
App\Repositories\BaseRepository
;
/**
* Class PermissionRepository.
*/
class
PasswordResetRepository
extends
BaseRepository
{
/**
* Associated Repository Model.
*/
const
MODEL
=
PasswordReset
::
class
;
/**
* Get token by email.
*
* @return mixed
*/
public
function
getByEmail
(
$email
)
{
return
$this
->
query
()
->
where
(
'email'
,
$email
)
->
get
()
->
toArray
();
}
/**
* Check if given email exist or not.
*
* @return mixed
*/
public
function
checkUser
(
$data
)
{
return
$this
->
query
()
->
where
(
'email'
,
$data
[
'email'
])
->
where
(
'token'
,
$data
[
'token'
])
->
get
()
->
toArray
();
}
/**
* Create password reset entry.
*
* @return mixed
*/
public
function
create
(
$attributes
)
{
return
$this
->
query
()
->
insert
(
$attributes
);
}
/**
* If token exist for same user then update.
*
* @return mixed
*/
public
function
update
(
$attributes
)
{
$token
=
[
'token'
=>
$attributes
[
'token'
]];
return
$this
->
query
()
->
where
(
'email'
,
$attributes
[
'email'
])
->
update
(
$attributes
);
}
/**
* Delete entry after reseting the password.
*
* @return mixed
*/
public
function
delete
(
$data
)
{
return
$this
->
query
()
->
where
(
'email'
,
$data
[
'email'
])
->
where
(
'token'
,
$data
[
'token'
])
->
delete
();
}
}
app/Repositories/Api/User/UserRepository.php
deleted
100755 → 0
View file @
b0204f64
<?php
namespace
App\Repositories\Api\User
;
use
App\Mail\ConfirmAcoountMail
;
use
App\Models\Access\User\User
;
use
App\Repositories\Backend\Access\Role\RoleRepository
;
use
App\Repositories\BaseRepository
;
/**
* Class PermissionRepository.
*/
class
UserRepository
extends
BaseRepository
{
/**
* Associated Repository Model.
*/
const
MODEL
=
User
::
class
;
/**
* Protected rolerepository.
*/
protected
$role
;
/**
* @param RoleRepository $role
*/
public
function
__construct
(
RoleRepository
$role
)
{
$this
->
role
=
$role
;
}
/**
* Check given user is exist or not.
*
* @return mixed
*/
public
function
checkUser
(
$email
)
{
return
$this
->
query
()
->
where
(
'email'
,
$email
)
->
get
()
->
toArray
();
}
/**
* Generate OTP when forgot password.
*
* @return mixed
*/
public
function
generateOTP
()
{
return
mt_rand
(
100000
,
999999
);
}
/**
* Reset password.
*
* @return mixed
*/
public
function
resetpassword
(
$data
)
{
$pass
=
[
'password'
=>
bcrypt
(
$data
[
'password'
])];
return
$this
->
query
()
->
where
(
'email'
,
$data
[
'email'
])
->
update
(
$pass
);
}
/**
* Get user details by id.
*
* @return mixed
*/
public
function
getById
(
$id
)
{
return
$this
->
query
()
->
select
(
'first_name'
,
'last_name'
,
'email'
,
'address'
,
'country_id'
,
'state_id'
,
'city_id'
,
'zip_code'
,
'ssn'
,
'status'
,
'created_at'
,
'updated_at'
)
->
where
(
'id'
,
$id
)
->
with
([
'country'
=>
function
(
$query
)
{
$query
->
select
(
'id'
,
'country'
);
}])
->
with
([
'state'
=>
function
(
$query
)
{
$query
->
select
(
'id'
,
'state'
);
}])
->
with
([
'city'
=>
function
(
$query
)
{
$query
->
select
(
'id'
,
'city'
);
}])
->
get
()
->
toArray
();
}
/**
* Create user account.
*
* @param array $data
* @param bool $provider
*
* @return static
*/
public
function
create
(
array
$data
,
$provider
=
false
)
{
$otp
=
$this
->
generateOTP
();
$user
=
self
::
MODEL
;
$user
=
new
$user
();
$user
->
first_name
=
$data
[
'first_name'
];
$user
->
last_name
=
$data
[
'last_name'
];
$user
->
address
=
$data
[
'address'
];
$user
->
state_id
=
$data
[
'state_id'
];
$user
->
country_id
=
config
(
'access.constants.default_country'
);
$user
->
city_id
=
$data
[
'city_id'
];
$user
->
zip_code
=
$data
[
'zip_code'
];
$user
->
ssn
=
$data
[
'ssn'
];
$user
->
email
=
$data
[
'email'
];
$user
->
confirmation_code
=
md5
(
$otp
);
$user
->
status
=
1
;
$user
->
password
=
$provider
?
null
:
bcrypt
(
$data
[
'password'
]);
$user
->
confirmed
=
$provider
?
1
:
(
config
(
'access.users.confirm_email'
)
?
0
:
1
);
$user
->
created_by
=
1
;
\DB
::
transaction
(
function
()
use
(
$user
)
{
if
(
$user
->
save
())
{
/*
* Add the default site role to the new user
*/
$user
->
attachRole
(
$this
->
role
->
getDefaultUserRole
());
}
});
/*
* If users have to confirm their email and this is not a social account,
* send the confirmation email
*
* If this is a social account they are confirmed through the social provider by default
*/
if
(
config
(
'access.users.confirm_email'
)
&&
$provider
===
false
)
{
$Confirmation_mail
=
\Mail
::
to
(
$data
[
'email'
])
->
send
(
new
ConfirmAcoountMail
(
$otp
));
}
/*
* Return the user object
*/
return
$user
;
}
/*
* Check user is already confirmed or not
*/
public
function
checkconfirmation
(
$email
)
{
return
$this
->
query
()
->
where
(
'email'
,
$email
)
->
get
()
->
toArray
();
}
/**
* Confirm user's account.
**/
public
function
confirmUser
(
$email
)
{
$confirmed
=
[
'confirmed'
=>
'1'
];
return
$this
->
query
()
->
where
(
'email'
,
$email
)
->
update
(
$confirmed
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment