Jump to content
Bicrypto v4.6.0 + All Plugins
Posted
  • Administrators
comment_58758

QRPay - Money Transfer with QR Code Full Solution


QRPay offers a comprehensive solution for seamless money transfers using QR codes, catering to Android and iOS platforms, along with a user-friendly website and efficient admin panels. The system comprises three distinct interfaces: User Panel, Merchant Panel, and Super Admin Panel. Key features encompass effortless money transfers through QR codes, swift payment processing, mobile top-up services, bill payment functionalities, streamlined remittance solutions, virtual card options, a secure payment checkout page, versatile payment gateway integration, and an accessible Developer API. Our commitment is in delivering exceptional software solutions at a budget-friendly cost, empowering you to capitalize on opportunities and excel in this dynamic industry. Embrace the opportunity to elevate ordinary operations into extraordinary accomplishments with QRPay.


QRPay - Money Transfer with QR Code Full Solution

Support is available for paid files only
Support for free files is offered for a fee only

  • Replies 26
  • Views 4.1k
  • Created
  • Last Reply

Top Posters In This Topic

Most Popular Posts

  • Updated

  • Ghost Tester
    Ghost Tester

    not nulled

  • Ufuk G
    Ufuk G

    resources\installer\src\Controllers/BaseController.php <?php namespace Project\Installer\Controllers; use Exception; use Illuminate\Http\Request; use App\Http\Controllers\Controller; use Project

Posted Images

Featured Replies

  • Mahmoud changed the title to QRPay v2.4.1 - Money Transfer with QR Code Full Solution NULLED
  • Mahmoud changed the title to QRPay v3.2.0 - Money Transfer with QR Code Full Solution
  • 2 months later...
  • Mahmoud changed the title to QRPay v4.3.0 - Money Transfer with QR Code Full Solution NULLED
  • 3 weeks later...
  • Mahmoud changed the title to QRPay v4.5.0 - Money Transfer with QR Code Full Solution
comment_71598
resources\installer\src\Controllers/BaseController.php

<?php

namespace Project\Installer\Controllers;

use Exception;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Project\Installer\Helpers\DBHelper;
use Illuminate\Support\Facades\Validator;
use Project\Installer\Helpers\ErrorHelper;
use Project\Installer\Helpers\Helper;
use Project\Installer\Helpers\RequirementHelper;
use Project\Installer\Helpers\URLHelper;
use Project\Installer\Helpers\ValidationHelper;

class BaseController extends Controller {

    public function __construct()
    {
        if(!request()->routeIs('project.install.finish') && request()->routeIs('project.install.*')) {
            if(env("PURCHASE_CODE",'') != "") {
                return abort(404);
            }
        }else if(request()->routeIs('project.install.finish')) {
            if(DBHelper::step('admin_account' !== "PASSED")) {
                return abort(404);
            }
        }
    }

    public function welcomeView(Helper $helper) {
        cache()->driver('file')->forget($helper->cache_key);
        $page_title = "Installation - Welcome";
        return view('installer.pages.welcome',compact('page_title'));
    }

    public function installationProcessCancel() {
        $page_title = "Installation - Cancel";
        return view('installer.pages.cancel',compact('page_title'));
    }

    public function requirementsView(ErrorHelper $handleError, RequirementHelper $handleRequirements) {

        if($handleRequirements->requirementConfigIsInvalid()) {
            return $handleError->redirectErrorPage(['Failed to open installer configuration file!']);
        }

        $requirements = $handleRequirements->getRequirementStatus();
        // Get All status

        $page_title = "Installation - Requirements";
        return view('installer.pages.requirements',compact('page_title','requirements'));
    }

    public function purchaseValidationForm() {
        if(RequirementHelper::step() != "PASSED") {
            return redirect()->route('project.install.requirements');
        }

        $page_title = "Installation - Validation";
        return view('installer.pages.validation-form',compact('page_title'));
    }

    public function purchaseValidationFormSubmit(Request $request, ErrorHelper $handleError, ValidationHelper $validator, Helper $helper) {

        $request->validate([
            'username'      => 'required|string',
            'code'          => 'required|string',
        ]);

        try{
            if($validator->isLocalInstallation()) {
                $helper->cache($request->all());
                $validator->setStepSession();
            }else {
                $validator->validate($request->all());
            }
        }catch(Exception $e) {
            return $handleError->redirectErrorPage([$e->getMessage()]);
        }
        return redirect()->route('project.install.database.config');
    }

