What is Core Plugin ?

Core Plugin is something that DatingFramework has tight dependency on those plugins. Core Plugins resources eg. Repositories, Models is used directly in DatingFramework so our system can not run without those plugins. Core Plugins cannot be uninstalled from admin panel too. All Core Plugins detailed are given below.

List of Core Plugins

  1. LanguagePlugin
  2. UpdaterPlugin
  3. VisitorPlugin
  4. PeopleNearByPlugin
  5. EncounterPlugin
  6. ChatPlugin
  7. NotificationsPlugin
  8. StripePlugin
  9. PaypalPlugin
  10. SpotlightPlugin

Language Plugin

Language Plugin helps to manage multilanguge feature of DatingFramework. Admin can choose languages form admin panel as default language that reflects to all users. Individual users can choose their own seperate language also.

Directory Structure

  • LanguagePlugin
    • controllers
      • LanguageController.php
    • repositories
      • LanguageRepository.php
    • views
      • language_button.blade.php
      • settings.blade.php
    • asstes
      • js
        • flag.js
    • LanguagePlugin.php

LanguageRepository

method return type description
getSupportedLanguages() array Used to get all supported languages by the application. Returns an array of strings. Eg: ['en', 'ar', 'fr']

*note: To add language choose options in landing pages add {{{Theme::render('top-header')}}} and css <link href="@plugin_asset('LanguagePlugin/css/flag.css')" rel = "stylesheet">

UpdaterPlugin Plugin

This Plugin helps to control versions of DatingFramework. Admin can update the whole system by giving a update url provided by us.

Directory Structure

  • UpdaterPlugin
    • controllers
      • UpdaterController.php
    • repositories
      • UpdaterRepository.php
    • views
      • updater.blade.php
    • updates
      • versions.json
    • UpdaterPlugin.php

UpdaterRepository

method return type description
checkReadWritePermissions(&$error) boolean Used to check app,storage,config,public directory write permissions. Param &$error is an array where this method pushes all the error strings.
checkPermissionStoragePath() boolean Used to check storage directory write permission.
checkPermissionAppPath() boolean Used to check app directory write permission.
checkPermissionConfigPath() boolean Used to check config directory write permission.
checkPermissionPublicPath() boolean Used to check config directory write permission.

Other Details

resource description
UpdaterController.php Used to do all the tasks like check for new updates, downloading update zip file, extracting, copying update files etc.
updater.blade.php Used to show updater view in admin panel.
versions.json Used to store DatingFramework version informations. Eg: current version, update zip file name, from where updates has been downloaded, update file size etc.

VisitorPlugin

Directory Structure

  • VisitorPlugin
    • controllers
      • VisitorController.php
    • repositories
      • VisitorRepository.php
    • views
      • visitor.blade.php
    • VisitorPlugin.php
    • VisotorPluginInstall.php

VisitorRepository

method return type description
getAllVisitors($id) Illuminate\Database\Eloquent\Collection Used to get all visitors of a specified user. $id is integer refers to user id.
getVisitingDetails($id) stdClass Used to get day, week and month wise number of visiters of a specified user. $id is integer refers to user id. Return object contains month, week, day attributes.
get_difference_visit_counts($id) stdClass Used to get details wheather a specific user's visitors count has increased or decreased (day, week, and month wise). $id is integer refers to user id. Return object contains month, week, day attributes. If value is 0 then visitor not increased or if 1 then increased.

Visitor Model

This model is used to store user's visiting details. Located in app/Plugins/VisitorPlugin/models directory and namespace is App\Models. To use this model add use App\Models\Visitor; in your code. Refers to table visitors. The attributes are listed below :

attribute type description
id bigint(20), auto-increment Primary key
user1 bigint(20) Foreign key of user table id column.
user2 bigint(20) Foreign key of user table id column.
status varchar(50) Can be only seen or unseen
created_at timestamp, nullable This field is set when row inserted.
updated_at timestamp, nullable This field is set when row gets updated.
deleted_at timestamp, nullable This field is set when row gets soft deleted.

All the relationship methods are listed below:

method return type description
user() App\Models\User Can be used to get the User object of the visitor refer to user1 column.

