camelcasetechsd / skillsbuilder

1 stars 0 forks source link

SBP-24: [NEW FEATURE] The training provider (training manager) and/or the trainer/instructor and/or student can review the resources and the material if they paid for it #24

Closed solimansamy closed 6 years ago

solimansamy commented 7 years ago

Related to #25

solimansamy commented 7 years ago

Frontend Features

Only subscribers can download materials if they paid for it

Technical Approach

  1. Create new entity for subscriber https://github.com/camelcasetechsd/skillsbuilder/issues/27.
  2. We need to encrypt/decrypt download link, see below
public static function encrypt($text)
    {
        return str_replace(array('+', '/'), array('-', '_'), base64_encode(openssl_encrypt($text, WWW-DDD-WWW, any-number-of-random-characters, true, any-number-of-random-characters)));
    }
public static function decrypt($text)
    {
        return openssl_decrypt(base64_decode(str_replace(array('-', '_'), array('+', '/'), $text)), 'WWW-DDD-WWW', 'any-number-of-random-characters', true, 'any-number-of-random-characters');
    }
  1. If current user is a subscriber then create for him download link on the fly using encrypt method and into download action decrypt the parameter sent by GET method using decrypt method.
badr4php commented 7 years ago

PR : https://git.camelcasetech.com/ahmed.elbougha/skillsbuilderpro/pulls/14

babanesma commented 7 years ago

@badr4php for any additional queries to be run please create new migration file in db/migrations