    public function databaseConfigView(Helper $helper) {
        $page_title = "Installation - Database Configuration";
        if(RequirementHelper::step() !== "PASSED") return redirect()->route('project.install.requirements');
        if(ValidationHelper::step() !== "PASSED") return redirect()->route('project.install.validation.form');

        $host_name = request()->host();
        if($host_name != "localhost" && $host_name != "127.0.0.1") {
            $host_name = gethostname();
        }

        return view('installer.pages.database-config',compact('page_title','host_name'));
    }

    public function databaseConfigSubmit(Request $request, DBHelper $db, Helper $helper) {

        $validator = Validator::make($request->all(),[
            'app_name'          => 'required|string|max:150',
            'host'              => 'required|string',
            'db_name'           => 'required|string|max:100',
            'db_user'           => 'required|string',
            'db_user_password'  => 'nullable|string',
        ]);

        if($validator->fails()) {
            return back()->withErrors($validator)->withInput();
        }
        $validated = $validator->validate();

        try{
            $db->create($validated);
        }catch(Exception $e) {
            return back()->with('error',$e->getMessage());
        }

        return redirect()->route('project.install.migration.view');
    }

    public function migrationView(Helper $helper, URLHelper $url) {

        if(RequirementHelper::step() !== "PASSED") return redirect()->route('project.install.requirements');
        if(ValidationHelper::step() !== "PASSED") return redirect()->route('project.install.validation.form');
        if(DBHelper::step() !== "PASSED") return redirect()->route('project.install.database.config');

        $database_data = DBHelper::getSessionData();

        $page_title = "Installation - Database Migration";
        return view('installer.pages.migration',compact('page_title','database_data'));
    }

    public function migrationSubmit(Request $request, DBHelper $db) {
        try{
            $db->migrate();
        }catch(Exception $e) {
            return back()->with('error',$e->getMessage());
        }
        return redirect()->route('project.install.admin.setup');
    }

    public function accountSetup(Helper $helper) {
        $page_title = "Installation - Admin account settings";
        if(RequirementHelper::step() !== "PASSED") return redirect()->route('project.install.requirements');
        if(ValidationHelper::step() !== "PASSED") return redirect()->route('project.install.validation.form');
        if(DBHelper::step() !== "PASSED") return redirect()->route('project.install.database.config');
        if(DBHelper::step('migrate') !== "PASSED") return redirect()->route('project.install.migration.view');

        return view('installer.pages.admin-setup',compact('page_title'));
    }

    public function accountUpdate(Request $request, DBHelper $db) {
        
        $request->validate([
            'email'     => "required|string|email",
            'f_name'    => "required|string",
            'l_name'    => "required|string",
            'password'  => "required|string",
        ],[
            'email.required'    => "Email address is required",
            'email.email'       => "Email address must be an valid email",
            'f_name.required'   => "First name is required",
            'l_name.required'   => "Last name is required",
            'password.required' => "Password field is required",
        ]);

        try{
            $db->updateAccountSettings($request->all());
        }catch(Exception $e) {
            return back()->with('error',$e->getMessage());
        }

        return redirect()->route('project.install.finish');
    }

    public function finish(Helper $helper) {
        $page_title = "Installation - Finish";
        if(RequirementHelper::step() !== "PASSED") return redirect()->route('project.install.requirements');
        if(ValidationHelper::step() !== "PASSED") return redirect()->route('project.install.validation.form');
        if(DBHelper::step() !== "PASSED") return redirect()->route('project.install.database.config');
        if(DBHelper::step('migrate') !== "PASSED") return redirect()->route('project.install.migration.view');
        if(DBHelper::step('admin_account' !== "PASSED")) return redirect()->route('project.install.admin.setup');

        cache()->driver("file")->forget($helper->cache_key);

        return view('installer.pages.finish',compact('page_title'));
    }

}
resources\installer\src\Helpers/DBHelper.php

<?php 

namespace Project\Installer\Helpers;

use Exception;
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
use Symfony\Component\Process\Process;