PeopleNearByPlugin

This plugin helps your users to see other users in their area and cities nearby. With the help of the filter in the top-right corner, users can find people based on their gender, age, location. Users also can come up on first place in nearby search by paying riseup credits. Credits has to be set by admin.

Directory Structure

  • PeopleNearByPlugin
    • controllers
      • PeopleNearByController.php
    • repositories
      • PeopleNearByRepository.php
    • views
      • peoplenearby.blade.php
    • PeopleNearByPlugin.php
    • PeopleNearByPluginInstall.php

PeopleNearByRepository

method return type description
getUsersByRadious($lat, $lng, $distance, $unit) Illuminate\Database\Eloquent Used to get new users by latitude, longitude within specified distance. $lat is float (latitude), $lng is float (longitude), $distance is integer (radious), $unit is string (km or mile).
getNearbyPeoples ($log_user_id, $gender, $ageLower, $ageUpper, $distance = 1, $curpage) Illuminate\Pagination\LengthAwarePaginator Used to get all nearby users of a specific user with gender and age filter. $log_user_id is integer, $gender is string (profile prefer gender), $ageLower is integer (age filter low limit), $ageUpper is string (age filter upper limit), $distance is integer (radious in km or mile) and $curpage is integer (current page number).
getRiseupCredits() integer used to get rise up credits will be deducted form a user while paying for rise up.
payRiseUp($userid, $credits) void Used to pay credits for riseup of a specific user. $userid is integer(user id who is goint to pay rise up credits) and $crdits is integer (riseup credits to be deducted from users balance).

RiseUp Model

This model is used to store user's riseup details.Refers to table riseup. The attributes are listed below :

attribute type description
id bigint(20), auto-increment Primary key
userid bigint(20) Foreign key of user table id column.
created_at timestamp, nullable This field is set when row inserted.
updated_at timestamp, nullable This field is set when row gets updated.
deleted_at timestamp, nullable This field is set when row gets soft deleted.

All the relationship methods are listed below:

method return type description
user() App\Models\User Can be used to get the User object of the riseup.
getTableName() string Can be used to get table name that of this Elloquent model.

EncounterPlugin

Directory Structure

  • LanguagePlugin
    • controllers
      • EncounterPluginController.php
    • repositories
      • EncouterRepository.php
    • views
      • home.blade.php
      • liked.blade.php
      • matches.blade.php
      • who_liked.blade.php
    • models
      • Encounter.php
      • Match.php
    • EncounterPlugin.php
    • EncounterPluginInstall.php

EncounterRepository

method return type description
insertNotif($from_user,$to_user,$type,$entity_id) App\Models\Notifications Can be used to insert notifications in the notifications table. from_user - The user responsible for creating the notification. to_user - the user that will receive the notification. type - the type of notification, example : visitor, liked etc. entity_id - the id that will be used for sending the notifications.
getTotalEncounters($id) integer This method can be used to get a total count of all the user's, the user with $id has encounterred that day.
nextEncounterUser($logUser , $flag) array This method is used to get an array of user's for the next encounter. It returns an array containing only 1 user model object, if the $flag is set to false or else it contains an array of 10 user model objects.
createEncounter($fromUser, $toUser, $likeOrDislike) App\Models\Encounter This method is used to create an entry in the encounter table, accordingly as the logged in user has liked or disliked the user. If the encounterred user has been blocked by the logged in user, the method returns false.
getEncounterCount($id) integer This method is used to get the total number of encounters left for the user with $id by taking into account the encounter limit set by the admin. If the superpower is activated, the method returns 9999.
getMutualMatch($fromUser, $toUser) App\Models\Encounter This method returns the encounter model object of the entry created when fromUser liked toUser.
createMatch($fromUser, $toUser) App\Models\Match This method is used to create an entry in the matches table when both user's have liked each other. This method also creates an entry in the notifications table for the newly matched user.
getAllMatchedUsers($id) App\Models\Encounter This method is used to get a match model object containing all the matched user's of id = $id. The model object also contains a count of all the matches.
getAllLikes($id) App\Models\Encounter This method is used to get an encounter model object containing all the liked user's of id = $id. The model object also contains a count of all the likes.
whoLiked($userid) stdClass This method is used to get a standard class object with likes attributes containing model object's of all the user's who has liked the user with id = $userid. The attribute count gives a total number of all the user's who has liked the user with id = $userid

