ls / client-assistant
Installs: 2 165
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 3
Open Issues: 1
Requires
- anhskohbo/no-captcha: ^3.5
- firebase/php-jwt: ^6.8
- guzzlehttp/guzzle: ^7.0
- hekmatinasser/verta: ^2.1
- illuminate/collections: ^8.83
- illuminate/routing: ^8.83
- illuminate/view: ^8.83
- larapack/dd: ^1.1
- nyholm/psr7: ^1.8
- phpfastcache/phpfastcache: ^8.1
- predis/predis: ^2.2
- respect/validation: ^2.2
- sentry/sdk: ^3.5
- symfony/http-foundation: ^5.4
- vlucas/phpdotenv: ^5.5
Requires (Dev)
- dev-main
- v1.45.11
- v1.45.10
- v1.45.09
- v1.45.08
- v1.45.07
- v1.45.06
- v1.45.05
- v1.45.04
- v1.45.03
- v1.45.02
- v1.45.01
- v1.45.0
- v1.44.24
- v1.44.23
- v1.44.22
- v1.44.21
- v1.44.20
- v1.44.13
- v1.44.12
- v1.44.11
- v1.44.10
- v1.44.09
- v1.44.08
- v1.44.07
- v1.44.06
- v1.44.05
- v1.44.04
- v1.44.03
- v1.44.02
- v1.44.01
- v1.41.19
- v1.41.18
- v1.41.17
- v1.41.16
- v1.41.15
- v1.41.14
- v1.41.13
- v1.41.12
- v1.41.11
- v1.41.10
- v1.41.9
- v1.41.8
- v1.41.7
- v1.41.6
- v1.41.5
- v1.41.4
- v1.41.3
- v1.41.2
- v1.41.1
- v1.41.0
- v1.40.4
- v1.40.3
- v1.40.2
- v1.40.1
- v1.40.0
- v1.39.5
- v1.39.4
- v1.39.3
- v1.39.2
- v1.39.1
- v1.39.0
- v1.38.5
- v1.38.4
- v1.38.3
- v1.38.2
- v1.38.1
- v1.38.0
- v1.37.2
- v1.37.1
- v1.37.0
- v1.36.48
- v1.36.47
- v1.36.46
- v1.36.45
- v1.36.44
- v1.36.43
- v1.36.42
- v1.36.41
- v1.36.40
- v1.36.26
- v1.36.25
- v1.36.24
- v1.36.23
- v1.36.22
- v1.36.21
- v1.36.20
- v1.36.19
- v1.36.18
- v1.36.17
- v1.36.16
- v1.36.15
- v1.36.14
- v1.36.12
- v1.36.11
- v1.36.10
- v1.36.9
- v1.36.8
- v1.36.7
- v1.36.6
- v1.36.5
- v1.36.4
- v1.36.3
- v1.36.2
- v1.36.1
- v1.36.0
- v1.33.94
- v1.33.93
- v1.33.92
- v1.33.91
- v1.33.9
- v1.33.8
- v1.33.7
- v1.33.6
- v1.33.5
- v1.33.4
- v1.33.3
- v1.33.2
- v1.33.1
- v1.33.0
- v1.31.10
- v1.31.9
- v1.31.8
- v1.31.7
- v1.31.6
- v1.31.5
- v1.31.4
- v1.31.3
- v1.31.2
- v1.31.1
- v1.31.0
- v1.30.81
- v1.30.8
- v1.30.7
- v1.30.6
- v1.30.5
- v1.30.4
- v1.30.3
- v1.30.2
- v1.30.1
- v1.30.0
- v1.29.9
- v1.29.8
- v1.29.7
- v1.29.6
- 1.29.5
- v1.29.4
- v1.29.3
- v1.29.2
- v1.28.54
- v1.28.53
- v1.28.52
- v1.28.51
- v1.28.50
- v1.28.49
- v1.28.48
- v1.28.47
- v1.28.46
- v1.28.45
- v1.28.44
- v1.28.43
- v1.28.41
- v1.28.40
- v1.28.39
- v1.28.38
- v1.28.37
- v1.28.36
- v1.28.35
- v1.28.34
- v1.28.33
- v1.28.32
- v1.28.31
- v1.28.30
- v1.28.29
- v1.28.28
- v1.28.27
- v1.28.26
- v1.28.25
- v1.28.24
- v1.28.23
- v1.28.22
- v1.28.21
- v1.28.20
- v1.28.19
- v1.28.18
- v1.28.17
- v1.28.16
- v1.28.15
- v1.28.14
- v1.28.13
- v1.28.12
- v1.28.11
- v1.28.10
- v1.28.9
- v1.28.8
- v1.28.7
- v1.28.5
- v1.28.3
- v1.28.1
- v1.28.0
- v1.27.12
- v1.27.11
- v1.27.10
- v1.27.9
- v1.21.8
- v1.21.7
- v1.21.6
- v1.21.5
- v1.21.4
- v1.21.3
- v1.21.2
- v1.21.1
- v1.21.0
- v1.20.31
- v1.20.30
- v1.20.29
- v1.20.28
- v1.20.27
- v1.20.26
- v1.20.25
- v1.20.24
- v1.20.23
- v1.20.22
- v1.20.21
- v1.20.20
- v1.20.19
- v1.20.18
- v1.20.17
- v1.20.16
- v1.20.15
- v1.20.14
- v1.20.13
- v1.20.12
- v1.20.11
- v1.20.10
- v1.20.9
- v1.20.8
- v1.20.7
- v1.20.6
- v1.20.5
- v1.20.4
- v1.20.3
- v1.20.1
- v1.19.14
- v1.19.13
- v1.19.12
- v1.19.11
- v1.19.10
- v1.19.9
- v1.19.8
- v1.19.7
- 1.19.6
- v1.19.5
- 1.19.4
- 1.19.3
- 1.19.2
- v1.19.1
- v1.19.0
- v1.18.13
- v1.18.12
- v1.18.11
- v1.18.10
- v1.18.9
- v1.18.8
- v1.18.7
- v1.18.6
- v1.18.5
- v1.18.4
- v1.18.3
- v1.18.2
- v1.18.1
- v1.18.0
- v1.17.11
- v1.17.10
- v1.17.9
- v1.17.8
- v1.17.7
- v1.17.6
- v1.17.5.1
- v1.17.5
- v1.17.4
- v1.17.3
- v1.17.2
- v1.17.1
- v1.17.0
- v1.16.19
- v1.16.18
- v1.16.17
- v1.16.16
- v1.16.15
- v1.16.14
- v1.16.13
- v1.16.12
- v1.16.11
- v1.16.10
- v1.16.9
- v1.16.8
- v1.16.7
- v1.16.6
- v1.16.5
- v1.16.4
- v1.16.3
- v1.16.2
- v1.16.1
- v1.16.0
- v1.15.9
- v1.15.8
- v1.15.7
- v1.15.6
- v1.15.5
- v1.15.4
- v1.15.3
- v1.15.2
- v1.15.1
- v1.15.0
- v1.14.12
- v1.14.11
- v1.14.10
- v1.14.9
- v1.14.8
- v1.14.7
- v1.14.6
- v1.14.5
- v1.14.4
- v1.14.3
- v1.14.2
- v1.14.1
- v1.14.0
- v1.13.37
- v1.13.36
- v1.13.35
- v1.13.34
- v1.13.33
- v1.13.32
- v1.13.31
- v1.13.30
- v1.13.29
- v1.13.28
- v1.13.27
- v1.13.26
- v1.13.25
- v1.13.24
- v1.13.23
- v1.13.22
- v1.13.21
- v1.13.20
- v1.13.19
- v1.13.18
- v1.13.17
- v1.13.16
- v1.13.15
- v1.13.14
- v1.13.13
- v1.13.12
- v1.13.11
- v1.13.10
- v1.13.9
- v1.13.8
- v1.13.7
- v1.13.6
- v1.13.5
- v1.13.4
- v1.13.3
- v1.13.2
- v1.13.1
- v1.13.0
- v1.12.9
- v1.12.8
- v1.12.7
- v1.12.6
- v1.12.5
- v1.12.4
- v1.12.3
- v1.12.2
- v1.12.1
- v1.12.0
- v1.11.1
- v1.11.0
- v1.10.19
- v1.10.18
- v1.10.17
- v1.10.16
- v1.10.15
- v1.10.14
- v1.10.13
- v1.10.12
- v1.10.11
- v1.10.10
- v1.10.9
- v1.10.8
- v1.10.7
- v1.10.6
- v1.10.5
- v1.10.4
- v1.10.3
- v1.10.2
- v1.10.1
- v1.10.0
- v1.9.19
- v1.9.18
- v1.9.17
- v1.9.16
- v1.9.15
- v1.9.14
- v1.9.13
- v1.9.12
- v1.9.11
- v1.9.10
- v1.9.9
- v1.9.8
- v1.9.7
- v1.9.6
- v1.9.5
- v1.9.4
- v1.9.3
- v1.9.2
- v1.9.1
- v1.9.0
- v1.8.71
- v1.8.8
- v1.8.7
- v1.8.6
- v1.8.5
- v1.8.4
- v1.8.3
- v1.8.2
- v1.8.1
- v1.8.0
- v1.7.3
- v1.7.2
- v1.7.1
- v1.7.0
- v1.6.16
- v1.6.15
- v1.6.14
- v1.6.13
- v1.6.12
- v1.6.11
- v1.6.10
- v1.6.9
- v1.6.8
- v1.6.7
- v1.6.6
- v1.6.5
- v1.6.4
- v1.6.3
- v1.6.2
- v1.6.1
- v1.6.0
- v1.5.18
- v1.5.17
- v1.5.16
- v1.5.15.1
- v1.5.15
- v1.5.14
- v1.5.13
- v1.5.12
- v1.5.11
- v1.5.10
- v1.5.9
- v1.5.8
- v1.5.7
- v1.5.6
- v1.5.5
- v1.5.4
- v1.5.3
- v1.5.2
- v1.5.1
- v1.5.0
- v1.4.17
- v1.4.16
- v1.4.15
- v1.4.14
- v1.4.13
- v1.4.12
- v1.4.11
- v1.4.10
- v1.4.9
- v1.4.8
- v1.4.7
- v1.4.6
- v1.4.5
- v1.4.4
- v1.4.3
- v1.4.2
- v1.4.1
- v1.4.0
- v1.3.2
- v1.3.1
- v1.3.0
- v1.2.3
- v1.2.2
- v1.2.1
- v1.2.0
- v1.1.1
- v1.0.1
- v1.0.0
- dev-fix/quiz-video-multiple
- dev-review-emojy
- dev-pwa/update
- dev-apa
- dev-snap_madam
- dev-bugfix/default_media
- dev-revert-423-fix/errors
- dev-revert-419-fix/errors
- dev-fix/errors
- dev-fix/some-change
- dev-refactore/api-class
- dev-pwa-v2
- dev-develop
- dev-fix/bug-result-to-data-key
- dev-fix/bug-result-to-data
- dev-add/lms-product-item-utils
- dev-addCMS
- dev-hotfix/pathname
- dev-fix/authRedirect
- dev-dr/search-and-single-pi
- dev-dr/course-performance
- dev-improvement/project-name
- dev-dr/enrolls2pwa-dashboard
- dev-dr/pwa-dashboard
- dev-refactor-and-profile-page
- dev-pageSeoMeta
- dev-fix-cache-flush
- dev-ignore-post-request-in-static-cache
- dev-fix/updateAxios
- dev-changeGatewayCopyright
- dev-pwa/fixManifest
- dev-dr/pwa4
- dev-dr/pwa-3
- dev-dr/pwa-changes2
- dev-change/crm-tasks
- dev-dr/cache-changes
- dev-fix/clear-cache
- dev-dr/workflow-forms-new-mode
- dev-dr/fix-static-cache
- dev-fix/task-source
- dev-fix/addErrorMsg
- dev-hotfix/remove-unused-enrollment-var
- dev-fix/consult-form
- dev-feature/transferAuthToSdk
- dev-pages
- dev-ui/snappPayBanks-2
- dev-change/snap-pay
- dev-ui/quick-pay
- dev-ui/minimal-landing-b
- dev-ui/minimal-landing
- dev-bug-fix
- dev-feature/addAuthVuejs
- dev-fix/verify-auth
- dev-fix/pageEditorModalStyle
- dev-m-landdind
- dev-seo
- dev-fix/gateways
- dev-test
- dev-theme
- dev-revert-248-theme
- dev-mini/video-cover
- dev-practic
- dev-hook/landing-logo
- dev-hook-default-image
- dev-hooksClients
- dev-fix/ckeditor
- dev-clientStructure
- dev-cart-payment
- dev-fix/token-nullable
- dev-abortNotification/supportSubdomains
This package is auto-updated.
Last update: 2024-11-23 20:56:13 UTC
README
Common methods
Most of the utilities has three method including get
, list
, search
that you can use statically
get
The get method is for fetch a single item, take a look at the example below
Parameters:
- id or slug
- with (optional - this parameter is when you want someting that is related to it, like you want to have prodcut and the creator data then you pass like this: ['user'])
LMSProduct::get(1, ['user']);
list
To get the list of someting you can just easily call list method, list method comes with four optional paramaters:
Paramters:
- with (optional)
- keyValues (optional - for filtering)
- perPage (optional - for pagination, the defualt number is 20 and it means 20 items per page)
- orderBy (optional - you can set an order for returned collection which the default is
OrderByEnum::LATEST
)
LMSProduct::list();
search
To search items you can use search method statically and it comes with four arguments which are optional.
Parameters:
- keyword (optional - the keyword you wanna search for)
- columns (optional - the columns name you want to be returned)
- with (optional)
- perPage (optional)
LMSProduct::search();
queryParams
Some of utilities has a method called queryParams
that is used to handle the parameters that are passed by url query params which can be accessible with $_GET in php.
Parameters:
- params
- with
- perPage
LMSProduct::queryParams();
Return type of methods
all the result from utilites are type of Collection
that comes with some useful feature that you can use in your projects. To get more information about collections click on the link below.
Authentication
There are two different authentication method you can use that are PasswordBasedAuth
and TwoFaBasedAuth
.
When user is successfully loggeed in or registered a token will be returned that you can store that token in user browser cookies to keep the user logged in.
Password based
Login
To login with your (mobile, email) and password.
PasswordBasedAuth::login($mobileOrEmail, $password);
If user already exists a token will be returned as result.
Register
To register you need to pass the parameters below:
- mobileOrEmail
- password
- password confirmation
PasswordBasedAuth::register($mobileOrEmail, $password, $passwordConfirmation);
After calling the register
method a otp will be sent to the user and you have to verify it.
verifyVerificationCode
To verify otp.
Parameters:
- mobileOrEmail
- otp
PasswordBasedAuth::verifyVerificationCode($mobileOrEmail, $otp);
If the otp is valid a token will be returned.
sendVerificationCode
To send an otp again.
PasswordBasedAuth::sendVerificationCode($mobileOrEmail);
Two fa based
login
To login or register.
TwoFaBasedAuth::login($mobileOrEmail);
An otp will be sent to the user then user has to verify it in order to get the token to be logged in.
verifyVerificationCode
TwoFaBasedAuth::verifyVerificationCode($mobileOrEmail, $otp);
If the otp is valid then a token will be returned as result.
sendVerificationCode
To an otp again
TwoFaBasedAuth::sendVerificationCode($mobileOrEmail);
logout
TwoFaBasedAuth::logout($userToken);
Storing the token in user browser
To store the returned token in authentication scenario, we provide the Token
class.
Token::token($token)->setCookie()->weeks(2);
We just stored the token for 2 weeks in user browser, there are also other methods you can use instead of weeks
like seconds
, minutes
, hours
, days
and weeks
.
You can also delete the token.
Token::token($token)->remove();
Just like that.
User
me
To get the all information about a user, you just need to pass the user token to the me
method.
User::me($userToken);
loggedIn
If you want to check if nor user is logged in you just need to call loggedIn
method and pass userToken.
User::loggedIn($userToken);
logout
User::logout($userToken);
updateUserInfo
To update user information like (real_name, display_name, gender, birth_date) you just need to pass mentioned data as an array and userToken as second argument.
User::updateUserInfo($data, $userToken);
A real example could be:
User::updateUserInfo([ 'real_name' => 'Amir Salehi', 'display_name' => 'Amir', 'gender' => 'male', 'birth_date' => '2001-09-27', ], $userToken);
courses
To get all the courses that user has purchased.
User::courses($userToken);
stats
Stats include (courses_count, questions_count, comments_count, days_with_platform)
User::stats($userToken);
uploadResumeBanner
To upload user resume's benner.
Paramters:
- file (uploaded file's response content)
- userToken
- title (optional)
- attachment id (optional - for updating resume banner)
User::uploadResumeBanner($file, $userToken, $title, $attachmentId);
updatePassword
To update user password.
Parameters:
- current password
- new password
- password confirmation
- user token
User::updatePassword($currentPassword, $newPassword, $passwordConfirmation, $userToken);
uploadProfileImage
To upload profile image
- file (uploaded file's response content)
- userToken
- title (optional)
- attachment id (optional - for updating user profile image)
User::uploadProfileImage($file, $userToken, $title, $attachmentId);
Update user mobile
In updating user mobile scenario, you first need to send an otp for user and then verify it.
sendOtpForMobileNumber
User::sendOtpForMobileNumber($mobile, $userToken);
verifyCodeForUpdatingMobileNumber
User::verifyCodeForUpdatingMobileNumber($mobile, $otp, $userToken);
CMS
CMS class includes five funtionalities that four of them are type of Common methods
that are explained at first (get
, list
, search
).
Signal
Signal include actions like (visit, like, dislike, rate, bookmark), for example to save a new like for a post you just need to write the code below:
Parameters:
- post id
- type (visit, like, dislike, rate, bookmark)
- value
CMS::signal($postId, 'like', 1);
Cart
Cart includes the common methods
(get
, list
, search
). Basically cart is for the shoppng basket in your website.
Chapter enrollment
User might have enrolled just some chapters that you can get the purchased chapters via this class.
ChapterEnrollment::forUser($userToken);
Comments
Comments of a product
To get all the comments of a product.
Parameters:
- Product id
- perPage (optional - for pagination, the default value is 20)
Comment::getLMSProductComments($productId, $perPage);
Comments of a post
To get all the comments of a post.
Parameters:
- post id
- perPage (optional - for pagination, the default value is 20)
Comment::getPostComments($postId, $perPage);
Comments of a shop product
To get all the comments of a shop product.
Parameters:
- shop id
- perPage (optional - for pagination, the default value is 20)
Comment::getShopProductComments($shopId, $perPage);
Coupon
Coupon has three Commen methods
that mentioned at first. Basically you can get information about existed coupons in platform by using this class.
Enrollments
Enrollment has three commen methods
that are mentioned at first (get
, list
, search
). but also it comes with two new methods called logs
and signal
.
logs
To get the logs of a enrollment to just can easily call the logs
method statically. The logs include all the information about every single session that user has viewed, played or completed.
First of all you need to use
the Enrollment class in first line of your code.
use Ls\ClientAssistant\Utilities\Modules\Enrollment;
By just using the code below you can get all the logs of an enrollment.
Paramters:
- enrollment id
- user token
Enrollment::logs(4, $userToken);
signal
Signals are a comment pattern in this framework that you can do some little action, for example, you can signal the action that user just played a video or viewed the session page. In order to that you can use the sample code below.
Parameters:
- enrollment id
- product id
- type (visited, played, completed)
- user token
Enrollment::signal(1, 1, 'visited', $userToken);
Gift
Gift are for gamification section that has three Common methods
that are mentioned at first (get
, list
, search
).
LMS Product
LMS Product comes with a lot of funcationally and some of the are Common methods
that are mentioned at first (get
, list
, search
, queryParams
).
chapters
To get all the chapters of a product.
LMSProduct::chapters($productId);
chapterStats
To get the stats about chapters that includes (chapter_complete_percentage)
Parameters:
- product id
- chapter id
- user token
LMSProduct::chapterStats($productId, $chapterId, $userToken);
nextItem
To get the next item's data of an item (like a video of a session that user is watching).
LMSProduct::nextItem($productId, $itemId);
prevItem
To get the previous item's data of an item (like a video of a session that user is watching).
LMSProduct::prevItem($productId, $itemId);
nextChapter
To get the next chapter's data.
LMSProduct::nextChapter($productId, $chapterId);
prevChapter
To get the previous chapter's data.
LMSProduct::prevChapter($productId, $chapterId);
faculty
To get all the information about teachers and mentors of an product.
LMSProduct::faculty($productId);
demo
To get the free items of a product which are known for demo.
LMSProduct::demo($productId);
createTopic
To create a topic for an item (session) of a product.
Parameters:
- data (includes: item_id, title, content, attachment(optional), is_anonymous(optional), section(optional), community(optional), department(optional))
- userToken
LMSProduct::createTopic([ 'title' => 'How to print a hello world in javascript?', 'content' => 'The long content of How to print a hello world in javascript?' ], $userToken);
QC
QC consists of three common methods
that are mentioned at first (get
, list
, search
).
addReview
To add a review for a product
Parameters:
- product id
- item id
- rate
- comment (optional)
- userToken
QC::addReview([ 'product_id' => 1, 'item_id' => 1, 'rate' => 5, ], $userToken);
Support
Support section consists of three sections that are community, topic and reply.
Community
list
To get the list of communities.
Parameters:
- with (optional)
- keyValue (optional)
- perPage (optional)
- orderBy (optional)
SupportCommunity::list();
stats
To get the stats about community like (active_students, topics_count, community_count)
SupportCommunity::stats();
Topic
Topic includes three Common methods
that are mentioned at first (get
, list
, search
).
Reply
reply
To reply a topic.
Parameters:
- data (topic_id, content, attachment(optional))
- userToken
SupportReply::reply([ 'topic_id' => 1, 'content' => 'this is a reply', ], $userToken);
update
To update a reply.
Parameters:
- data (topic_id, replye_id, content, attachment(optional))
- userToken
SupportReply::update([ 'topic_id' => 1, 'reply_id' => 1, 'content' => 'this is a reply', ], $userToken);
like
To like a reply.
Parameters:
- topic id
- reply id
- userToken
SupportReply::like($topicId, $replyId, $userToken);
delete
To delete a reply.
Parameters:
- topic id
- reply id
- userToken
SupportReply::delete($topicId, $replyId, $userToken);
Survery
Survery includes three Common methods that are mentioned at first (get
, list
, search
).
Term
Term includes three Common methods that are mentioned at first (get
, list
, search
).
Tools
Some useful tools are implemented to provide you better experience working with this framework
DateTime
To covert english date time to persian.
DateTime::toPersianDate($enDate);
IP
To get the user IP.
IP::get();
To get info about ip
IP::info($ip);
Lang
To convert persian number to english.
Lang::persianNumbers($number);
To convert english number to persian.
Lang::latinNumbers($number);
Price
To convert price to persian price.
Price::toPersianPrice($price);