class DBHelper {

    public function create(array $data) {
        $this->updateEnv([
            'DB_CONNECTION'     => "mysql",
            'DB_HOST'           => $data['host'],
            'DB_PORT'           =>"3306",
            'DB_DATABASE'       => $data['db_name'],
            'DB_USERNAME'       => $data['db_user'],
            'DB_PASSWORD'       => $data['db_user_password'],
        ]);
        
        $this->setStepSession();
        $this->saveDataInSession($data);

        $helper = new Helper();
        $helper->cache($data);
    }

    public function updateEnv(array $replace_array) {
        $array_going_to_modify  = $replace_array;

        if (count($array_going_to_modify) == 0) {
            return false;
        }

        $env_file = App::environmentFilePath();
        $env_content = $_ENV;

        $update_array = ["APP_ENV" => App::environment()];

        foreach ($env_content as $key => $value) {
            foreach ($array_going_to_modify as $modify_key => $modify_value) {

                if(!array_key_exists($modify_key,$env_content) && !array_key_exists($modify_key,$update_array)) {
                    $update_array[$modify_key] = $this->setEnvValue($modify_key,$modify_value);
                    break;
                }

                if ($key == $modify_key) {
                    $update_array[$key] = $this->setEnvValue($key,$modify_value);
                    break;
                } else {
                    $update_array[$key] = $this->setEnvValue($key,$value);
                }
            }
        }

        $string_content = "";
        foreach ($update_array as $key => $item) {
            $line = $key . "=" . $item;
            $string_content .= $line . "\n\r";
        }

        sleep(2);

        file_put_contents($env_file, $string_content);
    }

    public function setEnvValue($key,$value) {
        if($key == "APP_KEY") {
            return $value;
        }
        return '"'.$value.'"';
    }

    public function saveDataInSession($data) {
        session()->put('database_config_data',$data);
    }

    public static function getSessionData() {
        return session('database_config_data');
    }

    public function setStepSession() {
        session()->put("database_config","PASSED");
    }

    public static function step($step = 'database_config') {
        return session($step);
    }

    public function migrate() {
        self::execute("php artisan migrate:fresh --seed");
        self::execute("php artisan migrate");
        self::execute("php artisan passport:install");

        $this->setMigrateStepSession();

        $helper = new Helper();
        $data = cache()->driver("file")->get($helper->cache_key);

        // update env to production
        $this->updateEnv([
            'APP_ENV'               => "production",
        ]);
    }

    public function setMigrateStepSession() {
        session()->put('migrate','PASSED');
    }

    public function updateAccountSettings(array $data) {

        $helper = new Helper();
        $helper->cache($data);

        $p_code = $helper->cache()['code'] ?? "";
        if($p_code == "") {
            cache()->driver('file')->forget($helper->cache_key);
            throw new Exception("Something went wrong! Purchase code registration failed! Please try again");
        }

        $admin = DB::table('admins')->first();
        if(!$admin) {
            DB::table('admins')->insert([
                'firstname'     => $data['f_name'],
                'lastname'      => $data['l_name'],
                'password'      => password_hash($data['password'],PASSWORD_DEFAULT),
                'email'         => $data['email'],
            ]);
        }else {
            DB::table("admins")->where('id',$admin->id)->update([
                'firstname'     => $data['f_name'],
                'lastname'      => $data['l_name'],
                'password'      => password_hash($data['password'],PASSWORD_DEFAULT),
                'email'         => $data['email'],
            ]);
        }

        $validator = new ValidationHelper();
        if($validator->isLocalInstallation() == false) {
            $helper->connection($helper->cache());
        }

        $client_host = parse_url(url('/'))['host'];
        $filter_host = preg_replace('/^www\./', '', $client_host);

        if(Schema::hasTable('script')) {
            DB::table('script')->truncate();
            DB::table('script')->insert([
                'client'        => $filter_host,
                'signature'     => $helper->signature($helper->cache()),
            ]);
        }
        if(Schema::hasTable('basic_settings')) {
            try{
                DB::table('basic_settings')->where('id',1)->update([
                    'site_name'     => $helper->cache()['app_name'] ?? "",
                ]);
            }catch(Exception $e) {
                //handle error
            }
        }

        $db = new DBHelper();
        $db->updateEnv([
            'PURCHASE_CODE' => $p_code,
            'APP_MODE'      => "live",
        ]);

        // $helper->generateAppKey();
        $this->setAdminAccountStepSession();
    }