Encounter Model

attribute type description
user1 bigint(20) It contains the user id of the user who has liked or disliked another user.
user2 biging(20) It contains the user id of the user who has been liked or disliked by user1.
likes int(5) It either contains 1 if liked or 0 for dislike.

All the relationship methods are listed below:

method return type description
user() App\Models\User Can be used to get the user model object of id in user2 attribute.

Match Model

attribute type description
user1 bigint(20) It contains the user id of one of the matched user's.
user2 biging(20) It contains the user id of the other matched user.

All the relationship methods are listed below:

method return type description
user() App\Models\User Can be used to get the user model object of id in user2 attribute.

ChatPlugin

Directory Structure

  • ChatPlugin
    • controllers
      • ChatController.php
    • repositories
      • ChatRepository.php
    • views
      • chat.blade.php
    • models
      • ChatMessage.php
      • Contacts.php
    • ChatPlugin.php
    • ChatPluginInstall.php

ChatRepository

method return type description
postMessage($to_user,$from_user,$message,$contact_id,$type,$file) void Can be used to create an entry in the msg_chat table for any chat message sent between user's.
isContact($user1,$user2) boolean This method returns true if user1 and user2 are in contacts table in the same row entry.
addContact($user1,$user2,$source = false) string Can be used to create an entry in the contacts table. The $source attribute either contains the source for entry like match, etc or the user id who has sent the message directly.
contacts_count($user_id) integer This method returns a total count of all the contacts of id = $user_id.
contacts($user_id) array This method returns an array of std Class objects containing the details of the user id corresponding to $user_id in the contact table rows and the last message between the two.
unreadChatsWithUser($user,$contact) integer This method returns the count of all the unread chats between $user and $contact.
unread_chats($user_id) Illuminate\Database\Eloquent\Collection This method returns an eloquent object of model ChatMessage containing all the unread chats sent to $user_id
getMessages($contact_id,$user_id,$chat_user_id) Illuminate\Database\Eloquent\Collection This method can be used to get all the messages between two user's with contact id = $contact_id.
getMessagesCount($contact_id) integer This method returns a total count of all the messages between two user's with contact id = $contact_id.
getChatSpotlightUsers() App\Models\Spotlight This method returns a model object containing the user details of the top 4 spotlight users.

ChatMessage Model

attribute type description
from_user bigint(20) This contains the id of the user sending the message.
to_user bigint(20) This contains the id of the user the message is being sent to.
contact_id int(5) This contains the contacts table id containing from_user and to_user.
text text This contains the text message that is to be sent.
type biginteger(20) This contains the type of the Chat Message.
status varchar(1000) This contains the status as 'read' or 'unread' for the message.
meta text

Contacts Model

attribute type description
user1 bigint(20) This contains the user id of one of the user's that can chat.
user2 biging(20) This contains the user id of the other user that can chat with user1.
source varchar(100) This contains the source for entry in the contacts table. example : match - if the two user's are matched or logged in user id of the user initiating the chat.

All the relationship methods are listed below:

method return type description
chat_msg() Illuminate\Database\Eloquent\Collection This method returns an eloquent object containing all the chat messages with contact id - contact_id.
last_user() App\Models\User This method returns a user model object of user id user2.

NotificationsPlugin

Directory Structure

  • NotificationsPlugin
    • controllers
      • NotificationsController.php
    • repositories
      • NotificationsRepository.php
    • views
      • chat.blade.php
    • models
      • Notificatinos.php
    • NotificationsPlugin.php
    • NotificationsPluginInstall.php

NotificationsRepository