    public function setAdminAccountStepSession() {
        session()->put('admin_account','PASSED');
    }

    public static function execute($cmd): string
    {
        $process = Process::fromShellCommandline($cmd);

        $processOutput = '';

        $captureOutput = function ($type, $line) use (&$processOutput) {
            $processOutput .= $line;
        };

        $process->setTimeout(null)
            ->run($captureOutput);

        if ($process->getExitCode()) {
            throw new Exception($cmd . " - " . $processOutput);
        }

        return $processOutput;
    }
}
resources\installer\src\Helpers/ValidationHelper.php

<?php 

namespace Project\Installer\Helpers;

use Exception;
use Illuminate\Http\Client\RequestException;
use Illuminate\Http\Client\Response;
use Illuminate\Support\Facades\Http;
use Project\Installer\Helpers\Helper;
use Project\Installer\Helpers\URLHelper;

class ValidationHelper {

    public function validate(array $data) {

        $config = new ConfigHelper();
        $url = new URLHelper();
        $db = new DBHelper();
        $helper = new Helper();

        $data['client'] = $helper->client();
        $helper->connection($data);

        $helper->cache($data);

        $this->setStepSession();
    }

    public function setStepSession() {
        session()->put('validation',"PASSED");
    }

    public static function step() {
        return session('validation');
    }

    public function isLocalInstallation() {
    	return true;
        $url = request()->url();
        $url_path = parse_url($url);
        $host = $url_path['host'];
        if($host == "localhost" || $host == "127.0.0.1") return true;
        return false;
    }
}

 

4.5 Full Null İnstall 

comment_71638
On 6/25/2024 at 10:38 AM, Adegboye Rapheal said:

@farter1234 Its asking for 

Codecanyon Username and Purchase code

You need to make sure that you have made changes to all 3 files listed , for example in this first file it shows you the folders that you need to enter to find the file that you need to make changes to , copy the code below , enter the file , remove any existing code and just paste the new code and do this for all three files, after you do this it is still going to ask you for your username and purchase code just type in any random letters or numbers ,anything at all the installation will go through successfully

For example here you need to enter the resources folder,in there you'll see the installer folder,in there you'll see the src folder then controllers folder and finally the base controller.php file ,remove any code in there and copy and paste the code just below then save ,do this for all 3 files,good luck 

 

the design and functionality of this script is very beautiful and extensive if you have any issues installing it just post a screenshot of the issue 👍

 

PS I also noticed that the sub domain you are trying to install the script on does not have SSL installed , so far all of the hosting providers I have used offer free SSL and most of the time they add it to your domain name automatically but they don't always do this with sub domains you will have to do it manually you can do so by searching for the ssl/tls  section on the control panel of your hosting , that section should display all the domains and sub domains and give you the option to activate the free SSL that comes with each one

Screenshot_20240625-113233.png

Edited by farter1234
Clarification

comment_71764

@Ufuk Gerror importing database

 php artisan migrate:fresh --seed - Dropping all tables ............................................... 1ms FAIL Illuminate\Database\QueryException could not find driver (SQL: SHOW FULL TABLES WHERE table_type = 'BASE TABLE') at vendor/laravel/framework/src/Illuminate/Database/Connection.php:760 756▕ // If an exception occurs when attempting to run a query, we'll format the error 757▕ // message to include the bindings with SQL, which will make this exception a 758▕ // lot more helpful to the developer instead of just the database's errors. 759▕ catch (Exception $e) { ➜ 760▕ throw new QueryException( 761▕ $query, $this->prepareBindings($bindings), $e 762▕ ); 763▕ } 764▕ } [2m+44 vendor frames [22m 45 artisan:37 Illuminate\Foundation\Console\Kernel::handle()image.png.98cadd1a79a4fa708b7302f4e6a0e74e.png

Edited by Orokimundu Strong

  • Mahmoud changed the title to QRPay v4.7.0 - Money Transfer with QR Code Full Solution
  • 2 weeks later...
  • 1 month later...
comment_81103

@Ghost Tester @Reyyryh G replace the current code with below mentioned code:

 

resources\installer\src\Controllers/BaseController.php

<?php

namespace Project\Installer\Controllers;

use Exception;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Project\Installer\Helpers\DBHelper;
use Illuminate\Support\Facades\Validator;
use Project\Installer\Helpers\ErrorHelper;
use Project\Installer\Helpers\Helper;
use Project\Installer\Helpers\RequirementHelper;
use Project\Installer\Helpers\URLHelper;
use Project\Installer\Helpers\ValidationHelper;

class BaseController extends Controller {

    public function __construct()
    {
        if(!request()->routeIs('project.install.finish') && request()->routeIs('project.install.*')) {
            if(env("PURCHASE_CODE",'') != "") {
                return abort(404);
            }
        }else if(request()->routeIs('project.install.finish')) {
            if(DBHelper::step('admin_account' !== "PASSED")) {
                return abort(404);
            }
        }
    }

    public function welcomeView(Helper $helper) {
        cache()->driver('file')->forget($helper->cache_key);
        $page_title = "Installation - Welcome";
        return view('installer.pages.welcome',compact('page_title'));
    }

    public function installationProcessCancel() {
        $page_title = "Installation - Cancel";
        return view('installer.pages.cancel',compact('page_title'));
    }

    public function requirementsView(ErrorHelper $handleError, RequirementHelper $handleRequirements) {

        if($handleRequirements->requirementConfigIsInvalid()) {
            return $handleError->redirectErrorPage(['Failed to open installer configuration file!']);
        }

        $requirements = $handleRequirements->getRequirementStatus();
        // Get All status

        $page_title = "Installation - Requirements";
        return view('installer.pages.requirements',compact('page_title','requirements'));
    }

    public function purchaseValidationForm() {
        if(RequirementHelper::step() != "PASSED") {
            return redirect()->route('project.install.requirements');
        }

        $page_title = "Installation - Validation";
        return view('installer.pages.validation-form',compact('page_title'));
    }

    public function purchaseValidationFormSubmit(Request $request, ErrorHelper $handleError, ValidationHelper $validator, Helper $helper) {

        $request->validate([
            'username'      => 'required|string',
            'code'          => 'required|string',
        ]);

        try{
            if($validator->isLocalInstallation()) {
                $helper->cache($request->all());
                $validator->setStepSession();
            }else {
                $validator->validate($request->all());
            }
        }catch(Exception $e) {
            return $handleError->redirectErrorPage([$e->getMessage()]);
        }
        return redirect()->route('project.install.database.config');
    }

    public function databaseConfigView(Helper $helper) {
        $page_title = "Installation - Database Configuration";
        if(RequirementHelper::step() !== "PASSED") return redirect()->route('project.install.requirements');
        if(ValidationHelper::step() !== "PASSED") return redirect()->route('project.install.validation.form');

        $host_name = request()->host();
        if($host_name != "localhost" && $host_name != "127.0.0.1") {
            $host_name = gethostname();
        }

        return view('installer.pages.database-config',compact('page_title','host_name'));
    }

    public function databaseConfigSubmit(Request $request, DBHelper $db, Helper $helper) {

        $validator = Validator::make($request->all(),[
            'app_name'          => 'required|string|max:150',
            'host'              => 'required|string',
            'db_name'           => 'required|string|max:100',
            'db_user'           => 'required|string',
            'db_user_password'  => 'nullable|string',
        ]);

        if($validator->fails()) {
            return back()->withErrors($validator)->withInput();
        }
        $validated = $validator->validate();

        try{
            $db->create($validated);
        }catch(Exception $e) {
            return back()->with('error',$e->getMessage());
        }

        return redirect()->route('project.install.migration.view');
    }

    public function migrationView(Helper $helper, URLHelper $url) {

        if(RequirementHelper::step() !== "PASSED") return redirect()->route('project.install.requirements');
        if(ValidationHelper::step() !== "PASSED") return redirect()->route('project.install.validation.form');
        if(DBHelper::step() !== "PASSED") return redirect()->route('project.install.database.config');

        $database_data = DBHelper::getSessionData();

        $page_title = "Installation - Database Migration";
        return view('installer.pages.migration',compact('page_title','database_data'));
    }