method return type description
clearNotifs($type) void This method is used to set all notifications of type - $type to 'seen'.
getLastDayNotifsWithUnseenStatus($from_user, $to_user, $type) App\Models\Notifications This method is used to get all notifications of type - $type, in the last 24 hours between $from_user and $to_user that hasnt been seen by the user's.
getLastDayNotifs($from_user, $to_user, $type) App\Models\Notifications This method is used to get all the notifications of type - $type,in the last 24 hours between $from_user and $to_user.
getNotifs($id) Illuminate\Database\Eloquent\Collection This method returns all unseen notifications that is to be seen by user with id - $id containing name,age and pic of the user responsible for generating the notification.
set_notif_settings($arr,$id) void This method is used to set the notification settings by the logged in user.
save_notif_settings($notif , $userid, $type, $browser, $email) App\Models\NotificationSettings This method returns the notification model object after setting all the attributes for $notif.
getNotificationSettings($id) array This method returns an array of all the browser and email noifications for user with id = $id.
getNotifSettingsByType($id, $type) App\Models\NotificationSettings This method returns a NotificationSettings model object for user with id = $id and type = $type.

Notifications Model

This models belongs to core models. See documentation Notifications

StripePlugin

Directory Structure

  • StripePlugin
    • controllers
      • StripeController.php
    • repositories
      • StripeRepository.php
    • views
      • settings.blade.php
      • tab.blade.php
      • tab_content.blade.php
    • StripePlugin.php

StripeRepository

method return type description
get_stripe_api_key() string This method returns the stripe api key as set by the admin.
getStripePublishableKey() string This method returns the stripe publishable key as set by the admin.

Other Details

resource description
settings.blade.php This blade file contains the admin view for setting the stripe settings.
tab.blade.php This view file contains the tab that is hooked in the pop-up modal for payment.
tab_content.blade.php This view file contains the tab content that is hooked in the pop-up modal for payment.
StripeController.php This controller contains functions for displaying admin stripe settings and saving the settings. It contains a function that is used for charging the user and returns the transaction details for the payment.

PaypalPlugin

Directory Structure

  • PaypalPlugin
    • controllers
      • PaypalController.php
    • repositories
      • PaypalRepository.php
    • views
      • settings.blade.php
      • tab.blade.php
      • tab_content.blade.php
    • PaypalPlugin.php

PaypalRepository

method return type description
curlfun($post,$url) array This method is used to create a post request to $url using curl.

Other Details

resource description
settings.blade.php This blade file contains the admin view for setting the paypal settings.
tab.blade.php This view file contains the tab that is hooked in the pop-up modal for payment.
tab_content.blade.php This view file contains the tab content that is hooked in the pop-up modal for payment.
PaypalController.php This controller contains functions for displaying admin paypal settings and saving the settings. It contains a function that is used for charging the user and the callback returns the flow to PaymentGatewayController with the transaction details .

SpotlightPlugin

Profile Spotlight is a something that helps users can boost their popularity by putting their profile photo with profile link at the top of the page so everyone in the dating app can see it instantly. To come into spotlight users has to pay some credits. Admin has to set the amount of spotlight credits.

Directory Structure

  • SpotlightPlugin
    • controllers
      • SpotlightController.php
    • repositories
      • SpotlightRepository.php
    • models
      • Spotlight.php
    • views
      • spot_view.blade.php
    • SpotlightPlugin.php
    • SpotlightPluginInstall.php

SpotlightRepository

method return type description
addToSpotlight($id) boolean Used to add a user into spotlight. Some amount of user's credit is get deducted. $id is integer refers to user id of user table.
getSpotUsers() Illuminate\Database\Eloquent\Collection Used to take 20 spotlight activated users ordered by updated_at column of spotlight table.
getSpotCredits() integer Used to get amount of spolight credit to be deducted.
getSpotlightScreenshotUrl() string Used to get credit page spotlight image url.

Spotlight Model

Located in app/Plugins/SpotlightPluigin/models directory and namespace is App\Models. To use this model add use App\models\Spotlight; in your code. Refers to table spotlight. The attributes are listed below :

attribute type description
id bigint(20), auto-increment Primary key
userid bigint(20) Foreign key of user table id column.
created_at timestamp, nullable This field is set when row inserted.
updated_at timestamp, nullable This field is set when row gets updated.

All the relationship methods are listed below:

method return type description
user() App\Models\User Can be used to get the User object of the spotlight.