    public function migrationSubmit(Request $request, DBHelper $db) {
        try{
            $db->migrate();
        }catch(Exception $e) {
            return back()->with('error',$e->getMessage());
        }
        return redirect()->route('project.install.admin.setup');
    }

    public function accountSetup(Helper $helper) {
        $page_title = "Installation - Admin account settings";
        if(RequirementHelper::step() !== "PASSED") return redirect()->route('project.install.requirements');
        if(ValidationHelper::step() !== "PASSED") return redirect()->route('project.install.validation.form');
        if(DBHelper::step() !== "PASSED") return redirect()->route('project.install.database.config');
        if(DBHelper::step('migrate') !== "PASSED") return redirect()->route('project.install.migration.view');

        return view('installer.pages.admin-setup',compact('page_title'));
    }

    public function accountUpdate(Request $request, DBHelper $db) {
        
        $request->validate([
            'email'     => "required|string|email",
            'f_name'    => "required|string",
            'l_name'    => "required|string",
            'password'  => "required|string",
        ],[
            'email.required'    => "Email address is required",
            'email.email'       => "Email address must be an valid email",
            'f_name.required'   => "First name is required",
            'l_name.required'   => "Last name is required",
            'password.required' => "Password field is required",
        ]);

        try{
            $db->updateAccountSettings($request->all());
        }catch(Exception $e) {
            return back()->with('error',$e->getMessage());
        }

        return redirect()->route('project.install.finish');
    }

    public function finish(Helper $helper) {
        $page_title = "Installation - Finish";
        if(RequirementHelper::step() !== "PASSED") return redirect()->route('project.install.requirements');
        if(ValidationHelper::step() !== "PASSED") return redirect()->route('project.install.validation.form');
        if(DBHelper::step() !== "PASSED") return redirect()->route('project.install.database.config');
        if(DBHelper::step('migrate') !== "PASSED") return redirect()->route('project.install.migration.view');
        if(DBHelper::step('admin_account' !== "PASSED")) return redirect()->route('project.install.admin.setup');

        cache()->driver("file")->forget($helper->cache_key);

        return view('installer.pages.finish',compact('page_title'));
    }

}
resources\installer\src\Helpers/DBHelper.php

<?php 

namespace Project\Installer\Helpers;

use Exception;
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
use Symfony\Component\Process\Process;

class DBHelper {

    public function create(array $data) {
        $this->updateEnv([
            'DB_CONNECTION'     => "mysql",
            'DB_HOST'           => $data['host'],
            'DB_PORT'           =>"3306",
            'DB_DATABASE'       => $data['db_name'],
            'DB_USERNAME'       => $data['db_user'],
            'DB_PASSWORD'       => $data['db_user_password'],
        ]);
        
        $this->setStepSession();
        $this->saveDataInSession($data);

        $helper = new Helper();
        $helper->cache($data);
    }

    public function updateEnv(array $replace_array) {
        $array_going_to_modify  = $replace_array;

        if (count($array_going_to_modify) == 0) {
            return false;
        }

        $env_file = App::environmentFilePath();
        $env_content = $_ENV;

        $update_array = ["APP_ENV" => App::environment()];

        foreach ($env_content as $key => $value) {
            foreach ($array_going_to_modify as $modify_key => $modify_value) {

                if(!array_key_exists($modify_key,$env_content) && !array_key_exists($modify_key,$update_array)) {
                    $update_array[$modify_key] = $this->setEnvValue($modify_key,$modify_value);
                    break;
                }

                if ($key == $modify_key) {
                    $update_array[$key] = $this->setEnvValue($key,$modify_value);
                    break;
                } else {
                    $update_array[$key] = $this->setEnvValue($key,$value);
                }
            }
        }

        $string_content = "";
        foreach ($update_array as $key => $item) {
            $line = $key . "=" . $item;
            $string_content .= $line . "\n\r";
        }

        sleep(2);

        file_put_contents($env_file, $string_content);
    }

    public function setEnvValue($key,$value) {
        if($key == "APP_KEY") {
            return $value;
        }
        return '"'.$value.'"';
    }

    public function saveDataInSession($data) {
        session()->put('database_config_data',$data);
    }

    public static function getSessionData() {
        return session('database_config_data');
    }

    public function setStepSession() {
        session()->put("database_config","PASSED");
    }

    public static function step($step = 'database_config') {
        return session($step);
    }

    public function migrate() {
        self::execute("php artisan migrate:fresh --seed");
        self::execute("php artisan migrate");
        self::execute("php artisan passport:install");

        $this->setMigrateStepSession();

        $helper = new Helper();
        $data = cache()->driver("file")->get($helper->cache_key);

        // update env to production
        $this->updateEnv([
            'APP_ENV'               => "production",
        ]);
    }

    public function setMigrateStepSession() {
        session()->put('migrate','PASSED');
    }

    public function updateAccountSettings(array $data) {

        $helper = new Helper();
        $helper->cache($data);

        $p_code = $helper->cache()['code'] ?? "";
        if($p_code == "") {
            cache()->driver('file')->forget($helper->cache_key);
            throw new Exception("Something went wrong! Purchase code registration failed! Please try again");
        }

        $admin = DB::table('admins')->first();
        if(!$admin) {
            DB::table('admins')->insert([
                'firstname'     => $data['f_name'],
                'lastname'      => $data['l_name'],
                'password'      => password_hash($data['password'],PASSWORD_DEFAULT),
                'email'         => $data['email'],
            ]);
        }else {
            DB::table("admins")->where('id',$admin->id)->update([
                'firstname'     => $data['f_name'],
                'lastname'      => $data['l_name'],
                'password'      => password_hash($data['password'],PASSWORD_DEFAULT),
                'email'         => $data['email'],
            ]);
        }

        $validator = new ValidationHelper();
        if($validator->isLocalInstallation() == false) {
            $helper->connection($helper->cache());
        }

        $client_host = parse_url(url('/'))['host'];
        $filter_host = preg_replace('/^www\./', '', $client_host);

        if(Schema::hasTable('script')) {
            DB::table('script')->truncate();
            DB::table('script')->insert([
                'client'        => $filter_host,
                'signature'     => $helper->signature($helper->cache()),
            ]);
        }
        if(Schema::hasTable('basic_settings')) {
            try{
                DB::table('basic_settings')->where('id',1)->update([
                    'site_name'     => $helper->cache()['app_name'] ?? "",
                ]);
            }catch(Exception $e) {
                //handle error
            }
        }

        $db = new DBHelper();
        $db->updateEnv([
            'PURCHASE_CODE' => $p_code,
            'APP_MODE'      => "live",
        ]);

        // $helper->generateAppKey();
        $this->setAdminAccountStepSession();
    }

    public function setAdminAccountStepSession() {
        session()->put('admin_account','PASSED');
    }

    public static function execute($cmd): string
    {
        $process = Process::fromShellCommandline($cmd);

        $processOutput = '';

        $captureOutput = function ($type, $line) use (&$processOutput) {
            $processOutput .= $line;
        };

        $process->setTimeout(null)
            ->run($captureOutput);

        if ($process->getExitCode()) {
            throw new Exception($cmd . " - " . $processOutput);
        }

        return $processOutput;
    }
}
resources\installer\src\Helpers/ValidationHelper.php

<?php 

namespace Project\Installer\Helpers;

use Exception;
use Illuminate\Http\Client\RequestException;
use Illuminate\Http\Client\Response;
use Illuminate\Support\Facades\Http;
use Project\Installer\Helpers\Helper;
use Project\Installer\Helpers\URLHelper;

class ValidationHelper {

    public function validate(array $data) {

        $config = new ConfigHelper();
        $url = new URLHelper();
        $db = new DBHelper();
        $helper = new Helper();

        $data['client'] = $helper->client();
        $helper->connection($data);

        $helper->cache($data);

        $this->setStepSession();
    }

    public function setStepSession() {
        session()->put('validation',"PASSED");
    }

    public static function step() {
        return session('validation');
    }

    public function isLocalInstallation() {
    	return true;
        $url = request()->url();
        $url_path = parse_url($url);
        $host = $url_path['host'];
        if($host == "localhost" || $host == "127.0.0.1") return true;
        return false;
    }
}

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Recently Browsing 0

  • No registered users viewing this page.

Latest Updated Files