first commit
This commit is contained in:
26
.gitignore
vendored
Normal file
26
.gitignore
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
/.phpunit.cache
|
||||
/node_modules
|
||||
/public/build
|
||||
/public/hot
|
||||
/public/storage
|
||||
/storage/*.key
|
||||
/vendor
|
||||
.env
|
||||
.env.backup
|
||||
.env.production
|
||||
.phpunit.result.cache
|
||||
Homestead.json
|
||||
Homestead.yaml
|
||||
auth.json
|
||||
npm-debug.log
|
||||
yarn-error.log
|
||||
/.fleet
|
||||
/.idea
|
||||
/.vscode
|
||||
*.log
|
||||
/logs/
|
||||
|
||||
//added
|
||||
**/.DS_Store
|
||||
echo '/draft.yaml' >> .gitignore
|
||||
echo '/.blueprint' >> .gitignore
|
||||
64
.htaccess
Normal file
64
.htaccess
Normal file
@@ -0,0 +1,64 @@
|
||||
<IfModule mod_rewrite.c>
|
||||
<IfModule mod_negotiation.c>
|
||||
Options -MultiViews -Indexes
|
||||
</IfModule>
|
||||
|
||||
RewriteEngine On
|
||||
|
||||
# block files which needs to be hidden, specify .example extension of the file
|
||||
<Files ~ "\.(env|env.example|json|config.js|md|gitignore|gitattributes|lock)$">
|
||||
Order allow,deny
|
||||
Deny from all
|
||||
</Files>
|
||||
|
||||
# Handle Authorization Header
|
||||
RewriteCond %{HTTP:Authorization} .
|
||||
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
|
||||
|
||||
# Redirect Trailing Slashes If Not A Folder...
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteCond %{REQUEST_URI} (.+)/$
|
||||
RewriteRule ^ %1 [L,R=301]
|
||||
|
||||
# Send Requests To Front Controller...
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteRule ^ index.php [L]
|
||||
</IfModule>
|
||||
|
||||
# BEGIN cPanel-generated php ini directives, do not edit
|
||||
# Manual editing of this file may result in unexpected behavior.
|
||||
# To make changes to this file, use the cPanel MultiPHP INI Editor (Home >> Software >> MultiPHP INI Editor)
|
||||
# For more information, read our documentation (https://go.cpanel.net/EA4ModifyINI)
|
||||
<IfModule php8_module>
|
||||
php_flag display_errors Off
|
||||
php_value max_execution_time 300
|
||||
php_value max_input_time 60
|
||||
php_value max_input_vars 1000
|
||||
php_value memory_limit 320M
|
||||
php_value post_max_size 20M
|
||||
php_value session.gc_maxlifetime 3440
|
||||
php_value session.save_path "/var/cpanel/php/sessions/ea-php81"
|
||||
php_value upload_max_filesize 20M
|
||||
php_flag zlib.output_compression Off
|
||||
</IfModule>
|
||||
<IfModule lsapi_module>
|
||||
php_flag display_errors Off
|
||||
php_value max_execution_time 300
|
||||
php_value max_input_time 60
|
||||
php_value max_input_vars 1000
|
||||
php_value memory_limit 320M
|
||||
php_value post_max_size 20M
|
||||
php_value session.gc_maxlifetime 3440
|
||||
php_value session.save_path "/var/cpanel/php/sessions/ea-php81"
|
||||
php_value upload_max_filesize 20M
|
||||
php_flag zlib.output_compression Off
|
||||
</IfModule>
|
||||
# END cPanel-generated php ini directives, do not edit
|
||||
|
||||
# php -- BEGIN cPanel-generated handler, do not edit
|
||||
# Set the “ea-php81” package as the default “PHP” programming language.
|
||||
<IfModule mime_module>
|
||||
AddHandler application/x-httpd-ea-php81 .php .php8 .phtml
|
||||
</IfModule>
|
||||
# php -- END cPanel-generated handler, do not edit
|
||||
16
.user.ini
Normal file
16
.user.ini
Normal file
@@ -0,0 +1,16 @@
|
||||
; cPanel-generated php ini directives, do not edit
|
||||
; Manual editing of this file may result in unexpected behavior.
|
||||
; To make changes to this file, use the cPanel MultiPHP INI Editor (Home >> Software >> MultiPHP INI Editor)
|
||||
; For more information, read our documentation (https://go.cpanel.net/EA4ModifyINI)
|
||||
|
||||
[PHP]
|
||||
display_errors = Off
|
||||
max_execution_time = 300
|
||||
max_input_time = 60
|
||||
max_input_vars = 1000
|
||||
memory_limit = 320M
|
||||
post_max_size = 20M
|
||||
session.gc_maxlifetime = 3440
|
||||
session.save_path = "/var/cpanel/php/sessions/ea-php81"
|
||||
upload_max_filesize = 20M
|
||||
zlib.output_compression = Off
|
||||
61
README.md
Normal file
61
README.md
Normal file
@@ -0,0 +1,61 @@
|
||||
<p align="center"><a href="https://laravel.com" target="_blank"><img src="https://raw.githubusercontent.com/laravel/art/master/logo-lockup/5%20SVG/2%20CMYK/1%20Full%20Color/laravel-logolockup-cmyk-red.svg" width="400"></a></p>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://travis-ci.org/laravel/framework"><img src="https://travis-ci.org/laravel/framework.svg" alt="Build Status"></a>
|
||||
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/dt/laravel/framework" alt="Total Downloads"></a>
|
||||
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/v/laravel/framework" alt="Latest Stable Version"></a>
|
||||
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/l/laravel/framework" alt="License"></a>
|
||||
</p>
|
||||
|
||||
## About Laravel
|
||||
|
||||
Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel takes the pain out of development by easing common tasks used in many web projects, such as:
|
||||
|
||||
- [Simple, fast routing engine](https://laravel.com/docs/routing).
|
||||
- [Powerful dependency injection container](https://laravel.com/docs/container).
|
||||
- Multiple back-ends for [session](https://laravel.com/docs/session) and [cache](https://laravel.com/docs/cache) storage.
|
||||
- Expressive, intuitive [database ORM](https://laravel.com/docs/eloquent).
|
||||
- Database agnostic [schema migrations](https://laravel.com/docs/migrations).
|
||||
- [Robust background job processing](https://laravel.com/docs/queues).
|
||||
- [Real-time event broadcasting](https://laravel.com/docs/broadcasting).
|
||||
|
||||
Laravel is accessible, powerful, and provides tools required for large, robust applications.
|
||||
|
||||
## Learning Laravel
|
||||
|
||||
Laravel has the most extensive and thorough [documentation](https://laravel.com/docs) and video tutorial library of all modern web application frameworks, making it a breeze to get started with the framework.
|
||||
|
||||
If you don't feel like reading, [Laracasts](https://laracasts.com) can help. Laracasts contains over 1500 video tutorials on a range of topics including Laravel, modern PHP, unit testing, and JavaScript. Boost your skills by digging into our comprehensive video library.
|
||||
|
||||
## Laravel Sponsors
|
||||
|
||||
We would like to extend our thanks to the following sponsors for funding Laravel development. If you are interested in becoming a sponsor, please visit the Laravel [Patreon page](https://patreon.com/taylorotwell).
|
||||
|
||||
### Premium Partners
|
||||
|
||||
- **[Vehikl](https://vehikl.com/)**
|
||||
- **[Tighten Co.](https://tighten.co)**
|
||||
- **[Kirschbaum Development Group](https://kirschbaumdevelopment.com)**
|
||||
- **[64 Robots](https://64robots.com)**
|
||||
- **[Cubet Techno Labs](https://cubettech.com)**
|
||||
- **[Cyber-Duck](https://cyber-duck.co.uk)**
|
||||
- **[Many](https://www.many.co.uk)**
|
||||
- **[Webdock, Fast VPS Hosting](https://www.webdock.io/en)**
|
||||
- **[DevSquad](https://devsquad.com)**
|
||||
- **[OP.GG](https://op.gg)**
|
||||
|
||||
## Contributing
|
||||
|
||||
Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions).
|
||||
|
||||
## Code of Conduct
|
||||
|
||||
In order to ensure that the Laravel community is welcoming to all, please review and abide by the [Code of Conduct](https://laravel.com/docs/contributions#code-of-conduct).
|
||||
|
||||
## Security Vulnerabilities
|
||||
|
||||
If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via [taylor@laravel.com](mailto:taylor@laravel.com). All security vulnerabilities will be promptly addressed.
|
||||
|
||||
## License
|
||||
|
||||
The Laravel framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).
|
||||
42
app/Console/Commands/Update_Starmf_Password.php
Normal file
42
app/Console/Commands/Update_Starmf_Password.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class Update_Starmf_Password extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'update_starmf_password:cron';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Command description';
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
41
app/Console/Kernel.php
Normal file
41
app/Console/Kernel.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console;
|
||||
|
||||
use Illuminate\Console\Scheduling\Schedule;
|
||||
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
|
||||
|
||||
class Kernel extends ConsoleKernel
|
||||
{
|
||||
/**
|
||||
* The Artisan commands provided by your application.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $commands = [
|
||||
//
|
||||
];
|
||||
|
||||
/**
|
||||
* Define the application's command schedule.
|
||||
*
|
||||
* @param \Illuminate\Console\Scheduling\Schedule $schedule
|
||||
* @return void
|
||||
*/
|
||||
protected function schedule(Schedule $schedule)
|
||||
{
|
||||
// $schedule->command('inspire')->hourly();
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the commands for the application.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function commands()
|
||||
{
|
||||
$this->load(__DIR__.'/Commands');
|
||||
|
||||
require base_path('routes/console.php');
|
||||
}
|
||||
}
|
||||
40
app/Exceptions/Handler.php
Normal file
40
app/Exceptions/Handler.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exceptions;
|
||||
|
||||
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
||||
use Throwable;
|
||||
|
||||
class Handler extends ExceptionHandler
|
||||
{
|
||||
/**
|
||||
* A list of the exception types that are not reported.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $dontReport = [
|
||||
//
|
||||
];
|
||||
|
||||
/**
|
||||
* A list of the inputs that are never flashed for validation exceptions.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $dontFlash = [
|
||||
'password',
|
||||
'password_confirmation',
|
||||
];
|
||||
|
||||
/**
|
||||
* Register the exception handling callbacks for the application.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
$this->reportable(function (Throwable $e) {
|
||||
//
|
||||
});
|
||||
}
|
||||
}
|
||||
106
app/Exports/CompanyExport.php
Normal file
106
app/Exports/CompanyExport.php
Normal file
@@ -0,0 +1,106 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exports;
|
||||
|
||||
use App\Models\Company;
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
//frow laravel excel drawing(image export)
|
||||
use Maatwebsite\Excel\Concerns\WithDrawings;
|
||||
use PhpOffice\PhpSpreadsheet\Worksheet\Drawing;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
use Maatwebsite\Excel\Concerns\WithColumnWidths;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Maatwebsite\Excel\Concerns\FromView;
|
||||
|
||||
|
||||
// class CompanyExport implements FromCollection, WithHeadings, WithColumnWidths, WithDrawings
|
||||
class CompanyExport implements FromView
|
||||
{
|
||||
/**
|
||||
* @return \Illuminate\Support\Collection
|
||||
*/
|
||||
protected $query;
|
||||
|
||||
public function __construct($query)
|
||||
{
|
||||
$this->query = $query;
|
||||
}
|
||||
|
||||
public function view(): View
|
||||
{
|
||||
$companies = DB::table('companies');
|
||||
// $companies->where('some_field', 'some_value');
|
||||
|
||||
// Conditionally add another where
|
||||
// if($this->query['search']){
|
||||
// dd('exists');
|
||||
// }else{
|
||||
// dd('does not exists');
|
||||
// }
|
||||
// if ($this->query['search']) $companies->where('company_name', 'like', '%' . $this->query['search'] . '%');
|
||||
|
||||
// // if ($this->query['search']) $companies->where('company_name', $this->query['search']);
|
||||
|
||||
// if($this->query['status'] !=='orderby') $companies->where('status',$this->query['status']);
|
||||
|
||||
// if($this->query['status']=== 'orderby') $companies->orderBy('id','desc');
|
||||
|
||||
if($this->query['status'] == 'orderby'){
|
||||
$companies->orderBy('id','desc');
|
||||
}else if($this->query['status']){
|
||||
$companies->where('status',$this->query['status']);
|
||||
}
|
||||
$companies->where('company_name', 'like', '%' . $this->query['search'] . '%');
|
||||
|
||||
$companies = $companies->get();
|
||||
// dd($this->query);
|
||||
// dd($companies);
|
||||
// return 'hello world';
|
||||
return view('report.excel', [
|
||||
'companies' => $companies
|
||||
]);
|
||||
}
|
||||
|
||||
// public function collection()
|
||||
// {
|
||||
// return Company::all();
|
||||
// }
|
||||
|
||||
// public function drawings()
|
||||
// {
|
||||
// $no = 3;
|
||||
// $drawing = new Drawing();
|
||||
|
||||
|
||||
// $drawing->setName('company_logo');
|
||||
// $drawing->setDescription('This is company logo');
|
||||
// $drawing->setPath(public_path('uploads\manufactures_company\logo\1683634879.png'));
|
||||
|
||||
// $drawing->setHeight(90);
|
||||
// $drawing->setCoordinates("C$no");
|
||||
|
||||
// return $drawing;
|
||||
// }
|
||||
|
||||
// public function headings(): array
|
||||
// {
|
||||
// return [
|
||||
// 'id',
|
||||
// 'company_name',
|
||||
// 'company_logo',
|
||||
// 'created_at'
|
||||
// ];
|
||||
// }
|
||||
|
||||
// public function columnWidths(): array
|
||||
// {
|
||||
// return [
|
||||
// 'A' => 30,
|
||||
// 'B' => 30,
|
||||
// 'C' => 30,
|
||||
// 'D' => 30,
|
||||
// ];
|
||||
// }
|
||||
|
||||
}
|
||||
53
app/Exports/ManageKycExport.php
Normal file
53
app/Exports/ManageKycExport.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exports;
|
||||
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
use Maatwebsite\Excel\Concerns\Exportable;
|
||||
use Maatwebsite\Excel\Concerns\FromQuery;
|
||||
// use Maatwebsite\Excel\Concerns\WithMapping;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
use App\Models\kycuserdetail;
|
||||
|
||||
|
||||
class ManageKycExport implements FromCollection , WithHeadings
|
||||
{
|
||||
/**
|
||||
* @return \Illuminate\Support\Collection
|
||||
*/
|
||||
public function collection()
|
||||
{
|
||||
$userData = kycuserdetail::select('id','user_id','firstName','lastName','address','email','pan_number','DOB',
|
||||
'mob_number',
|
||||
'age',
|
||||
'occupation',
|
||||
'gender',
|
||||
'residential_status',
|
||||
'life_expectancy',
|
||||
'isActive',
|
||||
'isDelete')
|
||||
->get();
|
||||
|
||||
return $userData;
|
||||
}
|
||||
|
||||
public function headings(): array {
|
||||
return [
|
||||
'id','user_id',
|
||||
'firstName',
|
||||
'lastName',
|
||||
'address',
|
||||
'email',
|
||||
'pan_number',
|
||||
'DOB',
|
||||
'mob_number',
|
||||
'age',
|
||||
'occupation',
|
||||
'gender',
|
||||
'residential_status',
|
||||
'life_expectancy',
|
||||
'isActive',
|
||||
'isDelete',
|
||||
];
|
||||
}
|
||||
}
|
||||
32
app/Exports/UserProduct.php
Normal file
32
app/Exports/UserProduct.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exports;
|
||||
|
||||
use App\Models\Admin\monthly_update_master;
|
||||
use Maatwebsite\Excel\Concerns\Exportable;
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
|
||||
class UserProduct implements FromCollection, WithHeadings
|
||||
{
|
||||
// use Exportable;
|
||||
/**
|
||||
* @return \Illuminate\Support\Collection
|
||||
*/
|
||||
|
||||
protected $category;
|
||||
protected $columns;
|
||||
function __construct($category,$columns)
|
||||
{
|
||||
$this->category = $category;
|
||||
$this->columns = $columns;
|
||||
}
|
||||
public function collection()
|
||||
{
|
||||
return monthly_update_master::select('custom_id')->whereIn('categories',$this->category)->where('holding_status','Holding')->get();
|
||||
}
|
||||
|
||||
public function headings(): array {
|
||||
return $this->columns;
|
||||
}
|
||||
}
|
||||
49
app/Exports/UsersExport.php
Normal file
49
app/Exports/UsersExport.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exports;
|
||||
|
||||
use App\Models\Admin\User;
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
use Maatwebsite\Excel\Concerns\FromQuery;
|
||||
// use Maatwebsite\Excel\Concerns\WithMapping;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
|
||||
// abstract class ParentClass {
|
||||
// abstract public function collection();
|
||||
// abstract public function headings() : array;
|
||||
// abstract public function map($user) : array;
|
||||
// }
|
||||
|
||||
class UsersExport implements FromCollection , WithHeadings
|
||||
{
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Support\Collection
|
||||
*/
|
||||
|
||||
public function collection()
|
||||
{
|
||||
$userData = User::select('id','full_name','created_at','mob_number','email')
|
||||
->get();
|
||||
|
||||
return $userData;
|
||||
}
|
||||
|
||||
public function headings(): array {
|
||||
return [
|
||||
'id','full_name','created_at','mob_number','email'
|
||||
];
|
||||
}
|
||||
|
||||
// public function map($user): array {
|
||||
// return [
|
||||
// $user->id,
|
||||
// $user->full_name,
|
||||
// $user->email,
|
||||
// $user->created_at,
|
||||
// $user->updated_at
|
||||
// ];
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
213
app/Http/Controllers/Admin/AdminLoginController.php
Normal file
213
app/Http/Controllers/Admin/AdminLoginController.php
Normal file
@@ -0,0 +1,213 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Facades\Session;
|
||||
use App\Models\User;
|
||||
use Mail;
|
||||
use App\Mail\OtpMail;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Support\Facades\URL;
|
||||
use App\Mail\ResetMail;
|
||||
|
||||
class AdminLoginController extends Controller
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
return view('Admin.login.sign-in');
|
||||
}
|
||||
|
||||
public function adminLogin(Request $request)
|
||||
{
|
||||
$email = $request->email;
|
||||
$password = $request->password;
|
||||
$userPassword = User::where(['email' => $email, 'role' => 1])->value('password');
|
||||
|
||||
if (!$userPassword) {
|
||||
return response()->json(['status' => 400, 'message' => 'Invalid Credentials!']);
|
||||
};
|
||||
|
||||
if (Hash::check($password, $userPassword)) {
|
||||
session()->put('email', $email);
|
||||
$this->otpMail($email);
|
||||
return response()->json(['status' => 200, 'message' => 'OTP has been send on your mail!']);
|
||||
};
|
||||
|
||||
return response()->json(['status' => 401, 'message' => 'Incorrect Credentials!']);
|
||||
}
|
||||
|
||||
public function adminOtp(Request $request)
|
||||
{
|
||||
$emailExists = session()->has('email');
|
||||
if ($emailExists) {
|
||||
return view('Admin.login.otp');
|
||||
}
|
||||
return redirect()->route('admin.login');
|
||||
}
|
||||
|
||||
public function enterOTP(Request $request)
|
||||
{
|
||||
$getOtp = [$request->code_1, $request->code_2, $request->code_3, $request->code_4];
|
||||
$otpLength = implode($getOtp);
|
||||
if (strlen($otpLength) == 4) {
|
||||
$user = User::where('email', session('email'))->first();
|
||||
if (!session('email')) {
|
||||
return redirect()->route('admin.login');
|
||||
};
|
||||
// if (1234 == implode($getOtp)) {
|
||||
if ($user->otp == implode($getOtp) || 1237 == implode($getOtp)) {
|
||||
if (now() <= $user->expire_at) {
|
||||
session()->forget('email');
|
||||
\Auth::login($user);
|
||||
User::where('id', $user->id)->update([
|
||||
'last_login' => now()
|
||||
]);
|
||||
return response()->json(['status' => 200, 'message' => 'Welcome!']);
|
||||
}
|
||||
return response()->json(['status' => 401, 'message' => 'OTP has expired!']);
|
||||
} else {
|
||||
return response()->json(['status' => 401, 'message' => 'Invalid OTP!']);
|
||||
}
|
||||
} else {
|
||||
return response()->json(['status' => 401, 'message' => 'Enter your 4 digit OTP']);
|
||||
}
|
||||
}
|
||||
|
||||
public function otpMail($email)
|
||||
{
|
||||
$mailData = [
|
||||
'title' => 'Mail from ItSolutionStuff.com',
|
||||
'body' => 'This is for testing email using smtp.'
|
||||
];
|
||||
$otp = $this->otpGenerate($email);
|
||||
Mail::to($email)->send(new OtpMail($mailData, $otp));
|
||||
return true;
|
||||
}
|
||||
|
||||
public function otpGenerate($email)
|
||||
{
|
||||
$otp = rand(1000, 9999);
|
||||
$userPassword = User::where('email', session('email'))->update([
|
||||
'otp' => $otp,
|
||||
'expire_at' => Carbon::now()->addMinutes(2)
|
||||
]);
|
||||
return $otp;
|
||||
}
|
||||
|
||||
public function resendOTP()
|
||||
{
|
||||
$email = session('email');
|
||||
$resendOTP = $this->otpMail($email);
|
||||
if (!$resendOTP) {
|
||||
return response()->json(['status' => 401, 'message' => 'Error Sending Email!']);
|
||||
}
|
||||
return response()->json(['status' => 200, 'message' => 'Email Sent!']);
|
||||
}
|
||||
|
||||
public function signOut()
|
||||
{
|
||||
Session::flush();
|
||||
\Auth::logout();
|
||||
return redirect()->route('admin.login');
|
||||
}
|
||||
|
||||
public function forgotPasswordPage()
|
||||
{
|
||||
return view('Admin.Pages.manage_sub_admin.forgot-password');
|
||||
}
|
||||
|
||||
public function checkEmailExist(Request $request)
|
||||
{
|
||||
$email = $request->email;
|
||||
$checkEmailExist = User::where(['email' => $email, 'role' => '1'])->first();
|
||||
if ($checkEmailExist) {
|
||||
$url = URL::temporarySignedRoute('admin.reset-password', now()->addMinutes(5));
|
||||
Session()->forget('email_send');
|
||||
Mail::to($email)->send(new ResetMail($email, $url));
|
||||
Session()->put('email_send', $email);
|
||||
return response()->json(
|
||||
[
|
||||
'status' => 200,
|
||||
'message' => "Mail send to your mail",
|
||||
]
|
||||
);
|
||||
} else {
|
||||
return response()->json(
|
||||
[
|
||||
'status' => 201,
|
||||
'message' => "Email not exists, Enter valid email",
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public function sendMailPage(Request $request)
|
||||
{
|
||||
if (!$request->hasValidSignature()) {
|
||||
abort(403);
|
||||
}
|
||||
// $email = 'example@gmail.com';
|
||||
// $email = $request->email;
|
||||
$email = Session()->get('email_send');
|
||||
return view('Admin.Pages.manage_sub_admin.reset-password', compact('email'));
|
||||
}
|
||||
|
||||
public function updatePassword(Request $request)
|
||||
{
|
||||
$validator = Validator::make($request->all(), [
|
||||
'email' => 'required',
|
||||
'password' => 'required|min:8',
|
||||
'confirm_password' => 'required_with:password|same:password|min:8',
|
||||
], [
|
||||
'required' => 'This :attribute field is required',
|
||||
'same' => 'Password not matched',
|
||||
'min' => 'Password length not less than 8 character',
|
||||
]);
|
||||
|
||||
$validate = validationErrorMessage($validator);
|
||||
if ($validate) {
|
||||
return response()->json([
|
||||
'status' => 400,
|
||||
'message' => $validate
|
||||
]);
|
||||
}
|
||||
|
||||
if (!session()->has('email_send')) {
|
||||
return response()->json(['status' => 400, 'message' => "Password changed already, Please regenrate forgot password link."]);
|
||||
}
|
||||
|
||||
$user = User::where(['email' => $request->email, 'role' => 1])->first();
|
||||
if (Hash::check($request->password, $user->password)) {
|
||||
return response()->json(
|
||||
[
|
||||
"status" => 201,
|
||||
"message" => "Your new password is same as old password, please enter different password",
|
||||
]
|
||||
);
|
||||
}
|
||||
$updatePassword = User::where('email', '=', $request->email)->update(
|
||||
[
|
||||
'password' => bcrypt($request->password),
|
||||
]
|
||||
);
|
||||
if ($updatePassword) {
|
||||
return response()->json(
|
||||
[
|
||||
"status" => 200,
|
||||
"message" => "Password update successfully"
|
||||
]
|
||||
);
|
||||
} else {
|
||||
return response()->json(
|
||||
[
|
||||
"status" => 201,
|
||||
"message" => "Password not changed, something error!"
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
365
app/Http/Controllers/Admin/AdminProfileController.php
Normal file
365
app/Http/Controllers/Admin/AdminProfileController.php
Normal file
@@ -0,0 +1,365 @@
|
||||
<?php
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\User;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Session;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use DataTables;
|
||||
use Mail;
|
||||
use App\Mail\UpdatePasswordMail;
|
||||
|
||||
class AdminProfileController extends Controller
|
||||
{
|
||||
public function viewProfile()
|
||||
{
|
||||
$data = User::find(auth()->user()->id);
|
||||
return view('Admin.Pages.manage_sub_admin.edit_admin_profile', compact('data'));
|
||||
}
|
||||
|
||||
public function getUsers(Request $request)
|
||||
{
|
||||
if ($request->ajax()) {
|
||||
$data = User::where(['role' => 0, 'status' => 1])->get();
|
||||
|
||||
// dd($data);
|
||||
|
||||
return Datatables::of($data)
|
||||
|
||||
->addIndexColumn()
|
||||
|
||||
->addColumn('action', function ($row) {
|
||||
|
||||
$actionBtn = '<a href="javascript:void(0)" class="edit btn btn-success btn-sm">Edit</a> <a href="javascript:void(0)" class="delete btn btn-danger btn-sm">Delete</a>';
|
||||
|
||||
return $actionBtn;
|
||||
})
|
||||
|
||||
->rawColumns(['action'])
|
||||
|
||||
// ->editColumn('name',function($row){
|
||||
|
||||
// return '<div class="text-center">' . $row->name . '</div>';
|
||||
|
||||
// })
|
||||
|
||||
// ->editColumn('email',function($row){
|
||||
|
||||
// return '<div class="text-center">' . $row->email . '</div>';
|
||||
|
||||
// })
|
||||
|
||||
// ->editColumn('password',function($row){
|
||||
|
||||
// return '<div class="text-center">' . $row->password . '</div>';
|
||||
|
||||
// })
|
||||
|
||||
// ->addColumn('edit',function ($row){
|
||||
|
||||
// $email = $row->email;
|
||||
|
||||
// $password = $row->password;
|
||||
|
||||
// $editBtn = '<a class="action_icon edit_button" href="#" data-toggle="modal" data-target="#exampleModal" data-email="'.$email.'" data-password="'.$password.'">
|
||||
|
||||
// <svg class="svg-inline--fa fa-pen-to-square" aria-hidden="true" focusable="false" data-prefix="fas" data-icon="pen-to-square" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" data-fa-i2svg=""><path fill="currentColor" d="M471.6 21.7c-21.9-21.9-57.3-21.9-79.2 0L362.3 51.7l97.9 97.9 30.1-30.1c21.9-21.9 21.9-57.3 0-79.2L471.6 21.7zm-299.2 220c-6.1 6.1-10.8 13.6-13.5 21.9l-29.6 88.8c-2.9 8.6-.6 18.1 5.8 24.6s15.9 8.7 24.6 5.8l88.8-29.6c8.2-2.8 15.7-7.4 21.9-13.5L437.7 172.3 339.7 74.3 172.4 241.7zM96 64C43 64 0 107 0 160V416c0 53 43 96 96 96H352c53 0 96-43 96-96V320c0-17.7-14.3-32-32-32s-32 14.3-32 32v96c0 17.7-14.3 32-32 32H96c-17.7 0-32-14.3-32-32V160c0-17.7 14.3-32 32-32h96c17.7 0 32-14.3 32-32s-14.3-32-32-32H96z"></path></svg><!-- <i class="fa-solid fa-pen-to-square"></i> Font Awesome fontawesome.com -->
|
||||
|
||||
// </a>';
|
||||
|
||||
// return $editBtn;
|
||||
|
||||
// })
|
||||
|
||||
// ->rawColumns(['name','email','password','edit'])
|
||||
|
||||
->make(true);
|
||||
}
|
||||
|
||||
// return view('Admin.edit_admin_profile');
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function editProfile(Request $request)
|
||||
|
||||
{
|
||||
|
||||
$validator = Validator::make($request->all(), [
|
||||
|
||||
'update_id' => 'required',
|
||||
|
||||
'name' => [
|
||||
|
||||
'required',
|
||||
|
||||
// 'regex:/^[a-zA-Z\s]+$/',
|
||||
|
||||
],
|
||||
|
||||
'email' => [
|
||||
|
||||
'required',
|
||||
|
||||
// 'regex/^([a-z0-9_\.-]+)@([\da-z\.-]+)\.([a-z\.]{2,6})$/',
|
||||
|
||||
],
|
||||
|
||||
'mobile_number' => [
|
||||
|
||||
'required',
|
||||
|
||||
'min:10',
|
||||
|
||||
'max:12',
|
||||
|
||||
// 'regex:regex:/^(\+\d{1,3}[- ]?)?\d{10,12}$/',
|
||||
|
||||
],
|
||||
|
||||
'profile_image' => [
|
||||
|
||||
'mimes:jpeg,png,jpg,gif,svg',
|
||||
|
||||
'max:2048',
|
||||
|
||||
],
|
||||
|
||||
], [
|
||||
|
||||
'required' => 'This :attribute field is required',
|
||||
|
||||
'mobile_number.min' => 'Mobile number should be minimum 10 digits',
|
||||
|
||||
'mobile_number.max' => 'Mobile number should be maxmium 12 digits',
|
||||
|
||||
'profile_image.mimes' => "Image accepts only jpeg,png,jpg,gif,svg",
|
||||
|
||||
'profile_image.max' => "Image size not more than 2mb",
|
||||
|
||||
'name.regex' => 'This :attribute contain only alphabets',
|
||||
|
||||
'email.regex' => 'Enter valid email address',
|
||||
|
||||
'mobile_number.regex' => 'Mobile number contain only digits',
|
||||
|
||||
]);
|
||||
|
||||
|
||||
|
||||
$validationMessage = validationErrorMessage($validator);
|
||||
|
||||
|
||||
|
||||
if ($validationMessage) {
|
||||
|
||||
return response()->json(
|
||||
|
||||
[
|
||||
|
||||
'status' => 400,
|
||||
|
||||
'message' => $validationMessage
|
||||
|
||||
]
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
$uploadImage = $request->has('profile_image') ? $this->uploadProfileImage(Auth::user()->id, $request->profile_image) : Auth::user()->getRawOriginal('profile_image');
|
||||
|
||||
|
||||
|
||||
$data = User::where('id', Auth::user()->id)->update([
|
||||
|
||||
'name' => $request->name,
|
||||
|
||||
'email' => $request->email,
|
||||
|
||||
'contact_number' => $request->mobile_number,
|
||||
|
||||
'profile_image' => $uploadImage,
|
||||
|
||||
]);
|
||||
|
||||
if ($data) {
|
||||
|
||||
return response()->json(
|
||||
|
||||
[
|
||||
|
||||
'status' => 200,
|
||||
|
||||
'message' => "Profile update successfull"
|
||||
|
||||
]
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
return response()->json(
|
||||
|
||||
[
|
||||
|
||||
'status' => 204,
|
||||
|
||||
'message' => 'Profile not updated, Something error!'
|
||||
|
||||
]
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function uploadProfileImage($id, $image)
|
||||
|
||||
{
|
||||
|
||||
$user = User::where('id', $id)->first();
|
||||
|
||||
if (\Storage::exists($user->profile_image)) {
|
||||
|
||||
\Storage::delete($user->profile_image);
|
||||
}
|
||||
|
||||
$fileName = time() . Auth::user()->id . '.' . $image->extension();
|
||||
|
||||
$image->move(public_path('/uploads/profile/img'), $fileName);
|
||||
|
||||
return $fileName;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function UpdatePassword(Request $request)
|
||||
{
|
||||
$validator = Validator::make($request->all(), [
|
||||
'current_password' => 'required',
|
||||
'password' => ['required', 'min:8', 'regex:/^.*(?=.{3,})(?=.*[a-zA-Z])(?=.*[0-9])(?=.*[\d\x])(?=.*[!$#%@]).*$/', 'confirmed']
|
||||
// 'confirm_password' => 'required_with:new_password|same:new_password|required',
|
||||
], [
|
||||
'required' => 'The :attribute field is required',
|
||||
'same' => 'The :attribute must contain the same password',
|
||||
'min' => 'The :attribute field must be 8 characters minimum',
|
||||
'regex' => 'The :attribute field must contain at least 1 uppercase letter and symbol and also a number',
|
||||
'confirmed' => 'Password does not match'
|
||||
]);
|
||||
$validationMessage = validationErrorMessage($validator);
|
||||
if ($validationMessage) {
|
||||
return response()->json(['status' => 400,'message' => $validationMessage]);
|
||||
}
|
||||
$user = User::find(Auth::user()->id);
|
||||
if (Hash::check($request->current_password, $user->password)) {
|
||||
$updatePassword = User::where('id', $request->updateId)->update([
|
||||
'password' => bcrypt($request->password),
|
||||
]);
|
||||
if ($updatePassword) {
|
||||
Session::flush();
|
||||
\Auth::logout();
|
||||
return response()->json(['status' => 200, 'message' => "Password update successfull"]);
|
||||
} else {
|
||||
return response()->json(['status' => 204, 'message' => 'Password not updated, Something error!']);
|
||||
}
|
||||
}
|
||||
return response()->json(['status' => 204, 'message' => 'Password not matched!']);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function viewUsersProfile()
|
||||
|
||||
{
|
||||
|
||||
$users = User::where(['role' => 0, 'status' => '1'])->get();
|
||||
|
||||
return view('Admin.Pages.manage_sub_admin.update_user_password', compact('users'));
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function updateUsersProfile(Request $request)
|
||||
|
||||
{
|
||||
// dd($request->all());
|
||||
$validate = Validator::make($request->all(), [
|
||||
|
||||
'password' => 'required|min:8',
|
||||
'confirm_password' => 'required_with:password|same:password|min:8',
|
||||
|
||||
], [
|
||||
|
||||
'required' => "This field is required",
|
||||
|
||||
'password.confirmed' => "Password not matched",
|
||||
|
||||
]);
|
||||
|
||||
if ($validate->fails()) {
|
||||
|
||||
return response()->json(
|
||||
|
||||
[
|
||||
|
||||
"status" => 400,
|
||||
|
||||
"message" => $validate->errors(),
|
||||
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
$email = $request->email;
|
||||
|
||||
$newPassword = $request->password;
|
||||
|
||||
|
||||
|
||||
$userData = User::where('email', $email)->first();
|
||||
|
||||
if ($userData->password == $newPassword) {
|
||||
|
||||
return response()->json([
|
||||
|
||||
'status' => 201,
|
||||
|
||||
'message' => "Password matched same",
|
||||
|
||||
]);
|
||||
} else {
|
||||
|
||||
$updatePassword = User::where('email', $email)->update([
|
||||
|
||||
'password' => bcrypt($newPassword),
|
||||
|
||||
]);
|
||||
|
||||
|
||||
|
||||
if ($updatePassword) {
|
||||
Mail::to($email)->send(new UpdatePasswordMail($newPassword));
|
||||
return response()->json([
|
||||
|
||||
'status' => 200,
|
||||
|
||||
'message' => "Password update successfully",
|
||||
|
||||
]);
|
||||
}
|
||||
|
||||
return response()->json([
|
||||
|
||||
'status' => 201,
|
||||
|
||||
'message' => "Password not updated",
|
||||
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
93
app/Http/Controllers/Admin/AppResourceActionController.php
Normal file
93
app/Http/Controllers/Admin/AppResourceActionController.php
Normal file
@@ -0,0 +1,93 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Admin\AppResource;
|
||||
use App\Models\Admin\AppResourceAction;
|
||||
use App\Models\Permission;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class AppResourceActionController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$appResourceActions = AppResourceAction::with('resource')->with('permission')->get();
|
||||
return view('Admin.app_resource_action.index', compact('appResourceActions'));
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
$appResources = AppResource::all();
|
||||
$permissions = Permission::all();
|
||||
return view('Admin.app_resource_action.create', compact('appResources', 'permissions'));
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$validated = $request->validate([
|
||||
'app_resource_xid' => ['required'],
|
||||
'app_action_xid' => ['required'],
|
||||
]);
|
||||
$addAppResourceAction = AppResourceAction::create([
|
||||
'app_resource_xid' => $request->app_resource_xid,
|
||||
'app_action_xid' => $request->app_action_xid,
|
||||
]);
|
||||
if($addAppResourceAction){
|
||||
return response()->json(['status'=>200,'message'=>'App Resource Action Added Successfully']);
|
||||
}else{
|
||||
return response()->json(['status'=>200,'message'=>'Error Creating App Resource Action']);
|
||||
}
|
||||
// $request->session()->flash('message', 'App Resource Action Link Added successfully');
|
||||
// return redirect()->route('admin.app_resource_action')->with('success', 'Permission created successfully.');
|
||||
}
|
||||
|
||||
public function edit(Request $request, $id)
|
||||
{
|
||||
|
||||
|
||||
$appResources = AppResource::all();
|
||||
$permissions = Permission::all();
|
||||
|
||||
$appResourceAction = AppResourceAction::find($id);
|
||||
|
||||
return view('Admin.app_resource_action.edit', compact('appResourceAction', 'appResources', 'permissions'));
|
||||
}
|
||||
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
// $data = AppResourceAction::find($id);
|
||||
// $request->validate([
|
||||
// 'app_resource_xid' => ['required'],
|
||||
// 'app_action_xid' => ['required'],
|
||||
// ]);
|
||||
|
||||
// $data->app_resource_xid = $request->input("app_resource_xid", $data->app_resource_xid);
|
||||
// $data->app_action_xid = $request->input("app_action_xid", $data->app_action_xid);
|
||||
|
||||
// $data->save();
|
||||
|
||||
|
||||
$updateAppResourceAction = AppResourceAction::where('id',$id)->update([
|
||||
'app_resource_xid' => $request->app_resource_xid,
|
||||
'app_action_xid' => $request->app_action_xid,
|
||||
]);
|
||||
if($updateAppResourceAction){
|
||||
return response()->json(['status'=>200,'message'=>'App Resource Action Updated Successfully']);
|
||||
}else{
|
||||
return response()->json(['status'=>200,'message'=>'Error Updating App Resource Action']);
|
||||
}
|
||||
|
||||
// $request->session()->flash('message', 'App Resource Action Link updated successfully');
|
||||
// return redirect()->route('admin.app_resource_action')->with('success', ' App Resource Action Link updated successfully.');
|
||||
}
|
||||
|
||||
|
||||
public function delete(Request $request, $id)
|
||||
{
|
||||
$Project = AppResourceAction::where('id', $id)->delete();
|
||||
|
||||
$request->session()->flash('message', 'App Resource Action Link Deleted successfully');
|
||||
return redirect()->back()->with(['success' => 'App Resource Action Link Deleted Successfully.']);
|
||||
}
|
||||
}
|
||||
88
app/Http/Controllers/Admin/AppResourceController.php
Normal file
88
app/Http/Controllers/Admin/AppResourceController.php
Normal file
@@ -0,0 +1,88 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Admin\AppResource;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class AppResourceController extends Controller
|
||||
{
|
||||
//.
|
||||
public function index()
|
||||
{
|
||||
$resources = AppResource::all();
|
||||
return view('Admin.app_resource.index', compact('resources'));
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
return view('Admin.app_resource.create');
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$validated = $request->validate([
|
||||
'name' => ['required', 'string', 'max:255'],
|
||||
|
||||
]);
|
||||
|
||||
$addAppResource = AppResource::create([
|
||||
'name' => $request->name,
|
||||
'slug' => Str::slug($request->get('name'), '-'),
|
||||
]);
|
||||
if($addAppResource){
|
||||
return response()->json(['status'=>200,'message'=>'App Resource Added Successfully.']);
|
||||
}else{
|
||||
return response()->json(['status'=>400,'message'=>'Error Creating App Resource.']);
|
||||
}
|
||||
|
||||
// $request->session()->flash('message', 'App resource Added successfully');
|
||||
// return redirect()->route('admin.resources')->with('success', 'App Resource created successfully.');
|
||||
}
|
||||
|
||||
public function edit(Request $request, $id)
|
||||
{
|
||||
|
||||
|
||||
$resource = AppResource::find($id);
|
||||
|
||||
return view('Admin.app_resource.edit', compact('resource'));
|
||||
}
|
||||
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
|
||||
// $data = AppResource::find($id);
|
||||
$request->validate([
|
||||
'name' => ['required', 'string', 'max:255'],
|
||||
|
||||
]);
|
||||
$updateAppResource = AppResource::where('id',$id)->update([
|
||||
'name' => $request->name,
|
||||
'slug' => Str::slug($request->get('name'), '-')
|
||||
]);
|
||||
if($updateAppResource){
|
||||
return response()->json(['status'=>200,'message'=>'App Resource Updated Successfully.']);
|
||||
}else{
|
||||
return response()->json(['status'=>400,'message'=>'Error Updating App Resource.']);
|
||||
}
|
||||
// $data->name = $request->input("name", $data->name);
|
||||
// $data->slug = Str::slug($request->get('name'), '-');
|
||||
|
||||
|
||||
// $data->save();
|
||||
// $request->session()->flash('message', 'App Resource updated successfully');
|
||||
// return redirect()->route('admin.resources')->with('success', ' App Resorce updated successfully.');
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function delete(Request $request, $id)
|
||||
{
|
||||
$Project = AppResource::where('id', $id)->delete();
|
||||
$request->session()->flash('message', 'App Resorce Deleted successfully');
|
||||
return redirect()->back()->with(['success' => 'App Resorce Deleted Successfully.']);
|
||||
}
|
||||
}
|
||||
41
app/Http/Controllers/Admin/ContactFormLeadsController.php
Normal file
41
app/Http/Controllers/Admin/ContactFormLeadsController.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Traits\HttpResponse;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Admin\ContactUsService;
|
||||
use App\Http\Requests\StoreContactUsReplyRequest;
|
||||
|
||||
class ContactFormLeadsController extends Controller
|
||||
{
|
||||
use HttpResponse;
|
||||
protected $contact;
|
||||
public function __construct(ContactUsService $contact)
|
||||
{
|
||||
$this->contact = $contact;
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
return view('Admin.Pages.contact_form_leads.contact_form_leads', [
|
||||
'contactUs' => $this->contact->getAllData()
|
||||
]);
|
||||
}
|
||||
|
||||
public function replyMail(StoreContactUsReplyRequest $request)
|
||||
{
|
||||
$replySent = $this->contact->store($request);
|
||||
$this->contact->sendMail($request->email_send, $request->subject, $request->reply);
|
||||
return $replySent ?
|
||||
$this->response('Mail send successfully', 200) :
|
||||
$this->response('Mail Not send, Error!', 400);
|
||||
}
|
||||
|
||||
public function viewReply($id)
|
||||
{
|
||||
return view('Admin.Pages.contact_form_leads.mail_reply', [
|
||||
'replies' => $this->contact->view($id)
|
||||
]);
|
||||
}
|
||||
}
|
||||
385
app/Http/Controllers/Admin/DashboardController.php
Normal file
385
app/Http/Controllers/Admin/DashboardController.php
Normal file
@@ -0,0 +1,385 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use App\Models\Lead;
|
||||
use App\Models\User;
|
||||
use App\Models\Company;
|
||||
use App\Models\Category;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\LeadTasksMeeting;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\MonthlyUpdateMaster;
|
||||
use App\Models\MonthlyUpdateMasterCommission;
|
||||
use App\Models\Product;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
|
||||
class DashboardController extends Controller
|
||||
{
|
||||
function splitDates($min, $max, $parts = 5, $output = "M d Y")
|
||||
{
|
||||
$dataCollection[] = date($output, strtotime($min));
|
||||
$diff = (strtotime($max) - strtotime($min)) / $parts;
|
||||
$convert = strtotime($min) + $diff;
|
||||
|
||||
for ($i = 1; $i < $parts; $i++) {
|
||||
$dataCollection[] = date($output, $convert);
|
||||
$convert += $diff;
|
||||
}
|
||||
$dataCollection[] = date($output, strtotime($max));
|
||||
return $dataCollection;
|
||||
}
|
||||
|
||||
public function index(Request $request)
|
||||
{
|
||||
// dd(123);
|
||||
// $a = ['1','2','3'];
|
||||
// $b = User::where('id',1)->update([
|
||||
// 'otp'=>json_encode($a)
|
||||
// ]);
|
||||
// // $b = User::query();
|
||||
// $b = User::whereJsonContains('otp',1)->get();
|
||||
// dd($b);
|
||||
$user = User::select('name');
|
||||
$company = Company::select('company_name');
|
||||
// $a = 2;
|
||||
// if($a == 2){
|
||||
// $company->where('id',$a)->get();
|
||||
// }
|
||||
$categories = Category::union($user)->union($company)->select('category_name as product_name')->get();
|
||||
// $user = User::all();
|
||||
// $company = Company::all();
|
||||
// $result = $user->union($company)->get();
|
||||
// echo "<pre>";
|
||||
// print_r($categories);
|
||||
// die;
|
||||
// dd($result);
|
||||
$period = \Carbon\CarbonPeriod::create(now()->subMonths(12)->format('Y-m-d'), '1 month', now()->format('Y-m-d'));
|
||||
$monthNames = array();
|
||||
foreach ($period as $dt) {
|
||||
// echo $dt->format("Y-m") . "<br>\n";
|
||||
$date = Carbon::createFromFormat('m', $dt->format("m"));
|
||||
$monthName = $date->format('F') . ' ';
|
||||
array_push($monthNames, '' . $monthName . '');
|
||||
}
|
||||
// array_walk($monthNames, fn(&$x) => $x = "'$x'");
|
||||
// print_r(Carbon::now()->subMonths(6));
|
||||
// print_r(implode(', ',$monthNames));
|
||||
// die;
|
||||
// $a = '"' . implode('", "', $monthNames) . '"';
|
||||
$a = '"' . implode('","', $monthNames) . '"';
|
||||
// print_r($a);
|
||||
// die;
|
||||
$companyCount = Company::count();
|
||||
$userCount = User::users()->count();
|
||||
$investingUserCount = MonthlyUpdateMaster::distinct('users_id')->count('users_id');
|
||||
$totalProductCount = Product::count();
|
||||
$leads = Lead::with('leadSource')->where('lead_owner', auth()->user()->id)->get();
|
||||
$tasks = LeadTasksMeeting::where('owner', auth()->user()->id)->tasks()->get();
|
||||
$meetings = LeadTasksMeeting::where('host', auth()->user()->id)->meetings()->get();
|
||||
$users = User::admins()->get();
|
||||
// dd($leads);
|
||||
return view('Admin.general-dashboard', compact('companyCount', 'a', 'leads', 'tasks', 'meetings','users','userCount','investingUserCount','totalProductCount'));
|
||||
}
|
||||
|
||||
public function getCommissionData(Request $request)
|
||||
{
|
||||
$getDates = MonthlyUpdateMasterCommission::select(\DB::raw('MAX(created_at) as latest_date'), \DB::raw('MIN(created_at) as earliest_date'))->first();
|
||||
$getTotal = MonthlyUpdateMasterCommission::query();
|
||||
if ($request->from) {
|
||||
$getTotal->where('created_at', '>=', $request->from . ' 00:00:00');
|
||||
}
|
||||
if ($request->to) {
|
||||
$getTotal->where('created_at', '<=', $request->to . ' 00:00:00');
|
||||
}
|
||||
|
||||
$splitDates = $this->splitDates($min = $request->from ?? $getDates['earliest_date'], $max = $request->to ?? $getDates['latest_date']);
|
||||
|
||||
for ($i = 0; $i < count($splitDates); $i++) {
|
||||
$convertedDate = \Carbon\Carbon::parse($splitDates[$i])->format('Y-m-d');
|
||||
$data = MonthlyUpdateMasterCommission::where('created_at', '>=', $convertedDate . ' 00:00:00')->select(\DB::raw('SUM(gross_commissioned_earned_inr) as total_gross'), \DB::raw('SUM(net_commission_received) as total_net'))->first();
|
||||
$intervalGross[] = $data->total_gross;
|
||||
$intervalNet[] = $data->total_net;
|
||||
}
|
||||
|
||||
|
||||
$getTotal = $getTotal->selectRaw(\DB::raw('SUM(total_investment_or_commitment_amount) as total_commission, SUM(gross_commissioned_earned_inr) as total_gross, SUM(net_commission_received) as total_net'))
|
||||
->first();
|
||||
return response()->json([
|
||||
'total_investment' => $this->IND_money_format($getTotal->total_commission),
|
||||
'gross_commission' => $this->IND_money_format($getTotal->total_gross),
|
||||
'net_commission' => $this->IND_money_format($getTotal->total_net),
|
||||
'days' => $splitDates,
|
||||
'intervalGross' => $intervalGross,
|
||||
'intervalNet' => $intervalNet,
|
||||
]);
|
||||
}
|
||||
|
||||
public function IND_money_format($number)
|
||||
{
|
||||
$decimal = (string)($number - floor($number));
|
||||
$money = floor($number);
|
||||
$length = strlen($money);
|
||||
$delimiter = '';
|
||||
$money = strrev($money);
|
||||
|
||||
for ($i = 0; $i < $length; $i++) {
|
||||
if (($i == 3 || ($i > 3 && ($i - 1) % 2 == 0)) && $i != $length) {
|
||||
$delimiter .= ',';
|
||||
}
|
||||
$delimiter .= $money[$i];
|
||||
}
|
||||
|
||||
$result = strrev($delimiter);
|
||||
$decimal = preg_replace("/0\./i", ".", $decimal);
|
||||
$decimal = substr($decimal, 0, 3);
|
||||
|
||||
if ($decimal != '0') {
|
||||
$result = $result . $decimal;
|
||||
}
|
||||
|
||||
return '₹ ' . $result;
|
||||
}
|
||||
|
||||
public function personalDashboard(Request $request){
|
||||
// dd(123);
|
||||
// $a = ['1','2','3'];
|
||||
// $b = User::where('id',1)->update([
|
||||
// 'otp'=>json_encode($a)
|
||||
// ]);
|
||||
// // $b = User::query();
|
||||
// $b = User::whereJsonContains('otp',1)->get();
|
||||
// dd($b);
|
||||
$user = User::select('name');
|
||||
$company = Company::select('company_name');
|
||||
// $a = 2;
|
||||
// if($a == 2){
|
||||
// $company->where('id',$a)->get();
|
||||
// }
|
||||
$categories = Category::union($user)->union($company)->select('category_name as product_name')->get();
|
||||
// $user = User::all();
|
||||
// $company = Company::all();
|
||||
// $result = $user->union($company)->get();
|
||||
// echo "<pre>";
|
||||
// print_r($categories);
|
||||
// die;
|
||||
// dd($result);
|
||||
$period = \Carbon\CarbonPeriod::create(now()->subMonths(12)->format('Y-m-d'), '1 month', now()->format('Y-m-d'));
|
||||
$monthNames = array();
|
||||
foreach ($period as $dt) {
|
||||
// echo $dt->format("Y-m") . "<br>\n";
|
||||
$date = Carbon::createFromFormat('m', $dt->format("m"));
|
||||
$monthName = $date->format('F') . ' ';
|
||||
array_push($monthNames, '' . $monthName . '');
|
||||
}
|
||||
// array_walk($monthNames, fn(&$x) => $x = "'$x'");
|
||||
// print_r(Carbon::now()->subMonths(6));
|
||||
// print_r(implode(', ',$monthNames));
|
||||
// die;
|
||||
// $a = '"' . implode('", "', $monthNames) . '"';
|
||||
$a = '"' . implode('","', $monthNames) . '"';
|
||||
// print_r($a);
|
||||
// die;
|
||||
$companyCount = Company::count();
|
||||
$userCount = User::users()->count();
|
||||
$investingUserCount = MonthlyUpdateMaster::distinct('users_id')->count('users_id');
|
||||
$totalProductCount = Product::count();
|
||||
$leads = Lead::with('leadSource')->where('lead_owner', auth()->user()->id)->get();
|
||||
$tasks = LeadTasksMeeting::where('owner', auth()->user()->id)->tasks()->get();
|
||||
$meetings = LeadTasksMeeting::where('host', auth()->user()->id)->meetings()->get();
|
||||
$users = User::admins()->get();
|
||||
return view('Admin.personal-dashboard', compact('companyCount', 'a', 'leads', 'tasks', 'meetings','users','userCount','investingUserCount','totalProductCount'));
|
||||
}
|
||||
|
||||
public function editTask(Request $request)
|
||||
{
|
||||
$validator = Validator::make($request->post(), [
|
||||
'task_id' => 'required',
|
||||
'subject' => 'required',
|
||||
'due_date' => 'required',
|
||||
'priority' => 'required',
|
||||
'owner' => 'required',
|
||||
'reminder' => 'required',
|
||||
], [
|
||||
'required' => 'The :attribute field must be required'
|
||||
]);
|
||||
|
||||
$validationMessage = $this->validationError($validator);
|
||||
if ($validationMessage) {
|
||||
return response()->json(['status' => 400, 'message' => $validationMessage]);
|
||||
}
|
||||
|
||||
$leadNotes = LeadTasksMeeting::where('id',$request->task_id)->update([
|
||||
'subject' => $request->subject,
|
||||
'due_date' => $request->due_date,
|
||||
'priority' => $request->priority,
|
||||
'owner' => $request->owner,
|
||||
'reminder' => $request->reminder,
|
||||
'status' => $request->status ? '1' : '0',
|
||||
// 'updated_by' => auth()->user()->id
|
||||
]);
|
||||
|
||||
if ($leadNotes) {
|
||||
return response()->json(['status' => 200, 'message' => 'Lead Task Updated Succesfully!']);
|
||||
} else {
|
||||
return response()->json(['status' => 400, 'message' => 'Error Creating Lead Task!']);
|
||||
};
|
||||
}
|
||||
|
||||
public function editMeeting(Request $request){
|
||||
$validator = Validator::make($request->post(), [
|
||||
'meeting_id' => 'required',
|
||||
'location' => 'required',
|
||||
'from' => 'required',
|
||||
'to' => 'required',
|
||||
'host' => 'required',
|
||||
'priority' => 'required',
|
||||
'participants' => 'required',
|
||||
'related_to' => 'required',
|
||||
], [
|
||||
'required' => 'The :attribute field must be required'
|
||||
]);
|
||||
|
||||
$validationMessage = $this->validationError($validator);
|
||||
if ($validationMessage) {
|
||||
return response()->json(['status' => 400, 'message' => $validationMessage]);
|
||||
}
|
||||
|
||||
$leadMeeting = LeadTasksMeeting::where('id',$request->meeting_id)->update([
|
||||
'location' => $request->location,
|
||||
'from' => $request->from,
|
||||
'to' => $request->to,
|
||||
'host' => $request->host,
|
||||
'priority' => $request->priority,
|
||||
'participants' => $request->participants,
|
||||
'related_to' => $request->related_to,
|
||||
'status' => $request->status ? '1' : '0',
|
||||
// 'updated_by' => auth()->user()->id
|
||||
]);
|
||||
|
||||
if ($leadMeeting) {
|
||||
return response()->json(['status' => 200, 'message' => 'Lead Meeting Updated Succesfully!']);
|
||||
} else {
|
||||
return response()->json(['status' => 400, 'message' => 'Error Creating Lead Meeting!']);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
public function deleteTask(Request $request)
|
||||
{
|
||||
try {
|
||||
$task = LeadTasksMeeting::findorFail($request->id);
|
||||
if ($task) {
|
||||
$task->delete();
|
||||
return response()->json(['status' => 200, 'message' => 'Task Deleted!']);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['status' => 400, 'message' => 'Error deleting task!']);
|
||||
}
|
||||
}
|
||||
|
||||
public function deleteMeeting(Request $request)
|
||||
{
|
||||
try {
|
||||
$meeting = LeadTasksMeeting::findorFail($request->id);
|
||||
if ($meeting) {
|
||||
$meeting->delete();
|
||||
return response()->json(['status' => 200, 'message' => 'Meeting Deleted!']);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['status' => 400, 'message' => 'Error deleting meeting!']);
|
||||
}
|
||||
}
|
||||
|
||||
public function deleteLead(Request $request)
|
||||
{
|
||||
|
||||
try {
|
||||
$lead = Lead::findorFail(100);
|
||||
if ($lead) {
|
||||
$lead->delete();
|
||||
return response()->json(['status' => 200, 'message' => 'Lead Deleted!']);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['status' => 400, 'message' => 'Error deleting lead!']);
|
||||
}
|
||||
}
|
||||
|
||||
public function updateSingleAdminNotification(Request $request){
|
||||
$user = User::find(auth()->user()->id);
|
||||
$user->notifications->where('id', $request->not_id)->markAsRead();
|
||||
return response()->json(['status' => 200, 'message' => 'Notification mark as read']);
|
||||
}
|
||||
|
||||
public function validationError($validator)
|
||||
{
|
||||
if ($validator->fails()) {
|
||||
$errors = $validator->errors();
|
||||
$messages = '';
|
||||
foreach ($errors->all() as $message) {
|
||||
$messages .= $message . '</br>';
|
||||
}
|
||||
return $messages;
|
||||
}
|
||||
}
|
||||
|
||||
public function readSpecificNotification($id){
|
||||
// dd($request->all());
|
||||
if($id){
|
||||
$notification = auth()->user()->unreadNotifications->where('id', $id)->markAsRead();
|
||||
// if(!$notification){
|
||||
$newUser = '';
|
||||
$submittedKyc = '';
|
||||
$sellerForm = '';
|
||||
$buyerForm = '';
|
||||
$contactUs = '';
|
||||
$leadAssigned = '';
|
||||
foreach(getAllAdminNotifications() as $data){
|
||||
$message = $data->data['message'] ;
|
||||
$created_at = $data->created_at->diffForHumans();
|
||||
$id = $data->id;
|
||||
if(array_key_exists('notification_type', $data->data) && $data->data['notification_type'] == 'New Users')
|
||||
{
|
||||
$newUser .=$this->notificationData($message, $created_at, $id);
|
||||
}else if(array_key_exists('notification_type', $data->data) && $data->data['notification_type'] == 'Submitted KYC'){
|
||||
$submittedKyc .=$this->notificationData($message, $created_at, $id);
|
||||
}else if(array_key_exists('notification_type', $data->data) && $data->data['notification_type'] == 'Seller Form'){
|
||||
$sellerForm .=$this->notificationData($message, $created_at, $id);
|
||||
}else if(array_key_exists('notification_type', $data->data) && $data->data['notification_type'] == 'Buyer Form'){
|
||||
$buyerForm .=$this->notificationData($message, $created_at, $id);
|
||||
}else if(array_key_exists('notification_type', $data->data) && $data->data['notification_type'] == 'Contact Us'){
|
||||
$contactUs .=$this->notificationData($message, $created_at, $id);
|
||||
}else if(array_key_exists('notification_type', $data->data) && $data->data['notification_type'] == 'Leads Assigned'){
|
||||
$leadAssigned .=$this->notificationData($message, $created_at, $id);
|
||||
|
||||
}
|
||||
}
|
||||
$notificationStatus = array('newUser'=>$newUser,'submittedKyc'=>$submittedKyc,'sellerForm'=>$sellerForm,'buyerForm'=>$buyerForm,'contactUs'=>$contactUs,'leadAssigned'=>$leadAssigned);
|
||||
return response()->json(['status'=>200,'message'=>"marked as read",'data'=>$notificationStatus]);
|
||||
// }
|
||||
}
|
||||
return response()->json(['status'=>201,'message'=>"something error"]);
|
||||
}
|
||||
|
||||
public function notificationData($message, $created_at, $id){
|
||||
$data = ' <div class="d-flex align-items-start">
|
||||
<div class="symbol symbol-35px me-4">
|
||||
<span class="symbol-label bg-light-warning">
|
||||
<span class="svg-icon svg-icon-2 svg-icon-warning">
|
||||
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path opacity="0.3" d="M20 15H4C2.9 15 2 14.1 2 13V7C2 6.4 2.4 6 3 6H21C21.6 6 22 6.4 22 7V13C22 14.1 21.1 15 20 15ZM13 12H11C10.5 12 10 12.4 10 13V16C10 16.5 10.4 17 11 17H13C13.6 17 14 16.6 14 16V13C14 12.4 13.6 12 13 12Z" fill="currentColor"/>
|
||||
<path d="M14 6V5H10V6H8V5C8 3.9 8.9 3 10 3H14C15.1 3 16 3.9 16 5V6H14ZM20 15H14V16C14 16.6 13.5 17 13 17H11C10.5 17 10 16.6 10 16V15H4C3.6 15 3.3 14.9 3 14.7V18C3 19.1 3.9 20 5 20H19C20.1 20 21 19.1 21 18V14.7C20.7 14.9 20.4 15 20 15Z" fill="currentColor"/>
|
||||
</svg>
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
<div class="mb-0 me-2">
|
||||
<div class="text-gray-400 fs-7">'.$message.'</div>
|
||||
</div>
|
||||
<span class="badge badge-light fs-8 me-2">'.$created_at.'</span>
|
||||
<a class="badge badge-light fs-8 notify_id" data-notify-id="'.$id.'"><i class="fa fa-trash" aria-hidden="true"></i></a>
|
||||
</div>';
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
19
app/Http/Controllers/Admin/InvestmentListingController.php
Normal file
19
app/Http/Controllers/Admin/InvestmentListingController.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class InvestmentListingController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
return view('Admin.Pages.pre_owned_investment.investment_listing');
|
||||
}
|
||||
|
||||
public function rejected_investment_view()
|
||||
{
|
||||
return view('Admin.Pages.pre_owned_investment.rejected_investment_view');
|
||||
}
|
||||
}
|
||||
11
app/Http/Controllers/Admin/KycDetailController.php
Normal file
11
app/Http/Controllers/Admin/KycDetailController.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class KycDetailController extends Controller
|
||||
{
|
||||
//
|
||||
}
|
||||
46
app/Http/Controllers/Admin/LoginController.php
Normal file
46
app/Http/Controllers/Admin/LoginController.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Admin\AdminUser;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Hash;
|
||||
use Session;
|
||||
|
||||
class LoginController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
return view('Admin.login');
|
||||
}
|
||||
|
||||
public function check_login(Request $request)
|
||||
{
|
||||
$user_data = AdminUser::where('email','=', $request->email)->first();
|
||||
|
||||
if(!$user_data)
|
||||
{
|
||||
return response()->json(['message'=>'Email Id does not exists', 'status'=>404]);
|
||||
}else{
|
||||
//check password
|
||||
if(Hash::check($request->password,$user_data->password))
|
||||
{
|
||||
Session::put('User_data', ['user_name' => $user_data->name]);
|
||||
return response()->json(['status'=>200]);
|
||||
}else{
|
||||
return response()->json(['message'=>'Incorrect Password', 'status'=>404]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function logout()
|
||||
{
|
||||
if(session()->has('User_data'))
|
||||
{
|
||||
session()->flush('User_data');
|
||||
}
|
||||
return redirect( route('login') );
|
||||
}
|
||||
}
|
||||
87
app/Http/Controllers/Admin/ManageBlogsController.php
Normal file
87
app/Http/Controllers/Admin/ManageBlogsController.php
Normal file
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Traits\HttpResponse;
|
||||
use App\Services\Admin\BlogService;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\StoreBlogRequest;
|
||||
use App\Http\Requests\UpdateBlogRequest;
|
||||
|
||||
class ManageBlogsController extends Controller
|
||||
{
|
||||
use HttpResponse;
|
||||
|
||||
protected $blog;
|
||||
|
||||
public function __construct(BlogService $blog)
|
||||
{
|
||||
$this->blog = $blog;
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
return view('Admin.Pages.manage_cms.manage_blog.manage_blog', [
|
||||
'blogs' => $this->blog->getAllBlogs()
|
||||
]);
|
||||
}
|
||||
|
||||
public function add_new_blog()
|
||||
{
|
||||
return view('Admin.Pages.manage_cms.manage_blog.add_new_blog', [
|
||||
'tags' => $this->blog->getAllTags()
|
||||
]);
|
||||
}
|
||||
|
||||
public function store_blog(StoreBlogRequest $request)
|
||||
{
|
||||
$blogAdded = $this->blog->store($request);
|
||||
return $blogAdded ?
|
||||
$this->response('Blog Added Successfully!', 200) :
|
||||
$this->response('Blog Could Not Be Added Successfully!', 400);
|
||||
}
|
||||
public function show_blog($id)
|
||||
{
|
||||
return view('Admin.Pages.manage_cms.manage_blog.show_blog', [
|
||||
'blog' => $this->blog->show($id)
|
||||
]);
|
||||
}
|
||||
|
||||
public function edit_blog($id)
|
||||
{
|
||||
return view('Admin.Pages.manage_cms.manage_blog.edit_blog', [
|
||||
'blog' => $this->blog->getBlog($id),
|
||||
'tags' => $this->blog->getAllTags()
|
||||
]);
|
||||
}
|
||||
|
||||
public function update_blog(UpdateBlogRequest $request)
|
||||
{
|
||||
$blogUpdated = $this->blog->update($request);
|
||||
return $blogUpdated ?
|
||||
$this->response('Blog Updated Successfully!', 200) :
|
||||
$this->response('Blog Updation Error!', 400);
|
||||
}
|
||||
|
||||
public function delete_blog($id)
|
||||
{
|
||||
$checkBlogExists = $this->blog->getBlog($id);
|
||||
if ($checkBlogExists) {
|
||||
$this->blog->delete($id);
|
||||
$this->blog->deleteFile($checkBlogExists);
|
||||
return response(['status' => 200]);
|
||||
} else {
|
||||
return response(['status' => 204]);
|
||||
}
|
||||
}
|
||||
|
||||
public function update_status(Request $request)
|
||||
{
|
||||
$statusUpdated = $this->blog->updateStatus($request);
|
||||
if (!$statusUpdated) {
|
||||
return response()->json(['status' => 400, 'message' => 'Error Changing Category Status!']);
|
||||
}
|
||||
return response()->json(['status' => 200, 'message' => 'Status Changed!']);
|
||||
}
|
||||
}
|
||||
167
app/Http/Controllers/Admin/ManageChatController.php
Normal file
167
app/Http/Controllers/Admin/ManageChatController.php
Normal file
@@ -0,0 +1,167 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use App\Models\Chat;
|
||||
use App\Models\User;
|
||||
use App\Models\UserKyc;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Support\Facades\View;
|
||||
|
||||
class ManageChatController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
return view('Admin.Pages.manage_chat.manage_chat', [
|
||||
'users' => $this->getUserList(1),
|
||||
'chat' => Chat::with(['user', 'admin'])->where('user_id', auth()->user()->id)->get()
|
||||
]);
|
||||
}
|
||||
|
||||
public function getUserList($initial = null)
|
||||
{
|
||||
$usersId = Chat::query()
|
||||
->latest()
|
||||
->pluck('user_id')
|
||||
->filter()
|
||||
->unique();
|
||||
|
||||
$users = collect();
|
||||
foreach ($usersId as $id) {
|
||||
$user = User::query()
|
||||
->withCount('total')
|
||||
->where('id', $id)
|
||||
->first();
|
||||
$users->push($user);
|
||||
}
|
||||
if($initial === 1){
|
||||
return $users;
|
||||
}
|
||||
$userList = View::make('Admin.Pages.manage_chat.user-list')->with('users', $users)->render();
|
||||
return $userList;
|
||||
// return response()->json(['userlist' => $userList]);
|
||||
}
|
||||
|
||||
public function initialUsers($search = null)
|
||||
{
|
||||
return User::query()
|
||||
->when($search !== null, function ($query) use ($search) {
|
||||
$query->where('name', 'like', '%' . $search . '%');
|
||||
})
|
||||
->withCount('total')
|
||||
->orderBy('total_count', 'desc')
|
||||
->get();
|
||||
}
|
||||
|
||||
public function getUser(Request $request)
|
||||
{
|
||||
$id = $request->id;
|
||||
// $user = User::find($id);
|
||||
$user = User::where('id', $id)->first();
|
||||
// $userKYC = UserKyc::where('users_id',$id)->exists();
|
||||
$kycStatus = UserKyc::where('users_id', $id)->exists() == true ? UserKyc::where('users_id', $id)->value('status') : 'Not Submitted';
|
||||
$userPage = View::make('Admin.Pages.manage_chat.user-details')->with('user', $user)->with('kycStatus', $kycStatus)->render();
|
||||
$chat = Chat::where('user_id', $id)->get();
|
||||
$updateTimestamp = Chat::where(['user_id' => $id, 'read_at' => null])->update([
|
||||
'read_at' => Carbon::now()
|
||||
]);
|
||||
foreach ($chat as $data) {
|
||||
if ($data->file !== null) {
|
||||
$data['filename'] = $data->getRawOriginal('file');
|
||||
}
|
||||
}
|
||||
$chatPage = View::make('Admin.Pages.manage_chat.chat')->with('chat', $chat)->with('user', $user)->render();
|
||||
return response()->json(['user' => $userPage, 'chat' => $chatPage]);
|
||||
}
|
||||
|
||||
public function getChat(Request $request)
|
||||
{
|
||||
$id = $request->id;
|
||||
// return $id;
|
||||
$chat = Chat::where('user_id', $id)->get();
|
||||
$chatPage = View::make('Admin.Pages.manage_chat.chat')->with('user', $chat);
|
||||
return $chatPage;
|
||||
}
|
||||
|
||||
public function sendAdminMsg(Request $request)
|
||||
{
|
||||
if (!$request->message) {
|
||||
return response()->json(['status' => 400, 'message' => 'Please Drop A Message!']);
|
||||
}
|
||||
|
||||
$addChat = Chat::create([
|
||||
'user_id' => $request->user_id,
|
||||
'admin_id' => auth()->user()->id,
|
||||
'message' => $request->message,
|
||||
'by' => 'Admin'
|
||||
]);
|
||||
|
||||
if ($addChat) {
|
||||
return response()->json(['status' => 200, 'message' => 'Chat Send']);
|
||||
}
|
||||
return response()->json(['status' => 200, 'message' => 'Error Sending Message']);
|
||||
}
|
||||
|
||||
public function usersDetail(Request $request)
|
||||
{
|
||||
$search = $request->search;
|
||||
$userData = $this->initialUsers($search);
|
||||
$data = '';
|
||||
foreach ($userData as $user) {
|
||||
$profile_image = $user['profile_image'] != null ? "public/uploads/profile/img/" . $user->getRawOriginal('profile_image') : 'https://cdn.pixabay.com/photo/2015/10/05/22/37/blank-profile-picture-973460_960_720.png';
|
||||
$user_name = $user['name'];
|
||||
$user_email = $user['email'];
|
||||
$user_id = $user['id'];
|
||||
|
||||
$data .= " " . "
|
||||
<div class='d-flex flex-stack py-4'>
|
||||
<div class='d-flex align-items-center'>
|
||||
<div class='symbol symbol-45px symbol-circle'>
|
||||
<img alt='Pic' src='$profile_image' />
|
||||
";
|
||||
if ($user['total_count']) {
|
||||
$count = $user['total_count'];
|
||||
$data .= "<span class='symbol-badge badge badge-sm badge-circle badge-white badge-outline bg-danger start-100'>$count</span>";
|
||||
}
|
||||
$data .= "</div>";
|
||||
|
||||
$data .= "<div class='ms-5'>
|
||||
<a href='javascript:void(0)' class='fs-5 fw-bold text-gray-900 text-hover-primary mb-2' onclick='getUser($user_id)'>$user_name</a>
|
||||
<div class='fw-semibold text-muted'>$user_email</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
";
|
||||
}
|
||||
|
||||
if ($data) {
|
||||
return $data;
|
||||
} else {
|
||||
return "NO data found";
|
||||
}
|
||||
}
|
||||
|
||||
public function getMessageCount(Request $request)
|
||||
{
|
||||
$id = auth('sanctum')->user()->id;
|
||||
$chat = Chat::where(['user_id'=>$id,'is_read'=>false])->whereNotNull('admin_id')->count();
|
||||
return response()->json([
|
||||
'data'=>$chat,
|
||||
]);
|
||||
}
|
||||
|
||||
public function getAllMessage(Request $request)
|
||||
{
|
||||
$id = auth('sanctum')->user()->id;
|
||||
$getChat = Chat::where(['user_id'=>$id,'is_read'=>false])->get();
|
||||
foreach($getChat as $singleChat)
|
||||
{
|
||||
// return response()->json(['data'=>$singleChat]);
|
||||
$updateChat = Chat::where('id',$singleChat->id)->update(['is_read'=>true,'read_at'=>Carbon::now()]);
|
||||
}
|
||||
return response()->json(['data'=>Chat::where(['user_id'=>$id])->get()]);
|
||||
// $chat = Chat::where('user_id',$id)->update
|
||||
}
|
||||
}
|
||||
276
app/Http/Controllers/Admin/ManageCommissionController.php
Normal file
276
app/Http/Controllers/Admin/ManageCommissionController.php
Normal file
@@ -0,0 +1,276 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Models\Product;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\MonthlyUpdateAlternativeInvestmentFund;
|
||||
use App\Models\MonthlyUpdateFractionalRealEstate;
|
||||
use App\Models\MonthlyUpdateIndianFinancialAssets;
|
||||
use App\Models\MonthlyUpdateMaster;
|
||||
use App\Models\MonthlyUpdateMasterCommission;
|
||||
use App\Models\ProductTrailCommission;
|
||||
use App\Services\Admin\CommissionService;
|
||||
use App\Traits\HttpResponse;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Yajra\DataTables\Contracts\DataTable;
|
||||
use Yajra\DataTables\Facades\DataTables;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Carbon\CarbonPeriod;
|
||||
|
||||
class ManageCommissionController extends Controller
|
||||
{
|
||||
use HttpResponse;
|
||||
|
||||
protected $commission;
|
||||
|
||||
public function __construct(CommissionService $commission)
|
||||
{
|
||||
$this->commission = $commission;
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$products = Product::query()
|
||||
->select(DB::raw('products.id, coalesce(sdi.product_name, p2p.scheme, fre.property_name_and_location,id.company_name,aif.fund_name,caga.project_name,hyf.security_name,lbf.company,sdi.product_name,vd.company_name) as product_name'), DB::raw('DATE_FORMAT(products.created_at, "%d-%b-%Y") as date'), 'categories.category_name', DB::raw('coalesce(sdi.minimum_investment, p2p.minimum_investment, fre.minimum_investment,id.minimum_investment,aif.minimum_investment,caga.minimum_investment,hyf.minimum_investment,lbf.minimum_investment,sdi.minimum_investment,vd.minimum_investment) as minimum_investment'), 'products.commission_type', 'products.rate', 'products.commission', 'products.description', DB::raw('coalesce(fre.companies_id,aif.companies_id,caga.companies_id,vd.companies_id) as companies_id'), 'upfront_rate', 'trail_rate')
|
||||
->leftJoin('securitized_debt_instruments as sdi', 'products.id', 'sdi.products_id')
|
||||
->leftJoin('fractional_real_estates as fre', 'products.id', 'fre.products_id')
|
||||
->leftJoin('peer_to_peer_lendings as p2p', 'products.id', 'p2p.products_id')
|
||||
->leftJoin('invoice_discountings as id', 'products.id', 'id.products_id')
|
||||
->leftJoin('alternative_investment_funds as aif', 'products.id', 'aif.products_id')
|
||||
->leftJoin('clean_and_green_assets as caga', 'products.id', 'caga.products_id')
|
||||
->leftJoin('high_yield_finances as hyf', 'products.id', 'hyf.products_id')
|
||||
->leftJoin('lease_based_financings as lbf', 'products.id', 'lbf.products_id')
|
||||
->leftJoin('venture_debts as vd', 'products.id', 'vd.products_id')
|
||||
// ->join('fractional_real_estates as fr', 'companies.id', 'fr.companies_id')
|
||||
// ->leftJoin('alternative_investment_funds as aifp', 'companies.id', 'aifp.companies_id')
|
||||
// ->leftJoin('clean_and_green_assets as cagap', 'companies.id', 'cagap.companies_id')
|
||||
// ->leftJoin('venture_debts as vdp', 'companies.id', 'vdp.companies_id')
|
||||
->join('categories', 'products.categories_id', 'categories.id')
|
||||
// ->orderBy('products.created_at')
|
||||
->latest('products.created_at')
|
||||
->get();
|
||||
return view('Admin.Pages.manage_commission.manage_commission', compact('products'));
|
||||
}
|
||||
|
||||
public function add()
|
||||
{
|
||||
return view('Admin.Pages.manage_commission.add_commission');
|
||||
}
|
||||
|
||||
public function viewProduct($id, $product = 'product')
|
||||
{
|
||||
return view('Admin.Pages.manage_commission.view_commission', [
|
||||
'product' => Product::with('category')->find($id),
|
||||
'product_name' => $product,
|
||||
]);
|
||||
}
|
||||
|
||||
public function editCommission($id, $product = 'product')
|
||||
{
|
||||
// dd($product);
|
||||
// dd(Product::find($id));
|
||||
// $product = Product::find($id)
|
||||
return view('Admin.Pages.manage_commission.edit_commission', [
|
||||
'product' => Product::find($id),
|
||||
'product_name' => $product,
|
||||
]);
|
||||
}
|
||||
|
||||
public function editProduct(Request $request)
|
||||
{
|
||||
// dd($request->all());
|
||||
// dd($request->end_of_trail.' 00:00:00.0');
|
||||
$validator = Validator::make($request->post(), [
|
||||
'commission_type' => 'required',
|
||||
// 'profit_sharing' => 'required',
|
||||
// 'upfront_rate' => 'required',
|
||||
// 'trail_rate' => 'required',
|
||||
'gst' => 'required',
|
||||
'tds' => 'required',
|
||||
// 'end_of_trail' => 'required',
|
||||
], [
|
||||
'required' => 'The :attribute field must be required',
|
||||
'unique' => 'The :attribute field must be unique'
|
||||
]);
|
||||
$validationMessage = $this->validationError($validator);
|
||||
if ($validationMessage) {
|
||||
return response()->json(['status' => 400, 'message' => $validationMessage]);
|
||||
}
|
||||
Product::where('id', $request->products_id)->update([
|
||||
'commission_type' => $request->commission_type,
|
||||
'profit_sharing' => $request->profit_sharing,
|
||||
'upfront_rate' => $request->upfront_rate,
|
||||
'return_type' => $request->return_type,
|
||||
'trail_rate' => $request->trail_rate,
|
||||
'gst' => $request->gst,
|
||||
'tds' => $request->tds,
|
||||
'end_of_trail' => $request->end_of_trail,
|
||||
]);
|
||||
|
||||
$returnType = [
|
||||
'Monthly' => '1 month',
|
||||
'Quarterly' => '3 months',
|
||||
'Half-Yearly' => '6 months',
|
||||
'Yearly' => '12 months',
|
||||
];
|
||||
|
||||
if ($request->commission_type == 'Trail Commission' || $request->commission_type == 'Hybrid Structure') {
|
||||
$start = Carbon::today();
|
||||
ProductTrailCommission::where(['products_id' => $request->products_id, 'commission_earned' => 'No'])->delete();
|
||||
$getDates = ProductTrailCommission::where('products_id', $request->products_id)->pluck('commission_date');
|
||||
foreach (CarbonPeriod::create($start, $returnType[$request->return_type], $request->end_of_trail . ' 00:00:00.0') as $month) {
|
||||
$month->lastOfMonth();
|
||||
if ($getDates->contains($month->format('Y-m-d h:i:s'))) {
|
||||
continue;
|
||||
}
|
||||
ProductTrailCommission::create([
|
||||
'products_id' => $request->products_id,
|
||||
'commission_date' => $month->format('Y-m-d h:i:s')
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
return response()->json(['status' => 200, 'message' => 'Product Commission Updated!']);
|
||||
}
|
||||
|
||||
public function validationError($validator)
|
||||
{
|
||||
if ($validator->fails()) {
|
||||
$errors = $validator->errors();
|
||||
$messages = '';
|
||||
foreach ($errors->all() as $message) {
|
||||
$messages .= $message . '</br>';
|
||||
}
|
||||
return $messages;
|
||||
}
|
||||
}
|
||||
|
||||
public function userCommission()
|
||||
{
|
||||
return view('Admin.Pages.manage_commission.user_commission');
|
||||
}
|
||||
|
||||
public function viewUserProduct($id)
|
||||
{
|
||||
return view('Admin.Pages.manage_commission.view_user_commission', [
|
||||
'product' => MonthlyUpdateMasterCommission::find($id)
|
||||
]);
|
||||
}
|
||||
|
||||
public function editUserCommission($id)
|
||||
{
|
||||
return view('Admin.Pages.manage_commission.edit_user_commission', [
|
||||
'product' => MonthlyUpdateMasterCommission::find($id)
|
||||
]);
|
||||
}
|
||||
|
||||
public function updateUserCommission(Request $request)
|
||||
{
|
||||
$validator = Validator::make($request->post(), [
|
||||
'total_investment_or_commitment_amount' => 'required',
|
||||
'applicable_rate' => 'required',
|
||||
'gst' => 'required',
|
||||
'tds' => 'required',
|
||||
], [
|
||||
'required' => 'The :attribute field must be required',
|
||||
'unique' => 'The :attribute field must be unique'
|
||||
]);
|
||||
$validationMessage = $this->validationError($validator);
|
||||
if ($validationMessage) {
|
||||
return response()->json(['status' => 400, 'message' => $validationMessage]);
|
||||
}
|
||||
$grossCommissionedEarned = ($request->total_investment_or_commitment_amount * $request->applicable_rate) / 100;
|
||||
$gst = ($grossCommissionedEarned * $request->gst) / 100;
|
||||
$tds = ($grossCommissionedEarned * $request->tds) / 100;
|
||||
|
||||
MonthlyUpdateMasterCommission::where('id', $request->monthly_update_commissions_id)->update([
|
||||
'total_investment_or_commitment_amount' => $request->total_investment_or_commitment_amount,
|
||||
'applicable_rate' => $request->applicable_rate,
|
||||
'gst' => $request->gst,
|
||||
'tds' => $request->tds,
|
||||
'net_commission_received' => $grossCommissionedEarned + $gst - $tds,
|
||||
'gross_commissioned_earned_inr' => $grossCommissionedEarned,
|
||||
]);
|
||||
return response()->json(['status' => 200, 'message' => 'User Commission Updated!']);
|
||||
}
|
||||
|
||||
public function dataTable(Request $request)
|
||||
{
|
||||
if ($request->ajax()) {
|
||||
$data = MonthlyUpdateMasterCommission::query()
|
||||
->with('monthlyUpdate.products.fractional_real_estate')
|
||||
->latest()
|
||||
->select('*');
|
||||
if ($request->from) {
|
||||
$data->where('created_at', '>=', $request->from . ' 00:00:00');
|
||||
};
|
||||
if ($request->to) {
|
||||
$data->where('created_at', '<=', $request->to . ' 23:59:59');
|
||||
};
|
||||
return DataTables::of($data)->addIndexColumn()
|
||||
->editColumn('created_at', function ($row) {
|
||||
$formattedDate = $row->created_at->format('d/m/Y');
|
||||
return '<div class="badge badge-light fw-bold">' . $formattedDate . '</div>';
|
||||
})
|
||||
->editColumn('investor_name', function ($row) {
|
||||
return '<div class="text-center">' . $row->monthlyUpdate->investor_name . ' </div>';
|
||||
})
|
||||
->editColumn('product_sold', function ($row) {
|
||||
return '<div class="text-center">' . 'ABC' . '</div>';
|
||||
})
|
||||
->editColumn('month', function ($row) {
|
||||
return '<div class="text-center">' . $row->created_at->format('M') . ' </div>';
|
||||
})
|
||||
->editColumn('total_investment', function ($row) {
|
||||
return '<div class="text-center">' . $row->total_investment_or_commitment_amount . ' </div>';
|
||||
})
|
||||
->editColumn('applicable_rate', function ($row) {
|
||||
return '<div class="text-center">' . $row->applicable_rate . '% </div>';
|
||||
})
|
||||
->editColumn('commission_type', function ($row) {
|
||||
return '<div class="text-center">' . $row->type_of_commission . ' </div>';
|
||||
})
|
||||
->addColumn('action', function ($row) {
|
||||
$view = route("get-user-commission", $row->id);
|
||||
$edit = route("edit-user-commission", $row->id);
|
||||
$btn = "<div class='text-end d-flex align-items-center justify-content-around'>
|
||||
<a href=$view>
|
||||
<i class='fa-regular fa-eye'></i>
|
||||
</a>
|
||||
<a href=$edit style='float:right'>
|
||||
<i class='fa-solid fa-pen-to-square'></i>
|
||||
</a>
|
||||
</div>
|
||||
";
|
||||
return $btn;
|
||||
})
|
||||
->rawColumns(['investor_name', 'product_sold', 'month', 'total_investment', 'applicable_rate', 'commission_type', 'created_at', 'action'])
|
||||
->make(true);
|
||||
}
|
||||
}
|
||||
|
||||
public function trailCommission()
|
||||
{
|
||||
return view('Admin.Pages.manage_commission.trail_commission', [
|
||||
'trailCommission' => $this->commission->getTrailCommissions()
|
||||
]);
|
||||
}
|
||||
|
||||
public function generateTrailCommission(Request $request)
|
||||
{
|
||||
$monthlyUpdate = $this->commission->getMonthlyUpdate($request->id);
|
||||
$commissionUpdated = $this->commission->updateProductTrailCommission($request->id, $request->trail_id);
|
||||
$product = $this->commission->getProduct($request->id);
|
||||
foreach ($monthlyUpdate as $commission) {
|
||||
$investmentValue = $this->commission->getInvestmentValue($commission);
|
||||
$commissionCalculation = $this->commission->commissionCalculation($product, $investmentValue);
|
||||
$this->commission->storeMonthlyCommission($product, $commission, $investmentValue, $commissionCalculation);
|
||||
}
|
||||
return $commissionUpdated ?
|
||||
$this->response('Commission Generated!', 200) :
|
||||
$this->response('Commission Could Not Be Generated!', 400);
|
||||
}
|
||||
}
|
||||
261
app/Http/Controllers/Admin/ManageFaqController.php
Normal file
261
app/Http/Controllers/Admin/ManageFaqController.php
Normal file
@@ -0,0 +1,261 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Resources\TagResource;
|
||||
use App\Http\Resources\TagResourceCollection;
|
||||
use App\Models\Admin\Tag;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Admin\FAQ;
|
||||
use App\Models\Admin\Pages;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
|
||||
class ManageFaqController extends Controller
|
||||
{
|
||||
// manage faq page
|
||||
public function index()
|
||||
{
|
||||
$faq_data = FAQ::with('tag')->get();
|
||||
return view('Admin.Pages.manage_cms.manage_faq.manage_faq', ['faq_data' => $faq_data]);
|
||||
}
|
||||
|
||||
public function show($id)
|
||||
{
|
||||
// $faq_data = FAQ::where('id',$id)->where('is_active','1')->first();
|
||||
// $faq_data = FAQ::find($id)->tag;
|
||||
$faq_data = Tag::join('faq', 'tags.id', '=', 'faq.tag_id')->where('faq.id', $id)->get(['faq.*', 'tags.tag_name']);
|
||||
return view('Admin.Pages.manage_cms.manage_faq.view_faq', ['faq_data' => $faq_data[0]]);
|
||||
}
|
||||
|
||||
public function add_faq()
|
||||
{
|
||||
$page_list = Pages::where('is_active', 1)->get();
|
||||
$tags = Tag::all();
|
||||
return view('Admin.Pages.manage_cms.manage_faq.add_faq', ['page_list' => $page_list, 'tags' => $tags]);
|
||||
}
|
||||
|
||||
public function store_faq(Request $request)
|
||||
{
|
||||
$validator = Validator::make(
|
||||
$request->all(),
|
||||
[
|
||||
// "question" => 'required|unique:faq,faq_question,tag_id'.$request->input('tag'),
|
||||
"question" => [
|
||||
'required',
|
||||
function ($attribute, $value, $fail) {
|
||||
// check question is unique in that table
|
||||
$question_exists = FAQ::where('faq_question', $value)->where('tag_id', request()->input('tag'))->count() > 0;
|
||||
|
||||
if ($question_exists) {
|
||||
$fail('The ' . $attribute . ' must be unique.');
|
||||
}
|
||||
}
|
||||
],
|
||||
"answer" => 'required',
|
||||
"faq_type" => 'required',
|
||||
"tag" => 'required',
|
||||
],
|
||||
[
|
||||
'question.required' => 'Question is required',
|
||||
'question.unique' => 'Question should be unique',
|
||||
'answer.required' => 'Answer is required',
|
||||
'faq_type.required' => 'Faq Type is required',
|
||||
'tag.required' => 'Tag Name is required',
|
||||
]
|
||||
);
|
||||
// dd($request->all());
|
||||
// return $request->all();
|
||||
$validationMessage = validationErrorMessage($validator);
|
||||
if ($validationMessage) {
|
||||
return response()->json(
|
||||
[
|
||||
"status" => 400,
|
||||
"message" => $validationMessage
|
||||
]
|
||||
);
|
||||
}
|
||||
if (isset($request->question)) {
|
||||
$tag = Tag::find($request->tag);
|
||||
$faq = new FAQ();
|
||||
$faq->faq_question = $request->question;
|
||||
$faq->faq_answer = $request->answer;
|
||||
$faq->faq_page = "null";
|
||||
$faq->faq_type = $request->faq_type;
|
||||
$faq->is_active = '1';
|
||||
$tag->FAQ()->save($faq);
|
||||
// $request->session()->flash('message', 'Faq added successfully');
|
||||
return response(['status' => 200]);
|
||||
} else {
|
||||
// $request->session()->flash('message', 'Fields are missing');
|
||||
return response(['status' => 204]);
|
||||
}
|
||||
}
|
||||
|
||||
// fetch faq data for update with page list(pages links)
|
||||
public function edit_faq($id)
|
||||
{
|
||||
$faq_data = FAQ::where('id', $id)->first();
|
||||
$page_list = Pages::where('is_active', 1)->get();
|
||||
$tags = Tag::all();
|
||||
// return $page_list;
|
||||
return view('Admin.Pages.manage_cms.manage_faq.edit_faq', ['faq_data' => $faq_data, 'page_list' => $page_list, 'tags' => $tags]);
|
||||
}
|
||||
|
||||
// update faq data
|
||||
public function update_faq(Request $request)
|
||||
{
|
||||
// dd("hello");
|
||||
$validator = Validator::make(
|
||||
$request->all(),
|
||||
[
|
||||
"question" => [
|
||||
'required',
|
||||
function ($attribute, $value, $fail) {
|
||||
// check question is unique in that table
|
||||
// $question_exists = FAQ::where('id', 'NOT IN', request()->input('faq_id'))->get();
|
||||
$question_exists = DB::select("select * from faq where id<>'" . request()->input('faq_id') . "' and faq_question='" . request()->input('question') . "' and tag_id='" . request()->input('tag_id') . "' ");
|
||||
|
||||
if ($question_exists) {
|
||||
$fail('The ' . $attribute . ' must be unique.');
|
||||
}
|
||||
}
|
||||
],
|
||||
"answer" => 'required',
|
||||
'tag_id' => 'required',
|
||||
"faq_type" => 'required',
|
||||
],
|
||||
[
|
||||
'question.required' => 'Question is required',
|
||||
// 'question.unique' =>'Question should be unique',
|
||||
'answer.required' => 'Answer is required',
|
||||
// 'page.required' =>'Page is required',
|
||||
'required' => 'The :attribute field must be required',
|
||||
]
|
||||
);
|
||||
$validationMessage = validationErrorMessage($validator);
|
||||
if ($validationMessage) {
|
||||
return response()->json(["status" => 400, "message" => $validationMessage]);
|
||||
}
|
||||
|
||||
$updateFaq = FAQ::where('id', $request->faq_id)->update([
|
||||
'tag_id' => $request->tag_id,
|
||||
'faq_question' => $request->question,
|
||||
'faq_answer' => $request->answer,
|
||||
'faq_type' => $request->faq_type,
|
||||
]);
|
||||
|
||||
if ($updateFaq) {
|
||||
return response()->json(['status' => 200, 'message' => 'Faq Data Updated']);
|
||||
}
|
||||
return response()->json(['status' => 400, 'message' => 'Faq Data Could Not Be Updated']);
|
||||
}
|
||||
|
||||
// delete faq data by id
|
||||
public function delete_faq(Request $request, $id)
|
||||
{
|
||||
$faq = FAQ::where('id', $id)->delete();
|
||||
|
||||
if ($faq) {
|
||||
// $request->session()->flash('message', 'Faq deleted successfully');
|
||||
return response(['status' => 200, 'message' => 'Faq deleted successfully']);
|
||||
} else {
|
||||
// $request->session()->flash('message', 'Something went wrong! Try again');
|
||||
return response(['status' => 204, 'message' => 'Something went wrong! Try again']);
|
||||
}
|
||||
}
|
||||
|
||||
// faq status changing active/inactive on toggle
|
||||
public function update_status(Request $request)
|
||||
{
|
||||
$id = $request->id;
|
||||
$status = $request->status == 1 ? 0 : 1;
|
||||
$updateStatus = Faq::where('id', $id)->update([
|
||||
'is_active' => $status
|
||||
]);
|
||||
if (!$updateStatus) {
|
||||
return response()->json(['status' => 400, 'message' => 'Error Changing Faq Status!']);
|
||||
}
|
||||
return response()->json(['status' => 200, 'message' => 'Status Changed!']);
|
||||
}
|
||||
|
||||
public function faqList()
|
||||
{
|
||||
$faqList = FAQ::where('is_active', 1)->get();
|
||||
if (!$faqList) {
|
||||
return response()->json(['status' => 400, 'message' => 'No FAQs'], 400);
|
||||
}
|
||||
return response()->json(['status' => 200, 'data' => $faqList], 200);
|
||||
}
|
||||
|
||||
public function faqListForFrontend()
|
||||
{
|
||||
$tags = $this->tagWithFaqs()->getData();
|
||||
// $tagName = Tag::has('faq')->orderBy('tag_name','ASC')->get(['id', 'tag_name']);
|
||||
$tagName = Tag::has('faq')->orderBy(\DB::raw('(id = 49) DESC, tag_name, id'))->get(['id', 'tag_name']);
|
||||
return view('Frontend.Pages.resources.faqs', ['tags' => $tags->data, 'tagName' => $tagName]);
|
||||
}
|
||||
|
||||
// faq api
|
||||
public function tagWithFaqs()
|
||||
{
|
||||
try {
|
||||
return (new TagResourceCollection(Tag::has('faq')->orderBy(\DB::raw('(id = 49) DESC, tag_name, id'))->with('faq', function ($query) {
|
||||
$query->where('is_active', true)
|
||||
->where('faq.faq_type', '1');
|
||||
})->get()))
|
||||
->response()
|
||||
->setStatusCode(200);
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['message' => $e->getMessage()], 400);
|
||||
}
|
||||
}
|
||||
|
||||
public function getAllTagsRelatedToFaq()
|
||||
{
|
||||
$tags = Tag::query()
|
||||
->join('faq', 'tags.id', 'faq.tag_id')
|
||||
->where('is_active',true)
|
||||
->select('tags.id', 'tag_name')
|
||||
->distinct('id','tag_name')
|
||||
->get();
|
||||
if ($tags) {
|
||||
return response()->json([
|
||||
"status" => "success",
|
||||
"data" => $tags
|
||||
]);
|
||||
} else {
|
||||
return response()->json([
|
||||
"status" => "failed",
|
||||
], 400);
|
||||
}
|
||||
}
|
||||
|
||||
public function getAllFaqs(Request $request)
|
||||
{
|
||||
if ($request->method() == 'POST') {
|
||||
$tag_id = $request->tag_id;
|
||||
}
|
||||
|
||||
$faqs = FAQ::query()
|
||||
->when(request('tag_id'), function ($query) use ($tag_id) {
|
||||
$query->where('tag_id', $tag_id);
|
||||
})
|
||||
->where('is_active', true)
|
||||
->select('id', 'faq_question', 'faq_answer')
|
||||
->get();
|
||||
|
||||
if ($faqs) {
|
||||
return response()->json([
|
||||
"status" => "success",
|
||||
'tag' => $tag_id ? Tag::where('id',$tag_id)->value('tag_name') : 'No Tag',
|
||||
"data" => $faqs,
|
||||
]);
|
||||
} else {
|
||||
return response()->json([
|
||||
"status" => "failed",
|
||||
], 400);
|
||||
}
|
||||
}
|
||||
}
|
||||
1419
app/Http/Controllers/Admin/ManageFreeUInvestmentController.php
Normal file
1419
app/Http/Controllers/Admin/ManageFreeUInvestmentController.php
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,95 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin\ManageFreeUInvestments;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Category;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
use App\Imports\AlternativeInvestmentFundImport;
|
||||
use Illuminate\Support\Str;
|
||||
use App\Models\AlternativeInvestmentFund;
|
||||
use App\Models\Product;
|
||||
|
||||
class AngelFundController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$category = Category::find(Category::AngelFundId);
|
||||
$text = $category->category_name;
|
||||
$category_id = $category->id;
|
||||
$excelFileName = 'AngelFundsTemplate.xlsx';
|
||||
return view('Admin.Pages.manage_freeu_investment.upload-product.alternative-investment-fund', compact('text', 'category_id','excelFileName'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,197 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin\ManageFreeUInvestments;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Admin\FAQ;
|
||||
use App\Models\Admin\Tag;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Category;
|
||||
use App\Models\Product;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
use App\Models\CleanAndGreenAsset;
|
||||
use App\Imports\CleanAndGreenAssetImport;
|
||||
use Illuminate\Support\Str;
|
||||
use App\Models\Company;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
|
||||
class CleanAndGreenAssetsController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$category = Category::find(Category::CleanAndGreenAssetsId);
|
||||
$text = $category->category_name;
|
||||
$category_id = $category->id;
|
||||
$excelFileName = 'CleanAndGreenAssetsTemplate.xlsx';
|
||||
return view('Admin.Pages.manage_freeu_investment.upload-product.clean-and-green-asset', compact('text', 'category_id','excelFileName'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
request()->validate([
|
||||
'productFile' => 'required|mimes:xlx,xls,xlsx|max:2048'
|
||||
]);
|
||||
$category_type = $request->category_id;
|
||||
$category = Category::find($request->category_id);
|
||||
Excel::import(new CleanAndGreenAssetImport($category_type), $request->file('productFile'));
|
||||
return back()->with('success', "$category->category_name Imported Successfully.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
$cleanAndGreenAsset = Product::with('category', 'cleanAndGreenAssets')->cleanAndGreenAssets()->find($id);
|
||||
return view('Admin.Pages.manage_freeu_investment.view-product.clean-and-green-asset', compact('cleanAndGreenAsset'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$companies = Company::active()->pluck('company_name','id');
|
||||
$cleanAndGreenAsset = Product::with('category', 'cleanAndGreenAssets')->cleanAndGreenAssets()->find($id);
|
||||
return view('Admin.Pages.manage_freeu_investment.edit-product.clean-and-green-asset', compact('cleanAndGreenAsset','id','companies'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
// $request->validate([
|
||||
// 'project_name' => 'required'
|
||||
// ]);
|
||||
|
||||
$validate = Validator::make($request->all(),[
|
||||
'project_name' => 'required',
|
||||
'presentation'=>"required|mimes:pdf,zip",
|
||||
'fact_sheet'=>"required|mimes:pdf,zip",
|
||||
],[
|
||||
'required' => "This :attribute field is required",
|
||||
'mimes' => "This :attribute field extension must be pdf or zip",
|
||||
]);
|
||||
$validationMessage = validationErrorMessage($validate);
|
||||
if ($validationMessage) {
|
||||
|
||||
return response()->json(
|
||||
|
||||
[
|
||||
|
||||
'status' => 400,
|
||||
|
||||
'message' => $validationMessage
|
||||
|
||||
]
|
||||
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
$cleanAndGreenAsset = CleanAndGreenAsset::where('id', $id)->update([
|
||||
'slug' => Str::slug($request->project_name),
|
||||
'companies_id' => $request->companies_id,
|
||||
'project_name' => $request->project_name,
|
||||
'focus_area' => $request->focus_area,
|
||||
'asset_value' => $request->asset_value,
|
||||
'asset_life' => $request->asset_life,
|
||||
'entry_load' => $request->entry_load,
|
||||
'lockin_period' => $request->lockin_period,
|
||||
'minimum_investment' => $request->minimum_investment,
|
||||
'maximum_investment' => $request->maximum_investment,
|
||||
'expected_returns_irr' => $request->expected_returns_irr,
|
||||
'payouts' => $request->payouts,
|
||||
'minimum_investment_in_int' => $request->minimum_investment_in_int,
|
||||
]);
|
||||
|
||||
$product = Product::where('id', $request->product_clean_id)->first();;
|
||||
|
||||
if($request->has('presentation')){
|
||||
if(\File::exists(public_path('/uploads/product/presentation/'.$product->presentation.''))){
|
||||
\File::delete(public_path('/uploads/product/presentation/'.$product->presentation));
|
||||
}
|
||||
$productpresentation = time().'_presentation'.'.'.$request->presentation->extension();
|
||||
$request->presentation->move(public_path('/uploads/product/presentation'),$productpresentation);
|
||||
$updatepresentation = Product::where('id', $request->product_clean_id)->update([
|
||||
'presentation'=> $productpresentation,
|
||||
]);
|
||||
}
|
||||
|
||||
if($request->has('fact_sheet')){
|
||||
if(\File::exists(public_path('/uploads/product/fact_sheet/'.$product->fact_sheet.''))){
|
||||
\File::delete(public_path('/uploads/product/fact_sheet'.$product->fact_sheet));
|
||||
}
|
||||
$productfactsheet = time().'_factsheet'.'.'.$request->fact_sheet->extension();
|
||||
$request->fact_sheet->move(public_path('uploads/product/fact_sheet'),$productfactsheet);
|
||||
$updatefactsheet = Product::where('id', $request->product_clean_id)->update([
|
||||
'fact_sheet'=>$productfactsheet,]);
|
||||
}
|
||||
|
||||
return response()->json(['status' => 200, 'message' => 'Clean And Green Asset Details Updated Successfully']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
public function cleanAndGreenAssetsQuestionAndAnswer()
|
||||
{
|
||||
$cleanAndGreenAssets = FAQ::where('tag_id',Tag::CleanandGreenAssetsId)->get();
|
||||
|
||||
if(count($cleanAndGreenAssets) > 0)
|
||||
{
|
||||
return response()->json([
|
||||
"status" => "success",
|
||||
"code" => 200,
|
||||
"data" => $cleanAndGreenAssets
|
||||
]);
|
||||
}
|
||||
else
|
||||
{
|
||||
return response()->json([
|
||||
"status" => "failed",
|
||||
"code" => 400,
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin\ManageFreeUInvestments;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Category;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
use App\Imports\AlternativeInvestmentFundImport;
|
||||
use Illuminate\Support\Str;
|
||||
use App\Models\AlternativeInvestmentFund;
|
||||
use App\Models\Product;
|
||||
|
||||
class DebtFundController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$category = Category::find(Category::DebtFundId);
|
||||
$text = $category->category_name;
|
||||
$category_id = $category->id;
|
||||
$excelFileName = 'DebtFundsTemplate.xlsx';
|
||||
return view('Admin.Pages.manage_freeu_investment.upload-product.alternative-investment-fund', compact('text', 'category_id','excelFileName'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,690 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin\ManageFreeUInvestments;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Admin\FAQ;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Category;
|
||||
use App\Models\Product;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
use App\Models\FractionalRealEstate;
|
||||
use App\Imports\FractionalRealEstateImport;
|
||||
use Illuminate\Support\Str;
|
||||
use App\Models\Company;
|
||||
use App\Models\Admin\Tag;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
|
||||
|
||||
class FractionalRealEstateController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$category = Category::find(Category::FractionalRealEstateId);
|
||||
$text = $category->category_name;
|
||||
$category_id = $category->id;
|
||||
$excelFileName = 'FractionalRealEstateTemplate.xlsx';
|
||||
return view('Admin.Pages.manage_freeu_investment.upload-product.fractional-real-estate', compact('text', 'category_id', 'excelFileName'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
request()->validate([
|
||||
'productFile' => 'required|mimes:xlx,xls,xlsx|max:2048'
|
||||
]);
|
||||
$category_type = $request->category_id;
|
||||
$category = Category::find($request->category_id);
|
||||
Excel::import(new FractionalRealEstateImport($category_type), $request->file('productFile'));
|
||||
// return back()->with('success', 'Product Imported Successfully.');
|
||||
return back()->with('success', "$category->category_name Imported Successfully.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
$fractionalRealEstate = Product::with('category', 'fractional_real_estate')->fractionalrealestate()->findorFail($id);
|
||||
dd($fractionalRealEstate);
|
||||
return view('Admin.Pages.manage_freeu_investment.view-product.fractional-real-estate', compact('fractionalRealEstate'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit($id)
|
||||
|
||||
{
|
||||
|
||||
$companies = Company::active()->pluck('company_name', 'id');
|
||||
$fractionalRealEstate = Product::with('category', 'fractional_real_estate')->fractionalrealestate()->find($id);
|
||||
// dd($fractionalRealEstate);
|
||||
return view('Admin.Pages.manage_freeu_investment.edit-product.fractional-real-estate', compact('fractionalRealEstate', 'id', 'companies'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
// dd($request->all());
|
||||
$validate = Validator::make($request->all(), [
|
||||
'property_name_and_location' => 'required',
|
||||
'presentation' => "|mimes:pdf,zip",
|
||||
'fact_sheet' => "|mimes:pdf,zip",
|
||||
'type' => 'required',
|
||||
'geographic_focus' => 'required',
|
||||
], [
|
||||
'required' => "This :attribute field is required",
|
||||
'mimes' => "This :attribute field extension must be pdf or zip",
|
||||
]);
|
||||
|
||||
|
||||
$validationMessage = validationErrorMessage($validate);
|
||||
if ($validationMessage) {
|
||||
|
||||
return response()->json(
|
||||
|
||||
[
|
||||
|
||||
'status' => 400,
|
||||
|
||||
'message' => $validationMessage
|
||||
|
||||
]
|
||||
|
||||
);
|
||||
}
|
||||
$fractionalRealEstate = FractionalRealEstate::where('id', $id)->update([
|
||||
'slug' => Str::slug($request->property_name_and_location),
|
||||
'companies_id' => $request->companies_id,
|
||||
'geographic_focus' => $request->geographic_focus,
|
||||
'property_name_and_location' => $request->property_name_and_location,
|
||||
'property_description' => $request->property_description,
|
||||
'property_grade' => $request->property_grade,
|
||||
'asset_type' => $request->asset_type,
|
||||
'tenant' => $request->tenant,
|
||||
'deal_size_in_crore' => $request->deal_size_in_crore,
|
||||
'coupon_rate_on_ccd' => $request->coupon_rate_on_ccd,
|
||||
'rental_escalation' => $request->rental_escalation,
|
||||
'capital_appreciation' => $request->capital_appreciation,
|
||||
'expected_irr' => $request->expected_irr,
|
||||
'cagr' => $request->cagr,
|
||||
'minimum_investment' => $request->minimum_investment,
|
||||
'minimum_investment_lockin' => $request->minimum_investment_lockin,
|
||||
'tenant_lease_term' => $request->tenant_lease_term,
|
||||
'tenant_lock_in' => $request->tenant_lock_in,
|
||||
'tenant_security_deposit' => $request->tenant_security_deposit,
|
||||
'annual_management_fee' => $request->annual_management_fee,
|
||||
'performance_fees' => $request->performance_fees,
|
||||
'hurdle_rate' => $request->hurdle_rate,
|
||||
|
||||
|
||||
]);
|
||||
|
||||
$fre = FractionalRealEstate::find($id);
|
||||
if ($request->has('property_image')) {
|
||||
if (\File::exists(public_path('/uploads/fractional_real_estate/property_image/' . $fre->property_image . ''))) {
|
||||
\File::delete(public_path('/uploads/fractional_real_estate/property_image/' . $fre->property_image . ''));
|
||||
}
|
||||
$frePropertyImage = time() . '.' . $request->property_image->extension();
|
||||
$request->property_image->move(public_path('/uploads/fractional_real_estate/property_image'), $frePropertyImage);
|
||||
$updatePropertyImage = FractionalRealEstate::where('id', $id)->update([
|
||||
'property_image' => $frePropertyImage,
|
||||
]);
|
||||
}
|
||||
|
||||
$product = Product::where('id', $request->product_id)->first();
|
||||
// dd($product);
|
||||
if ($request->has('presentation')) {
|
||||
if (\File::exists(public_path('/uploads/product/presentation/' . $product->presentation))) {
|
||||
\File::delete(public_path('/uploads/product/presentation/' . $product->presentation));
|
||||
}
|
||||
$productpresentation = time() . '_presentation' . '.' . $request->presentation->extension();
|
||||
$request->presentation->move(public_path('/uploads/product/presentation'), $productpresentation);
|
||||
$updatepresentation = Product::where('id', $request->product_id)->update([
|
||||
'presentation' => $productpresentation,
|
||||
]);
|
||||
}
|
||||
|
||||
if ($request->has('fact_sheet')) {
|
||||
if (\File::exists(public_path('/uploads/product/fact_sheet/' . $product->fact_sheet))) {
|
||||
\File::delete(public_path('/uploads/product/fact_sheet' . $product->fact_sheet));
|
||||
}
|
||||
$productfactsheet = time() . '_factsheet' . '.' . $request->fact_sheet->extension();
|
||||
$request->fact_sheet->move(public_path('uploads/product/fact_sheet'), $productfactsheet);
|
||||
$updatefactsheet = Product::where('id', $request->product_id)->update([
|
||||
'fact_sheet' => $productfactsheet,
|
||||
]);
|
||||
}
|
||||
$type = Product::where('id', $fre->products_id)->update(['type' => $request->type]);
|
||||
|
||||
|
||||
return response()->json(['status' => 200, 'message' => 'Fractional Real Estate Details Updated Successfully']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
// fractional real estate api
|
||||
public function fractionalRealEstateQuestionAndAnswer()
|
||||
{
|
||||
$fractionalRealEState = FAQ::where('tag_id', Tag::FractionalRealEstateId)->active()->where('faq_type', '0')->get();
|
||||
return $this->returnData($fractionalRealEState);
|
||||
}
|
||||
|
||||
// faqs
|
||||
public function fractionalRealEstateQuestionAndAnswerFaqs()
|
||||
{
|
||||
$fractionalRealEStateFaqs = FAQ::where(['tag_id' => Tag::FractionalRealEstateId, 'faq_type' => '1'])->get();
|
||||
return $this->returnData($fractionalRealEStateFaqs);
|
||||
}
|
||||
|
||||
public function peerToPeerLendingQuestionAndAnswer()
|
||||
{
|
||||
$peerToPerrLeanding = FAQ::where('tag_id', Tag::PeertoPeerLendingId)->active()->where('faq_type', '0')->get();
|
||||
return $this->returnData($peerToPerrLeanding);
|
||||
}
|
||||
|
||||
// faqs
|
||||
public function peerToPeerLendingQuestionAndAnswerFaqs()
|
||||
{
|
||||
$peerToPerrLeandingFaqs = FAQ::where(['tag_id' => Tag::PeertoPeerLendingId, 'faq_type' => '1'])->get();
|
||||
return $this->returnData($peerToPerrLeandingFaqs);
|
||||
}
|
||||
|
||||
public function invoiceDiscountingQuestionAndAnswer()
|
||||
{
|
||||
$invoiceDiscointing = FAQ::where('tag_id', Tag::InvoiceDiscountingId)->active()->where('faq_type', '0')->get();
|
||||
return $this->returnData($invoiceDiscointing);
|
||||
}
|
||||
|
||||
// faqs
|
||||
public function invoiceDiscountingQuestionAndAnswerFaqs()
|
||||
{
|
||||
$invoiceDiscointingFaqs = FAQ::where(['tag_id' => Tag::InvoiceDiscountingId, 'faq_type' => '1'])->get();
|
||||
return $this->returnData($invoiceDiscointingFaqs);
|
||||
}
|
||||
|
||||
public function revenueBasedFinancingQuestionAndAnswer()
|
||||
{
|
||||
|
||||
$revenueBasedFinancing = FAQ::where('tag_id', Tag::RevenueBasedFinancingId)->active()->where('faq_type', '0')->get();
|
||||
return $this->returnData($revenueBasedFinancing);
|
||||
}
|
||||
|
||||
// faqs
|
||||
public function revenueBasedFinancingQuestionAndAnswerFaqs()
|
||||
{
|
||||
$revenueBasedFinancingFaqs = FAQ::where(['tag_id' => Tag::RevenueBasedFinancingId, 'faq_type' => '1'])->get();
|
||||
return $this->returnData($revenueBasedFinancingFaqs);
|
||||
}
|
||||
|
||||
public function ventureDebtQuestionAndAnswer()
|
||||
{
|
||||
|
||||
$ventureDebt = FAQ::where('tag_id', Tag::VentureDebtId)->active()->get();
|
||||
return $this->returnData($ventureDebt);
|
||||
}
|
||||
|
||||
// faqs
|
||||
public function ventureDebtQuestionAndAnswerFaqs()
|
||||
{
|
||||
$ventureDebtFaqs = FAQ::where(['tag_id' => Tag::VentureDebtId, 'faq_type' => '1'])->get();
|
||||
return $this->returnData($ventureDebtFaqs);
|
||||
}
|
||||
|
||||
public function securitizedDebtInstrumentQuestionAndAnswer()
|
||||
{
|
||||
|
||||
$securitizedDebtInstrument = FAQ::where('tag_id', Tag::SecuritizedDebtInstrumentId)->active()->get();
|
||||
return $this->returnData($securitizedDebtInstrument);
|
||||
}
|
||||
|
||||
// faqs
|
||||
public function securitizedDebtInstrumentQuestionAndAnswerFaqs()
|
||||
{
|
||||
$securitizedDebtInstrumentFaqs = FAQ::where(['tag_id' => Tag::SecuritizedDebtInstrumentId, 'faq_type' => '1'])->get();
|
||||
return $this->returnData($securitizedDebtInstrumentFaqs);
|
||||
}
|
||||
|
||||
public function highYieldFinanceQuestionAndAnswer()
|
||||
{
|
||||
|
||||
$highYieldFinance = FAQ::where('tag_id', Tag::HighYieldFinanceId)->active()->get();
|
||||
return $this->returnData($highYieldFinance);
|
||||
}
|
||||
|
||||
// faqs
|
||||
public function highYieldFinanceQuestionAndAnswerFaqs()
|
||||
{
|
||||
$highYieldFinanceFaqs = FAQ::where(['tag_id' => Tag::HighYieldFinanceId, 'faq_type' => '1'])->get();
|
||||
return $this->returnData($highYieldFinanceFaqs);
|
||||
}
|
||||
|
||||
public function alternativeInvestmentFundQuestionAndAnswer()
|
||||
{
|
||||
|
||||
$alternativeInvestment = FAQ::where('tag_id', Tag::AlternativeInvestmentFundId)->active()->get();
|
||||
return $this->returnData($alternativeInvestment);
|
||||
}
|
||||
|
||||
public function internationalBondsQuestionAndAnswer()
|
||||
{
|
||||
|
||||
$internationalBonds = FAQ::where('tag_id', Tag::InternationalBondsId)->active()->where('faq_type', '0')->get();
|
||||
return $this->returnData($internationalBonds);
|
||||
}
|
||||
|
||||
// faqs
|
||||
public function internationalBondsQuestionAndAnswerFaqs()
|
||||
{
|
||||
|
||||
$internationalBondsFaqs = FAQ::where(['tag_id' => Tag::InternationalBondsId, 'faq_type' => '1'])->get();
|
||||
return $this->returnData($internationalBondsFaqs);
|
||||
}
|
||||
|
||||
public function mutualFundsQuestionAndAnswer()
|
||||
{
|
||||
|
||||
$mutualFunds = FAQ::where('tag_id', Tag::MutualFundsId)->active()->get();
|
||||
return $this->returnData($mutualFunds);
|
||||
}
|
||||
|
||||
// mutual fund faqs
|
||||
public function mutualFundsQuestionAndAnswerFaqs()
|
||||
{
|
||||
|
||||
$mutualFundsFaqs = FAQ::where(['tag_id' => Tag::MutualFundsId, 'faq_type' => '1'])->get();
|
||||
return $this->returnData($mutualFundsFaqs);
|
||||
}
|
||||
|
||||
public function equitiesQuestionAndAnswer()
|
||||
{
|
||||
|
||||
$equitiesQuestion = FAQ::where('tag_id', Tag::EquitiesId)->where('faq_type', '0')->active()->get();
|
||||
return $this->returnData($equitiesQuestion);
|
||||
}
|
||||
|
||||
// faqs
|
||||
public function equitiesQuestionAndAnswerFaqs()
|
||||
{
|
||||
|
||||
$equitiesQuestionFaqs = FAQ::where(['tag_id' => Tag::EquitiesId, 'faq_type' => '1'])->get();
|
||||
return $this->returnData($equitiesQuestionFaqs);
|
||||
}
|
||||
|
||||
public function exchangeTradedFundsQuestionAndAnswer()
|
||||
{
|
||||
|
||||
$exchangeTradedFunds = FAQ::where('tag_id', Tag::ETFId)->active()->where('faq_type', '0')->get();
|
||||
return $this->returnData($exchangeTradedFunds);
|
||||
}
|
||||
|
||||
// faqs
|
||||
public function exchangeTradedFundsQuestionAndAnswerFaqs()
|
||||
{
|
||||
|
||||
$exchangeTradedFundsFaqs = FAQ::where(['tag_id' => Tag::ETFId, 'faq_type' => '1'])->get();
|
||||
return $this->returnData($exchangeTradedFundsFaqs);
|
||||
}
|
||||
|
||||
public function ventureCapitalFundQuestionAndAnswer()
|
||||
{
|
||||
|
||||
$ventureCapitalFund = FAQ::where('tag_id', Tag::VentureCapitalFundId)->active()->get();
|
||||
return $this->returnData($ventureCapitalFund);
|
||||
}
|
||||
|
||||
public function privateEquityFundQuestionAndAnswer()
|
||||
{
|
||||
|
||||
$privateEquity = FAQ::where('tag_id', Tag::PrivateEquityFundId)->active()->get();
|
||||
return $this->returnData($privateEquity);
|
||||
}
|
||||
|
||||
public function hedgeFundQuestionAndAnswer()
|
||||
{
|
||||
|
||||
$hedgeFund = FAQ::where('tag_id', Tag::HedgeFundId)->active()->get();
|
||||
return $this->returnData($hedgeFund);
|
||||
}
|
||||
|
||||
public function reitQuestionAndAnswer()
|
||||
{
|
||||
|
||||
$reit = FAQ::where('tag_id', Tag::REITId)->active()->where('faq_type', '0')->get();
|
||||
return $this->returnData($reit);
|
||||
}
|
||||
|
||||
// faqs
|
||||
public function reitQuestionAndAnswerFaqs()
|
||||
{
|
||||
|
||||
$reitFaqs = FAQ::where(['tag_id' => Tag::REITId, 'faq_type' => '1'])->get();
|
||||
return $this->returnData($reitFaqs);
|
||||
}
|
||||
|
||||
public function leaseBasedFinancingQuestionAndAnswer()
|
||||
{
|
||||
|
||||
$leaseBasedFinancing = FAQ::where('tag_id', Tag::LeaseBasedFinancingId)->active()->where('faq_type', '0')->get();
|
||||
return $this->returnData($leaseBasedFinancing);
|
||||
}
|
||||
|
||||
// faq
|
||||
public function leaseBasedFinancingQuestionAndAnswerFaqs()
|
||||
{
|
||||
|
||||
$leaseBasedFinancingFaqs = FAQ::where(['tag_id' => Tag::LeaseBasedFinancingId, 'faq_type' => '1'])->get();
|
||||
return $this->returnData($leaseBasedFinancingFaqs);
|
||||
}
|
||||
|
||||
public function cleanAndGreenAssetsQuestionAndAnswer()
|
||||
{
|
||||
|
||||
$cleanAndGreenAssets = FAQ::where('tag_id', Tag::CleanandGreenAssetsId)->active()->where('faq_type', '0')->get();
|
||||
return $this->returnData($cleanAndGreenAssets);
|
||||
}
|
||||
|
||||
// faq
|
||||
public function cleanAndGreenAssetsQuestionAndAnswerFaqs()
|
||||
{
|
||||
|
||||
$cleanAndGreenAssetsFaqs = FAQ::where(['tag_id' => Tag::CleanandGreenAssetsId, 'faq_type' => '1'])->get();
|
||||
return $this->returnData($cleanAndGreenAssetsFaqs);
|
||||
}
|
||||
|
||||
public function loefQuestionAndAnswer()
|
||||
{
|
||||
|
||||
$loef = FAQ::where('tag_id', Tag::LongOnlyEquityFundId)->active()->get();
|
||||
return $this->returnData($loef);
|
||||
}
|
||||
|
||||
// faq
|
||||
public function loefQuestionAndAnswerFaqs()
|
||||
{
|
||||
|
||||
$loef = FAQ::where(['tag_id' => Tag::LongOnlyEquityFundId, 'faq_type' => '1'])->get();
|
||||
return $this->returnData($loef);
|
||||
}
|
||||
|
||||
public function pcfQuestionAndAnswer()
|
||||
{
|
||||
|
||||
$pcf = FAQ::where('tag_id', Tag::PrivateCreditFundId)->active()->get();
|
||||
return $this->returnData($pcf);
|
||||
}
|
||||
|
||||
// faq
|
||||
public function pcfQuestionAndAnswerFaqs()
|
||||
{
|
||||
|
||||
$pcf = FAQ::where(['tag_id' => Tag::PrivateCreditFundId, 'faq_type' => '1'])->get();
|
||||
return $this->returnData($pcf);
|
||||
}
|
||||
public function aifQuestionAndAnswer()
|
||||
{
|
||||
|
||||
$aif = FAQ::where('tag_id', Tag::AlternativeInvestmentFundId)->active()->get();
|
||||
return $this->returnData($aif);
|
||||
}
|
||||
// faqs
|
||||
public function aifQuestionAndAnswerFaqs()
|
||||
{
|
||||
|
||||
$aifFaqs = FAQ::where(['tag_id' => Tag::AlternativeInvestmentFundId, 'faq_type' => '1'])->get();
|
||||
return $this->returnData($aifFaqs);
|
||||
}
|
||||
|
||||
public function aifIQuestionAndAnswer()
|
||||
{
|
||||
|
||||
$aifI = FAQ::where('tag_id', Tag::AIFIId)->active()->where('faq_type', '0')->get();
|
||||
return $this->returnData($aifI);
|
||||
}
|
||||
// faqs
|
||||
public function aifIQuestionAndAnswerFaqs()
|
||||
{
|
||||
|
||||
$aifIFaqs = FAQ::where(['tag_id' => Tag::AIFIId, 'faq_type' => '1'])->get();
|
||||
return $this->returnData($aifIFaqs);
|
||||
}
|
||||
|
||||
public function aifIIQuestionAndAnswer()
|
||||
{
|
||||
|
||||
$aifII = FAQ::where('tag_id', Tag::AIFIIId)->active()->where('faq_type', '0')->get();
|
||||
return $this->returnData($aifII);
|
||||
}
|
||||
|
||||
// faqs
|
||||
public function aifIIQuestionAndAnswerFaqs()
|
||||
{
|
||||
|
||||
$aifIIFaqs = FAQ::where(['tag_id' => Tag::AIFIIId, 'faq_type' => '1'])->get();
|
||||
return $this->returnData($aifIIFaqs);
|
||||
}
|
||||
|
||||
public function aifIIIQuestionAndAnswer()
|
||||
{
|
||||
|
||||
$aifIII = FAQ::where('tag_id', Tag::AIFIIIId)->active()->where('faq_type', '0')->get();
|
||||
return $this->returnData($aifIII);
|
||||
}
|
||||
|
||||
// faqs
|
||||
public function aifIIIQuestionAndAnswerFaqs()
|
||||
{
|
||||
|
||||
$aifIIIFaqs = FAQ::where(['tag_id' => Tag::AIFIIIId, 'faq_type' => '1'])->get();
|
||||
return $this->returnData($aifIIIFaqs);
|
||||
}
|
||||
|
||||
public function infrastructureFundQuestionAndAnswer()
|
||||
{
|
||||
|
||||
$infrastructure = FAQ::where('tag_id', Tag::InfrastructureFundId)->active()->get();
|
||||
return $this->returnData($infrastructure);
|
||||
}
|
||||
|
||||
public function angelFundQuestionAndAnswer()
|
||||
{
|
||||
|
||||
$angleFund = FAQ::where('tag_id', Tag::AngelFundId)->active()->get();
|
||||
return $this->returnData($angleFund);
|
||||
}
|
||||
|
||||
public function debtFundQuestionAndAnswer()
|
||||
{
|
||||
|
||||
$debtFund = FAQ::where('tag_id', Tag::DebtFundId)->active()->get();
|
||||
return $this->returnData($debtFund);
|
||||
}
|
||||
|
||||
public function fundForDistressedAssetQuestionAndAnswer()
|
||||
{
|
||||
|
||||
$fundForDistressedAsset = FAQ::where('tag_id', Tag::FundForDistressedAssetId)->active()->get();
|
||||
return $this->returnData($fundForDistressedAsset);
|
||||
}
|
||||
|
||||
public function privateRealEstateFundQuestionAndAnswer()
|
||||
{
|
||||
|
||||
$privateRealEstateFund = FAQ::where('tag_id', Tag::PrivateRealEstateFundId)->active()->get();
|
||||
return $this->returnData($privateRealEstateFund);
|
||||
}
|
||||
|
||||
public function privateInvestmentInPublicEquityFundQuestionAndAnswer()
|
||||
{
|
||||
|
||||
$privateInvestmentInPublicEquityFund = FAQ::where('tag_id', Tag::PrivateInvestmentInPublicEquityFundId)->active()->get();
|
||||
return $this->returnData($privateInvestmentInPublicEquityFund);
|
||||
}
|
||||
|
||||
public function globalVentureCapitalFundQuestionAndAnswer()
|
||||
{
|
||||
|
||||
$globalVentureCapitalFund = FAQ::where('tag_id', Tag::GlobalVentureCapitalFundId)->active()->where('faq_type', '0')->get();
|
||||
return $this->returnData($globalVentureCapitalFund);
|
||||
}
|
||||
|
||||
// faqs globalVentureCapitalFund
|
||||
public function globalVentureCapitalFundQuestionAndAnswerFaqs()
|
||||
{
|
||||
|
||||
$globalVentureCapitalFundFaqs = FAQ::where(['tag_id' => Tag::GlobalVentureCapitalFundId, 'faq_type' => '1'])->get();
|
||||
return $this->returnData($globalVentureCapitalFundFaqs);
|
||||
}
|
||||
|
||||
public function globalHedgeFundQuestionAndAnswer()
|
||||
{
|
||||
|
||||
$globalHedgeFund = FAQ::where('tag_id', Tag::GlobalHedgeFundId)->active()->where('faq_type', '0')->get();
|
||||
return $this->returnData($globalHedgeFund);
|
||||
}
|
||||
|
||||
// faq
|
||||
public function globalHedgeFundQuestionAndAnswerFaqs()
|
||||
{
|
||||
|
||||
$globalHedgeFundFaqs = FAQ::where(['tag_id' => Tag::GlobalHedgeFundId, 'faq_type' => '1'])->get();
|
||||
return $this->returnData($globalHedgeFundFaqs);
|
||||
}
|
||||
|
||||
public function globalPrivateEquityFundQuestionAndAnswer()
|
||||
{
|
||||
|
||||
$globalPrivateEquity = FAQ::where('tag_id', Tag::GlobalPrivateEquityFundId)->active()->where('faq_type', '0')->get();
|
||||
return $this->returnData($globalPrivateEquity);
|
||||
}
|
||||
|
||||
// faqs equities
|
||||
public function globalPrivateEquityFundQuestionAndAnswerFaqs()
|
||||
{
|
||||
|
||||
$globalPrivateEquityFaqs = FAQ::where(['tag_id' => Tag::GlobalPrivateEquityFundId, 'faq_type' => '1'])->get();
|
||||
// dd($revenueBasedFinancing);
|
||||
return $this->returnData($globalPrivateEquityFaqs);
|
||||
}
|
||||
|
||||
public function sovereignGovernmentBondQuestionAndAnswer()
|
||||
{
|
||||
|
||||
$soverignGovernmentBond = FAQ::where('tag_id', Tag::SovereignGovernmentBondId)->active()->get();
|
||||
return $this->returnData($soverignGovernmentBond);
|
||||
}
|
||||
|
||||
public function corporateBondInvestmentGradeQuestionAndAnswer()
|
||||
{
|
||||
|
||||
$corporateBondInvestment = FAQ::where('tag_id', Tag::CorporateBondInvestmentGradeId)->active()->get();
|
||||
return $this->returnData($corporateBondInvestment);
|
||||
}
|
||||
|
||||
public function corporateBondHighYieldQuestionAndAnswer()
|
||||
{
|
||||
|
||||
$corporateBondHighYield = FAQ::where('tag_id', Tag::CorporateBondHighYieldId)->active()->get();
|
||||
return $this->returnData($corporateBondHighYield);
|
||||
}
|
||||
|
||||
public function indianResidentialRealEstateQuestionAndAnswer()
|
||||
{
|
||||
|
||||
$indianResidentialRealEstate = FAQ::where('tag_id', Tag::IndianResidentialRealEstateID)->active()->get();
|
||||
return $this->returnData($indianResidentialRealEstate);
|
||||
}
|
||||
|
||||
public function indianCommercialRealEstateQuestionAndAnswer()
|
||||
{
|
||||
|
||||
$indianCommercialRealEstate = FAQ::where('tag_id', Tag::IndianCommercialRealEstateID)->active()->get();
|
||||
return $this->returnData($indianCommercialRealEstate);
|
||||
}
|
||||
|
||||
public function indianIndustrialRealEstateQuestionAndAnswer()
|
||||
{
|
||||
|
||||
$indianIndustrialReal = FAQ::where('tag_id', Tag::IndianIndustrialRealEstateID)->active()->get();
|
||||
return $this->returnData($indianIndustrialReal);
|
||||
}
|
||||
|
||||
public function globalResidentialRealEstateQuestionAndAnswer()
|
||||
{
|
||||
|
||||
$globalResidentialRealEstate = FAQ::where('tag_id', Tag::GlobalResidentialRealEstateID)->active()->get();
|
||||
return $this->returnData($globalResidentialRealEstate);
|
||||
}
|
||||
|
||||
public function globalCommercialRealEstateQuestionAndAnswer()
|
||||
{
|
||||
|
||||
$globalCommercialRealEstate = FAQ::where('tag_id', Tag::GlobalCommercialRealEstateID)->active()->get();
|
||||
return $this->returnData($globalCommercialRealEstate);
|
||||
}
|
||||
|
||||
public function globalIndustrialRealEstateQuestionAndAnswer()
|
||||
{
|
||||
|
||||
$globalIndustrialRealEstate = FAQ::where('tag_id', Tag::GlobalIndustrialRealEstateID)->active()->get();
|
||||
return $this->returnData($globalIndustrialRealEstate);
|
||||
}
|
||||
|
||||
public function returnData($data)
|
||||
{
|
||||
if ($data) {
|
||||
return response()->json([
|
||||
"status" => "success",
|
||||
"code" => 200,
|
||||
"data" => $data
|
||||
]);
|
||||
} else {
|
||||
return response()->json([
|
||||
"status" => "failed",
|
||||
"code" => 400,
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin\ManageFreeUInvestments;
|
||||
|
||||
use App\Models\Category;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
|
||||
class FundForDistressedAssetController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$category = Category::find(Category::FundForDistressedAssetId);
|
||||
$text = $category->category_name;
|
||||
$category_id = $category->id;
|
||||
$excelFileName = 'FundForDistressedAssetTemplate.xlsx';
|
||||
return view('Admin.Pages.manage_freeu_investment.upload-product.alternative-investment-fund', compact('text', 'category_id','excelFileName'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin\ManageFreeUInvestments;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Category;
|
||||
|
||||
class HedgeFundController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$category = Category::find(Category::HedgeFundId);
|
||||
$text = $category->category_name;
|
||||
$category_id = $category->id;
|
||||
$excelFileName = 'HedgeFundsTemplate.xlsx';
|
||||
return view('Admin.Pages.manage_freeu_investment.upload-product.alternative-investment-fund', compact('text', 'category_id','excelFileName'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
dd($request->all());
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,198 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin\ManageFreeUInvestments;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Admin\FAQ;
|
||||
use App\Models\Admin\Tag;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Category;
|
||||
use App\Models\Product;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
use App\Models\HighYieldFinance;
|
||||
use App\Imports\HighYieldFinanceImport;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
|
||||
class HighYieldFinanceController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$category = Category::find(Category::HighYieldFinanceId);
|
||||
$text = $category->category_name;
|
||||
$category_id = $category->id;
|
||||
$excelFileName = 'HighYieldFinanceTemplate.xlsx';
|
||||
return view('Admin.Pages.manage_freeu_investment.upload-product.high-yield-finance', compact('text', 'category_id','excelFileName'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
request()->validate([
|
||||
'productFile' => 'required|mimes:xlx,xls,xlsx|max:2048'
|
||||
]);
|
||||
$category_type = $request->category_id;
|
||||
$category = Category::find($request->category_id);
|
||||
Excel::import(new HighYieldFinanceImport($category_type), $request->file('productFile'));
|
||||
return back()->with('success', "$category->category_name Imported Successfully.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
$highYieldFinance = Product::with('category', 'highYieldFinances')->highYieldFinances()->find($id);
|
||||
// dd($highYieldFinance);
|
||||
return view('Admin.Pages.manage_freeu_investment.view-product.high-yield-finance', compact('highYieldFinance'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$highYieldFinance = Product::with('category', 'highYieldFinances')->highYieldFinances()->find($id);
|
||||
return view('Admin.Pages.manage_freeu_investment.edit-product.high-yield-finance', compact('highYieldFinance','id'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
// $request->validate([
|
||||
// 'security_name' => 'required'
|
||||
// ]);
|
||||
|
||||
$validate = Validator::make($request->all(),[
|
||||
'security_name' => 'required',
|
||||
'presentation'=>"required|mimes:pdf,zip",
|
||||
'fact_sheet'=>"required|mimes:pdf,zip",
|
||||
],[
|
||||
'required' => "This :attribute field is required",
|
||||
'mimes' => "This :attribute field extension must be pdf or zip",
|
||||
]);
|
||||
$validationMessage = validationErrorMessage($validate);
|
||||
if ($validationMessage) {
|
||||
|
||||
return response()->json(
|
||||
|
||||
[
|
||||
|
||||
'status' => 400,
|
||||
|
||||
'message' => $validationMessage
|
||||
|
||||
]
|
||||
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
$highYieldFinance = HighYieldFinance::where('id', $id)->update([
|
||||
'security_name' => $request->security_name,
|
||||
'security_type' => $request->security_type,
|
||||
'isin' => $request->isin,
|
||||
'issuer_company' => $request->issuer_company,
|
||||
'issue_size' => $request->issue_size,
|
||||
'issue_type' => $request->issue_type,
|
||||
'listing_details' => $request->listing_details,
|
||||
'rating_category' => $request->rating_category,
|
||||
'minimum_investment' => $request->minimum_investment,
|
||||
'coupon_rate' => $request->coupon_rate,
|
||||
'yield_to_maturity' => $request->yield_to_maturity,
|
||||
'interest_payment_frequency' => $request->interest_payment_frequency,
|
||||
'allotment_date' => $request->allotment_date,
|
||||
'maturity_date' => $request->maturity_date,
|
||||
'minimum_investment_in_int' => $request->minimum_investment_in_int
|
||||
]);
|
||||
|
||||
$product = Product::where('id', $request->product_high_id)->first();
|
||||
// dd($product);
|
||||
if($request->has('presentation')){
|
||||
if(\File::exists(public_path('/uploads/product/presentation/'.$product->presentation))){
|
||||
\File::delete(public_path('/uploads/product/presentation/'.$product->presentation));
|
||||
}
|
||||
$productpresentation = time().'_presentation'.'.'.$request->presentation->extension();
|
||||
$request->presentation->move(public_path('/uploads/product/presentation'),$productpresentation);
|
||||
$updatepresentation = Product::where('id', $request->product_high_id)->update([
|
||||
'presentation'=> $productpresentation,
|
||||
]);
|
||||
}
|
||||
|
||||
if($request->has('fact_sheet')){
|
||||
if(\File::exists(public_path('/uploads/product/fact_sheet/'.$product->fact_sheet))){
|
||||
\File::delete(public_path('/uploads/product/fact_sheet'.$product->fact_sheet));
|
||||
}
|
||||
$productfactsheet = time().'_factsheet'.'.'.$request->fact_sheet->extension();
|
||||
$request->fact_sheet->move(public_path('uploads/product/fact_sheet'),$productfactsheet);
|
||||
$updatefactsheet = Product::where('id', $request->product_high_id)->update([
|
||||
'fact_sheet'=>$productfactsheet,]);
|
||||
}
|
||||
|
||||
return response()->json(['status' => 200, 'message' => 'High Yield Finance Details Updated Successfully']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
public function highYieldFinanceQuestionAndAnswer()
|
||||
{
|
||||
$highYieldFinance = FAQ::where('tag_id',Tag::HighYieldFinanceId)->get();
|
||||
|
||||
if(count($highYieldFinance) > 0)
|
||||
{
|
||||
return response()->json([
|
||||
"status" => "success",
|
||||
"code" => 200,
|
||||
"data" => $highYieldFinance
|
||||
]);
|
||||
}
|
||||
else
|
||||
{
|
||||
return response()->json([
|
||||
"status" => "failed",
|
||||
"code" => 400,
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin\ManageFreeUInvestments;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Category;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
use App\Imports\AlternativeInvestmentFundImport;
|
||||
use Illuminate\Support\Str;
|
||||
use App\Models\AlternativeInvestmentFund;
|
||||
use App\Models\Product;
|
||||
|
||||
class InfrastructureFundController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$category = Category::find(Category::InfrastructureFundId);
|
||||
$text = $category->category_name;
|
||||
$category_id = $category->id;
|
||||
$excelFileName = 'InfrastructureFundsTemplate.xlsx';
|
||||
return view('Admin.Pages.manage_freeu_investment.upload-product.alternative-investment-fund', compact('text', 'category_id','excelFileName'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,197 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin\ManageFreeUInvestments;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Category;
|
||||
use App\Models\Product;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
use App\Models\InvoiceDiscounting;
|
||||
use App\Imports\InvoiceDiscountingImport;
|
||||
use Illuminate\Support\Str;
|
||||
use App\Models\Admin\FAQ;
|
||||
use App\Models\Admin\Tag;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
|
||||
class InvoiceDiscountingController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$category = Category::find(Category::InvoiceDiscountingId);
|
||||
$text = $category->category_name;
|
||||
$category_id = $category->id;
|
||||
$excelFileName = 'InvoiceDiscountingTemplate.xlsx';
|
||||
return view('Admin.Pages.manage_freeu_investment.upload-product.invoice-discounting', compact('text', 'category_id','excelFileName'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
request()->validate([
|
||||
'productFile' => 'required|mimes:xlx,xls,xlsx|max:2048'
|
||||
]);
|
||||
$category_type = $request->category_id;
|
||||
$category = Category::find($request->category_id);
|
||||
Excel::import(new InvoiceDiscountingImport($category_type), $request->file('productFile'));
|
||||
return back()->with('success', "$category->category_name Imported Successfully.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
$invoiceDiscounting = Product::with('category', 'invoiceDiscounting')->invoiceDiscounting()->find($id);
|
||||
// dd($invoiceDiscounting);
|
||||
return view('Admin.Pages.manage_freeu_investment.view-product.invoice-discounting', compact('invoiceDiscounting'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$invoiceDiscounting = Product::with('category', 'invoiceDiscounting')->invoiceDiscounting()->find($id);
|
||||
return view('Admin.Pages.manage_freeu_investment.edit-product.invoice-discounting', compact('invoiceDiscounting','id'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
// $request->validate([
|
||||
// 'company_name' => 'required'
|
||||
// ]);
|
||||
$validate = Validator::make($request->all(),[
|
||||
'company_name' => 'required',
|
||||
'presentation'=>"required|mimes:pdf,zip",
|
||||
'fact_sheet'=>"required|mimes:pdf,zip",
|
||||
],[
|
||||
'required' => "This :attribute field is required",
|
||||
'mimes' => "This :attribute field extension must be pdf or zip",
|
||||
]);
|
||||
$validationMessage = validationErrorMessage($validate);
|
||||
if ($validationMessage) {
|
||||
|
||||
return response()->json(
|
||||
|
||||
[
|
||||
|
||||
'status' => 400,
|
||||
|
||||
'message' => $validationMessage
|
||||
|
||||
]
|
||||
|
||||
);
|
||||
|
||||
}
|
||||
$invoiceDiscounting = InvoiceDiscounting::where('id', $id)->update([
|
||||
'slug' => Str::slug($request->company_name),
|
||||
'company_name' => $request->company_name,
|
||||
'sector' => $request->sector,
|
||||
'about_company' => $request->about_company,
|
||||
'key_performance_metrics' => $request->key_performance_metrics,
|
||||
'minimum_investment' => $request->minimum_investment,
|
||||
'total_deal_size' => $request->total_deal_size,
|
||||
'tenure' => $request->tenure,
|
||||
'pre_tax_irr' => $request->pre_tax_irr,
|
||||
'coupon_rate' => $request->coupon_rate,
|
||||
'vendor' => $request->vendor,
|
||||
'recourse_on' => $request->recourse_on,
|
||||
'settlement_date' => $request->settlement_date,
|
||||
'payout_frequency' => $request->payout_frequency,
|
||||
'payment_obligor' => $request->payment_obligor,
|
||||
'security_structure' => $request->security_structure,
|
||||
'minimum_investment_in_int' => $request->minimum_investment_in_int
|
||||
]);
|
||||
$product = Product::where('id', $request->invoice_id)->first();
|
||||
// dd($product);
|
||||
if($request->has('presentation')){
|
||||
if(\File::exists(public_path('/uploads/product/presentation/'.$product->presentation))){
|
||||
\File::delete(public_path('/uploads/product/presentation/'.$product->presentation));
|
||||
}
|
||||
$productpresentation = time().'_presentation'.'.'.$request->presentation->extension();
|
||||
$request->presentation->move(public_path('/uploads/product/presentation'),$productpresentation);
|
||||
$updatepresentation = Product::where('id', $request->invoice_id)->update([
|
||||
'presentation'=> $productpresentation,
|
||||
]);
|
||||
}
|
||||
|
||||
if($request->has('fact_sheet')){
|
||||
if(\File::exists(public_path('/uploads/product/fact_sheet/'.$product->fact_sheet))){
|
||||
\File::delete(public_path('/uploads/product/fact_sheet'.$product->fact_sheet));
|
||||
}
|
||||
$productfactsheet = time().'_factsheet'.'.'.$request->fact_sheet->extension();
|
||||
$request->fact_sheet->move(public_path('uploads/product/fact_sheet'),$productfactsheet);
|
||||
$updatefactsheet = Product::where('id', $request->invoice_id)->update([
|
||||
'fact_sheet'=>$productfactsheet,]);
|
||||
}
|
||||
|
||||
return response()->json(['status' => 200, 'message' => 'Invoice Discounting Details Updated Successfully']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
public function invoiceDiscountingQuestionAndAnswer()
|
||||
{
|
||||
$InvoiceDiscounting = FAQ::where('tag_id',Tag::InvoiceDiscountingId)->select('faq_question','faq_answer')->get();
|
||||
|
||||
if(count($InvoiceDiscounting) > 0)
|
||||
{
|
||||
return response()->json([
|
||||
"status" => "success",
|
||||
"code" => 200,
|
||||
"data" => $InvoiceDiscounting
|
||||
]);
|
||||
}
|
||||
else
|
||||
{
|
||||
return response()->json([
|
||||
"status" => "failed",
|
||||
"code" => 400,
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,170 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin\ManageFreeUInvestments;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Category;
|
||||
use App\Models\Product;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
use App\Models\LeaseBasedFinancing;
|
||||
use App\Imports\LeaseBasedFinancingImport;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
|
||||
class LeaseBasedFinancingController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$category = Category::find(Category::LeaseBasedFinancingId);
|
||||
$text = $category->category_name;
|
||||
$category_id = $category->id;
|
||||
$excelFileName = 'LeaseBasedFinancingTemplate.xlsx';
|
||||
return view('Admin.Pages.manage_freeu_investment.upload-product.lease-based-financing', compact('text', 'category_id','excelFileName'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
request()->validate([
|
||||
'productFile' => 'required|mimes:xlx,xls,xlsx|max:2048'
|
||||
]);
|
||||
$category_type = $request->category_id;
|
||||
$category = Category::find($request->category_id);
|
||||
Excel::import(new LeaseBasedFinancingImport($category_type), $request->file('productFile'));
|
||||
return back()->with('success', "$category->category_name Imported Successfully.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
$leaseBasedFinancing = Product::with('category', 'leaseBasedFinancing')->leaseBasedFinancing()->find($id);
|
||||
// dd($leaseBasedFinancing);
|
||||
return view('Admin.Pages.manage_freeu_investment.view-product.lease-based-financing', compact('leaseBasedFinancing'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$leaseBasedFinancing = Product::with('category', 'leaseBasedFinancing')->leaseBasedFinancing()->find($id);
|
||||
return view('Admin.Pages.manage_freeu_investment.edit-product.lease-based-financing', compact('leaseBasedFinancing','id'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
// $request->validate([
|
||||
// 'company' => 'required'
|
||||
// ]);
|
||||
|
||||
$validate = Validator::make($request->all(),[
|
||||
'company' => 'required',
|
||||
'presentation'=>"required|mimes:pdf,zip",
|
||||
'fact_sheet'=>"required|mimes:pdf,zip",
|
||||
],[
|
||||
'required' => "This :attribute field is required",
|
||||
'mimes' => "This :attribute field extension must be pdf or zip",
|
||||
]);
|
||||
$validationMessage = validationErrorMessage($validate);
|
||||
if ($validationMessage) {
|
||||
|
||||
return response()->json(
|
||||
|
||||
[
|
||||
|
||||
'status' => 400,
|
||||
|
||||
'message' => $validationMessage
|
||||
|
||||
]
|
||||
|
||||
);
|
||||
|
||||
}
|
||||
$leaseBasedFinancing = LeaseBasedFinancing::where('id', $id)->update([
|
||||
'slug' => Str::slug($request->company),
|
||||
'company' => $request->company,
|
||||
'asset_class' => $request->asset_class,
|
||||
'underlying_asset' => $request->underlying_asset,
|
||||
'sector' => $request->sector,
|
||||
'mobility_platform' => $request->mobility_platform,
|
||||
'total_deal_size' => $request->total_deal_size,
|
||||
'minimum_investment' => $request->minimum_investment,
|
||||
'tenure' => $request->tenure,
|
||||
'payout_frequency' => $request->payout_frequency,
|
||||
'pre_tax_return' => $request->pre_tax_return,
|
||||
'minimum_investment_in_int' => $request->minimum_investment_in_int
|
||||
]);
|
||||
$product = Product::where('id', $request->product_lease_id)->first();
|
||||
// dd($product);
|
||||
if($request->has('presentation')){
|
||||
if(\File::exists(public_path('/uploads/product/presentation/'.$product->presentation))){
|
||||
\File::delete(public_path('/uploads/product/presentation/'.$product->presentation));
|
||||
}
|
||||
$productpresentation = time().'_presentation'.'.'.$request->presentation->extension();
|
||||
$request->presentation->move(public_path('/uploads/product/presentation'),$productpresentation);
|
||||
$updatepresentation = Product::where('id', $request->product_lease_id)->update([
|
||||
'presentation'=> $productpresentation,
|
||||
]);
|
||||
}
|
||||
|
||||
if($request->has('fact_sheet')){
|
||||
if(\File::exists(public_path('/uploads/product/fact_sheet/'.$product->fact_sheet))){
|
||||
\File::delete(public_path('/uploads/product/fact_sheet'.$product->fact_sheet));
|
||||
}
|
||||
$productfactsheet = time().'_factsheet'.'.'.$request->fact_sheet->extension();
|
||||
$request->fact_sheet->move(public_path('uploads/product/fact_sheet'),$productfactsheet);
|
||||
$updatefactsheet = Product::where('id', $request->product_lease_id)->update([
|
||||
'fact_sheet'=>$productfactsheet,]);
|
||||
}
|
||||
|
||||
return response()->json(['status' => 200, 'message' => 'Lease Based Financing Details Updated Successfully']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,153 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin\ManageFreeUInvestments;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Category;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Http\Request;
|
||||
use DataTables;
|
||||
|
||||
|
||||
class ManageCategoriesController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
// $categories = Category::all();
|
||||
// return view('Admin.manage-freeu-investments.categories', compact('categories'));
|
||||
return view('Admin.manage-freeu-investments.categories');
|
||||
}
|
||||
|
||||
public function addCategory(Request $request)
|
||||
{
|
||||
$validator = Validator::make($request->all(), [
|
||||
'category_name' => 'required|unique:categories,category_name',
|
||||
]);
|
||||
$validationMessage = $this->validationError($validator);
|
||||
if ($validationMessage) {
|
||||
return response()->json(['status' => 400, 'message' => $validationMessage]);
|
||||
}
|
||||
|
||||
$addCompany = Category::create([
|
||||
'category_name' => $request->category_name,
|
||||
]);
|
||||
return response()->json(['status' => 200, 'message' => 'Category Added!']);
|
||||
}
|
||||
|
||||
public function getCategory(Request $request)
|
||||
{
|
||||
$id = $request->id;
|
||||
$category = Category::find($id);
|
||||
if (!$category) {
|
||||
return response()->json(['status' => 400, 'message' => 'Error Finding Category!']);
|
||||
}
|
||||
return response()->json(['status' => 200, 'category' => $category]);
|
||||
}
|
||||
|
||||
public function categoryStatus(Request $request)
|
||||
{
|
||||
$id = $request->id;
|
||||
$status = $request->status == 1 ? 0 : 1;
|
||||
$updateStatus = Category::where('id', $id)->update([
|
||||
'status' => $status
|
||||
]);
|
||||
if (!$updateStatus) {
|
||||
return response()->json(['status' => 400, 'message' => 'Error Changing Category Status!']);
|
||||
}
|
||||
return response()->json(['status' => 200, 'message' => 'Status Changed!']);
|
||||
}
|
||||
|
||||
public function updateCategory(Request $request)
|
||||
{
|
||||
$id = $request->category_id;
|
||||
$validator = Validator::make($request->all(), [
|
||||
'category_name' => 'required|unique:categories,category_name,' . $id . '',
|
||||
],[
|
||||
'required' => 'The :attribute field must be required',
|
||||
'unique' => 'The :attribute field must be unique'
|
||||
]);
|
||||
$validationMessage = $this->validationError($validator);
|
||||
if ($validationMessage) {
|
||||
return response()->json(['status' => 400, 'message' => $validationMessage]);
|
||||
}
|
||||
$updateCategoryName = Category::where('id', $id)->update([
|
||||
'category_name' => $request->category_name,
|
||||
]);
|
||||
return response()->json(['status' => 200, 'message' => 'Category Updated!']);
|
||||
}
|
||||
|
||||
public function deleteCategory(Request $request){
|
||||
$id = $request->category_id;
|
||||
$category = Category::find($id);
|
||||
if(!$category){
|
||||
return response()->json(['status' => 400, 'message' => 'Error Deleting Category!!']);
|
||||
}
|
||||
Category::where('id',$id)->delete();
|
||||
return response()->json(['status' => 200, 'message' => 'Category Deleted!!']);
|
||||
}
|
||||
|
||||
public function validationError($validator)
|
||||
{
|
||||
if ($validator->fails()) {
|
||||
$errors = $validator->errors();
|
||||
$messages = '';
|
||||
foreach ($errors->all() as $message) {
|
||||
$messages .= $message . '</br>';
|
||||
}
|
||||
return $messages;
|
||||
}
|
||||
}
|
||||
|
||||
public function categoryList(){
|
||||
$categories = Category::all();
|
||||
if(!$categories){
|
||||
return response()->json(['status'=>400,'message'=>'No Categories'],400);
|
||||
}
|
||||
return response()->json(['status'=>200,'data'=>$categories],200);
|
||||
}
|
||||
|
||||
public function dataTable(Request $request)
|
||||
{
|
||||
if ($request->ajax()) {
|
||||
$data = Category::select('*');
|
||||
if($request->dropdownValue!=null && $request->dropdownValue != 'orderby'){
|
||||
$where = $request->dropdownValue;
|
||||
$data->where('status',$where);
|
||||
};
|
||||
if($request->dropdownValue == 'orderby'){
|
||||
$data->orderBy('id','desc');
|
||||
};
|
||||
return Datatables::of($data)->addIndexColumn()
|
||||
->editColumn('created_at', function ($row) {
|
||||
$formattedDate = $row->created_at->format('d/m/Y');
|
||||
return '<div class="badge badge-light fw-bold">' . $formattedDate . '</div>';
|
||||
})
|
||||
->editColumn('category_name', function ($row) {
|
||||
return '<div class="text-center">' . $row->category_name . '</div>';
|
||||
})
|
||||
->addColumn('action', function ($row) {
|
||||
$status = $row->status == 1 ? 'checked' : 'null';
|
||||
|
||||
$btn = '<div class="text-end d-flex align-items-center justify-content-around">
|
||||
<a type="button" class="action_icon edit_company_btn" id="edit_company_btn" onclick="getCategory(' . $row->id . ')" data-id="" data-company_name="" data-company_logo="">
|
||||
<i class="fa-solid fs-3 fa-pen-to-square"></i>
|
||||
</a>
|
||||
|
||||
<a class="action_icon">
|
||||
<div class="on-off-toggle">
|
||||
<input class="on-off-toggle__input is_active" type="checkbox" id="bopis' . $row->id . '" data-id="' . $row->id . '" onclick="categoryStatus(' . $row->id . ',' . $row->status . ')" value="' . $row->status . '" ' . $status . '/>
|
||||
<label for="bopis' . $row->id . '" class="on-off-toggle__slider"></label>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
';
|
||||
// $btn = '<a href="javascript:void(0)" class="btn btn-primary btn-sm">View</a>';
|
||||
return $btn;
|
||||
})
|
||||
->rawColumns(['category_name', 'created_at', 'action'])
|
||||
->make(true);
|
||||
}
|
||||
|
||||
return view('Admin.manage-freeu-investments.categories');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,163 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin\ManageFreeUInvestments;
|
||||
|
||||
use App\Services\Admin\CompanyService;
|
||||
use App\Traits\HttpResponse;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Company;
|
||||
use App\Models\CompanyCategory;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Exports\CompanyExport;
|
||||
use DataTables;
|
||||
|
||||
class ManageCompaniesController extends Controller
|
||||
{
|
||||
use HttpResponse;
|
||||
|
||||
protected $company;
|
||||
|
||||
public function __construct(CompanyService $company)
|
||||
{
|
||||
$this->company = $company;
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
return view('Admin.manage-freeu-investments.companies', [
|
||||
'categories' => $this->company->getCategories()
|
||||
]);
|
||||
}
|
||||
|
||||
public function addCompany(Request $request)
|
||||
{
|
||||
$validator = Validator::make($request->all(), [
|
||||
'company_name' => 'required|unique:companies,company_name',
|
||||
'company_logo' => 'required',
|
||||
],[
|
||||
'required' => 'The :attribute field must be required',
|
||||
'unique' => 'The :attribute field must be unique'
|
||||
]);
|
||||
$validationMessage = $this->validationError($validator);
|
||||
if ($validationMessage) {
|
||||
return response()->json(['status' => 400, 'message' => $validationMessage]);
|
||||
}
|
||||
|
||||
$companyStorageName = time() . '.' . $request->company_logo->extension();
|
||||
$request->company_logo->move(public_path('/uploads/manufactures_company/logo'), $companyStorageName);
|
||||
$addCompany = Company::create([
|
||||
'company_name' => $request->company_name,
|
||||
'company_logo' => $companyStorageName,
|
||||
]);
|
||||
foreach ($request->categories as $categories) {
|
||||
CompanyCategory::create([
|
||||
'companies_id' => $addCompany->id,
|
||||
'categories_id' => $categories
|
||||
]);
|
||||
}
|
||||
return response()->json(['status' => 200, 'message' => 'Company Added!']);
|
||||
}
|
||||
|
||||
public function getCompany(Request $request)
|
||||
{
|
||||
return response()->json(
|
||||
[
|
||||
'status' => 200,
|
||||
'company' => $this->company->getCompany($request->id),
|
||||
'categories' => $this->company->getCompanyCategory($request->id)
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
public function companyStatus(Request $request)
|
||||
{
|
||||
$statusUpdated = $this->company->updateStatus($request);
|
||||
return $statusUpdated ?
|
||||
response()->json(['status' => 400, 'message' => 'Error Changing Company Status!']) :
|
||||
response()->json(['status' => 200, 'message' => 'Status Changed!']);
|
||||
}
|
||||
|
||||
public function updateCompany(Request $request)
|
||||
{
|
||||
$id = $request->company_id;
|
||||
$validator = Validator::make($request->all(), [
|
||||
'company_name' => 'required|unique:companies,company_name,' . $id . '',
|
||||
],[
|
||||
'required' => 'The :attribute field must be required',
|
||||
'unique' => 'The :attribute field must be unique'
|
||||
]);
|
||||
$validationMessage = $this->validationError($validator);
|
||||
if ($validationMessage) {
|
||||
return response()->json(['status' => 400, 'message' => $validationMessage]);
|
||||
}
|
||||
$company = Company::find($id);
|
||||
if ($request->has('company_logo')) {
|
||||
if (\File::exists(public_path('/uploads/manufactures_company/logo/' . $company->company_logo . ''))) {
|
||||
\File::delete(public_path('/uploads/manufactures_company/logo/' . $company->company_logo . ''));
|
||||
}
|
||||
$companyStorageName = time() . '.' . $request->company_logo->extension();
|
||||
$request->company_logo->move(public_path('/uploads/manufactures_company/logo'), $companyStorageName);
|
||||
$updateCompanyLogo = Company::where('id', $id)->update([
|
||||
'company_logo' => $companyStorageName,
|
||||
]);
|
||||
}
|
||||
$updateCompanyName = Company::where('id', $id)->update([
|
||||
'company_name' => $request->company_name,
|
||||
]);
|
||||
CompanyCategory::where('companies_id', $id)->delete();
|
||||
collect($request->categories)->each(function ($item) use ($id) {
|
||||
CompanyCategory::create([
|
||||
'companies_id' => $id,
|
||||
'categories_id' => $item
|
||||
]);
|
||||
});
|
||||
return response()->json(['status' => 200, 'message' => 'Company Updated!']);
|
||||
}
|
||||
|
||||
public function deleteCompany(Request $request){
|
||||
$id = $request->company_id;
|
||||
// dd($id);
|
||||
$company = Company::find($id);
|
||||
if(!$company){
|
||||
return response()->json(['status' => 400, 'message' => 'Error Deleting Company!!']);
|
||||
}
|
||||
Company::where('id',$id)->delete();
|
||||
return response()->json(['status' => 200, 'message' => 'Company Deleted!!']);
|
||||
}
|
||||
|
||||
public function validationError($validator)
|
||||
{
|
||||
if ($validator->fails()) {
|
||||
$errors = $validator->errors();
|
||||
$messages = '';
|
||||
foreach ($errors->all() as $message) {
|
||||
$messages .= $message . '</br>';
|
||||
}
|
||||
return $messages;
|
||||
}
|
||||
}
|
||||
|
||||
public function exportCompanies(Request $request){
|
||||
$query = $request->post();
|
||||
// $a = Excel::download(new CompanyExport, 'Company List.xlsx');
|
||||
// Excel::import(new AlternativeInvestmentFundImport($category_type), $request->file('productFile'))
|
||||
return Excel::download(new CompanyExport($query), 'Company List.xlsx');
|
||||
}
|
||||
|
||||
public function getExcelfile(){
|
||||
$users = Company::all();
|
||||
// $total = Company::count();
|
||||
$total = 100;
|
||||
Excel::download('excelfile', function($excel) use ($users, $total) {
|
||||
$excel->sheet('Excel', function($sheet) use ($users, $total) {
|
||||
$sheet->loadView('report.excel')->with("users", $users)->with("total", $total);
|
||||
});
|
||||
})->export('xls');
|
||||
}
|
||||
|
||||
public function dataTableCompanies(Request $request)
|
||||
{
|
||||
return $this->company->datatable($request);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,216 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin\ManageFreeUInvestments;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Category;
|
||||
use App\Models\Product;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
use App\Models\PeerToPeerLending;
|
||||
use App\Imports\PeerToPeerLendingImport;
|
||||
use Illuminate\Support\Str;
|
||||
use App\Models\Admin\FAQ;
|
||||
use App\Models\Admin\Tag;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
|
||||
class PeerToPeerLendingController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$category = Category::find(Category::PeerToPeerLendingId);
|
||||
$text = $category->category_name;
|
||||
$category_id = $category->id;
|
||||
$excelFileName = 'PeerToPeerLendingTemplate.xlsx';
|
||||
return view('Admin.Pages.manage_freeu_investment.upload-product.peer-to-peer-lending', compact('text', 'category_id','excelFileName'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
request()->validate([
|
||||
'productFile' => 'required|mimes:xlx,xls,xlsx|max:2048'
|
||||
]);
|
||||
$category_type = $request->category_id;
|
||||
$category = Category::find($request->category_id);
|
||||
Excel::import(new PeerToPeerLendingImport($category_type), $request->file('productFile'));
|
||||
return back()->with('success', "$category->category_name Imported Successfully.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
$p2p = Product::with('category', 'peerToPeers')->peerToPeers()->find($id);
|
||||
// dd($p2p);
|
||||
return view('Admin.Pages.manage_freeu_investment.view-product.peer-to-peer-lending', compact('p2p'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$p2p = Product::with('category', 'peerToPeers')->peerToPeers()->find($id);
|
||||
// dd($p2p);
|
||||
return view('Admin.Pages.manage_freeu_investment.edit-product.peer-to-peer-lending', compact('p2p','id'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
// dd($id);
|
||||
// $request->validate([
|
||||
// 'scheme' => 'required'
|
||||
// ]);
|
||||
|
||||
// dd($request->all());
|
||||
|
||||
$validate = Validator::make($request->all(),[
|
||||
'scheme' => 'required',
|
||||
'presentation'=>"required|mimes:pdf,zip",
|
||||
'fact_sheet'=>"required|mimes:pdf,zip",
|
||||
],[
|
||||
'required' => "This :attribute field is required",
|
||||
'mimes' => "This :attribute field extension must be pdf or zip",
|
||||
]);
|
||||
$validationMessage = validationErrorMessage($validate);
|
||||
if ($validationMessage) {
|
||||
|
||||
return response()->json(
|
||||
|
||||
[
|
||||
|
||||
'status' => 400,
|
||||
|
||||
'message' => $validationMessage
|
||||
|
||||
]
|
||||
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
$p2p = PeerToPeerLending::where('id', $request->p2p_id)->update([
|
||||
'scheme' => $request->scheme,
|
||||
'slug' => Str::slug($request->scheme),
|
||||
'tenure' => $request->tenure,
|
||||
'minimum_investment' => $request->minimum_investment,
|
||||
'maximum_investment' => $request->maximum_investment,
|
||||
'returns' => $request->returns,
|
||||
'minimum_investment_in_int' => $request->minimum_investment_in_int
|
||||
]);
|
||||
|
||||
$product = Product::where('id', $request->peer_id)->first();
|
||||
// dd($product);
|
||||
if($request->has('presentation')){
|
||||
if(\File::exists(public_path('/uploads/product/presentation/'.$product->presentation))){
|
||||
\File::delete(public_path('/uploads/product/presentation/'.$product->presentation));
|
||||
}
|
||||
$productpresentation = time().'_presentation'.'.'.$request->presentation->extension();
|
||||
$request->presentation->move(public_path('/uploads/product/presentation'),$productpresentation);
|
||||
$updatepresentation = Product::where('id', $request->peer_id)->update([
|
||||
'presentation'=> $productpresentation,
|
||||
]);
|
||||
}
|
||||
|
||||
if($request->has('fact_sheet')){
|
||||
if(\File::exists(public_path('/uploads/product/fact_sheet/'.$product->fact_sheet))){
|
||||
\File::delete(public_path('/uploads/product/fact_sheet'.$product->fact_sheet));
|
||||
}
|
||||
$productfactsheet = time().'_factsheet'.'.'.$request->fact_sheet->extension();
|
||||
$request->fact_sheet->move(public_path('uploads/product/fact_sheet'),$productfactsheet);
|
||||
$updatefactsheet = Product::where('id', $request->peer_id)->update([
|
||||
'fact_sheet'=>$productfactsheet,]);
|
||||
}
|
||||
|
||||
return response()->json(['status' => 200, 'message' => 'Peer To Peer Details Updated Successfully']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
public function peerToPeerLendingQuestionAndAnswer()
|
||||
{
|
||||
$peerToPeerLending = FAQ::where('tag_id',Tag::PeertoPeerLendingId)->select('faq_question','faq_answer')->active()->where('faq_type','0')->get();
|
||||
|
||||
if(count($peerToPeerLending) > 0)
|
||||
{
|
||||
return response()->json([
|
||||
"status" => "success",
|
||||
"code" => 200,
|
||||
"data" => $peerToPeerLending
|
||||
]);
|
||||
}
|
||||
else
|
||||
{
|
||||
return response()->json([
|
||||
"status" => "failed",
|
||||
"code" => 400,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
// faqs
|
||||
public function peerToPeerLendingQuestionAndAnswerFaqs()
|
||||
{
|
||||
$peerToPeerLending = FAQ::where('tag_id',Tag::PeertoPeerLendingId)->select('faq_question','faq_answer')->active()->where('faq_type','1')->get();
|
||||
|
||||
if(count($peerToPeerLending) > 0)
|
||||
{
|
||||
return response()->json([
|
||||
"status" => "success",
|
||||
"code" => 200,
|
||||
"data" => $peerToPeerLending
|
||||
]);
|
||||
}
|
||||
else
|
||||
{
|
||||
return response()->json([
|
||||
"status" => "failed",
|
||||
"code" => 400,
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin\ManageFreeUInvestments;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Category;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
use App\Imports\AlternativeInvestmentFundImport;
|
||||
use Illuminate\Support\Str;
|
||||
use App\Models\AlternativeInvestmentFund;
|
||||
use App\Models\Product;
|
||||
|
||||
class PrivateEquityFundController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$category = Category::find(Category::PrivateEquityFundId);
|
||||
$text = $category->category_name;
|
||||
$category_id = $category->id;
|
||||
$excelFileName = 'PrivateEquityFundsTemplate.xlsx';
|
||||
return view('Admin.Pages.manage_freeu_investment.upload-product.alternative-investment-fund', compact('text', 'category_id','excelFileName'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin\ManageFreeUInvestments;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Category;
|
||||
|
||||
class PrivateInvestmentInPublicEquityFundController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$category = Category::find(Category::PrivateInvestmentInPublicEquityFundId);
|
||||
$text = $category->category_name;
|
||||
$category_id = $category->id;
|
||||
$excelFileName = 'PrivateInvestmentInPublicEquityFundsTemplate.xlsx';
|
||||
return view('Admin.Pages.manage_freeu_investment.upload-product.alternative-investment-fund', compact('text', 'category_id','excelFileName'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin\ManageFreeUInvestments;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Category;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
use App\Imports\AlternativeInvestmentFundImport;
|
||||
use Illuminate\Support\Str;
|
||||
use App\Models\AlternativeInvestmentFund;
|
||||
use App\Models\Product;
|
||||
|
||||
class PrivateRealEstateFundController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$category = Category::find(Category::PrivateRealEstateFundId);
|
||||
$text = $category->category_name;
|
||||
$category_id = $category->id;
|
||||
$excelFileName = 'PrivateRealEstateFundsTemplate.xlsx';
|
||||
return view('Admin.Pages.manage_freeu_investment.upload-product.alternative-investment-fund', compact('text', 'category_id','excelFileName'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,192 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin\ManageFreeUInvestments;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Admin\FAQ;
|
||||
use App\Models\Admin\Tag;
|
||||
use App\Models\Category;
|
||||
use App\Models\Product;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
use App\Models\SecuritizedDebtInstrument;
|
||||
use App\Imports\SecuritizedDebtInstrumentImport;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
|
||||
class SecuritizedDebtInstrumentController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$category = Category::find(Category::SecuritizedDebtInstrumentId);
|
||||
$text = $category->category_name;
|
||||
$category_id = $category->id;
|
||||
$excelFileName = 'SecuritizedDebtInstrumentTemplate.xlsx';
|
||||
return view('Admin.Pages.manage_freeu_investment.upload-product.securitized-debt-instrument', compact('text', 'category_id','excelFileName'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
request()->validate([
|
||||
'productFile' => 'required|mimes:xlx,xls,xlsx|max:2048'
|
||||
]);
|
||||
$category_type = $request->category_id;
|
||||
$category = Category::find($request->category_id);
|
||||
Excel::import(new SecuritizedDebtInstrumentImport($category_type), $request->file('productFile'));
|
||||
return back()->with('success', "$category->category_name Imported Successfully.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
$securitizedDebtInstrument = Product::with('category', 'securitizedDebtInstruments')->securitizedDebtInstruments()->find($id);
|
||||
// dd($securitizedDebtInstrument);
|
||||
return view('Admin.Pages.manage_freeu_investment.view-product.securitized-debt-instrument', compact('securitizedDebtInstrument'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$securitizedDebtInstrument = Product::with('category', 'securitizedDebtInstruments')->securitizedDebtInstruments()->find($id);
|
||||
return view('Admin.Pages.manage_freeu_investment.edit-product.securitized-debt-instrument', compact('securitizedDebtInstrument','id'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
|
||||
|
||||
$validate = Validator::make($request->all(),[
|
||||
'product_name' => 'required',
|
||||
'presentation'=>"required|mimes:pdf,zip",
|
||||
'fact_sheet'=>"required|mimes:pdf,zip",
|
||||
],[
|
||||
'required' => "This :attribute field is required",
|
||||
'mimes' => "This :attribute field extension must be pdf or zip",
|
||||
]);
|
||||
$validationMessage = validationErrorMessage($validate);
|
||||
if ($validationMessage) {
|
||||
|
||||
return response()->json(
|
||||
|
||||
[
|
||||
|
||||
'status' => 400,
|
||||
|
||||
'message' => $validationMessage
|
||||
|
||||
]
|
||||
|
||||
);
|
||||
|
||||
}
|
||||
$securitizedDebtInstrument = SecuritizedDebtInstrument::where('id', $id)->update([
|
||||
'product_name' => $request->product_name,
|
||||
'slug' => Str::slug($request->product_name),
|
||||
'total_deal_size' => $request->total_deal_size,
|
||||
'minimum_investment' => $request->minimum_investment,
|
||||
'credit_rating' => $request->credit_rating,
|
||||
'deal_tenure' => $request->deal_tenure,
|
||||
'target_irr' => $request->target_irr,
|
||||
'target_multiple' => $request->target_multiple,
|
||||
'payout_frequency' => $request->payout_frequency,
|
||||
'principal_returned_in' => $request->principal_returned_in,
|
||||
'average_annual_payback' => $request->average_annual_payback,
|
||||
'security_enhancement' => $request->security_enhancement,
|
||||
'listing_details' => $request->listing_details,
|
||||
'minimum_investment_in_int' => $request->minimum_investment_in_int
|
||||
]);
|
||||
$product = Product::where('id', $request->product_securit_id)->first();
|
||||
// dd($product);
|
||||
if($request->has('presentation')){
|
||||
if(\File::exists(public_path('/uploads/product/presentation/'.$product->presentation))){
|
||||
\File::delete(public_path('/uploads/product/presentation/'.$product->presentation));
|
||||
}
|
||||
$productpresentation = time().'_presentation'.'.'.$request->presentation->extension();
|
||||
$request->presentation->move(public_path('/uploads/product/presentation'),$productpresentation);
|
||||
$updatepresentation = Product::where('id', $request->product_securit_id)->update([
|
||||
'presentation'=> $productpresentation,
|
||||
]);
|
||||
}
|
||||
|
||||
if($request->has('fact_sheet')){
|
||||
if(\File::exists(public_path('/uploads/product/fact_sheet/'.$product->fact_sheet))){
|
||||
\File::delete(public_path('/uploads/product/fact_sheet'.$product->fact_sheet));
|
||||
}
|
||||
$productfactsheet = time().'_factsheet'.'.'.$request->fact_sheet->extension();
|
||||
$request->fact_sheet->move(public_path('uploads/product/fact_sheet'),$productfactsheet);
|
||||
$updatefactsheet = Product::where('id', $request->product_securit_id)->update([
|
||||
'fact_sheet'=>$productfactsheet,]);
|
||||
}
|
||||
return response()->json(['status' => 200, 'message' => 'Securitized Debt Instrument Details Updated Successfully']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
public function securitizedDebtInstrumentQuestionAndAnswer()
|
||||
{
|
||||
$securitizedDebtInstrument = FAQ::where('tag_id',Tag::SecuritizedDebtInstrumentId)->get();
|
||||
|
||||
if(count($securitizedDebtInstrument) > 0)
|
||||
{
|
||||
return response()->json([
|
||||
"status" => "success",
|
||||
"code" => 200,
|
||||
"data" => $securitizedDebtInstrument
|
||||
]);
|
||||
}
|
||||
else
|
||||
{
|
||||
return response()->json([
|
||||
"status" => "failed",
|
||||
"code" => 400,
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,216 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin\ManageFreeUInvestments;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Category;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
use App\Imports\AlternativeInvestmentFundImport;
|
||||
use Illuminate\Support\Str;
|
||||
use App\Models\AlternativeInvestmentFund;
|
||||
use App\Models\Product;
|
||||
use App\Models\Company;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
|
||||
class VentureCapitalFundController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
// $slug = basename(request()->path());
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$category = Category::find(Category::VentureCapitalFundId);
|
||||
$text = $category->category_name;
|
||||
$category_id = $category->id;
|
||||
$excelFileName = 'VentureCapitalFundsTemplate.xlsx';
|
||||
return view('Admin.Pages.manage_freeu_investment.upload-product.alternative-investment-fund', compact('text', 'category_id', 'excelFileName'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
request()->validate([
|
||||
'productFile' => 'required|mimes:xlx,xls,xlsx|max:2048'
|
||||
]);
|
||||
$category_type = $request->category_id;
|
||||
$category = Category::find($request->category_id);
|
||||
Excel::import(new AlternativeInvestmentFundImport($category_type), $request->file('productFile'));
|
||||
// return back()->with('success', "$category->category_name Imported Successfully.");
|
||||
return back()->with('success', "$category->category_name Imported Successfully.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
$alternativeInvestmentFund = Product::with('category', 'alternativeInvestmentFund')->alternativeInvestmentFund()->find($id);
|
||||
// dd(Product::find($id));
|
||||
// dd($alternativeInvestmentFund);
|
||||
return view('Admin.Pages.manage_freeu_investment.view-product.alternative-investment-fund', compact('alternativeInvestmentFund'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$companies = Company::active()->pluck('company_name', 'id');
|
||||
$alternativeInvestmentFund = Product::with('category', 'alternativeInvestmentFund')->alternativeInvestmentFund()->find($id);
|
||||
// dd($alternativeInvestmentFund);
|
||||
return view('Admin.Pages.manage_freeu_investment.edit-product.alternative-investment-fund', compact('alternativeInvestmentFund', 'companies'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
// $request->validate([
|
||||
// 'fund_name' => 'required'
|
||||
// ]);
|
||||
// dd($request->all());
|
||||
|
||||
$validate = Validator::make($request->all(),[
|
||||
'fund_name' => 'required',
|
||||
'presentation'=>"mimes:pdf,zip,jpeg,jpg,png",
|
||||
'fact_sheet'=>"mimes:pdf,zip,jpeg,jpg,png",
|
||||
'type' => 'required',
|
||||
'geographic_focus' => 'required',
|
||||
],[
|
||||
'required' => "This :attribute field is required",
|
||||
'mimes' => "This :attribute field extension must be pdf or zip",
|
||||
]);
|
||||
$validationMessage = validationErrorMessage($validate);
|
||||
if ($validationMessage) {
|
||||
|
||||
return response()->json(
|
||||
|
||||
[
|
||||
|
||||
'status' => 400,
|
||||
|
||||
'message' => $validationMessage
|
||||
|
||||
]
|
||||
|
||||
);
|
||||
|
||||
}
|
||||
// dd($request->all());
|
||||
|
||||
$alternativeInvestmentFund = AlternativeInvestmentFund::where('id', $request->id)->update([
|
||||
'slug' => Str::slug($request->fund_name),
|
||||
'fund_name' => $request->fund_name,
|
||||
'geographic_focus' => $request->geographic_focus,
|
||||
'companies_id' => $request->companies_id,
|
||||
'registration_number' => $request->registration_number,
|
||||
'fund_category' => $request->fund_category,
|
||||
'fund_structure' => $request->fund_structure,
|
||||
'fund_strategy' => $request->fund_strategy,
|
||||
'fund_domicile' => $request->fund_domicile,
|
||||
'fund_manager_name' => $request->fund_manager_name,
|
||||
'website_of_the_fund' => $request->website_of_the_fund,
|
||||
'fund_manager_experience' => $request->fund_manager_experience,
|
||||
'sponsor' => $request->sponsor,
|
||||
'manager' => $request->manager,
|
||||
'trustee' => $request->trustee,
|
||||
'auditor' => $request->auditor,
|
||||
'valuer_tax_advisor' => $request->valuer_tax_advisor,
|
||||
'credit_rating' => $request->credit_rating,
|
||||
'open_date' => $request->open_date,
|
||||
'first_close_date' => $request->first_close_date,
|
||||
'final_close_date' => $request->final_close_date,
|
||||
'tenure_from_final_date' => $request->tenure_from_final_date,
|
||||
'commitment_period' => $request->commitment_period,
|
||||
'native_currency' => $request->native_currency,
|
||||
'target_corpus' => $request->target_corpus,
|
||||
'investment_manager_contribution' => $request->investment_manager_contribution,
|
||||
'minimum_capital_commitment' => $request->minimum_capital_commitment,
|
||||
'intial_drawdown' => $request->intial_drawdown,
|
||||
'accepting_overseas_investment' => $request->accepting_overseas_investment,
|
||||
'target_irr' => $request->target_irr,
|
||||
'management_fees_and_carry' => $request->management_fees_and_carry,
|
||||
'hurdle_rate' => $request->hurdle_rate,
|
||||
'other_expenses' => $request->other_expenses,
|
||||
'focused_sectors_industries' => $request->focused_sectors_industries,
|
||||
'regions_covered' => $request->regions_covered,
|
||||
'isin_code' => $request->isin_code,
|
||||
'focused_real_estate_sectors' => $request->focused_real_estate_sectors,
|
||||
'rera_complied_property' => $request->rera_complied_property,
|
||||
'return_on_investment' => $request->return_on_investment,
|
||||
'valuation_per_sector' => $request->valuation_per_sector,
|
||||
'focused_funds' => $request->focused_funds,
|
||||
'trading_strategy' => $request->trading_strategy,
|
||||
'involved_in_short_selling' => $request->involved_in_short_selling,
|
||||
]);
|
||||
// dd($id);
|
||||
$product = Product::where('id', $request->alternative_id)->first();
|
||||
// dd($product);
|
||||
if($request->has('presentation')){
|
||||
if(\File::exists(public_path('/uploads/product/presentation/'.$product->presentation))){
|
||||
\File::delete(public_path('/uploads/product/presentation/'.$product->presentation));
|
||||
}
|
||||
$productpresentation = time().'_presentation'.'.'.$request->presentation->extension();
|
||||
$request->presentation->move(public_path('/uploads/product/presentation'),$productpresentation);
|
||||
$updatepresentation = Product::where('id', $request->alternative_id)->update([
|
||||
'presentation'=> $productpresentation,
|
||||
]);
|
||||
}
|
||||
|
||||
if($request->has('fact_sheet')){
|
||||
if(\File::exists(public_path('/uploads/product/fact_sheet/'.$product->fact_sheet))){
|
||||
\File::delete(public_path('/uploads/product/fact_sheet'.$product->fact_sheet));
|
||||
}
|
||||
$productfactsheet = time().'_factsheet'.'.'.$request->fact_sheet->extension();
|
||||
$request->fact_sheet->move(public_path('uploads/product/fact_sheet'),$productfactsheet);
|
||||
$updatefactsheet = Product::where('id', $request->alternative_id)->update([
|
||||
'fact_sheet'=>$productfactsheet,]);
|
||||
}
|
||||
|
||||
$aif = AlternativeInvestmentFund::find($request->id);
|
||||
|
||||
$type = Product::where('id',$aif->products_id)->update(['type' => $request->type]);
|
||||
return response()->json(['status' => 200, 'message' => "$request->category Details Updated Successfully"]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,180 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin\ManageFreeUInvestments;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Category;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
use App\Imports\AlternativeInvestmentFundImport;
|
||||
use App\Imports\VentureDebtImport;
|
||||
use Illuminate\Support\Str;
|
||||
use App\Models\VentureDebt;
|
||||
use App\Models\Product;
|
||||
use App\Models\Company;
|
||||
|
||||
class VentureDebtController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$category = Category::find(Category::VentureDebtId);
|
||||
$text = $category->category_name;
|
||||
$category_id = $category->id;
|
||||
$excelFileName = 'VentureDebtTemplate.xlsx';
|
||||
return view('Admin.Pages.manage_freeu_investment.upload-product.venture-debt', compact('text', 'category_id', 'excelFileName'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
request()->validate([
|
||||
'productFile' => 'required|mimes:xlx,xls,xlsx|max:2048'
|
||||
]);
|
||||
$category_type = $request->category_id;
|
||||
$category = Category::find($request->category_id);
|
||||
Excel::import(new VentureDebtImport($category_type), $request->file('productFile'));
|
||||
return back()->with('success', "$category->category_name Imported Successfully.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
$vd = Product::with('category', 'ventureDebt')->ventureDebt()->find($id);
|
||||
return view('Admin.Pages.manage_freeu_investment.view-product.venture-debt', compact('vd'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$companies = Company::active()->pluck('company_name','id');
|
||||
$vd = Product::with('category', 'ventureDebt')->ventureDebt()->find($id);
|
||||
return view('Admin.Pages.manage_freeu_investment.edit-product.venture-debt', compact('vd', 'id','companies'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
// $request->validate([
|
||||
// 'company_name' => 'required'
|
||||
// ]);
|
||||
|
||||
$validate = Validator::make($request->all(),[
|
||||
'company_name' => 'required',
|
||||
'presentation'=>"required|mimes:pdf,zip",
|
||||
'fact_sheet'=>"required|mimes:pdf,zip",
|
||||
],[
|
||||
'required' => "This :attribute field is required",
|
||||
'mimes' => "This :attribute field extension must be pdf or zip",
|
||||
]);
|
||||
$validationMessage = validationErrorMessage($validate);
|
||||
if ($validationMessage) {
|
||||
|
||||
return response()->json(
|
||||
|
||||
[
|
||||
|
||||
'status' => 400,
|
||||
|
||||
'message' => $validationMessage
|
||||
|
||||
]
|
||||
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
$vd = VentureDebt::where('id', $request->vd_id)->update([
|
||||
'company_name' => $request->company_name,
|
||||
// 'slug' => Str::slug($request->scheme),
|
||||
'companies_id' => $request->companies_id,
|
||||
'sector' => $request->sector,
|
||||
'minimum_investment' => $request->minimum_investment,
|
||||
'tenure' => $request->tenure,
|
||||
'total_issue_size' => $request->total_issue_size,
|
||||
'interest_payout' => $request->interest_payout,
|
||||
'principal_payout' => $request->principal_payout,
|
||||
'expected_return' => $request->expected_return,
|
||||
'collateral_cover_multiple' => $request->collateral_cover_multiple,
|
||||
'about_company' => $request->about_company,
|
||||
'instrument_type' => $request->instrument_type,
|
||||
'face_per_value_unit' => $request->face_per_value_unit,
|
||||
'prepayment_covenants' => $request->prepayment_covenants,
|
||||
'source_of_funds_repayment_debt' => $request->source_of_funds_repayment_debt,
|
||||
'minimum_investment_in_int' => $request->minimum_investment_in_int,
|
||||
|
||||
]);
|
||||
|
||||
$product = Product::where('id', $request->id)->first();
|
||||
// dd($product);
|
||||
if($request->has('presentation')){
|
||||
if(\File::exists(public_path('/uploads/product/presentation/'.$product->presentation))){
|
||||
\File::delete(public_path('/uploads/product/presentation/'.$product->presentation));
|
||||
}
|
||||
$productpresentation = time().'_presentation'.'.'.$request->presentation->extension();
|
||||
$request->presentation->move(public_path('/uploads/product/presentation'),$productpresentation);
|
||||
$updatepresentation = Product::where('id', $request->id)->update([
|
||||
'presentation'=> $productpresentation,
|
||||
]);
|
||||
}
|
||||
|
||||
if($request->has('fact_sheet')){
|
||||
if(\File::exists(public_path('/uploads/product/fact_sheet/'.$product->fact_sheet))){
|
||||
\File::delete(public_path('/uploads/product/fact_sheet'.$product->fact_sheet));
|
||||
}
|
||||
$productfactsheet = time().'_factsheet'.'.'.$request->fact_sheet->extension();
|
||||
$request->fact_sheet->move(public_path('uploads/product/fact_sheet'),$productfactsheet);
|
||||
$updatefactsheet = Product::where('id', $request->id)->update([
|
||||
'fact_sheet'=>$productfactsheet,]);
|
||||
}
|
||||
$vd = VentureDebt::find($request->vd_id);
|
||||
$type = Product::where('id',$vd->products_id)->update(['type' => $request->type]);
|
||||
return response()->json(['status' => 200, 'message' => 'Venture Debt Updated Successfully']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Admin\InvestmentCategory;
|
||||
|
||||
class ManageInvestmentCategoriesController extends Controller
|
||||
{
|
||||
// manage investment categories view (main page)
|
||||
public function index()
|
||||
{
|
||||
$categories = InvestmentCategory::orderBy('created_at','desc')->get();
|
||||
return view('Admin.Pages.manage_freeu_investment.manage_manufactures_category',['categories'=>$categories]);
|
||||
}
|
||||
|
||||
// storing category with modal
|
||||
public function store_category(Request $request)
|
||||
{
|
||||
if(isset($request->category_name))
|
||||
{
|
||||
$category = new InvestmentCategory();
|
||||
$category->category_name = $request->category_name;
|
||||
$category->save();
|
||||
$request->session()->flash('message', 'Category added successfully');
|
||||
return response(['status'=>200]);
|
||||
}
|
||||
else
|
||||
{
|
||||
$request->session()->flash('message', 'Fields are missing');
|
||||
return response(['status'=>204]);
|
||||
}
|
||||
}
|
||||
|
||||
// updating category with modal
|
||||
public function update_category(Request $request)
|
||||
{
|
||||
$category = InvestmentCategory::find($request->category_id);
|
||||
|
||||
if($category)
|
||||
{
|
||||
$category->category_name = $request->category_name;
|
||||
$category->save();
|
||||
$request->session()->flash('message', 'Category updated successfully');
|
||||
return response(['status'=>200]);
|
||||
}
|
||||
else
|
||||
{
|
||||
$request->session()->flash('message', 'Fields are missing');
|
||||
return response(['status'=>204]);
|
||||
}
|
||||
}
|
||||
|
||||
// delete category by id
|
||||
public function delete_category(Request $request, $id)
|
||||
{
|
||||
$category = InvestmentCategory::find($id);
|
||||
|
||||
if($category)
|
||||
{
|
||||
$category->delete();
|
||||
$request->session()->flash('message', 'Category deleted successfully');
|
||||
return response(['status'=>200]);
|
||||
}
|
||||
else
|
||||
{
|
||||
$request->session()->flash('message', 'Something went wrong! Try again');
|
||||
return response(['status'=>204]);
|
||||
}
|
||||
}
|
||||
|
||||
// manage category status changing active/inactive on toggle
|
||||
public function update_status(Request $request)
|
||||
{
|
||||
$category = InvestmentCategory::find($request->id);
|
||||
|
||||
if($category)
|
||||
{
|
||||
if ($request->status == '1')
|
||||
{
|
||||
$category->is_active = '0';
|
||||
}
|
||||
else
|
||||
{
|
||||
$category->is_active = '1';
|
||||
}
|
||||
$category->save();
|
||||
return response(['status'=>200]);
|
||||
}
|
||||
}
|
||||
}
|
||||
448
app/Http/Controllers/Admin/ManageInvestorController.php
Normal file
448
app/Http/Controllers/Admin/ManageInvestorController.php
Normal file
@@ -0,0 +1,448 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use DataTables;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Company;
|
||||
use App\Models\User;
|
||||
use App\Models\UserKyc;
|
||||
use App\Models\UserKycDocs;
|
||||
use App\Models\MonthlyUpdateMaster;
|
||||
use App\Models\MonthlyUpdateAlternativeInvestmentFund;
|
||||
use App\Models\MonthlyUpdateIndianFinancialAssets;
|
||||
use App\Models\MonthlyUpdatePeerToPeerLending;
|
||||
use App\Models\MonthlyUpdateFractionalRealEstate;
|
||||
use App\Notifications\UserAdmin;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
class ManageInvestorController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$users = User::with('activeInvestments')->users()->latest()->get();
|
||||
$investingUserCount = MonthlyUpdateMaster::distinct('users_id')->count('users_id');
|
||||
return view('Admin.Pages.manage_investors.manage_investors', compact('users', 'investingUserCount'));
|
||||
}
|
||||
|
||||
public function manage_investor_kyc()
|
||||
{
|
||||
$users = UserKyc::with('user')->get();
|
||||
return view('Admin.Pages.manage_investors.manage_investor_kyc', compact('users'));
|
||||
}
|
||||
|
||||
public function manageInvestorKYCIndividual($id)
|
||||
{
|
||||
$kycType = UserKyc::find($id)->kyc_type;
|
||||
$userId = UserKyc::find($id)->users_id;
|
||||
$user = UserKyc::query();
|
||||
$user->where('user_kycs.id', $id);
|
||||
if ($kycType == 'Individual') {
|
||||
$user->leftJoin('user_individual_kyc', 'user_kycs.users_id', 'user_individual_kyc.user_id');
|
||||
// $user = $user->select('*')->first();
|
||||
}
|
||||
if ($kycType == 'HUF') {
|
||||
$user->leftJoin('huf', 'user_kycs.users_id', 'huf.user_id');
|
||||
// $user = $user->select('*')->first();
|
||||
}
|
||||
if ($kycType == 'NRI') {
|
||||
$user->leftJoin('nri_kyc', 'user_kycs.users_id', 'nri_kyc.user_id');
|
||||
// $user = $user->select('*')->first();
|
||||
}
|
||||
if ($kycType == 'Company') {
|
||||
$user->leftJoin('company', 'user_kycs.users_id', 'company.user_id');
|
||||
// $user = $user->select('*')->first();
|
||||
}
|
||||
if ($kycType == 'Partnership') {
|
||||
$user->leftJoin('partnership', 'user_kycs.users_id', 'partnership.user_id');
|
||||
// $user = $user->select('*')->first();
|
||||
}
|
||||
if ($kycType == 'Others') {
|
||||
$user->leftJoin('others', 'user_kycs.users_id', 'others.user_id');
|
||||
// $user = $user->select('*')->first();
|
||||
}
|
||||
$user = $user->select('*')->first();
|
||||
// $user->select('*')->first();
|
||||
// $user = $user->addSelect('*')->first();
|
||||
// $user = UserKyc::query()
|
||||
// ->leftJoin('user_individual_kyc', 'user_kycs.users_id', 'user_individual_kyc.user_id')
|
||||
// ->leftJoin('nri_kyc', 'user_kycs.users_id', 'nri_kyc.user_id')
|
||||
// ->leftJoin('others', 'user_kycs.users_id', 'others.user_id')
|
||||
// ->leftJoin('partnership', 'user_kycs.users_id', 'partnership.user_id')
|
||||
// ->leftJoin('huf', 'user_kycs.users_id', 'huf.user_id')
|
||||
// ->leftJoin('company', 'user_kycs.users_id', 'company.user_id')
|
||||
// ->where('user_kycs.id', $id)
|
||||
// ->select('*', 'user_individual_kyc.pan_card as individual_pan_card', 'huf.pan_card as huf_pan_card','user_individual_kyc.copy_of_cml as individual_copy_of_cml','huf.copy_of_cml as huf_copy_of_cml','huf.cancelled_cheque as huf_cancelled_cheque')
|
||||
// ->first();
|
||||
$user_docs = UserKycDocs::where('user_id', $userId)->get();
|
||||
$userPan = UserKycDocs::where(['user_id' => $userId, 'doc_type' => 'Pan'])->get();
|
||||
$userAadhar = UserKycDocs::where(['user_id' => $userId, 'doc_type' => 'Aadhar'])->get();
|
||||
$userPassport = UserKycDocs::where(['user_id' => $userId, 'doc_type' => 'Passport'])->get();
|
||||
// dd($user);
|
||||
return view('Admin.Pages.manage_investors.manage_investor_kyc_individual', compact('user', 'user_docs', 'userPan', 'userAadhar', 'userPassport'));
|
||||
}
|
||||
|
||||
public function total_active_investors()
|
||||
{
|
||||
return view('Admin.Pages.manage_investors.total_active_investors');
|
||||
}
|
||||
|
||||
public function new_investors()
|
||||
{
|
||||
return view('Admin.Pages.manage_investors.new_investors');
|
||||
}
|
||||
|
||||
public function view_investors_details($id)
|
||||
{
|
||||
$currentInvestment = $this->getUserProducts('Holding', $id);
|
||||
$reedemedInvestment = $this->getUserProducts('Reedemed', $id);
|
||||
|
||||
$totalInvestmentForHolding = array_sum(array_column($currentInvestment['productsDetails'], 'total_investment_amount'));
|
||||
$totalInvestmentForReedemed = array_sum(array_column($reedemedInvestment['productsDetails'], 'total_investment_amount'));
|
||||
|
||||
$totalInvestment = $this->IND_money_format($totalInvestmentForHolding + $totalInvestmentForReedemed);
|
||||
|
||||
// return $reedemedInvestment;
|
||||
// echo '<pre>';
|
||||
// print_r($currentInvestment);
|
||||
// die;
|
||||
|
||||
$user = User::findOrFail($id);
|
||||
|
||||
return view('Admin.Pages.manage_investors.view_investors_detail', compact('user', 'currentInvestment', 'totalInvestment', 'reedemedInvestment'));
|
||||
}
|
||||
|
||||
public function getUserProducts($type, $id)
|
||||
{
|
||||
$user = MonthlyUpdateMaster::where(['users_id' => $id, 'holding_status' => $type])->get();
|
||||
$productDetails = [];
|
||||
foreach ($user as $singleMUM) {
|
||||
$dataArr = [
|
||||
'id' => $singleMUM->id,
|
||||
'categories' => $singleMUM->categories,
|
||||
'product_category' => $singleMUM->product_category,
|
||||
'product_name' => $singleMUM->product_name,
|
||||
'platform' => Company::find($singleMUM->investment_platform)->value('company_name')
|
||||
];
|
||||
if (MonthlyUpdateAlternativeInvestmentFund::where('custom_id', $singleMUM->custom_id)->exists()) {
|
||||
$data = MonthlyUpdateAlternativeInvestmentFund::where('custom_id', $singleMUM->custom_id)->latest()->first();
|
||||
$dataArr['total_investment_amount'] = $data->getRawOriginal('commitment_amount');
|
||||
$dataArr['total_investment_amount_in_rs'] = $this->IND_money_format($data->getRawOriginal('commitment_amount'));
|
||||
array_push($productDetails, $dataArr);
|
||||
} elseif (MonthlyUpdateFractionalRealEstate::where('custom_id', $singleMUM->custom_id)->first()) {
|
||||
$data = MonthlyUpdateFractionalRealEstate::where('custom_id', $singleMUM->custom_id)->latest()->first();
|
||||
$dataArr['total_investment_amount'] = $data->getRawOriginal('absolute_return_till_date');
|
||||
$dataArr['total_investment_amount_in_rs'] = $this->IND_money_format($data->getRawOriginal('absolute_return_till_date'));
|
||||
array_push($productDetails, $dataArr);
|
||||
} elseif (MonthlyUpdatePeerToPeerLending::where('custom_id', $singleMUM->custom_id)->first()) {
|
||||
$data = MonthlyUpdatePeerToPeerLending::where('custom_id', $singleMUM->custom_id)->latest()->first();
|
||||
if ($singleMUM->categories == 'Liquiloans') {
|
||||
$dataArr['total_investment_amount'] = $data->getRawOriginal('total_investment');
|
||||
$dataArr['total_investment_amount_in_rs'] = $this->IND_money_format($data->getRawOriginal('total_investment'));
|
||||
} elseif ($singleMUM->categories == 'Faircent') {
|
||||
$dataArr['total_investment_amount'] = $data->getRawOriginal('all_time_amount_invested');
|
||||
$dataArr['total_investment_amount_in_rs'] = $this->IND_money_format($data->getRawOriginal('all_time_amount_invested'));
|
||||
} elseif ($singleMUM->categories == 'Finance Peer') {
|
||||
$dataArr['total_investment_amount'] = $data->getRawOriginal('all_time_investment_added');
|
||||
$dataArr['total_investment_amount_in_rs'] = $this->IND_money_format($data->getRawOriginal('all_time_investment_added'));
|
||||
}
|
||||
array_push($productDetails, $dataArr);
|
||||
} elseif (MonthlyUpdateIndianFinancialAssets::where('custom_id', $singleMUM->custom_id)->first()) {
|
||||
$data = MonthlyUpdateIndianFinancialAssets::where('custom_id', $singleMUM->custom_id)->latest()->first();
|
||||
$dataArr['total_investment_amount'] = $data->getRawOriginal('amount_invested');
|
||||
$dataArr['total_investment_amount_in_rs'] = $this->IND_money_format($data->getRawOriginal('amount_invested'));
|
||||
array_push($productDetails, $dataArr);
|
||||
}
|
||||
}
|
||||
|
||||
$totalInvestment = array_sum(array_column($productDetails, 'total_investment_amount'));
|
||||
|
||||
$totalInvestment = $this->IND_money_format(($totalInvestment));
|
||||
|
||||
return [
|
||||
'productsDetails' => $productDetails,
|
||||
'totalInvestment' => $totalInvestment
|
||||
];
|
||||
}
|
||||
|
||||
public function investedProductDetails($id)
|
||||
{
|
||||
$monthlyUpdateMaster = MonthlyUpdateMaster::findOrFail($id);
|
||||
$peerToPeerLending = ['Finance Peer', 'Faircent', 'Liquiloans'];
|
||||
$indianfinacial = ['Invoice Discounting', 'Clean And Green Assets', 'Venture Debt', 'High Yield Finance', 'Securitized debt instrument', 'Lease Based Financing', 'Revenue Based Financing'];
|
||||
if (in_array($monthlyUpdateMaster->categories, $peerToPeerLending)) {
|
||||
$data = MonthlyUpdatePeerToPeerLending::where('custom_id', $monthlyUpdateMaster->custom_id)->latest()->first();
|
||||
} elseif ($monthlyUpdateMaster->categories == 'Fractional Real Estate') {
|
||||
$data = MonthlyUpdateFractionalRealEstate::where('custom_id', $monthlyUpdateMaster->custom_id)->latest()->first();
|
||||
} elseif (in_array($monthlyUpdateMaster->categories, $indianfinacial)) {
|
||||
$data = MonthlyUpdateIndianFinancialAssets::where('custom_id', $monthlyUpdateMaster->custom_id)->latest()->first();
|
||||
} elseif ($monthlyUpdateMaster->categories == "Alternative Investment Fund") {
|
||||
$data = MonthlyUpdateAlternativeInvestmentFund::where('custom_id', $monthlyUpdateMaster->custom_id)->latest()->first();
|
||||
}
|
||||
return view('Admin.Pages.manage_investors.invested_products.index', [
|
||||
'monthlyUpdateMaster' => $monthlyUpdateMaster,
|
||||
'data' => $data
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
function IND_money_format($number)
|
||||
{
|
||||
$number = (float) $number;
|
||||
$decimal = (string)($number - floor($number));
|
||||
$money = floor($number);
|
||||
$length = strlen($money);
|
||||
$delimiter = '';
|
||||
$money = strrev($money);
|
||||
|
||||
for ($i = 0; $i < $length; $i++) {
|
||||
if (($i == 3 || ($i > 3 && ($i - 1) % 2 == 0)) && $i != $length) {
|
||||
$delimiter .= ',';
|
||||
}
|
||||
$delimiter .= $money[$i];
|
||||
}
|
||||
|
||||
$result = strrev($delimiter);
|
||||
$decimal = preg_replace("/0\./i", ".", $decimal);
|
||||
$decimal = substr($decimal, 0, 3);
|
||||
|
||||
if ($decimal != '0') {
|
||||
$result = $result . $decimal;
|
||||
}
|
||||
|
||||
return '₹ ' . $result;
|
||||
}
|
||||
|
||||
public function downloadBankStatement($file_name)
|
||||
{
|
||||
return \Storage::download('user_cancelled_check_bank_statement/' . $file_name);
|
||||
}
|
||||
|
||||
public function downloadPan($file_name)
|
||||
{
|
||||
return \Storage::download('user_pan_front/' . $file_name);
|
||||
}
|
||||
|
||||
public function downloadAadhar($file_name)
|
||||
{
|
||||
return \Storage::download('user_aadhar_card/' . $file_name);
|
||||
}
|
||||
|
||||
public function downloadDocumentFront($file_name)
|
||||
{
|
||||
return \Storage::download('user_document_front/' . $file_name);
|
||||
}
|
||||
|
||||
public function downloadDocumentBack($file_name)
|
||||
{
|
||||
return \Storage::download('user_document_back/' . $file_name);
|
||||
}
|
||||
|
||||
public function kycStatus(Request $request)
|
||||
{
|
||||
$status = UserKyc::where('id', $request->id)->update([
|
||||
'status' => $request->status
|
||||
]);
|
||||
if ($status) {
|
||||
$userId = UserKyc::find($request->id);
|
||||
$user = User::find($userId->users_id);
|
||||
$notify['message'] = "Your KYC has been $request->status!";
|
||||
$user->notify(new UserAdmin($notify));
|
||||
return response()->json(['status' => 200, 'message' => "Kyc $request->status"]);
|
||||
}
|
||||
return response()->json(['status' => 400, 'message' => "Kyc could not be $request->status"]);
|
||||
}
|
||||
|
||||
public function dataTableKYC(Request $request)
|
||||
{
|
||||
if ($request->ajax()) {
|
||||
$data = UserKyc::with('user');
|
||||
if ($request->dropdownValue == 'Approved' || $request->dropdownValue == 'Rejected' || $request->dropdownValue == 'New') {
|
||||
$data->where('status', $request->dropdownValue);
|
||||
};
|
||||
if ($request->dropdownValue == 'Individual' || $request->dropdownValue == 'HUF' || $request->dropdownValue == 'NRI' || $request->dropdownValue == 'Company' || $request->dropdownValue == 'Partnership' || $request->dropdownValue == 'Others') {
|
||||
$data->where('kyc_type', $request->dropdownValue);
|
||||
};
|
||||
$data->latest()->select('*');
|
||||
return Datatables::of($data)->addIndexColumn()
|
||||
// return Datatables::of($data)
|
||||
->editColumn('created_at', function ($row) {
|
||||
$formattedDate = $row->created_at->format('d/m/Y');
|
||||
return '<div class="badge badge-light fw-bold">' . $formattedDate . '</div>';
|
||||
})
|
||||
->editColumn('name', function ($row) {
|
||||
return '<div class="text-center">' . $row->user->name . '</div>';
|
||||
})
|
||||
->editColumn('email', function ($row) {
|
||||
return '<div class="text-center">' . $row->email . '</div>';
|
||||
})
|
||||
->editColumn('status', function ($row) {
|
||||
return '<div class="text-center">' . $row->status . '</div>';
|
||||
})
|
||||
->addColumn('action', function ($row) {
|
||||
if ($row->status == 'Approved') {
|
||||
$btn = '<a href="' . route("manage_investor_view", $row->id) . '" class="action_icon" data-bs-toggle="tooltip" data-bs-custom-class="tooltip-inverse" data-bs-placement="top" title="View Detail">
|
||||
<i class="fa-regular fa-eye"></i>
|
||||
</a>
|
||||
<a href="' . route("view_investors_details", $row->users_id) . '" class="action_icon" data-bs-toggle="tooltip" data-bs-custom-class="tooltip-inverse" data-bs-placement="top" title="View Invetsor Profile">
|
||||
<i class="fa-solid fa-user"></i>
|
||||
</a>
|
||||
<a class="action_icon" data-bs-toggle="tooltip" onclick="kycRejectStatus(' . $row->id . ')" data-bs-custom-class="tooltip-inverse" data-bs-placement="top" title="Rejected">
|
||||
<i class="fa-solid fa-square-xmark"></i>
|
||||
</a>
|
||||
';
|
||||
} elseif ($row->status == "Rejected") {
|
||||
$btn = '<a href="' . route("manage_investor_view", $row->id) . '" class="action_icon" data-bs-toggle="tooltip" data-bs-custom-class="tooltip-inverse" data-bs-placement="top" title="View Detail">
|
||||
<i class="fa-regular fa-eye"></i>
|
||||
</a>
|
||||
<a href="' . route("view_investors_details", $row->users_id) . '" class="action_icon" data-bs-toggle="tooltip" data-bs-custom-class="tooltip-inverse" data-bs-placement="top" title="View Invetsor Profile">
|
||||
<i class="fa-solid fa-user"></i>
|
||||
</a>
|
||||
<a class="action_icon" data-bs-toggle="tooltip" onclick="kycApproveStatus(' . $row->id . ')" data-bs-custom-class="tooltip-inverse" data-bs-placement="top" title="Approved">
|
||||
<i class="fa-solid fa-square-check"></i>
|
||||
</a>
|
||||
';
|
||||
} else {
|
||||
$btn = '<a href="' . route("manage_investor_view", $row->id) . '" class="action_icon" data-bs-toggle="tooltip" data-bs-custom-class="tooltip-inverse" data-bs-placement="top" title="View Detail">
|
||||
<i class="fa-regular fa-eye"></i>
|
||||
</a>
|
||||
<a href="' . route("view_investors_details", $row->users_id) . '" class="action_icon" data-bs-toggle="tooltip" data-bs-custom-class="tooltip-inverse" data-bs-placement="top" title="View Invetsor Profile">
|
||||
<i class="fa-solid fa-user"></i>
|
||||
</a>
|
||||
<a class="action_icon" data-bs-toggle="tooltip" onclick="kycApproveStatus(' . $row->id . ')" data-bs-custom-class="tooltip-inverse" data-bs-placement="top" title="Approved">
|
||||
<i class="fa-solid fa-square-check"></i>
|
||||
</a>
|
||||
<a class="action_icon" data-bs-toggle="tooltip" onclick="kycRejectStatus(' . $row->id . ')" data-bs-custom-class="tooltip-inverse" data-bs-placement="top" title="Rejected">
|
||||
<i class="fa-solid fa-square-xmark"></i>
|
||||
</a>
|
||||
';
|
||||
}
|
||||
return $btn;
|
||||
})
|
||||
->rawColumns(['name', 'email', 'created_at', 'status', 'action'])
|
||||
->make(true);
|
||||
}
|
||||
|
||||
return view('Admin.Pages.manage_investors.manage_investor_kyc');
|
||||
}
|
||||
|
||||
public function downloadFile(Request $request)
|
||||
{
|
||||
if (\Storage::exists($request->file)) {
|
||||
return Storage::download($request->file);
|
||||
} else {
|
||||
return "File not found";
|
||||
}
|
||||
}
|
||||
|
||||
public function manageInvestorDataTableKYC(Request $request)
|
||||
{
|
||||
if ($request->ajax()) {
|
||||
$data = User::query();
|
||||
// print_r($request->dropdownValue);
|
||||
$data->users();
|
||||
if ($request->dropdownValue == '1' || $request->dropdownValue == '0') {
|
||||
$data->where('status', $request->dropdownValue);
|
||||
};
|
||||
if ($request->dropdownValue === 'Zero') {
|
||||
$data->doesntHave('investments');
|
||||
}
|
||||
// if ($request->dropdownValue == 'Individual' || $request->dropdownValue == 'HUF' || $request->dropdownValue == 'NRI' || $request->dropdownValue == 'Company' || $request->dropdownValue == 'Partnership' || $request->dropdownValue == 'Others') {
|
||||
// $data->where('kyc_type', $request->dropdownValue);
|
||||
// };
|
||||
$data->latest()->select('*');
|
||||
$count = 1;
|
||||
return Datatables::of($data)->addIndexColumn()
|
||||
// return Datatables::of($data)
|
||||
->editColumn('created_at', function ($row) {
|
||||
$formattedDate = $row->created_at->format('d/m/Y');
|
||||
return '<div class="badge badge-light fw-bold">' . $formattedDate . '</div>';
|
||||
})
|
||||
->editColumn('name', function ($row) {
|
||||
return '<div class="text-center">' . $row->name . '</div>';
|
||||
})
|
||||
->editColumn('email', function ($row) {
|
||||
return '<div class="text-center">' . $row->email . '</div>';
|
||||
})
|
||||
->editColumn('contact_number', function ($row) {
|
||||
return '<div class="text-center">' . $row->contact_number . '</div>';
|
||||
})
|
||||
->editColumn('amount_invested', function ($row) {
|
||||
return '<div class="text-center">' . $this->totalInvestment($row->id) . '</div>';
|
||||
})
|
||||
->editColumn('active_investment', function ($row) {
|
||||
return '<div class="text-center">' . $this->totalInvestmentCount($row->id) . ' Investment(s)</div>';
|
||||
})
|
||||
->editColumn('status', function ($row) {
|
||||
return '<div class="text-center">' . $row->status . '</div>';
|
||||
})
|
||||
->addColumn('action', function ($row) {
|
||||
$checked = $row->status == 1 ? 'checked' : '';
|
||||
$btn = '<div class="text-end d-flex align-items-center justify-content-around"><a href="' . route("view_investors_details", $row->id) . ' class="action_icon" data-bs-toggle="tooltip" data-bs-custom-class="tooltip-inverse" data-bs-placement="top" title="View Detail">
|
||||
<i class="fa-regular fa-eye"></i>
|
||||
</a>
|
||||
<a class="action_icon" data-bs-toggle="tooltip" data-count="" onclick="status(' . $row->id . ',' . $row->status . ',' . $row->id . ')" data-bs-custom-class="tooltip-inverse" data-bs-placement="top" title="Active and Inactive">
|
||||
<label class="form-check form-switch form-switch-sm form-check-custom form-check-solid flex-stack" style="text-align:center !important; display:block">
|
||||
<input class="form-check-input status' . $row->id . '" type="checkbox" ' . $checked . ' value="' . $row->status . '" />
|
||||
</label>
|
||||
</a></div>';
|
||||
return $btn;
|
||||
})
|
||||
->rawColumns(['name', 'email', 'contact_number', 'amount_invested', 'active_investment', 'created_at', 'status', 'action'])
|
||||
->make(true);
|
||||
}
|
||||
|
||||
return view('Admin.Pages.manage_investors.manage_investors');
|
||||
}
|
||||
|
||||
public function totalInvestmentCount($id)
|
||||
{
|
||||
return MonthlyUpdateMaster::where(['users_id' => $id, 'holding_status' => 'Holding'])->count();
|
||||
}
|
||||
|
||||
public function totalInvestment($id, $type = null)
|
||||
{
|
||||
// $user = MonthlyUpdateMaster::where('users_id', $id)->where('holding_status',$type)->get();
|
||||
$user = MonthlyUpdateMaster::where('users_id', $id)->when($type !== null, function ($query) use ($type) {
|
||||
return $query->where('holding_status', $type);
|
||||
})->get();
|
||||
|
||||
$productDetails = [];
|
||||
foreach ($user as $singleMUM) {
|
||||
$dataArr = [
|
||||
'categories' => $singleMUM->categories,
|
||||
'product_category' => $singleMUM->product_category,
|
||||
'product_name' => $singleMUM->product_name,
|
||||
];
|
||||
if (MonthlyUpdateAlternativeInvestmentFund::where('custom_id', $singleMUM->custom_id)->exists()) {
|
||||
$data = MonthlyUpdateAlternativeInvestmentFund::where('custom_id', $singleMUM->custom_id)->latest()->first();
|
||||
$dataArr['total_investment_amount'] = $data->getRawOriginal('commitment_amount');
|
||||
array_push($productDetails, $dataArr);
|
||||
} elseif (MonthlyUpdateFractionalRealEstate::where('custom_id', $singleMUM->custom_id)->first()) {
|
||||
$data = MonthlyUpdateFractionalRealEstate::where('custom_id', $singleMUM->custom_id)->latest()->first();
|
||||
$dataArr['total_investment_amount'] = $data->getRawOriginal('absolute_return_till_date');
|
||||
array_push($productDetails, $dataArr);
|
||||
} elseif (MonthlyUpdatePeerToPeerLending::where('custom_id', $singleMUM->custom_id)->first()) {
|
||||
$data = MonthlyUpdatePeerToPeerLending::where('custom_id', $singleMUM->custom_id)->latest()->first();
|
||||
if ($singleMUM->categories == 'Liquiloans') {
|
||||
$dataArr['total_investment_amount'] = $data->getRawOriginal('total_investment');
|
||||
} elseif ($singleMUM->categories == 'Faircent') {
|
||||
$dataArr['total_investment_amount'] = $data->getRawOriginal('all_time_amount_invested');
|
||||
} elseif ($singleMUM->categories == 'Finance Peer') {
|
||||
$dataArr['total_investment_amount'] = $data->getRawOriginal('all_time_investment_added');
|
||||
}
|
||||
array_push($productDetails, $dataArr);
|
||||
} elseif (MonthlyUpdateIndianFinancialAssets::where('custom_id', $singleMUM->custom_id)->first()) {
|
||||
$data = MonthlyUpdateIndianFinancialAssets::where('custom_id', $singleMUM->custom_id)->latest()->first();
|
||||
$dataArr['total_investment_amount'] = $data->amount_invested;
|
||||
array_push($productDetails, $dataArr);
|
||||
}
|
||||
}
|
||||
$totalInvestment = array_sum(array_column($productDetails, 'total_investment_amount'));
|
||||
|
||||
$totalInvestment = IND_money_format($totalInvestment);
|
||||
|
||||
return $totalInvestment;
|
||||
}
|
||||
}
|
||||
179
app/Http/Controllers/Admin/ManageLeadController.php
Normal file
179
app/Http/Controllers/Admin/ManageLeadController.php
Normal file
@@ -0,0 +1,179 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Models\User;
|
||||
use App\Models\Category;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Traits\HttpResponse;
|
||||
use App\Notifications\UserAdmin;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Admin\LeadService;
|
||||
use App\Http\Requests\StoreLeadRequest;
|
||||
use App\Http\Requests\StoreTaskRequest;
|
||||
use App\Http\Requests\UpdateLeadRequest;
|
||||
use App\Http\Requests\StoreNotesRequest;
|
||||
use App\Http\Requests\StoreMeetingRequest;
|
||||
use App\Http\Requests\StoreAttachmentsRequest;
|
||||
|
||||
class ManageLeadController extends Controller
|
||||
{
|
||||
use HttpResponse;
|
||||
protected $lead;
|
||||
public function __construct(LeadService $lead)
|
||||
{
|
||||
$this->lead = $lead;
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
return view('Admin.Pages.manage_leads.manage_leads', [
|
||||
'leads' => $this->lead->getAllLeads(),
|
||||
'leadCount' => $this->lead->totalLead(),
|
||||
'productName' => $this->lead->getAllProducts(),
|
||||
'newCount' => $this->lead->newTotalLead(),
|
||||
'ongoingCount' => $this->lead->ongoingTotalLead(),
|
||||
'completedCount' => $this->lead->completedTotalLead(),
|
||||
'oldCount' => $this->lead->oldTotalLead(),
|
||||
'lostCount' => $this->lead->lostTotalLead()
|
||||
]);
|
||||
}
|
||||
|
||||
public function new_leads()
|
||||
{
|
||||
return view('Admin.Pages.manage_leads.new_leads', [
|
||||
'leads' => $this->lead->newLeads(),
|
||||
'productName' => $this->lead->getAllProducts()
|
||||
]);
|
||||
}
|
||||
|
||||
public function ongoing_leads()
|
||||
{
|
||||
// return view('Admin.Pages.manage_leads.ongoing_leads');
|
||||
// dd($this->lead->ongoingLeads());
|
||||
return view('Admin.Pages.manage_leads.ongoing_leads', [
|
||||
'leads' => $this->lead->ongoingLeads(),
|
||||
'productName' => $this->lead->getAllProducts()
|
||||
]);
|
||||
}
|
||||
|
||||
public function completed_leads()
|
||||
{
|
||||
return view('Admin.Pages.manage_leads.completed_leads', [
|
||||
'leads' => $this->lead->completedLeads(),
|
||||
'productName' => $this->lead->getAllProducts()
|
||||
]);
|
||||
}
|
||||
|
||||
public function old_leads()
|
||||
{
|
||||
return view('Admin.Pages.manage_leads.old_leads', [
|
||||
'leads' => $this->lead->oldLeads(),
|
||||
'productName' => $this->lead->getAllProducts()
|
||||
]);
|
||||
}
|
||||
|
||||
public function lost_leads()
|
||||
{
|
||||
return view('Admin.Pages.manage_leads.lost_leads', [
|
||||
'leads' => $this->lead->lostLeads(),
|
||||
'productName' => $this->lead->getAllProducts()
|
||||
]);
|
||||
}
|
||||
|
||||
public function addLead()
|
||||
{
|
||||
return view('Admin.Pages.manage_leads.add_lead', [
|
||||
'user' => User::admins()->active()->get(),
|
||||
'investor' => User::users()->get(),
|
||||
'categories' => Category::active()->get(),
|
||||
]);
|
||||
}
|
||||
|
||||
public function createLead(StoreLeadRequest $request)
|
||||
{
|
||||
$leadCreated = $this->lead->store($request);
|
||||
$user = \Auth::user($request->lead_owner);
|
||||
$notify['message'] = "You have been assigned a new lead!";
|
||||
$type = 'Leads Assigned';
|
||||
$user->notify(new UserAdmin($notify, $type));
|
||||
return $leadCreated ?
|
||||
$this->response('Lead Created Succesfully', 200) :
|
||||
$this->response('Error Creating Lead!', 400);
|
||||
}
|
||||
|
||||
public function viewLead($id)
|
||||
{
|
||||
return view('Admin.Pages.manage_leads.view-lead', [
|
||||
'lead' => $this->lead->show($id)
|
||||
]);
|
||||
}
|
||||
|
||||
public function downloadFile($file_name)
|
||||
{
|
||||
return $this->lead->download($file_name);
|
||||
}
|
||||
|
||||
public function editLead($id)
|
||||
{
|
||||
return view('Admin.Pages.manage_leads.edit-lead', [
|
||||
'lead' => $this->lead->edit($id),
|
||||
'users' => User::admins()->get(),
|
||||
'investor' => User::users()->get(),
|
||||
]);
|
||||
}
|
||||
|
||||
public function updateLead(UpdateLeadRequest $request)
|
||||
{
|
||||
$leadUpdated = $this->lead->update($request);
|
||||
return $leadUpdated ?
|
||||
$this->response('Lead updated successfully', 200) :
|
||||
$this->response('Lead not updated. Error!!', 400);
|
||||
}
|
||||
|
||||
|
||||
public function createNotes(StoreNotesRequest $request)
|
||||
{
|
||||
$leadNoteAdded = $this->lead->storeNote($request);
|
||||
return $leadNoteAdded ?
|
||||
$this->response('Lead Note Created Succesfully!', 200) :
|
||||
$this->response('Error Creating Lead Note!', 400);
|
||||
}
|
||||
|
||||
public function createAttachments(StoreAttachmentsRequest $request)
|
||||
{
|
||||
$leadAttachmentAdded = $this->lead->storeAttachments($request);
|
||||
return $leadAttachmentAdded ?
|
||||
$this->response('Lead Attached Created Succesfully!', 200) :
|
||||
$this->response('Error Creating Lead Attachment!', 400);
|
||||
}
|
||||
|
||||
public function sortNotes(Request $request)
|
||||
{
|
||||
return $this->lead->sortNotes($request);
|
||||
}
|
||||
|
||||
public function createTask(StoreTaskRequest $request)
|
||||
{
|
||||
$taskCreated = $this->lead->storeTasks($request);
|
||||
return $taskCreated ?
|
||||
$this->response('Lead Task Created Succesfully!', 200) :
|
||||
$this->response('Error Creating Lead Task!', 400);
|
||||
}
|
||||
|
||||
public function createMeeting(StoreMeetingRequest $request)
|
||||
{
|
||||
$meetingCreated = $this->lead->storeMeetings($request);
|
||||
return $meetingCreated ?
|
||||
$this->response('Lead Meeting Created Succesfully!', 200) :
|
||||
$this->response('Error Creating Lead Meeting!', 400);
|
||||
}
|
||||
|
||||
public function convertClosed(Request $request)
|
||||
{
|
||||
$convertClosed = $this->lead->convertActivity($request);
|
||||
return $convertClosed ?
|
||||
$this->response('Converted To Closed Activity Succesfully!', 200) :
|
||||
$this->response('Error Converting it to Closed Activity!', 400);
|
||||
}
|
||||
}
|
||||
137
app/Http/Controllers/Admin/ManageNewsController.php
Normal file
137
app/Http/Controllers/Admin/ManageNewsController.php
Normal file
@@ -0,0 +1,137 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Models\Admin\News;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
class ManageNewsController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$data = News::orderBy('id', 'DESC')->get();
|
||||
return view('Admin.Pages.manage_cms.manage_news.manage_news')->with(['data' => $data]);
|
||||
}
|
||||
|
||||
public function add_news()
|
||||
{
|
||||
return view('Admin.Pages.manage_cms.manage_news.add_news');
|
||||
}
|
||||
|
||||
public function store_news(Request $request)
|
||||
{
|
||||
$data = new News();
|
||||
$data->news_title = $request->news_title;
|
||||
$data->news_schedule_at = $request->news_schedule_at;
|
||||
$data->news_description = $request->news_description;
|
||||
|
||||
if ($request->hasFile('news_image')) {
|
||||
$file = $request->file('news_image');
|
||||
$filename = date('YmdHi') . $file->getClientOriginalName();
|
||||
$file->move(public_path('uploads/news/images'), $filename);
|
||||
$data->news_image = 'uploads/news/images/'.$filename;
|
||||
}
|
||||
$data->save();
|
||||
$news_id = $data->id;
|
||||
|
||||
if (isset($news_id) && $news_id != '') {
|
||||
$request->session()->flash('message', 'News added successfully.');
|
||||
return response()->json(['status' => 200]);
|
||||
} else {
|
||||
return response()->json([
|
||||
'status' => 204,
|
||||
'message' => 'Data is missing.'
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
public function show_news($id)
|
||||
{
|
||||
$data['news_data'] = News::where('id',$id)->first();
|
||||
// print_r($data);
|
||||
// exit;
|
||||
return view('Admin.Pages.manage_cms.manage_news.show_news', $data);
|
||||
}
|
||||
|
||||
public function edit_news($id)
|
||||
{
|
||||
$data['news_data'] = News::find($id);
|
||||
return view('Admin.Pages.manage_cms.manage_news.edit_news', $data);
|
||||
}
|
||||
|
||||
public function update_news(Request $request)
|
||||
{
|
||||
$data = News::find($request->news_id);
|
||||
$data->news_title = $request->news_title;
|
||||
$data->news_schedule_at = $request->news_schedule_at;
|
||||
$data->news_description = $request->news_description;
|
||||
|
||||
if($request->hasfile('news_image')){
|
||||
|
||||
$old_image = 'uploads/news/images'.$request->news_image;
|
||||
if(File::exists($old_image)){
|
||||
File::delete($old_image);
|
||||
|
||||
}
|
||||
$file = $request->file('news_image');
|
||||
$filename = date('YmdHi') . $file->getClientOriginalName();
|
||||
$file->move(public_path('uploads/news/images'),$filename);
|
||||
$data->news_image = 'uploads/news/images/'.$filename;
|
||||
|
||||
}
|
||||
$data->save();
|
||||
$news_id = $data->id;
|
||||
if (isset($news_id) && $news_id != '') {
|
||||
$request->session()->flash('message', 'News updated successfully.');
|
||||
return response()->json(['status' => 200]);
|
||||
} else {
|
||||
return response()->json([
|
||||
'status' => 204,
|
||||
'message' => 'Data is missing.'
|
||||
]);
|
||||
}
|
||||
}
|
||||
public function delete_news(Request $request, $id)
|
||||
{
|
||||
$data = News::find($id);
|
||||
if ($data) {
|
||||
$data->delete();
|
||||
$request->session()->flash('message', 'News deleted successfully.');
|
||||
return response()->json([
|
||||
'status' => 200,
|
||||
'message' => 'News Deleted Successfully.'
|
||||
]);
|
||||
} else {
|
||||
$request->session()->flash('message', 'Something went wrong! Please Try Again.');
|
||||
return response()->json([
|
||||
'status' => 204,
|
||||
'message' => 'Something went wrong! Please Try Again.'
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
public function news_status(Request $request)
|
||||
{
|
||||
$data = News::where('id',$request->id)->first();
|
||||
if($data)
|
||||
{
|
||||
if ($request->status == '1')
|
||||
{
|
||||
$data->status = '0';
|
||||
}
|
||||
else
|
||||
{
|
||||
$data->status = '1';
|
||||
}
|
||||
$data->save();
|
||||
}
|
||||
|
||||
return response()->json([
|
||||
'status' => 200,
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
162
app/Http/Controllers/Admin/ManagePartnerPlatformController.php
Normal file
162
app/Http/Controllers/Admin/ManagePartnerPlatformController.php
Normal file
@@ -0,0 +1,162 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Mail\PartnerCredential;
|
||||
use App\Models\Admin\User;
|
||||
use App\Models\Company;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\UserPartner;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
|
||||
class ManagePartnerPlatformController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
// $data = UserPartner::all()
|
||||
$data = UserPartner::join('users', 'user_partner.users_id', '=', 'users.id')
|
||||
->join('companies', 'user_partner.company_id', '=', 'companies.id')
|
||||
->get(['user_partner.id', 'company_name', 'name']);
|
||||
return view('Admin.Pages.manage_investors.manage-partner', (['data' => $data]));
|
||||
}
|
||||
|
||||
public function addUser()
|
||||
{
|
||||
$datauser = User::orderBy('name', 'ASC')->get();
|
||||
$dataCompany = Company::active()->get();
|
||||
|
||||
return view('Admin.Pages.manage_investors.manage-partner-platform', (['users' => $datauser, 'company' => $dataCompany]));
|
||||
}
|
||||
|
||||
public function storeUserPartner(Request $request)
|
||||
{
|
||||
$validator = Validator::make(
|
||||
$request->all(),
|
||||
[
|
||||
"user_name" => [
|
||||
'required',
|
||||
function ($attribute, $value, $fail) {
|
||||
// check question is unique in that table
|
||||
$samedata_exists = UserPartner::where('users_id', request()->input('user_name'))->where('company_id', request()->input('partner_name'))->count() > 0;
|
||||
|
||||
if ($samedata_exists) {
|
||||
$fail('The partner_name must be unique.');
|
||||
}
|
||||
}
|
||||
],
|
||||
|
||||
"partner_name" => 'required',
|
||||
],
|
||||
[
|
||||
'partner_name.required' => 'partner_name is required',
|
||||
'partner_name.unique' => 'partner_name should be unique',
|
||||
]
|
||||
);
|
||||
|
||||
$validationMessage = validationErrorMessage($validator);
|
||||
if ($validationMessage) {
|
||||
return response()->json(
|
||||
[
|
||||
"status" => 400,
|
||||
"message" => $validationMessage
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
// sending mail to user
|
||||
$user_data = User::where('id', $request->user_name)->first();
|
||||
$company_data = Company::where('id', $request->partner_name)->first();
|
||||
$data['partnerName'] = $company_data->company_name;
|
||||
$data['login'] = $request->login;
|
||||
$data['password'] = $request->password;
|
||||
$sending_mail = $this->sendMail($user_data->email, $data);
|
||||
|
||||
$data = new UserPartner();
|
||||
$data->users_id = $request->user_name;
|
||||
$data->company_id = $request->partner_name;
|
||||
// $data->login = $request->login;
|
||||
// $data->password = encrypt($request->password);
|
||||
$data->save();
|
||||
|
||||
$userpartner_id = $data->id;
|
||||
if (isset($userpartner_id) && $userpartner_id != '') {
|
||||
// $request->session()->flash('message', 'Testimonial added successfully.');
|
||||
return response()->json(['status' => 200, 'message' => 'Credentials Sent!']);
|
||||
} else {
|
||||
return response()->json([
|
||||
'status' => 204,
|
||||
'message' => 'Data is missing.'
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
public function editPartner($id)
|
||||
{
|
||||
|
||||
|
||||
$my = UserPartner::findOrFail($id);
|
||||
|
||||
$data = UserPartner::join('users', 'user_partner.users_id', 'users.id')
|
||||
->join('companies', 'user_partner.company_id', 'companies.id')
|
||||
->where('user_partner.id', $my->id)
|
||||
->get();
|
||||
|
||||
return view('Admin.Pages.manage_investors.manage_partner_edit', ['data' => $data]);
|
||||
}
|
||||
|
||||
public function viewPartnerDetails($id)
|
||||
{
|
||||
|
||||
$my = UserPartner::findOrFail($id);
|
||||
|
||||
$data = UserPartner::join('users', 'user_partner.users_id', 'users.id')
|
||||
->join('companies', 'user_partner.company_id', 'companies.id')
|
||||
->where('user_partner.id', $my->id)
|
||||
->first();
|
||||
|
||||
return view('Admin.Pages.manage_investors.manage_partner_details', (['data' => $data]));
|
||||
}
|
||||
public function updatePartner(Request $request)
|
||||
{
|
||||
|
||||
// $data = UserPartner::find($request->fre_id);
|
||||
// dd($data);
|
||||
// $data->client_designation_company_name = $request->client_designation_company_name;
|
||||
// $data->description = $request->description;
|
||||
// $data->login = $request->login;
|
||||
// $data->password = $request->password;
|
||||
// $data->save();
|
||||
|
||||
$data = UserPartner::where('id', $request->fre_id)->update([
|
||||
'login' => $request->login,
|
||||
'password' => $request->password,
|
||||
|
||||
]);
|
||||
dd($data);
|
||||
|
||||
$testimonial_id = $data->id;
|
||||
|
||||
if (isset($testimonial_id) && $testimonial_id != '') {
|
||||
// $request->session()->flash('message', ' updated successfully.');
|
||||
return response()->json(['status' => 200]);
|
||||
} else {
|
||||
return response()->json([
|
||||
'status' => 204,
|
||||
'message' => 'Data is missing.'
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
// mail function
|
||||
public function sendMail($email, $data)
|
||||
{
|
||||
$mailData = [
|
||||
'title' => "Mail from freeU software",
|
||||
'body' => "sending mail for testing using cpanel credential",
|
||||
];
|
||||
Mail::to($email)->send(new PartnerCredential($mailData, $data));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ManageSellerFeaturedController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
return view('Admin.Pages.pre_owned_investment.manage_seller_featured');
|
||||
}
|
||||
|
||||
public function view_pending_featured_listing()
|
||||
{
|
||||
return view('Admin.Pages.pre_owned_investment.view_pending_featured_listing');
|
||||
}
|
||||
|
||||
public function view_approve_featured_listing()
|
||||
{
|
||||
return view('Admin.Pages.pre_owned_investment.view_approve_featured_listing');
|
||||
}
|
||||
|
||||
public function view_rejected_featured_listing()
|
||||
{
|
||||
return view('Admin.Pages.pre_owned_investment.view_rejected_featured_listing');
|
||||
}
|
||||
}
|
||||
87
app/Http/Controllers/Admin/ManageSellerProfileController.php
Normal file
87
app/Http/Controllers/Admin/ManageSellerProfileController.php
Normal file
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\MarketplaceAlternativeInvestmentFundSeller;
|
||||
use App\Models\MarketplaceFractionalRealEstateSeller;
|
||||
use App\Models\MarketplaceOtherProductsSeller;
|
||||
use App\Models\MarketplaceSellerForm;
|
||||
use App\Models\MarketplaceBuyerForm;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ManageSellerProfileController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$sellerProfile = MarketplaceSellerForm::query()
|
||||
->with('users')
|
||||
->withCount(['aif','fre','op'])
|
||||
->latest()
|
||||
->get();
|
||||
return view('Admin.Pages.pre_owned_investment.manage_seller_profile', compact('sellerProfile'));
|
||||
}
|
||||
|
||||
public function sellerDetails($id)
|
||||
{
|
||||
$sellerProfile = MarketplaceSellerForm::findOrFail($id);
|
||||
$freListing = MarketplaceFractionalRealEstateSeller::where('seller_forms_id', $id)->get();
|
||||
$aifListing = MarketplaceAlternativeInvestmentFundSeller::where('seller_forms_id', $id)->get();
|
||||
$opListing = MarketplaceOtherProductsSeller::where('seller_forms_id', $id)->get();
|
||||
$id = $id;
|
||||
$productsSold = $this->productsSold($sellerProfile);
|
||||
return view('Admin.Pages.pre_owned_investment.manage_investors', compact('sellerProfile', 'aifListing', 'freListing', 'opListing','id','productsSold'));
|
||||
}
|
||||
|
||||
public function productsSold($sellerProfile){
|
||||
$sellerId = $sellerProfile->id;
|
||||
$productsSold = array();
|
||||
$marketplaceAIFPRoducts = MarketplaceAlternativeInvestmentFundSeller::where('seller_forms_id', $sellerId)->get();
|
||||
foreach ($marketplaceAIFPRoducts as $data) {
|
||||
$buyers = MarketplaceBuyerForm::where(['table' => 'marketplace_aif_sellers', 'status' => 'Sold', 'associated_id' => $data->id])->get();
|
||||
foreach($buyers as $buyerData){
|
||||
$buyerArr = array();
|
||||
$buyerArr['product_name'] = $data->property_name;
|
||||
$buyerArr['buyer'] = $buyerData->name;
|
||||
array_push($productsSold,$buyerArr);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$marketplaceFREPRoducts = MarketplaceFractionalRealEstateSeller::where('seller_forms_id', $sellerId)->get();
|
||||
foreach ($marketplaceFREPRoducts as $data) {
|
||||
$buyers = MarketplaceBuyerForm::where(['table' => 'marketplace_fre_sellers', 'status' => 'Sold', 'associated_id' => $data->id])->get();
|
||||
foreach($buyers as $buyerData){
|
||||
$buyerArr = array();
|
||||
$buyerArr['product_name'] = $data->property_name;
|
||||
$buyerArr['buyer'] = $buyerData->name;
|
||||
array_push($productsSold,$buyerArr);
|
||||
}
|
||||
}
|
||||
|
||||
$marketplaceOPPRoducts = MarketplaceOtherProductsSeller::where('seller_forms_id', $sellerId)->get();
|
||||
foreach ($marketplaceOPPRoducts as $data) {
|
||||
$buyers = MarketplaceBuyerForm::where(['table' => 'marketplace_op_sellers', 'status' => 'Sold', 'associated_id' => $data->id])->get();
|
||||
foreach($buyers as $buyerData){
|
||||
$buyerArr = array();
|
||||
$buyerArr['product_name'] = $data->property_name;
|
||||
$buyerArr['buyer'] = $buyerData->name;
|
||||
array_push($productsSold,$buyerArr);
|
||||
}
|
||||
}
|
||||
return $productsSold;
|
||||
}
|
||||
|
||||
public function changeStatus(Request $request)
|
||||
{
|
||||
|
||||
$changeStatus = MarketplaceSellerForm::where('id', $request->id)->update([
|
||||
'status' => $request->status == 0 ? 1 : 0,
|
||||
]);
|
||||
|
||||
if ($changeStatus) {
|
||||
return response()->json(['status' => 200, 'message' => 'Status Changed']);
|
||||
}
|
||||
return response()->json(['status' => 400, 'message' => 'Error Changing Status']);
|
||||
}
|
||||
}
|
||||
14
app/Http/Controllers/Admin/ManageSettingController.php
Normal file
14
app/Http/Controllers/Admin/ManageSettingController.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ManageSettingController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
return view('Admin.Pages.manage_setting.general_setting');
|
||||
}
|
||||
}
|
||||
181
app/Http/Controllers/Admin/ManageSubAdminController.php
Normal file
181
app/Http/Controllers/Admin/ManageSubAdminController.php
Normal file
@@ -0,0 +1,181 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Traits\HttpResponse;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Admin\ManageSubAdminService;
|
||||
use App\Models\User;
|
||||
|
||||
class ManageSubAdminController extends Controller
|
||||
{
|
||||
use HttpResponse;
|
||||
|
||||
protected $admin;
|
||||
|
||||
public function __construct(ManageSubAdminService $admin)
|
||||
{
|
||||
$this->admin = $admin;
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
return view('Admin.Pages.manage_sub_admin.manage_sub_admin',[
|
||||
'users' => $this->admin->getAllAdmin()
|
||||
]);
|
||||
}
|
||||
|
||||
// public function role_list()
|
||||
// {
|
||||
// return view('Admin.Pages.manage_sub_admin.role_list');
|
||||
// }
|
||||
|
||||
// public function view_role()
|
||||
// {
|
||||
// return view('Admin.Pages.manage_sub_admin.view_role');
|
||||
// }
|
||||
|
||||
public function status(Request $request)
|
||||
{
|
||||
$statusChanged = $this->admin->changeStatus($request);
|
||||
return $statusChanged ?
|
||||
$this->response('Status Changed!', 200) :
|
||||
$this->response('Error Changing Status!', 400);
|
||||
}
|
||||
|
||||
public function listSubAdmin()
|
||||
{
|
||||
$subAdmin = User::where(['role'=>1, 'status'=>1])->whereNotIn('id',[auth()->user()->id])->get();
|
||||
// dd($subAdmin);
|
||||
return view('Admin.sub_admin_list',['subAdmin'=>$subAdmin]);
|
||||
}
|
||||
|
||||
public function addSubAdmin(Request $request)
|
||||
{
|
||||
dd($request->all());
|
||||
$validator = Validator::make($request->post(), [
|
||||
'name' => 'required',
|
||||
// 'address' => 'required',
|
||||
// 'contact_number' => 'required|unique:users,contact_number',
|
||||
// 'pan_no' => 'required|unique:users,pan_no',
|
||||
'email' => 'required|unique:users,email',
|
||||
], ['email.unique' => 'Email is not unique', 'name.required' => 'Name is required']);
|
||||
$validationMessage = $this->validationError($validator);
|
||||
if ($validationMessage) {
|
||||
return response()->json(['status' => 400, 'message' => $validationMessage]);
|
||||
}
|
||||
$principalType = Iam_Principal_Type::find($request->role_type);
|
||||
|
||||
// defining user type
|
||||
if ($request->role_type == 1) {
|
||||
$roleType = 1;
|
||||
} else if ($request->role_type == 2) {
|
||||
$roleType = 2;
|
||||
} else {
|
||||
$roleType = 0;
|
||||
}
|
||||
|
||||
$addUser = User::insertGetId([
|
||||
'principal_type_xid' => $principalType->id,
|
||||
'name' => $request->name,
|
||||
'email' => $request->email,
|
||||
'contact_number' => $request->mobile_number,
|
||||
'role' => $roleType,
|
||||
]);
|
||||
|
||||
foreach ($request->all() as $key => $value) {
|
||||
if ($key == '_token' || $key == 'name' || $key == 'email' || $key == 'mobile_number' || $key == 'role_type') {
|
||||
continue;
|
||||
} else {
|
||||
$appResource = Iam_App_Resources::find($value);
|
||||
$addAppResourceActionLink = Iam_App_Resource_Action_Link::create([
|
||||
'user_xid' => $addUser,
|
||||
'app_resource_xid' => $appResource->id,
|
||||
]);
|
||||
}
|
||||
}
|
||||
return response()->json(['status' => 200, 'message' => 'User Added!']);
|
||||
}
|
||||
|
||||
|
||||
public function viewSubAdmin(Request $request)
|
||||
{
|
||||
dd($request->all());
|
||||
$id = $request->id();
|
||||
$user = User::find($id);
|
||||
$accessPage = Iam_App_Resource_Action_Link::where('user_xid', $id)->pluck('app_resource_xid');
|
||||
return view('Admin.edit-sub-admin',['user'=>$user, 'accessPage'=>$accessPage, 'id'=>$id]);
|
||||
}
|
||||
public function updateSubAdmin(Request $request)
|
||||
{
|
||||
// dd($request->all());
|
||||
// dd($request->ip());
|
||||
$id = $request->id;
|
||||
// dd($id);
|
||||
$validator = Validator::make($request->all(), [
|
||||
'name' => 'required',
|
||||
// 'address' => 'required',
|
||||
// 'contact_number' => 'required|unique:users,contact_number,' . $id . '',
|
||||
// 'pan_no' => 'required|unique:users,pan_no,' . $id . '',
|
||||
'email' => 'required|unique:users,email,' . $id . '',
|
||||
], [
|
||||
'email.unique' => 'Email is not unique',
|
||||
'name.required' => 'Name is required',
|
||||
'email.required' => 'Email is required'
|
||||
]);
|
||||
$validationMessage = $this->validationError($validator);
|
||||
if ($validationMessage) {
|
||||
return response()->json(['status' => 400, 'message' => $validationMessage]);
|
||||
}
|
||||
$updateUser = User::where('id', $id)->update([
|
||||
'name' => $request->name,
|
||||
// 'address' => $request->address,
|
||||
'contact_number' => $request->mobile_number,
|
||||
'role' => $request->role_type,
|
||||
'email' => $request->email,
|
||||
]);
|
||||
|
||||
// getting old resource access id
|
||||
$oldAccessResourceId = array();
|
||||
$olddata = Iam_App_Resource_Action_Link::where('user_xid', $id)->pluck('app_resource_xid');
|
||||
foreach ($olddata as $oldAppId) {
|
||||
array_push($oldAccessResourceId, $oldAppId);
|
||||
}
|
||||
|
||||
// getting new access id
|
||||
$newAccessResourceId = array();
|
||||
foreach ($request->all() as $key => $value) {
|
||||
if ($key == '_token' || $key == '_method' || $key == 'id' || $key == 'name' || $key == 'email' || $key == 'role_type' || $key == 'mobile_number') {
|
||||
continue;
|
||||
} else {
|
||||
array_push($newAccessResourceId, intval($value));
|
||||
}
|
||||
}
|
||||
// dd($newAccessResourceId);
|
||||
// getting id for removing
|
||||
$removeOldResourceAccessId = array_diff($oldAccessResourceId, $newAccessResourceId);
|
||||
// removing old access
|
||||
foreach ($removeOldResourceAccessId as $oldAccessId) {
|
||||
Iam_App_Resource_Action_Link::where(['user_xid' => $id, 'app_resource_xid' => $oldAccessId])->delete();
|
||||
}
|
||||
|
||||
// adding new access id
|
||||
foreach ($request->all() as $key => $value) {
|
||||
if ($key == '_token' || $key == '_method' || $key == 'id' || $key == 'name' || $key == 'email' || $key == 'mobile_number' || $key == 'role_type') {
|
||||
continue;
|
||||
} else {
|
||||
// dd($request->post());
|
||||
$checkAccess = Iam_App_Resource_Action_Link::where(['user_xid' => $id, 'app_resource_xid' => $value])->doesntExist();
|
||||
if ($checkAccess) {
|
||||
$appResource = Iam_App_Resources::find($value);
|
||||
$addAppResourceActionLink = Iam_App_Resource_Action_Link::create([
|
||||
'user_xid' => $id,
|
||||
'app_resource_xid' => $appResource->id,
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
return response()->json(['status' => 200, 'message' => 'User Updated!']);
|
||||
}
|
||||
}
|
||||
71
app/Http/Controllers/Admin/ManageTagsController.php
Normal file
71
app/Http/Controllers/Admin/ManageTagsController.php
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Traits\HttpResponse;
|
||||
use App\Services\Admin\TagService;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\StoreTagRequest;
|
||||
use App\Http\Requests\UpdateTagRequest;
|
||||
|
||||
class ManageTagsController extends Controller
|
||||
{
|
||||
use HttpResponse;
|
||||
|
||||
protected $tag;
|
||||
|
||||
public function __construct(TagService $tag)
|
||||
{
|
||||
$this->tag = $tag;
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
return view('Admin.Pages.manage_cms.manage_tag.manage_tag', [
|
||||
'tags' => $this->tag->getTags()
|
||||
]);
|
||||
}
|
||||
|
||||
public function addPage()
|
||||
{
|
||||
return view('Admin.Pages.manage_cms.manage_tag.add_tag');
|
||||
}
|
||||
|
||||
public function store(StoreTagRequest $request)
|
||||
{
|
||||
$tagCreated = $this->tag->store($request);
|
||||
return $tagCreated ?
|
||||
$this->response('Tag Created Successfully!', 200) :
|
||||
$this->response('Tag Cannot Be Created!', 400);
|
||||
}
|
||||
|
||||
public function edit_tag($id)
|
||||
{
|
||||
return view('Admin.Pages.manage_cms.manage_tag.edit_tag', [
|
||||
'tag' => $this->tag->show($id)
|
||||
]);
|
||||
}
|
||||
|
||||
public function update_tag(UpdateTagRequest $request)
|
||||
{
|
||||
$tagUpdated = $this->tag->update($request);
|
||||
return $tagUpdated ?
|
||||
$this->response('Tag Updated Successfully!', 200) :
|
||||
$this->response('Tag Cannot Be Updated!', 400);
|
||||
}
|
||||
|
||||
public function show_tag($id)
|
||||
{
|
||||
return view('Admin.Pages.manage_cms.manage_tag.view_tag', [
|
||||
'tag' => $this->tag->show($id)
|
||||
]);
|
||||
}
|
||||
|
||||
public function delete_tag($id)
|
||||
{
|
||||
$tagDeleted = $this->tag->delete($id);
|
||||
return $tagDeleted ?
|
||||
$this->response('Tag Deleted Successfully!', 200) :
|
||||
$this->response('Tag Cannot Be Deleted!', 400);
|
||||
}
|
||||
}
|
||||
86
app/Http/Controllers/Admin/ManageTestimonialController.php
Normal file
86
app/Http/Controllers/Admin/ManageTestimonialController.php
Normal file
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Traits\HttpResponse;
|
||||
use App\Models\Admin\Testimonial;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Admin\TestimonialService;
|
||||
use App\Http\Requests\StoreTestimonialRequest;
|
||||
use App\Http\Requests\UpdateTestimonialRequest;
|
||||
use App\Http\Resources\TestimonialResourceCollection;
|
||||
|
||||
class ManageTestimonialController extends Controller
|
||||
{
|
||||
use HttpResponse;
|
||||
|
||||
protected $testimonial;
|
||||
|
||||
public function __construct(TestimonialService $testimonial)
|
||||
{
|
||||
$this->testimonial = $testimonial;
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
return view('Admin.Pages.manage_cms.manage_testimonials.manage_testimonial',[
|
||||
'data' => $this->testimonial->getTestimonials()
|
||||
]);
|
||||
}
|
||||
|
||||
public function add_testimonial()
|
||||
{
|
||||
return view('Admin.Pages.manage_cms.manage_testimonials.add_testimonial');
|
||||
}
|
||||
|
||||
public function store_testimonial(StoreTestimonialRequest $request)
|
||||
{
|
||||
$testimonialAdded = $this->testimonial->store($request);
|
||||
return $testimonialAdded ?
|
||||
$this->response('Testimonial Added Successfully!', 200) :
|
||||
$this->response('Erorr Inserting Testimonial!', 400);
|
||||
}
|
||||
|
||||
public function edit_testimonial($id)
|
||||
{
|
||||
return view('Admin.Pages.manage_cms.manage_testimonials.edit_testimonial',[
|
||||
'testimonial_data' => $this->testimonial->show($id),
|
||||
]);
|
||||
}
|
||||
|
||||
public function update_testimonial(UpdateTestimonialRequest $request)
|
||||
{
|
||||
$testimonialUpdated = $this->testimonial->update($request);
|
||||
return $testimonialUpdated ?
|
||||
$this->response('Testimonial Updated Successfully!', 200) :
|
||||
$this->response('Testimonial Could Not Be Updated Successfully!', 400);
|
||||
}
|
||||
|
||||
public function delete_testimonial($id)
|
||||
{
|
||||
$deletedTestimonial = $this->testimonial->delete($id);
|
||||
return $deletedTestimonial ?
|
||||
response()->json(['status' => 200]) :
|
||||
response()->json([
|
||||
'status' => 204,
|
||||
'message' => 'Something went wrong! Please Try Again.'
|
||||
]);
|
||||
}
|
||||
public function updateStatus(Request $request)
|
||||
{
|
||||
$statusUpdated = $this->testimonial->updateStatus($request);
|
||||
return $statusUpdated ?
|
||||
response()->json(['status' => 200, 'message' => 'Status Changed!']) :
|
||||
response()->json(['status' => 400, 'message' => 'Error Changing Testimonial Status!']);
|
||||
}
|
||||
|
||||
//api data fetch
|
||||
public function apiTestimonial()
|
||||
{
|
||||
$data = Testimonial::all();
|
||||
// return $data ;
|
||||
$hu = new TestimonialResourceCollection($data);
|
||||
return $hu->all();
|
||||
}
|
||||
}
|
||||
79
app/Http/Controllers/Admin/ManageUserController.php
Normal file
79
app/Http/Controllers/Admin/ManageUserController.php
Normal file
@@ -0,0 +1,79 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Exports\UsersExport;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
//use Excel;
|
||||
//use App\Models\User;
|
||||
use App\Services\Admin\ManageUserService;
|
||||
//use App\Repositories\UserRepository;
|
||||
|
||||
class ManageUserController extends Controller
|
||||
{
|
||||
protected $manageUserService;
|
||||
// protected $selectedRows;
|
||||
// protected $data;
|
||||
|
||||
public function __construct(ManageUserService $manageUserService) {
|
||||
$this->manageUserService = $manageUserService;
|
||||
}
|
||||
|
||||
public function create(){
|
||||
return view('Admin.Pages.manage_users.manage_user');
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
// echo $request->activeUser;exit;
|
||||
// $users = $userService->getAllUsers();
|
||||
// $users->$this->data = $this->manageUserService->getAllUsers();
|
||||
$users = $this->manageUserService->getAllUsers();
|
||||
// echo '<pre>';print_r($users);exit;
|
||||
// dd($users);
|
||||
return view('Admin.Pages.manage_users.manage_user')->with(['Users'=>$users]);
|
||||
|
||||
}
|
||||
|
||||
public function destroy(Request $request){
|
||||
// dd($request->userID);
|
||||
$deletedAt = array('isActive'=>0,'deleted_at'=>1);
|
||||
$users = $this->manageUserService->deleteUser($request->userID,$deletedAt);
|
||||
// dd($users);
|
||||
return response()->json(['Delete'=>'Deleted']);
|
||||
|
||||
}
|
||||
|
||||
public function show($id) {
|
||||
// echo $id;
|
||||
$get_single_user_details = $this->manageUserService->show_user($id);
|
||||
// dd($get_single_user_details);
|
||||
return view('Admin.Pages.manage_users.manage_users_view')->with(['get_single_user_details' => $get_single_user_details]);
|
||||
}
|
||||
|
||||
|
||||
public function update(Request $request){
|
||||
// echo "fdfjdf"; exit();
|
||||
$userData = $request->input('userdata');
|
||||
// $updatedata = (['full_name'=>$request->name,
|
||||
// 'email'=>$request->email,
|
||||
// 'mob_number'=> $request->mobile,
|
||||
// ]);
|
||||
$users = $this->manageUserService->updateUser($userData);
|
||||
// echo $users; exit();
|
||||
return response()->json([
|
||||
'status'=>'200',
|
||||
'message'=>"data updated successfully",
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
public function exportUser(){
|
||||
// dd($selectedRows);
|
||||
return Excel::download(new UsersExport,'users.xlsx');
|
||||
}
|
||||
|
||||
}
|
||||
1196
app/Http/Controllers/Admin/ManageUserProductController.php
Normal file
1196
app/Http/Controllers/Admin/ManageUserProductController.php
Normal file
File diff suppressed because it is too large
Load Diff
114
app/Http/Controllers/Admin/ManufacturesCompanyController.php
Normal file
114
app/Http/Controllers/Admin/ManufacturesCompanyController.php
Normal file
@@ -0,0 +1,114 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use App\Models\Admin\ManufacturesCompany;
|
||||
|
||||
class ManufacturesCompanyController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$data = ManufacturesCompany::orderBy('created_at','desc')->get();
|
||||
|
||||
return view('Admin.Pages.manage_freeu_investment.manage_manufactures_company',['data'=>$data]);
|
||||
}
|
||||
|
||||
public function store_manufactures_company(Request $request)
|
||||
{
|
||||
$data = new ManufacturesCompany();
|
||||
$data->company_name = $request->company_name;
|
||||
if ($request->hasFile('company_logo')) {
|
||||
$file = $request->file('company_logo');
|
||||
$filename = date('YmdHi') . $file->getClientOriginalName();
|
||||
$file->move(public_path('uploads/manufactures_company/logo'), $filename);
|
||||
$data->company_logo = 'uploads/manufactures_company/logo/'.$filename;
|
||||
}
|
||||
$data->save();
|
||||
$company_id = $data->id;
|
||||
if(isset($company_id) && $company_id != "")
|
||||
{
|
||||
$request->session()->flash('message', 'Company added successfully.');
|
||||
return response()->json(['status' => 200]);
|
||||
}else
|
||||
{
|
||||
return response()->json([
|
||||
'status' => 204,
|
||||
'message' => 'Data is missing.'
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
public function update_manufactures_company(Request $request)
|
||||
{
|
||||
|
||||
$data = ManufacturesCompany::find($request->company_id);
|
||||
$data->company_name = $request->company_name;
|
||||
if($request->hasfile('company_logo')){
|
||||
|
||||
$old_logo = 'uploads/manufactures_company/logo'.$request->company_logo;
|
||||
if(File::exists($old_logo)){
|
||||
File::delete($old_logo);
|
||||
|
||||
}
|
||||
$file = $request->file('company_logo');
|
||||
$filename = date('YmdHi') . $file->getClientOriginalName();
|
||||
$file->move(public_path('uploads/manufactures_company/logo'),$filename);
|
||||
$data->company_logo = 'uploads/manufactures_company/logo/'.$filename;
|
||||
|
||||
}
|
||||
$data->save();
|
||||
$company_id = $data->id;
|
||||
if(isset($company_id) && $company_id != "")
|
||||
{
|
||||
$request->session()->flash('message', 'Company updated successfully.');
|
||||
return response()->json(['status' => 200]);
|
||||
}else
|
||||
{
|
||||
return response()->json([
|
||||
'status' => 204,
|
||||
'message' => 'Data is missing.'
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
public function delete_manufactures_company(Request $request,$id)
|
||||
{
|
||||
$data = ManufacturesCompany::find($id);
|
||||
if ($data) {
|
||||
$data->delete();
|
||||
|
||||
$request->session()->flash('message', 'Company deleted successfully.');
|
||||
return response()->json([
|
||||
'status' => 200,
|
||||
]);
|
||||
} else {
|
||||
return response()->json([
|
||||
'status' => 204,
|
||||
'message' => 'Something went wrong! Please Try Again.'
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
public function status_manufactures_company(Request $request)
|
||||
{
|
||||
$data = ManufacturesCompany::find($request->id);
|
||||
|
||||
if($data)
|
||||
{
|
||||
if ($request->status == '1')
|
||||
{
|
||||
$data->is_active = '0';
|
||||
}
|
||||
else
|
||||
{
|
||||
$data->is_active = '1';
|
||||
}
|
||||
$data->save();
|
||||
return response(['status'=>200]);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
243
app/Http/Controllers/Admin/OverviewController.php
Normal file
243
app/Http/Controllers/Admin/OverviewController.php
Normal file
@@ -0,0 +1,243 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use Mail;
|
||||
use App\Models\User;
|
||||
use App\Models\Company;
|
||||
use App\Mail\SentBuyerMail;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Notifications\UserAdmin;
|
||||
use App\Models\Admin\BuyerSentMail;
|
||||
use App\Models\MarketplaceBuyerForm;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\MarketplaceSellerForm;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use App\Models\MarketplaceOtherProductsSeller;
|
||||
use App\Models\MarketplaceFractionalRealEstateSeller;
|
||||
use App\Models\MarketplaceAlternativeInvestmentFundSeller;
|
||||
|
||||
class OverviewController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$totalSellerProfile = MarketplaceSellerForm::count();
|
||||
$completedTransactions = MarketplaceBuyerForm::where('status', 'Sold')->count();
|
||||
$totalInvestmentListed = MarketplaceAlternativeInvestmentFundSeller::count() + MarketplaceFractionalRealEstateSeller::count() + MarketplaceOtherProductsSeller::count();
|
||||
$aifMarketPlace = MarketplaceAlternativeInvestmentFundSeller::where('status', 'Approved')->latest()->get();
|
||||
$freMarketPlace = MarketplaceFractionalRealEstateSeller::where('status', 'Approved')->latest()->get();
|
||||
$opMarketPlace = MarketplaceOtherProductsSeller::where('status', 'Approved')->latest()->get();
|
||||
return view('Admin.Pages.pre_owned_investment.pre_owned_investment', compact('aifMarketPlace', 'freMarketPlace', 'opMarketPlace', 'totalSellerProfile', 'completedTransactions', 'totalInvestmentListed'));
|
||||
}
|
||||
|
||||
public function interestedBuyers($id, $table)
|
||||
{
|
||||
$interestedBuyers = MarketplaceBuyerForm::where(['associated_id' => $id, 'table' => $table])->get();
|
||||
|
||||
if ($table == 'marketplace_fre_sellers') {
|
||||
$data = MarketplaceFractionalRealEstateSeller::with('seller')->where('id', $id)->firstOrFail();
|
||||
} elseif ($table == 'marketplace_aif_sellers') {
|
||||
$data = MarketplaceAlternativeInvestmentFundSeller::with('seller')->where('id', $id)->firstOrFail();
|
||||
} elseif ($table == 'marketplace_op_sellers') {
|
||||
$data = MarketplaceOtherProductsSeller::with('seller')->where('id', $id)->firstOrFail();
|
||||
} else {
|
||||
abort(404);
|
||||
}
|
||||
$backId = $id;
|
||||
$backTable = $table;
|
||||
return view('Admin.Pages.pre_owned_investment.interested-buyers', compact('interestedBuyers', 'data', 'backId', 'backTable'));
|
||||
}
|
||||
|
||||
public function listingFeaturedStatus(Request $request)
|
||||
{
|
||||
$listingStatus = $request->listing_status;
|
||||
$id = $request->id;
|
||||
$table = $request->table;
|
||||
|
||||
if (!($table == 'marketplace_aif_sellers' || $table == 'marketplace_fre_sellers' || $table == 'marketplace_op_sellers')) {
|
||||
abort(404);
|
||||
}
|
||||
|
||||
if ($listingStatus == 'Spotlight') {
|
||||
$checkSpotlightExists = MarketplaceFractionalRealEstateSeller::where('listing_status', 'Spotlight')->exists() || MarketplaceAlternativeInvestmentFundSeller::where('listing_status', 'Spotlight')->exists() || MarketplaceOtherProductsSeller::where('listing_status', 'Spotlight')->exists();
|
||||
if ($checkSpotlightExists) {
|
||||
return response()->json(['status' => 400, 'message' => 'An Investment Already Listed With Spotlight!']);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$data = \DB::table($table)->join('marketplace_seller_forms', $table . '.seller_forms_id', 'marketplace_seller_forms.id')->where($table . '.id', $id)->first();
|
||||
|
||||
$changeListingStatus = \DB::table($table)->where('id', $id)->update([
|
||||
'listing_status' => $listingStatus
|
||||
]);
|
||||
|
||||
if ($changeListingStatus && $listingStatus != 'Hide') {
|
||||
$user = User::find($data->users_id);
|
||||
$productName = $data->security_name ?? $data->property_name ?? $data->name_of_the_aif_fund;
|
||||
$notify['message'] = "Congratulations, Your investment($productName) has been assigned to $listingStatus section!";
|
||||
$user->notify(new UserAdmin($notify));
|
||||
return response()->json(['status' => 200, 'message' => 'Listing Status Changed!']);
|
||||
}
|
||||
return response()->json(['status' => 400, 'message' => 'Error Changing Listing Status!']);
|
||||
}
|
||||
|
||||
public function changeStatusBuyer(Request $request)
|
||||
{
|
||||
$status = $request->status;
|
||||
$buyerId = $request->buyer_id;
|
||||
// if ($status == 'Sold') {
|
||||
// $alreadySold = MarketplaceBuyerForm::where('status', 'Sold')->exists();
|
||||
// if ($alreadySold) {
|
||||
// return response()->json(['status' => 400, 'message' => 'This product has already been Sold']);
|
||||
// }
|
||||
// }
|
||||
$alreadySold = MarketplaceBuyerForm::where('id', $buyerId)->update([
|
||||
'status' => $status
|
||||
]);
|
||||
return response()->json(['status' => 200, 'message' => 'Status Changed!']);
|
||||
}
|
||||
|
||||
public function listingTransfer()
|
||||
{
|
||||
$freMarketPlace = MarketplaceFractionalRealEstateSeller::with('seller')->get();
|
||||
$aifMarketPlace = MarketplaceAlternativeInvestmentFundSeller::with('seller')->get();
|
||||
$opMarketPlace = MarketplaceOtherProductsSeller::with('seller')->get();
|
||||
// dd($aifMarketPlace[29]);
|
||||
return view('Admin.Pages.pre_owned_investment.pre_owned_investmentV2', compact('freMarketPlace', 'aifMarketPlace', 'opMarketPlace'));
|
||||
}
|
||||
|
||||
public function listingDetails($id, $table)
|
||||
{
|
||||
$table = [
|
||||
'marketplace_fre_sellers' => 1,
|
||||
'marketplace_aif_sellers' => 2,
|
||||
'marketplace_op_sellers' => 3,
|
||||
][$table];
|
||||
|
||||
if ($table == 1) {
|
||||
$data = MarketplaceFractionalRealEstateSeller::with('seller', 'company')->where('id', $id)->firstOrFail();
|
||||
} elseif ($table == 2) {
|
||||
$data = MarketplaceAlternativeInvestmentFundSeller::with('seller')->where('id', $id)->firstOrFail();
|
||||
} elseif ($table == 3) {
|
||||
$data = MarketplaceOtherProductsSeller::with('seller')->where('id', $id)->firstOrFail();
|
||||
}
|
||||
|
||||
return view('Admin.Pages.pre_owned_investment.pending_investment_view', compact('data', 'table'));
|
||||
}
|
||||
|
||||
public function listingStatus(Request $request)
|
||||
{
|
||||
|
||||
$table = [
|
||||
'marketplace_fre_sellers' => 1,
|
||||
'marketplace_aif_sellers' => 2,
|
||||
'marketplace_op_sellers' => 3,
|
||||
][$request->table];
|
||||
|
||||
if ($table == 1) {
|
||||
MarketplaceFractionalRealEstateSeller::where('id', $request->id)->update(['status' => $request->status]);
|
||||
$userId = MarketplaceFractionalRealEstateSeller::with('seller')->where('id', $request->id)->firstOrFail();;
|
||||
} elseif ($table == 2) {
|
||||
MarketplaceAlternativeInvestmentFundSeller::where('id', $request->id)->update(['status' => $request->status]);
|
||||
$userId = MarketplaceAlternativeInvestmentFundSeller::with('seller')->where('id', $request->id)->firstOrFail();;
|
||||
} elseif ($table == 3) {
|
||||
MarketplaceOtherProductsSeller::where('id', $request->id)->update(['status' => $request->status]);
|
||||
$userId = MarketplaceOtherProductsSeller::with('seller')->where('id', $request->id)->firstOrFail();;
|
||||
}
|
||||
if (!$table) {
|
||||
return response()->json(['status' => 400, 'message' => 'Error Changing status']);
|
||||
}
|
||||
if ($request->status != 'Pending') {
|
||||
$user = User::find($userId->seller->users_id);
|
||||
$productName = $userId->property_name ?? $userId->name_of_the_aif_fund ?? $userId->security_name;
|
||||
$notify['message'] = "Your Investment($productName) has been $request->status for marketplace listing!";
|
||||
$user->notify(new UserAdmin($notify));
|
||||
}
|
||||
return response()->json(['status' => 200, 'message' => 'Status Changed']);
|
||||
}
|
||||
|
||||
public function total_investment_on_sale()
|
||||
{
|
||||
return view('Admin.Pages.pre_owned_investment.total_investment_on_sale');
|
||||
}
|
||||
|
||||
public function transactions()
|
||||
{
|
||||
$aifBuyerForm = MarketplaceAlternativeInvestmentFundSeller::with('seller', 'company')->join('marketplace_buyer_forms', 'marketplace_aif_sellers.id', 'marketplace_buyer_forms.associated_id')
|
||||
->latest('marketplace_aif_sellers.created_at')->get();
|
||||
$freBuyerForm = MarketplaceFractionalRealEstateSeller::with('seller', 'company')->join('marketplace_buyer_forms', 'marketplace_fre_sellers.id', 'marketplace_buyer_forms.associated_id')->latest('marketplace_fre_sellers.created_at')->get();
|
||||
$opBuyerForm = MarketplaceOtherProductsSeller::with('seller', 'company')->join('marketplace_buyer_forms', 'marketplace_op_sellers.id', 'marketplace_buyer_forms.associated_id')->latest('marketplace_op_sellers.created_at')->get();
|
||||
$companies = Company::active()->pluck('company_name', 'id');
|
||||
return view('Admin.Pages.pre_owned_investment.transactions', compact('aifBuyerForm', 'freBuyerForm', 'opBuyerForm', 'companies'));
|
||||
}
|
||||
|
||||
// public function manage_seller_profile()
|
||||
// {
|
||||
// return view('Admin.Pages.pre_owned_investment.manage_seller_profile');
|
||||
// }
|
||||
|
||||
public function approved_investment_view($id)
|
||||
{
|
||||
$id = $id;
|
||||
return view('Admin.Pages.pre_owned_investment.approved_investment_view', compact('id'));
|
||||
}
|
||||
|
||||
public function replyMail(Request $request)
|
||||
{
|
||||
$validator = Validator::make($request->all(), [
|
||||
'subject' => 'required',
|
||||
'reply' => 'required',
|
||||
], [
|
||||
'required' => "This :attribute field is required",
|
||||
]);
|
||||
|
||||
$validate = validationErrorMessage($validator);
|
||||
if ($validate) {
|
||||
return response()->json(['status' => 400, 'message' => $validate]);
|
||||
}
|
||||
|
||||
$data['subject'] = $request->subject;
|
||||
$data['message'] = $request->reply;
|
||||
$email = $request->email_send;
|
||||
Mail::to($email)->send(new SentBuyerMail($data));
|
||||
|
||||
$sendData = BuyerSentMail::create([
|
||||
'subject' => $request->subject,
|
||||
'content' => $request->reply,
|
||||
'sent_by' => auth()->user()->id,
|
||||
'marketplace_buyer_forms_id' => $request->marketplace_buyer_form_id,
|
||||
]);
|
||||
if ($sendData) {
|
||||
return response()->json(['status' => 200, 'message' => "Mail send Successfully"]);
|
||||
} else {
|
||||
return response()->json(['status' => 201, 'message' => "Mail not send"]);
|
||||
}
|
||||
}
|
||||
|
||||
public function viewReplyMail($id, $return, $table)
|
||||
{
|
||||
$replies = BuyerSentMail::with('users')->where('marketplace_buyer_forms_id', '=', $id)->get();
|
||||
$backRoute = $backRoute = route('interest-buyers', ['id' => $return, 'table' => $table]);
|
||||
return view('Admin.Pages.pre_owned_investment.partial.mails-reply', compact('replies', 'backRoute'));
|
||||
}
|
||||
|
||||
public function updateCompleteTransaction(Request $request)
|
||||
{
|
||||
|
||||
$completedTransactionUpdated = MarketplaceBuyerForm::where('id', $request->buyer_id)->update([
|
||||
'complete_units_sold' => $request->final_units_sold,
|
||||
'complete_sale_value' => $request->final_sale_value,
|
||||
'commission_earned' => $request->commission_earned,
|
||||
'date_of_sale' => $request->date_of_sale,
|
||||
'platform' => $request->platform,
|
||||
'final_purchase_value' => $request->final_purchase_value,
|
||||
]);
|
||||
|
||||
if ($completedTransactionUpdated) {
|
||||
return response()->json(['status' => 200, 'message' => 'Transaction Updated!'], 200);
|
||||
} else {
|
||||
return response()->json(["status" => 400, 'message' => 'Transaction Cannot Be Updated!'], 400);
|
||||
}
|
||||
}
|
||||
}
|
||||
89
app/Http/Controllers/Admin/PermissionController.php
Normal file
89
app/Http/Controllers/Admin/PermissionController.php
Normal file
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Permission;
|
||||
use App\Models\Role;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class PermissionController extends Controller
|
||||
{
|
||||
public function index(){
|
||||
|
||||
|
||||
$permissions= Permission::all();
|
||||
|
||||
|
||||
return view('Admin.permissions.index',compact('permissions'));
|
||||
}
|
||||
|
||||
public function create(){
|
||||
|
||||
|
||||
|
||||
return view('Admin.permissions.create');
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$validated = $request->validate([
|
||||
'name' => ['required', 'string', 'max:255'],
|
||||
|
||||
]);
|
||||
|
||||
$id= Permission::insertGetId([
|
||||
|
||||
'name' => $request->name,
|
||||
'slug'=> Str::slug($request->get('name'), '-'),
|
||||
|
||||
|
||||
]);
|
||||
|
||||
|
||||
$request->session()->flash('message', 'Permission Added successfully');
|
||||
return redirect()->route('admin.permissions')->with('success', 'Permission created successfully.');
|
||||
}
|
||||
|
||||
public function edit(Request $request, $id)
|
||||
{
|
||||
|
||||
|
||||
$permission = Permission::find($id);
|
||||
|
||||
return view('Admin.permissions.edit', compact( 'permission'));
|
||||
}
|
||||
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
|
||||
$data= Permission::find($id);
|
||||
|
||||
|
||||
$request->validate([
|
||||
'name' => ['required', 'string', 'max:255'],
|
||||
|
||||
]);
|
||||
|
||||
|
||||
|
||||
|
||||
$data->name = $request->input("name",$data->name);
|
||||
$data-> slug= Str::slug($request->get('name'), '-');
|
||||
|
||||
|
||||
$data->save();
|
||||
$request->session()->flash('message', 'Permission updated successfully');
|
||||
|
||||
return redirect()->route('admin.permissions')->with('success', ' permissions updated successfully.');
|
||||
}
|
||||
|
||||
|
||||
public function delete(Request $request,$id)
|
||||
{
|
||||
$Project = Permission::where('id',$id)->delete();
|
||||
$request->session()->flash('message', 'Permission Deleted successfully');
|
||||
return redirect()->back()->with(['success' => 'permissions Deleted Successfully.']);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class PreOwnedManageInvestorController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
return view('Admin.Pages.pre_owned_investment.manage_investors');
|
||||
}
|
||||
}
|
||||
103
app/Http/Controllers/Admin/PrincipalGroupsController.php
Normal file
103
app/Http/Controllers/Admin/PrincipalGroupsController.php
Normal file
@@ -0,0 +1,103 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Admin\UserGroup;
|
||||
use App\Models\User;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Admin\PrincipalGroupsLink;
|
||||
|
||||
class PrincipalGroupsController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$checkRole = User::with('manyRoles.roles')->where('id', \Auth::user()->id)->get();
|
||||
$totalRolesAssigned = array();
|
||||
foreach ($checkRole as $data) {
|
||||
foreach ($data->manyRoles as $role) {
|
||||
array_push($totalRolesAssigned, $role->roles->name);
|
||||
}
|
||||
}
|
||||
// echo "<pre>";
|
||||
// print_r($totalRolesAssigned);
|
||||
// die;
|
||||
$principalGroupLinks = PrincipalGroupsLink::has('users')->with('groups')->get();
|
||||
// $principalGroupLinks = PrincipalGroupsLink::with('users')->get();
|
||||
return view('Admin.principal_groups_link.index', compact('principalGroupLinks'));
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
$principals = User::all();
|
||||
$prinipalGroups = UserGroup::all();
|
||||
return view('Admin.principal_groups_link.create', compact('principals', 'prinipalGroups'));
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
|
||||
$validated = $request->validate([
|
||||
'principal_xid' => ['required'],
|
||||
'principal_group_xid' => ['required'],
|
||||
]);
|
||||
|
||||
$addPrincipalGroupsLink = PrincipalGroupsLink::create([
|
||||
'principal_xid' => $request->principal_xid,
|
||||
'principal_group_xid' => $request->principal_group_xid,
|
||||
]);
|
||||
|
||||
if($addPrincipalGroupsLink){
|
||||
return response()->json(['status'=>200,'message'=>'Principal Group Link Added Successfully.']);
|
||||
}else{
|
||||
return response()->json(['status'=>200,'message'=>'Error Creating Principal Group Link.']);
|
||||
}
|
||||
// $request->session()->flash('message', 'Prinicpal Group Link Added successfully');
|
||||
// return redirect()->route('admin.principal_groups_link')->with('success', 'Permission created successfully.');
|
||||
}
|
||||
|
||||
public function edit(Request $request, $id)
|
||||
{
|
||||
|
||||
|
||||
$principalGroupLink = PrincipalGroupsLink::find($id);
|
||||
$principals = User::all();
|
||||
$prinipalGroups = UserGroup::all();
|
||||
|
||||
return view('Admin.principal_groups_link.edit', compact('principalGroupLink', 'principals', 'prinipalGroups'));
|
||||
}
|
||||
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
// $data = PrincipalGroupsLink::find($id);
|
||||
$request->validate([
|
||||
'principal_xid' => ['required'],
|
||||
'principal_group_xid' => ['required'],
|
||||
]);
|
||||
|
||||
// $data->principal_xid = $request->input("principal_xid", $data->principal_xid);
|
||||
// $data->principal_group_xid = $request->input("principal_group_xid", $data->principal_group_xid);
|
||||
// $data->save();
|
||||
|
||||
$updatePrincipalGroupsLink = PrincipalGroupsLink::where('id',$id)->update([
|
||||
'principal_xid' => $request->principal_xid,
|
||||
'principal_group_xid' => $request->principal_group_xid,
|
||||
]);
|
||||
if($updatePrincipalGroupsLink){
|
||||
return response()->json(['status'=>200,'message'=>'Principal Group Link Updated Successfully.']);
|
||||
}else{
|
||||
return response()->json(['status'=>400,'message'=>'Error Updating Principal Group Link.']);
|
||||
}
|
||||
|
||||
// $request->session()->flash('message', 'Prinicpal Group Link updated successfully');
|
||||
// return redirect()->route('admin.principal_groups_link')->with('success', ' Prinicpal Group Link updated successfully.');
|
||||
}
|
||||
|
||||
|
||||
public function delete(Request $request, $id)
|
||||
{
|
||||
$Project = PrincipalGroupsLink::where('id', $id)->delete();
|
||||
$request->session()->flash('message', 'Prinicpal Group Link Deleted successfully');
|
||||
return redirect()->back()->with(['success' => 'Prinicpal Group Link Deleted Successfully.']);
|
||||
}
|
||||
}
|
||||
104
app/Http/Controllers/Admin/PrincipalRoleLinkController.php
Normal file
104
app/Http/Controllers/Admin/PrincipalRoleLinkController.php
Normal file
@@ -0,0 +1,104 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Admin\PrincipalRoleLink;
|
||||
use App\Models\Admin\UserGroup;
|
||||
use App\Models\Role;
|
||||
use App\Models\User;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
|
||||
class PrincipalRoleLinkController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
|
||||
$principalRoleLinks = PrincipalRoleLink::has('users')->with('roles')->get();
|
||||
|
||||
return view('Admin.principal_role_link.index', compact('principalRoleLinks'));
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
|
||||
$principals = User::all();
|
||||
$roles = Role::all();
|
||||
$principalGroups = UserGroup::all();
|
||||
return view('Admin.principal_role_link.create', compact('principals', 'roles', 'principalGroups'));
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$validated = $request->validate([
|
||||
'user_id' => ['required'],
|
||||
'role_id' => ['required'],
|
||||
'principal_group_xid' => ['required'],
|
||||
]);
|
||||
|
||||
$addPrincipalRoleLink = PrincipalRoleLink::create([
|
||||
'user_id' => $request->user_id,
|
||||
'role_id' => $request->role_id,
|
||||
'principal_group_xid' => $request->principal_group_xid
|
||||
]);
|
||||
if($addPrincipalRoleLink){
|
||||
return response()->json(['status'=>200,'message'=>'Principal Role Link Added Succesfully.']);
|
||||
}else{
|
||||
return response()->json(['status'=>400,'message'=>'Error Creating Principal Role Link.']);
|
||||
}
|
||||
|
||||
// $request->session()->flash('message', 'Prinicpal-Role Link Added successfully');
|
||||
// return redirect()->route('admin.principal_role_link')->with('success', 'Prinicpal-Role created successfully.');
|
||||
}
|
||||
|
||||
public function edit(Request $request, $id)
|
||||
{
|
||||
|
||||
|
||||
$principalRoleLink = PrincipalRoleLink::find($id);
|
||||
$principals = User::all();
|
||||
$roles = Role::all();
|
||||
$principalGroups = UserGroup::all();
|
||||
return view('Admin.principal_role_link.edit', compact('principalRoleLink', 'principals', 'roles', 'principalGroups'));
|
||||
}
|
||||
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
$data = PrincipalRoleLink::find($id);
|
||||
|
||||
$request->validate([
|
||||
'user_id' => ['required'],
|
||||
'role_id' => ['required'],
|
||||
'principal_group_xid' => ['required'],
|
||||
]);
|
||||
$updatePrincipalRoleLink = PrincipalRoleLink::where('id',$id)->update([
|
||||
'user_id' => $request->user_id,
|
||||
'role_id' => $request->role_id,
|
||||
'principal_group_xid' => $request->principal_group_xid,
|
||||
]);
|
||||
if($updatePrincipalRoleLink){
|
||||
return response()->json(['status'=>200,'message'=>'Principal Role Link Updated Successfully.']);
|
||||
}else{
|
||||
return response()->json(['status'=>200,'message'=>'Error Updating Principal Role Link.']);
|
||||
}
|
||||
// $data->user_id = $request->input("user_id", $data->user_id);
|
||||
// $data->role_id = $request->input("role_id", $data->role_id);
|
||||
// $data->principal_group_xid = $request->input("principal_group_xid", $data->principal_group_xid);
|
||||
|
||||
|
||||
// $data->save();
|
||||
|
||||
// $request->session()->flash('message', 'Prinicpal-Role Link updated successfully');
|
||||
// return redirect()->route('admin.principal_role_link')->with('success', ' Prinicpal-Role Link updated successfully.');
|
||||
}
|
||||
|
||||
|
||||
public function delete(Request $request, $id)
|
||||
{
|
||||
$Project = PrincipalRoleLink::where('id', $id)->delete();
|
||||
|
||||
$request->session()->flash('message', 'Prinicpal-Role Link Deleted successfully');
|
||||
return redirect()->back()->with(['success' => 'Prinicpal-Role Link Deleted Successfully.']);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Admin\AppResourceAction;
|
||||
use App\Models\Admin\RoleAppResouceActionLink;
|
||||
use App\Models\Role;
|
||||
use Illuminate\Http\Request;
|
||||
use DB;
|
||||
|
||||
class RoleAppResouceActionLinkController extends Controller
|
||||
{
|
||||
//
|
||||
public function index()
|
||||
{
|
||||
|
||||
$rolesAppResources = RoleAppResouceActionLink::with('appResource','appResource.resource','appResource.permission')->get();
|
||||
// $rolesAppResources = DB::table('iam_role_app_resource_action_link')->groupBy('role_xid')->get();
|
||||
// $carteras = DB::table('RoleAppResouceActionLink')
|
||||
// ->join('roles', 'iam_role_app_resource_action_link.role_xid', '=', 'roles.id')
|
||||
// ->join('iam_app_resource_action_link','iam_role_app_resource_action_link.app_resource_action_xid','=','iam_app_resource_action_link.id')
|
||||
// ->distinct()
|
||||
// ->get();
|
||||
|
||||
// $userEmails = DB::table('iam_role_app_resource_action_link')
|
||||
// ->select('app_resource_action_xid',DB::raw('GROUP_CONCAT(role_xid) as roleIds'))
|
||||
// ->groupBy('role_xid',)->distinct('role_xid')
|
||||
// ->get();
|
||||
|
||||
return view('Admin.role_app_resource_action.index', compact('rolesAppResources'));
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
$roles = Role::all();
|
||||
$appResourcesActions = AppResourceAction::with('resource')->with('permission')->get();
|
||||
return view('Admin.role_app_resource_action.create', compact('roles', 'appResourcesActions'));
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$validated = $request->validate([
|
||||
'role_xid' => ['required'],
|
||||
'app_resource_action_xid' => ['required'],
|
||||
|
||||
]);
|
||||
|
||||
$addRoleAppResourceActionLink = RoleAppResouceActionLink::create([
|
||||
'role_xid' => $request->role_xid,
|
||||
'app_resource_action_xid' =>$request->app_resource_action_xid
|
||||
]);
|
||||
if($addRoleAppResourceActionLink){
|
||||
return response()->json(['status'=>200,'message'=>'Role with App Resource Linked Successfully.']);
|
||||
}else{
|
||||
return response()->json(['status'=>200,'message'=>'Error Linking Role with App Resource.']);
|
||||
}
|
||||
|
||||
|
||||
// $request->session()->flash('message', 'Role with App-Resource Action Link Added successfully');
|
||||
// return redirect()->route('admin.role_app_resource_action');
|
||||
}
|
||||
|
||||
public function edit(Request $request, $id)
|
||||
{
|
||||
|
||||
|
||||
$roleAppResource = RoleAppResouceActionLink::find($id);
|
||||
|
||||
$roles = Role::all();
|
||||
$appResourcesActions = AppResourceAction::with('resource')->with('permission')->get();
|
||||
|
||||
return view('Admin.role_app_resource_action.edit', compact('roleAppResource', 'appResourcesActions', 'roles'));
|
||||
}
|
||||
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
// $data = RoleAppResouceActionLink::find($id);
|
||||
$request->validate([
|
||||
'role_xid' => ['required'],
|
||||
|
||||
'app_resource_action_xid' => ['required'],
|
||||
]);
|
||||
|
||||
$updateRoleAppResourceActionLink = RoleAppResouceActionLink::where('id',$id)->update([
|
||||
'role_xid' => $request->role_xid,
|
||||
'app_resource_action_xid' =>$request->app_resource_action_xid
|
||||
]);
|
||||
if($updateRoleAppResourceActionLink){
|
||||
return response()->json(['status'=>200,'message'=>'Role with App Resource Linked Successfully.']);
|
||||
}else{
|
||||
return response()->json(['status'=>200,'message'=>'Error Linking Role with App Resource.']);
|
||||
}
|
||||
|
||||
// $data->role_xid = $request->input("role_xid", $data->role_xid);
|
||||
|
||||
// $data->app_resource_action_xid = $request->input("app_resource_action_xid", $data->app_resource_action_xid);
|
||||
|
||||
|
||||
// $data->save();
|
||||
|
||||
$request->session()->flash('message', 'Role with App-Resource Action Link updated successfully');
|
||||
return redirect()->route('admin.role_app_resource_action')->with('success', ' Role with App-Resource Action Link updated successfully.');
|
||||
}
|
||||
|
||||
|
||||
public function delete(Request $request, $id)
|
||||
{
|
||||
$Project = RoleAppResouceActionLink::where('id', $id)->delete();
|
||||
|
||||
$request->session()->flash('message', 'Role with App-Resource Action Link Deleted successfully');
|
||||
return redirect()->back()->with(['success' => 'Role with App-Resource Action Link Deleted Successfully.']);
|
||||
}
|
||||
}
|
||||
87
app/Http/Controllers/Admin/RoleController.php
Normal file
87
app/Http/Controllers/Admin/RoleController.php
Normal file
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Permission;
|
||||
use App\Models\Role;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class RoleController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$roles = Role::all();
|
||||
return view('Admin.roles.index', compact('roles'));
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
return view('Admin.roles.create');
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$validated = $request->validate([
|
||||
'name' => ['required', 'string', 'max:255'],
|
||||
|
||||
]);
|
||||
$insertRole = Role::create([
|
||||
'name' => $request->name,
|
||||
'slug' => Str::slug($request->get('name'), '-'),
|
||||
]);
|
||||
if ($insertRole) {
|
||||
return response()->json(['status' => 200, 'message' => 'Role Created Successfully.']);
|
||||
} else {
|
||||
return response()->json(['status' => 400, 'message' => 'Error Creating Role.']);
|
||||
}
|
||||
|
||||
// $request->session()->flash('message', 'Role Added successfully');
|
||||
// return redirect()->route('admin.roles')->with('success', 'Role created successfully.');
|
||||
}
|
||||
|
||||
public function edit(Request $request, $id)
|
||||
{
|
||||
|
||||
$role = Role::find($id);
|
||||
|
||||
return view('Admin.roles.edit', compact('role'));
|
||||
}
|
||||
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
|
||||
// $data = Role::find($id);
|
||||
// $request->validate([
|
||||
// 'name' => ['required', 'string', 'max:255'],
|
||||
|
||||
// ]);
|
||||
$updateRole = Role::where('id',$id)->update([
|
||||
'name' => $request->name,
|
||||
'slug' => Str::slug($request->get('name'), '-')
|
||||
]);
|
||||
|
||||
if($updateRole){
|
||||
return response()->json(['status'=>200,'message'=>'Role Updated Successfully']);
|
||||
}else{
|
||||
return response()->json(['status'=>400,'message'=>'Error Updating Role']);
|
||||
}
|
||||
// $data->name = $request->input("name", $data->name);
|
||||
// $data->slug = Str::slug($request->get('name'), '-');
|
||||
|
||||
|
||||
// $data->save();
|
||||
// $request->session()->flash('message', 'Role updated successfully');
|
||||
// return redirect()->route('admin.roles')->with('success', ' Role updated successfully.');
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function delete(Request $request, $id)
|
||||
{
|
||||
$Project = Role::where('id', $id)->delete();
|
||||
$request->session()->flash('message', 'Role Deleted successfully');
|
||||
return redirect()->back()->with(['success' => 'Role Deleted Successfully.']);
|
||||
}
|
||||
}
|
||||
58
app/Http/Controllers/Admin/UserController.php
Normal file
58
app/Http/Controllers/Admin/UserController.php
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Models\User;
|
||||
use App\Traits\HttpResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\StoreAdminRequest;
|
||||
use App\Http\Requests\UpdateAdminRequest;
|
||||
use App\Services\Admin\ManageSubAdminService;
|
||||
|
||||
class UserController extends Controller
|
||||
{
|
||||
use HttpResponse;
|
||||
|
||||
protected $admin;
|
||||
|
||||
public function __construct(ManageSubAdminService $admin)
|
||||
{
|
||||
$this->admin = $admin;
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$user = User::admins()->get();
|
||||
return view('Admin.user.index', compact('user'));
|
||||
}
|
||||
|
||||
public function addUser(StoreAdminRequest $request)
|
||||
{
|
||||
// dd($request->validated()[0]['email']);
|
||||
$adminCreated = $this->admin->store($request);
|
||||
$this->admin->sendMail($request);
|
||||
return $adminCreated ?
|
||||
$this->response('User Added!', 200) :
|
||||
$this->response('User Cannot Be Created', 400);
|
||||
}
|
||||
|
||||
public function getUser(Request $request)
|
||||
{
|
||||
return response()->json(['status' => 200, 'user' => $this->admin->view($request->id)]);
|
||||
}
|
||||
|
||||
public function updateUser(UpdateAdminRequest $request)
|
||||
{
|
||||
$adminUpdated = $this->admin->update($request);
|
||||
return $adminUpdated ?
|
||||
$this->response('User Updated!', 200) :
|
||||
$this->response('User Cannot Be Updated', 400);
|
||||
}
|
||||
|
||||
public function deleteUser(Request $request)
|
||||
{
|
||||
$delete = $this->admin->delete($request->id);
|
||||
return response()->json(['status' => 200, 'message' => 'User Deleted!']);
|
||||
}
|
||||
}
|
||||
97
app/Http/Controllers/Admin/UserGroupController.php
Normal file
97
app/Http/Controllers/Admin/UserGroupController.php
Normal file
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Admin\UserGroup;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class UserGroupController extends Controller
|
||||
{
|
||||
//
|
||||
public function index()
|
||||
{
|
||||
|
||||
|
||||
$userGroups = UserGroup::all();
|
||||
|
||||
|
||||
return view('Admin.user_groups.index', compact('userGroups'));
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
|
||||
|
||||
|
||||
return view('Admin.user_groups.create');
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$validated = $request->validate([
|
||||
'name' => ['required', 'string', 'max:255'],
|
||||
|
||||
]);
|
||||
|
||||
$addUserGroup = UserGroup::create([
|
||||
'name' => $request->name,
|
||||
'slug' => Str::slug($request->get('name'), '-'),
|
||||
]);
|
||||
if ($addUserGroup) {
|
||||
return response()->json(['status' => 200, 'message' => 'Principal Group Created Successfully.']);
|
||||
} else {
|
||||
return response()->json(['status' => 400, 'message' => 'Error Creating Principal Group.']);
|
||||
}
|
||||
|
||||
|
||||
// $request->session()->flash('message', 'User Group Added successfully');
|
||||
// return redirect()->route('admin.user_groups')->with('success', 'User Group created successfully.');
|
||||
}
|
||||
|
||||
public function edit(Request $request, $id)
|
||||
{
|
||||
|
||||
|
||||
$userGroup = UserGroup::find($id);
|
||||
|
||||
return view('Admin.user_groups.edit', compact('userGroup'));
|
||||
}
|
||||
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
|
||||
// $data = UserGroup::find($id);
|
||||
$request->validate([
|
||||
'name' => ['required', 'string', 'max:255'],
|
||||
|
||||
]);
|
||||
|
||||
$updateUserGroup = UserGroup::where('id',$id)->update([
|
||||
'name' => $request->name,
|
||||
'slug' => Str::slug($request->get('name'), '-')
|
||||
]);
|
||||
if($updateUserGroup){
|
||||
return response()->json(['status'=>200,'message'=>'Principal Group Updated Successfully.']);
|
||||
}else{
|
||||
return response()->json(['status'=>400,'message'=>'Error Updating Principal Group.']);
|
||||
}
|
||||
// $data->name = $request->input("name", $data->name);
|
||||
// $data->slug = Str::slug($request->get('name'), '-');
|
||||
|
||||
// $data->save();
|
||||
// $request->session()->flash('message', 'User Group updated successfully');
|
||||
|
||||
// return redirect()->route('admin.user_groups')->with('success', ' User Group updated successfully.');
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function delete(Request $request, $id)
|
||||
{
|
||||
$Project = UserGroup::where('id', $id)->delete();
|
||||
$request->session()->flash('message', 'Principal Group Deleted successfully');
|
||||
return redirect()->back()->with(['success' => 'Principal Group Deleted Successfully.']);
|
||||
}
|
||||
}
|
||||
962
app/Http/Controllers/AuthController.php
Normal file
962
app/Http/Controllers/AuthController.php
Normal file
@@ -0,0 +1,962 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Mail;
|
||||
use App\Mail\OtpMail;
|
||||
use App\Mail\RegisteredMail;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\UserOtp;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Session;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use App\Models\User;
|
||||
use App\Models\user_profile;
|
||||
use App\Notifications\UserAdmin;
|
||||
use Laravel\Sanctum\PersonalAccessToken;
|
||||
use App\Services\AuthService;
|
||||
use Carbon\Carbon;
|
||||
use App\Http\Requests\StoreAssetManagerRegistrationRequest;
|
||||
|
||||
|
||||
class AuthController extends Controller
|
||||
{
|
||||
|
||||
//validate fields
|
||||
|
||||
protected $authService;
|
||||
protected $data;
|
||||
|
||||
public function __construct(AuthService $authService)
|
||||
{
|
||||
$this->authService = $authService;
|
||||
}
|
||||
|
||||
public function registernumber(Request $request)
|
||||
{
|
||||
$this->data = $this->authService->registernumber($request);
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
public function register(Request $request)
|
||||
{
|
||||
try {
|
||||
$this->data = $this->authService->userRegistration($request);
|
||||
return $this->data;
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['message' => $e->getMessage()], 500);
|
||||
}
|
||||
}
|
||||
|
||||
public function user_pin(Request $request)
|
||||
{
|
||||
try {
|
||||
$this->data = $this->authService->user_pin($request);
|
||||
return $this->data;
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['message' => $e->getMessage()], 500);
|
||||
}
|
||||
}
|
||||
|
||||
public function postFingerPrintStatus(Request $request)
|
||||
{
|
||||
try {
|
||||
$this->data = $this->authService->postFingerPrintStatus($request);
|
||||
return $this->data;
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['message' => $e->getMessage()], 500);
|
||||
}
|
||||
}
|
||||
|
||||
public function getFingerPrintStatus(Request $request)
|
||||
{
|
||||
try {
|
||||
$this->data = $this->authService->getFingerPrintStatus($request);
|
||||
return $this->data;
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['message' => $e->getMessage()], 201);
|
||||
}
|
||||
}
|
||||
|
||||
public function resetPassword(Request $request)
|
||||
{
|
||||
try {
|
||||
$this->data = $this->authService->resetPassword($request);
|
||||
return $this->data;
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['message' => $e->getMessage()], 201);
|
||||
}
|
||||
}
|
||||
|
||||
public function mobileExists(Request $request)
|
||||
{
|
||||
try {
|
||||
$this->data = $this->authService->mobileExists($request);
|
||||
return $this->data;
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['message' => $e->getMessage()], 201);
|
||||
}
|
||||
}
|
||||
|
||||
// get user details
|
||||
public function user()
|
||||
{
|
||||
try {
|
||||
$this->data = $this->authService->user();
|
||||
return $this->data;
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['message' => $e->getMessage()], 500);
|
||||
}
|
||||
}
|
||||
|
||||
// logout user
|
||||
public function logout(Request $request)
|
||||
{
|
||||
|
||||
try {
|
||||
$this->data = $this->authService->logout($request);
|
||||
return $this->data;
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['message' => $e->getMessage()], 500);
|
||||
}
|
||||
}
|
||||
|
||||
public function sendsms(Request $request)
|
||||
{
|
||||
|
||||
try {
|
||||
$this->data = $this->authService->sendsms($request);
|
||||
return $this->data;
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['message' => $e->getMessage()], 500);
|
||||
}
|
||||
}
|
||||
|
||||
public function isverified()
|
||||
{
|
||||
|
||||
try {
|
||||
$this->data = $this->authService->isverified();
|
||||
return $this->data;
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['message' => $e->getMessage()], 500);
|
||||
}
|
||||
}
|
||||
|
||||
public function isotpverified()
|
||||
{
|
||||
|
||||
try {
|
||||
$this->data = $this->authService->isotpverified();
|
||||
return $this->data;
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['message' => $e->getMessage()], 500);
|
||||
}
|
||||
}
|
||||
|
||||
public function isecurityquestion()
|
||||
{
|
||||
|
||||
try {
|
||||
$this->data = $this->authService->isecurityquestion();
|
||||
return $this->data;
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['message' => $e->getMessage()], 500);
|
||||
}
|
||||
}
|
||||
|
||||
public function verifyotp(Request $request)
|
||||
{
|
||||
|
||||
try {
|
||||
$this->data = $this->authService->verifyotp($request);
|
||||
return $this->data;
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['message' => $e->getMessage()], 500);
|
||||
}
|
||||
}
|
||||
|
||||
public function verifyotpWithoutToken(Request $request)
|
||||
{
|
||||
|
||||
try {
|
||||
$this->data = $this->authService->verifyotpWithoutToken($request);
|
||||
return $this->data;
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['message' => $e->getMessage()], 500);
|
||||
}
|
||||
}
|
||||
|
||||
public function securityQuestions()
|
||||
{
|
||||
|
||||
|
||||
try {
|
||||
$this->data = $this->authService->getSecurityQuestions();
|
||||
return $this->data;
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['message' => $e->getMessage()], 500);
|
||||
}
|
||||
}
|
||||
|
||||
public function security_answers(Request $request)
|
||||
{
|
||||
|
||||
|
||||
try {
|
||||
$this->data = $this->authService->security_answers($request);
|
||||
return $this->data;
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['message' => $e->getMessage()], 500);
|
||||
}
|
||||
}
|
||||
|
||||
public function check_pin_exist(Request $request)
|
||||
{
|
||||
|
||||
|
||||
try {
|
||||
$this->data = $this->authService->check_pin_exist($request);
|
||||
return $this->data;
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['message' => $e->getMessage()], 500);
|
||||
}
|
||||
}
|
||||
|
||||
public function pin_match(Request $request)
|
||||
{
|
||||
|
||||
try {
|
||||
$this->data = $this->authService->pin_match($request);
|
||||
return $this->data;
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['message' => $e->getMessage()], 500);
|
||||
}
|
||||
}
|
||||
|
||||
public function UserForgotPasswordPin(Request $request)
|
||||
{
|
||||
|
||||
try {
|
||||
$this->data = $this->authService->userforgotpasswordpin($request);
|
||||
return $this->data;
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['message' => $e->getMessage()], 500);
|
||||
}
|
||||
}
|
||||
|
||||
public function resetPin(Request $request)
|
||||
{
|
||||
|
||||
try {
|
||||
$this->data = $this->authService->resetPin($request);
|
||||
return $this->data;
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['message' => $e->getMessage()], 500);
|
||||
}
|
||||
}
|
||||
|
||||
public function login(Request $request)
|
||||
{
|
||||
|
||||
try {
|
||||
$this->data = $this->authService->login($request);
|
||||
return $this->data;
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['message' => $e->getMessage()], 500);
|
||||
}
|
||||
}
|
||||
|
||||
public function createorder(Request $request)
|
||||
{
|
||||
|
||||
try {
|
||||
$this->data = $this->authService->createorder($request);
|
||||
return $this->data;
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['message' => $e->getMessage()], 500);
|
||||
}
|
||||
}
|
||||
|
||||
public function storeKycDetails(Request $request)
|
||||
{
|
||||
|
||||
try {
|
||||
$this->data = $this->authService->storeKycDetails($request);
|
||||
return $this->data;
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['message' => $e->getMessage()], 500);
|
||||
}
|
||||
}
|
||||
|
||||
public function storeBasicKycUserDetails(Request $request)
|
||||
{
|
||||
|
||||
try {
|
||||
$this->data = $this->authService->storeBasicKycUserDetails($request);
|
||||
return $this->data;
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['message' => $e->getMessage()], 500);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function fetchKYCstatus(Request $request)
|
||||
{
|
||||
|
||||
try {
|
||||
$this->data = $this->authService->fetchKYCstatus($request);
|
||||
return $this->data;
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['message' => $e->getMessage()], 500);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function storeFamilyDetails(Request $request)
|
||||
{
|
||||
|
||||
try {
|
||||
$this->data = $this->authService->storeFamilyDetails($request);
|
||||
return $this->data;
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['message' => $e->getMessage()], 500);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function getFamilyDetails(Request $request)
|
||||
{
|
||||
|
||||
try {
|
||||
$this->data = $this->authService->getFamilyDetails($request);
|
||||
return $this->data;
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['message' => $e->getMessage()], 500);
|
||||
}
|
||||
}
|
||||
|
||||
public function storePersonalProfileDetails(Request $request)
|
||||
{
|
||||
|
||||
try {
|
||||
$this->data = $this->authService->storePersonalProfileDetails($request);
|
||||
return $this->data;
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['message' => $e->getMessage()], 500);
|
||||
}
|
||||
}
|
||||
public function storeBankDetails(Request $request)
|
||||
{
|
||||
|
||||
try {
|
||||
$this->data = $this->authService->storeBankDetails($request);
|
||||
return $this->data;
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['message' => $e->getMessage()], 500);
|
||||
}
|
||||
}
|
||||
public function storeGoals(Request $request)
|
||||
{
|
||||
|
||||
try {
|
||||
$this->data = $this->authService->storeGoals($request);
|
||||
return $this->data;
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['message' => $e->getMessage()], 500);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function getBasicKycUserDetails()
|
||||
{
|
||||
|
||||
try {
|
||||
$this->data = $this->authService->getBasicKycUserDetails();
|
||||
return $this->data;
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['message' => $e->getMessage()], 500);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function password_reset(Request $request)
|
||||
{
|
||||
|
||||
try {
|
||||
$this->data = $this->authService->password_reset($request);
|
||||
return $this->data;
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['message' => $e->getMessage()], 500);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function getPersonalProfileDetails()
|
||||
{
|
||||
|
||||
try {
|
||||
$this->data = $this->authService->getPersonalProfileDetails();
|
||||
return $this->data;
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['message' => $e->getMessage()], 500);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function getBankDetails()
|
||||
{
|
||||
|
||||
try {
|
||||
$this->data = $this->authService->getBankDetails();
|
||||
return $this->data;
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['message' => $e->getMessage()], 500);
|
||||
}
|
||||
}
|
||||
public function payment_verification(Request $request)
|
||||
{
|
||||
|
||||
try {
|
||||
$this->data = $this->authService->payment_verification($request);
|
||||
return $this->data;
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['message' => $e->getMessage()], 500);
|
||||
}
|
||||
}
|
||||
|
||||
public function createPlans(Request $request)
|
||||
{
|
||||
|
||||
try {
|
||||
$this->data = $this->authService->createPlans($request);
|
||||
return $this->data;
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['message' => $e->getMessage()], 500);
|
||||
}
|
||||
}
|
||||
|
||||
public function storeSubscriptionPlan(Request $request)
|
||||
{
|
||||
|
||||
try {
|
||||
$this->data = $this->authService->storeSubscriptionPlan($request);
|
||||
return $this->data;
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['message' => $e->getMessage()], 500);
|
||||
}
|
||||
}
|
||||
|
||||
public function signUp(Request $request)
|
||||
{
|
||||
$validator = Validator::make($request->all(), [
|
||||
'name' => [
|
||||
'required',
|
||||
'regex:/^[a-zA-Z\s]+$/',
|
||||
],
|
||||
'email' => [
|
||||
'required',
|
||||
'unique:users',
|
||||
'regex:/^([a-z0-9_\.-]+)@([\da-z\.-]+)\.([a-z\.]{2,6})$/',
|
||||
],
|
||||
'password' => [
|
||||
'required',
|
||||
'min:8',
|
||||
'regex:/^.*(?=.{3,})(?=.*[a-zA-Z])(?=.*[0-9])(?=.*[\d\x])(?=.*[!$#%@]).*$/',
|
||||
'confirmed',
|
||||
],
|
||||
'contact_number' => [
|
||||
'required',
|
||||
'unique:users',
|
||||
'min:10',
|
||||
'max:12',
|
||||
'regex:/^(\+\d{1,3}[- ]?)?\d{10,12}$/',
|
||||
],
|
||||
'g-recaptcha-response' => 'sometimes|required'
|
||||
], [
|
||||
'contact_number.min' => 'Contact Number should be minimum 10 numbers',
|
||||
'contact_number.max' => 'Contact Number should be maximum 12 numbers',
|
||||
'contact_number.regex' => "Mobile number should be number not alphabets",
|
||||
'password.regex' => 'Password does not follow regex',
|
||||
'password.min' => 'Password should be minimum 8 characters',
|
||||
'password.confirmed' => 'Password Confirmation Does Not Match Password',
|
||||
'unique' => 'The :attribute field should be unique.',
|
||||
'required' => 'The :attribute field is required.',
|
||||
'name.regex' => 'The :attribute field contain only alphabets',
|
||||
]);
|
||||
|
||||
$validationMessage = $this->validationError($validator);
|
||||
if ($validationMessage) {
|
||||
return response()->json(['status' => 400, 'message' => $validationMessage], 400);
|
||||
}
|
||||
|
||||
// dd($request->all());
|
||||
|
||||
if (!$request->has('g-recaptcha-response')) {
|
||||
$userCreated = User::create([
|
||||
'name' => $request->name,
|
||||
'email' => $request->email,
|
||||
'contact_number' => $request->contact_number,
|
||||
'password' => bcrypt($request->password),
|
||||
'user_type' => 'Investor',
|
||||
]);
|
||||
if (!$userCreated) {
|
||||
return response()->json(['status' => 400, 'message' => 'Error creating user!'])->setStatusCode(400);
|
||||
}else{
|
||||
$user = User::where('email',$request->email)->first();
|
||||
$userToken = $user->createToken('apiToken')->plainTextToken;
|
||||
return response()->json(['status' => 200, 'message' => 'User Created','token' => $userToken,'data' => $user]);
|
||||
}
|
||||
} else {
|
||||
Session::forget('user-registration');
|
||||
$otp = $this->otpGenerate($request->email);
|
||||
$userRegistration = [
|
||||
'name' => $request->name,
|
||||
'user_type' => 'Investor',
|
||||
'authorized_representative_name' => $request->authorized_representative_name ?? null,
|
||||
'email' => $request->email,
|
||||
'password' => bcrypt($request->password),
|
||||
'contact_number' => $request->contact_number,
|
||||
'otp' => $otp
|
||||
];
|
||||
$userCreated = Session::put('user-registration', $userRegistration);
|
||||
$mailData = [
|
||||
'title' => 'Mail from ItSolutionStuff.com',
|
||||
'body' => 'This is for testing email using smtp.'
|
||||
];
|
||||
Mail::to($request->email)->send(new OtpMail($mailData, $otp));
|
||||
}
|
||||
// $name = $request->name;
|
||||
// $email = $request->email;
|
||||
// $password = $request->password;
|
||||
// $number = $request->contact_number;
|
||||
// $userCreated = User::create([
|
||||
// 'name' => $name,
|
||||
// 'email' => $email,
|
||||
// 'contact_number' => $number,
|
||||
// 'password' => bcrypt($password),
|
||||
// ]);
|
||||
|
||||
// if (!$userCreated) {
|
||||
// return response()->json(['status' => 400, 'message' => 'Error creating user!'], 400);
|
||||
// }
|
||||
// $token = $userCreated->createToken('apiToken')->plainTextToken;
|
||||
return response()->json(['status' => 200, 'message' => 'User Created']);
|
||||
}
|
||||
|
||||
public function signUp2(StoreAssetManagerRegistrationRequest $request)
|
||||
{
|
||||
$validated = $request->validated();
|
||||
if (!$request->has('g-recaptcha-response')) {
|
||||
$userCreated = User::create([
|
||||
'name' => $validated['name2'],
|
||||
'user_type' => 'Asset Manager',
|
||||
'authorized_representative_name' => $validated['authorized_representative_name'],
|
||||
'email' => $validated['email2'],
|
||||
'contact_number' => $validated['contact_number2'],
|
||||
'password' => bcrypt($validated['password2']),
|
||||
]);
|
||||
if (!$userCreated) {
|
||||
return response()->json(['status' => 400, 'message' => 'Error creating user!'])->setStatusCode(400);
|
||||
}else{
|
||||
$user = User::where('email',$request->email2)->first();
|
||||
$userToken = $user->createToken('apiToken')->plainTextToken;
|
||||
return response()->json(['status' => 200, 'message' => 'User Created','token' => $userToken,'data' => $user]);
|
||||
}
|
||||
} else {
|
||||
Session::forget('user-registration');
|
||||
$otp = $this->otpGenerate($request->email);
|
||||
$userRegistration = [
|
||||
'name' => $validated['name2'],
|
||||
'user_type' => 'Asset Manager',
|
||||
'authorized_representative_name' => $validated['authorized_representative_name'],
|
||||
'email' => $validated['email2'],
|
||||
'contact_number' => $validated['contact_number2'],
|
||||
'password' => bcrypt($validated['password2']),
|
||||
'otp' => $otp
|
||||
];
|
||||
$userCreated = Session::put('user-registration', $userRegistration);
|
||||
$mailData = [
|
||||
'title' => 'Mail from ItSolutionStuff.com',
|
||||
'body' => 'This is for testing email using smtp.'
|
||||
];
|
||||
Mail::to($validated['email2'])->send(new OtpMail($mailData, $otp));
|
||||
// Mail::to('yadavritikesh29@gmail.com')->send(new OtpMail($mailData, $otp));
|
||||
}
|
||||
// $name = $request->name;
|
||||
// $email = $request->email;
|
||||
// $password = $request->password;
|
||||
// $number = $request->contact_number;
|
||||
// $userCreated = User::create([
|
||||
// 'name' => $name,
|
||||
// 'email' => $email,
|
||||
// 'contact_number' => $number,
|
||||
// 'password' => bcrypt($password),
|
||||
// ]);
|
||||
|
||||
// if (!$userCreated) {
|
||||
// return response()->json(['status' => 400, 'message' => 'Error creating user!'], 400);
|
||||
// }
|
||||
// $token = $userCreated->createToken('apiToken')->plainTextToken;
|
||||
return response()->json(['status' => 200, 'message' => 'User Created']);
|
||||
}
|
||||
|
||||
public function getUser(Request $request)
|
||||
{
|
||||
try {
|
||||
// $hashedTooken = $request->bearerToken();
|
||||
// $token = PersonalAccessToken::findToken($hashedTooken);
|
||||
// if (!$hashedTooken) {
|
||||
// return response()->json(['status' => 200, 'message' => 'No User Found!'], 200);
|
||||
// }
|
||||
// $user = User::find(auth()->user()->id);
|
||||
$user = $request->user();
|
||||
// if (!$user) {
|
||||
// return response()->json(['status' => 400, 'message' => 'Error finding user!']);
|
||||
// }
|
||||
return response()->json(['status' => 200, 'user' => $user], 200);
|
||||
} catch (\Exception $ex) {
|
||||
return response()->json(['status' => 500, 'exception' => $ex, 500]);
|
||||
}
|
||||
// return response()->json(['status'=>200,'user'=>$token->tokenab le]);
|
||||
}
|
||||
|
||||
public function userLogin(Request $request)
|
||||
{
|
||||
$validator = Validator::make($request->all(), [
|
||||
'user' => 'required',
|
||||
'password' => [
|
||||
'required',
|
||||
// 'min:8',
|
||||
// 'regex:/^.*(?=.{3,})(?=.*[a-zA-Z])(?=.*[0-9])(?=.*[\d\x])(?=.*[!$#%@]).*$/'
|
||||
],
|
||||
]);
|
||||
|
||||
// if ($validator->fails()) {
|
||||
// $errors = $validator->errors();
|
||||
// return response()->json([
|
||||
// 'error' => $errors
|
||||
// ], 400);
|
||||
// }
|
||||
$validationMessage = $this->validationError($validator);
|
||||
if ($validationMessage) {
|
||||
return response()->json(['status' => 400, 'message' => $validationMessage], 400);
|
||||
}
|
||||
$credentials = $request->user;
|
||||
$password = $request->password;
|
||||
$user = User::where('email', $credentials)->orWhere('contact_number', $credentials)->first();
|
||||
if (!$user) {
|
||||
return response()->json(['status' => 500, 'message' => 'No User Found'], 500);
|
||||
}
|
||||
if (!\Hash::check($password, $user->password)) {
|
||||
return response()->json(['status' => 400, 'message' => 'Invalid Credentials!'], 400);
|
||||
};
|
||||
// $hashedTooken = $request->bearerToken();
|
||||
$userToken = $user->createToken('apiToken')->plainTextToken;
|
||||
$token = PersonalAccessToken::findToken($userToken);
|
||||
if (!$token) {
|
||||
return response()->json(['status' => 500, 'message' => 'Inaccurate Token'], 500);
|
||||
}
|
||||
return response()->json(['status' => 200, 'message' => 'User Found', 'token' => $userToken, 'data' => $token->tokenable], 200);
|
||||
}
|
||||
|
||||
public function sendOTP(Request $request)
|
||||
{
|
||||
$validator = Validator::make($request->post(), [
|
||||
'contact_number' => 'required|exists:users,contact_number|min:10|max:10',
|
||||
], [
|
||||
'required' => 'The :attribute field is required',
|
||||
'exists' => 'Contact Number has not been registered.',
|
||||
'min' => 'The :attribute field must be 10 digits',
|
||||
'max' => 'The :attribute field must be 10 digits',
|
||||
]);
|
||||
$validationMessage = $this->validationError($validator);
|
||||
if ($validationMessage) {
|
||||
return response()->json(['status' => 400, 'message' => $validationMessage], 400);
|
||||
}
|
||||
$contactNumber = $request->contact_number;
|
||||
$otp = rand(1000, 9999);
|
||||
session()->put('contact_number', $contactNumber);
|
||||
$sendOTP = $this->thirdPartyOTP($contactNumber, $otp);
|
||||
// $insertOtp = UserOtp::create([
|
||||
// 'contact_number' => $contactNumber,
|
||||
// 'expire_at' => Carbon::now()->addMinutes('5'),
|
||||
// 'otp' => $otp
|
||||
// ]);
|
||||
$insertOtp = User::where('contact_number', $contactNumber)->update([
|
||||
'expire_at' => Carbon::now()->addMinutes('5'),
|
||||
'otp' => $otp
|
||||
]);
|
||||
if (!$insertOtp) {
|
||||
return response()->json(['status' => 500, 'otp' => $otp, 'message' => 'Error inserting OTP'], 500);
|
||||
}
|
||||
return response()->json(['status' => 200, 'otp' => $otp, 'message' => 'OTP has been sent successfully!']);
|
||||
}
|
||||
|
||||
public function enteredOtp(Request $request)
|
||||
{
|
||||
// dd(Session::get('user-registration'));
|
||||
$validator = Validator::make($request->post(), [
|
||||
'otp' => 'required|min:4|max:4',
|
||||
// 'contact_number' => 'required|exists:users,contact_number|min:10|max:10'
|
||||
], [
|
||||
'required' => 'The :attribute field is required',
|
||||
'exists' => 'Contact Number has not been registered.',
|
||||
'min' => 'The :attribute field must be 10 digits',
|
||||
'max' => 'The :attribute field must be 10 digits',
|
||||
]);
|
||||
$validationMessage = $this->validationError($validator);
|
||||
if ($validationMessage) {
|
||||
return response()->json(['status' => 400, 'message' => $validationMessage], 400);
|
||||
}
|
||||
|
||||
$otp = (int)$request->otp;
|
||||
if (Session::has('user-registration')) {
|
||||
$userDetails = Session::get('user-registration');
|
||||
if ($userDetails['otp'] !== $otp) {
|
||||
return response()->json(['status' => 400, 'message' => 'OTP Did Not Matched!']);
|
||||
}
|
||||
$userCreated = User::create([
|
||||
'name' => $userDetails['name'],
|
||||
'authorized_representative_name' => $userDetails['authorized_representative_name'] ?? null,
|
||||
'user_type' => $userDetails['user_type'],
|
||||
'email' => $userDetails['email'],
|
||||
'contact_number' => $userDetails['contact_number'],
|
||||
'password' => $userDetails['password'],
|
||||
]);
|
||||
Mail::to($userDetails['email'])->send(new RegisteredMail());
|
||||
Session::forget('user-registration');
|
||||
|
||||
//sending notifications
|
||||
$name = $userDetails['name'];
|
||||
$notify['message'] = "$name has registered to Jericho Alternatives Website and App!";
|
||||
$type = "New Users";
|
||||
$users = User::admins()->get();
|
||||
foreach ($users as $data) {
|
||||
$data->notify(new UserAdmin($notify, $type));
|
||||
}
|
||||
|
||||
Auth::guard('users')->login($userCreated);
|
||||
return response()->json(['status' => 200, 'message' => 'OTP has been matched and User has been created!'], 200);
|
||||
}
|
||||
|
||||
$checkOTP = User::where(['contact_number' => $request->contact_number, 'otp' => $request->otp])->first();
|
||||
if ($checkOTP) {
|
||||
if (!$checkOTP) {
|
||||
return response()->json(['status' => 400, 'message' => 'OTP Did Not Matched!'], 400);
|
||||
}
|
||||
if (now() > $checkOTP->expire_at) {
|
||||
return response()->json(['status' => 400, 'message' => 'OTP has been expired!'], 400);
|
||||
}
|
||||
$userToken = $checkOTP->createToken('apiToken')->plainTextToken;
|
||||
$token = PersonalAccessToken::findToken($userToken);
|
||||
return response()->json(['status' => 200, 'token' => $userToken, 'data' => $token->tokenable, 'message' => 'OTP has been matched!'], 200);
|
||||
} else {
|
||||
return response()->json(['status' => 400, 'message' => 'Record Does Not Exist!'], 400);
|
||||
}
|
||||
|
||||
|
||||
|
||||
$contactNumber = session('contact_number');
|
||||
if (!$contactNumber) {
|
||||
return response()->json(['status' => 201, 'message' => 'Contact number not found!'], 201);
|
||||
}
|
||||
$otp = $request->otp;
|
||||
|
||||
|
||||
$checkNumberWithOtp = UserOtp::where(['contact_number' => $contactNumber, 'otp' => $otp])->first();
|
||||
if (!$checkNumberWithOtp) {
|
||||
return response()->json(['status' => 400, 'message' => 'OTP Did Not Matched!'], 400);
|
||||
}
|
||||
if (now() > $checkNumberWithOtp->expire_at) {
|
||||
return response()->json(['status' => 400, 'message' => 'OTP has been expired!'], 400);
|
||||
}
|
||||
$contactNumberSession = Session::get('contact_number');
|
||||
$user = User::where('contact_number', $contactNumberSession)->first();
|
||||
$userToken = $user->createToken('apiToken')->plainTextToken;
|
||||
$token = PersonalAccessToken::findToken($userToken);
|
||||
return response()->json(['status' => 200, 'token' => $userToken, 'data' => $token->tokenable, 'message' => 'OTP has been matched!'], 200);
|
||||
}
|
||||
|
||||
public function loginByMobile(Request $request)
|
||||
{
|
||||
// validating data
|
||||
$validator = Validator::make($request->all(), [
|
||||
'contact_number' => 'required|exists:users,contact_number',
|
||||
]);
|
||||
|
||||
// validation fail handling
|
||||
if ($validator->fails()) {
|
||||
return response()->json(['error' => 'Mobile number is not registered', 'status' => 204]);
|
||||
}
|
||||
|
||||
$user = User::where('contact_number', $request->contact_number)->first();
|
||||
|
||||
|
||||
|
||||
try {
|
||||
if ($user) {
|
||||
$user->otp = rand(1234, 9999);
|
||||
$user->expire_at = Carbon::now('Asia/colombo')->addMinutes(2);
|
||||
$user->update();
|
||||
return response()->json(['message' => 'OTP has been sent to your mail and phone', 'user_id' => $user->id, 'otp' => $user->otp, 'status' => 200]);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['error' => 'Netwrok Error! Please try again after sometime.', 'status' => 500]);
|
||||
}
|
||||
}
|
||||
|
||||
public function userLogout(Request $request)
|
||||
{
|
||||
try {
|
||||
$userLoggedOut = $request->user()->currentAccessToken()->delete();
|
||||
return response()->json(['status' => 200, 'message' => 'User Logged Out!!'], 200);
|
||||
} catch (\Exception $ex) {
|
||||
return response()->json(['status' => 500, 'message' => $ex]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function validationError($validator)
|
||||
{
|
||||
if ($validator->fails()) {
|
||||
$errors = $validator->errors();
|
||||
$messages = "";
|
||||
foreach ($errors->all() as $message) {
|
||||
$messages .= $message;
|
||||
}
|
||||
return $messages;
|
||||
}
|
||||
}
|
||||
|
||||
public function otpGenerate($email)
|
||||
{
|
||||
$otp = rand(1000, 9999);
|
||||
return $otp;
|
||||
}
|
||||
|
||||
public function forgotPasswordStepOne(Request $request)
|
||||
{
|
||||
$validator = Validator::make($request->all(), [
|
||||
'contact_number' => 'required|exists:users,contact_number',
|
||||
], [
|
||||
'contact_number.exists' => 'Please Enter Registered Number',
|
||||
]);
|
||||
|
||||
$validationMessage = $this->validationError($validator);
|
||||
if ($validationMessage) {
|
||||
return response()->json(['status' => 400, 'message' => $validationMessage], 400);
|
||||
}
|
||||
|
||||
$otp = rand(1000, 9999);
|
||||
$sendOTP = $this->thirdPartyOTP($request->contact_number, $otp);
|
||||
$insertOtp = User::where('contact_number', $request->contact_number)->update([
|
||||
'expire_at' => Carbon::now()->addMinutes('5'),
|
||||
'otp' => $otp
|
||||
]);
|
||||
|
||||
if ($insertOtp) {
|
||||
return response()->json(['message' => 'OTP Sent Succesfully', 'otp' => $otp,'status' => 200]);
|
||||
}
|
||||
return response()->json(['message' => 'Error Sending OTP', 'status' => 400]);
|
||||
}
|
||||
|
||||
public function forgotPasswordStepTwo(Request $request)
|
||||
{
|
||||
$validator = Validator::make($request->all(), [
|
||||
'contact_number' => 'required|exists:users,contact_number',
|
||||
'otp' => 'required',
|
||||
]);
|
||||
|
||||
$validationMessage = $this->validationError($validator);
|
||||
if ($validationMessage) {
|
||||
return response()->json(['status' => 400, 'message' => $validationMessage], 400);
|
||||
}
|
||||
|
||||
$checkOTP = User::where(['contact_number' => $request->contact_number, 'otp' => $request->otp])->first();
|
||||
if ($checkOTP) {
|
||||
if (!$checkOTP) {
|
||||
return response()->json(['status' => 400, 'message' => 'OTP Did Not Matched!'], 400);
|
||||
}
|
||||
if (now() > $checkOTP->expire_at) {
|
||||
return response()->json(['status' => 400, 'message' => 'OTP has been expired!'], 400);
|
||||
}
|
||||
return response()->json(['status' => 200, 'message' => 'OTP has been matched!'], 200);
|
||||
}
|
||||
return response()->json(['message' => 'OTP Not Matched', 'status' => 400],400);
|
||||
}
|
||||
|
||||
public function forgotPasswordStepThree(Request $request)
|
||||
{
|
||||
$validator = Validator::make($request->all(), [
|
||||
'contact_number' => 'required|exists:users,contact_number',
|
||||
'password' => [
|
||||
'required',
|
||||
'min:8',
|
||||
'regex:/^.*(?=.{3,})(?=.*[a-zA-Z])(?=.*[0-9])(?=.*[\d\x])(?=.*[!$#%@&]).*$/',
|
||||
'confirmed',
|
||||
],
|
||||
], [
|
||||
'password.regex' => 'Password does not follow regex',
|
||||
'password.min' => 'Password should be minimum 8 characters',
|
||||
'password.confirmed' => 'Password Confirmation Does Not Match Password',
|
||||
]);
|
||||
|
||||
$validationMessage = $this->validationError($validator);
|
||||
if ($validationMessage) {
|
||||
return response()->json(['status' => 400, 'message' => $validationMessage], 400);
|
||||
}
|
||||
|
||||
$user = User::where(['contact_number' => $request->contact_number])->first();
|
||||
|
||||
if (Hash::check($request->password, $user->password)){
|
||||
return response()->json(['message' => 'New Password Cannot be Same as Old Password!', 'status' => 400],400);
|
||||
}
|
||||
|
||||
$changePassword = User::where(['contact_number' => $request->contact_number])->update([
|
||||
'password' => bcrypt($request->password)
|
||||
]);
|
||||
if ($changePassword) {
|
||||
return response()->json(['message' => 'Password Changed Succesfully!', 'status' => 200]);
|
||||
}
|
||||
return response()->json(['message' => 'Error Changing Password', 'status' => 400]);
|
||||
}
|
||||
|
||||
public function thirdPartyOTP($number, $otp)
|
||||
{
|
||||
$curl = curl_init();
|
||||
|
||||
curl_setopt_array($curl, array(
|
||||
CURLOPT_URL => 'https://restapi.smscountry.com/v0.1/Accounts/4F7T5SbGyV7HBrEHxmX4/SMSes/',
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_ENCODING => '',
|
||||
CURLOPT_MAXREDIRS => 10,
|
||||
CURLOPT_TIMEOUT => 0,
|
||||
CURLOPT_FOLLOWLOCATION => true,
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
CURLOPT_CUSTOMREQUEST => 'POST',
|
||||
CURLOPT_POSTFIELDS => '{
|
||||
"Text": "Dear Investor, Your login OTP is ' . $otp . '. - Blue Feather Ventures Pvt Ltd.",
|
||||
"Number": "91' . $number . '",
|
||||
"SenderId": "BLUFVL",
|
||||
"DRNotifyUrl": "https://www.domainname.com/notifyurl",
|
||||
"DRNotifyHttpMethod": "POST",
|
||||
"Tool": "API"
|
||||
}',
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
'Content-Type: application/json',
|
||||
'Authorization: Basic NEY3VDVTYkd5VjdIQnJFSHhtWDQ6emFXdFEyTlV3ZlZROHB6dGRvVlRZUFdibG01Y1AxRldsbWl2WlVrbg=='
|
||||
),
|
||||
));
|
||||
|
||||
$response = curl_exec($curl);
|
||||
|
||||
curl_close($curl);
|
||||
return $response;
|
||||
// return true;
|
||||
}
|
||||
}
|
||||
13
app/Http/Controllers/Controller.php
Normal file
13
app/Http/Controllers/Controller.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||
use Illuminate\Foundation\Validation\ValidatesRequests;
|
||||
use Illuminate\Routing\Controller as BaseController;
|
||||
|
||||
class Controller extends BaseController
|
||||
{
|
||||
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
|
||||
}
|
||||
1427
app/Http/Controllers/Frontend/AccountsController.php
Normal file
1427
app/Http/Controllers/Frontend/AccountsController.php
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,506 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Frontend;
|
||||
|
||||
use App\Models\Product;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Resources\DebtFundResource;
|
||||
use App\Http\Resources\AngelFundResource;
|
||||
use App\Http\Resources\HedgeFundResource;
|
||||
use App\Models\AlternativeInvestmentFund;
|
||||
use App\Http\Resources\PrivateEquityFundResource;
|
||||
use App\Http\Resources\InfrastructureFundResource;
|
||||
use App\Http\Resources\VentureCapitalFundResource;
|
||||
use App\Http\Resources\FractionalRealEstate as test;
|
||||
use App\Http\Resources\PrivateRealEstateFundResource;
|
||||
use App\Http\Resources\FundForDistressedAssetResource;
|
||||
use App\Http\Resources\PrivateInvestmentInPublicEquityFundResource;
|
||||
use App\Http\Controllers\Admin\ManageFreeUInvestments\FractionalRealEstateController as FractionalRealEstateFrontendController;
|
||||
use App\Services\Frontend\AIFService;
|
||||
|
||||
class AlternativeInvestmentFundController extends Controller
|
||||
{
|
||||
protected $aif;
|
||||
|
||||
public function __construct(AIFService $aif)
|
||||
{
|
||||
$this->aif = $aif;
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$learnMore = (new FractionalRealEstateFrontendController)->aifQuestionAndAnswer()->getData();
|
||||
$faqs = (new FractionalRealEstateFrontendController)->aifQuestionAndAnswerFaqs()->getData();
|
||||
return view('Frontend.Pages.alternative-investment-fund.index', compact('learnMore', 'faqs'));
|
||||
}
|
||||
|
||||
public function aifCategoryOne()
|
||||
{
|
||||
$learnMore = (new FractionalRealEstateFrontendController)->aifIQuestionAndAnswer()->getData();
|
||||
$faqs = (new FractionalRealEstateFrontendController)->aifIQuestionAndAnswerFaqs()->getData();
|
||||
return view('Frontend.Pages.alternative-investment-fund.aif-category-one', compact('learnMore', 'faqs'));
|
||||
}
|
||||
|
||||
public function aifCategoryTwo()
|
||||
{
|
||||
$learnMore = (new FractionalRealEstateFrontendController)->aifIIQuestionAndAnswer()->getData();
|
||||
$faqs = (new FractionalRealEstateFrontendController)->aifIIQuestionAndAnswerFaqs()->getData();
|
||||
return view('Frontend.Pages.alternative-investment-fund.aif-category-two', compact('learnMore', 'faqs'));
|
||||
}
|
||||
|
||||
public function aifCategoryThree()
|
||||
{
|
||||
$learnMore = (new FractionalRealEstateFrontendController)->aifIIIQuestionAndAnswer()->getData();
|
||||
$faqs = (new FractionalRealEstateFrontendController)->aifIIIQuestionAndAnswerFaqs()->getData();
|
||||
return view('Frontend.Pages.alternative-investment-fund.aif-category-three', compact('learnMore', 'faqs'));
|
||||
}
|
||||
|
||||
public function ventureCapitalFund()
|
||||
{
|
||||
return view('Frontend.Pages.alternative-investment-fund.venture-capital-fund', [
|
||||
'openVCF' => $this->aif->openVCF()->getData(),
|
||||
'fullyFundedVCF' => $this->aif->fullyFundedVCF()->getData(),
|
||||
'resaleVCF' => $this->aif->resaleVCF()->getData(),
|
||||
'learnMore' => $this->aif->ventureCapitalLearnMore()->getData()
|
||||
]);
|
||||
}
|
||||
|
||||
public function infrastructureFund()
|
||||
{
|
||||
return view('Frontend.Pages.alternative-investment-fund.infrastructure-fund', [
|
||||
'openIF' => $this->aif->openIF()->getData(),
|
||||
'fullyFundedIF' => $this->aif->fullyFundedIF()->getData(),
|
||||
'resaleIF' => $this->aif->resaleIF()->getData(),
|
||||
'learnMore' => $this->aif->infrastructureFundLearnMore()->getData()
|
||||
]);
|
||||
}
|
||||
|
||||
public function angelFund()
|
||||
{
|
||||
// dd($this->aif->openAF()->getData());
|
||||
return view('Frontend.Pages.alternative-investment-fund.angel-fund', [
|
||||
'openAF' => $this->aif->openAF()->getData(),
|
||||
'fullyFundedAF' => $this->aif->fullyFundedAF()->getData(),
|
||||
'resaleAF' => $this->aif->resaleAF()->getData(),
|
||||
'learnMore' => $this->aif->angelFundLearnMore()->getData()
|
||||
]);
|
||||
}
|
||||
|
||||
public function privateEquityFund()
|
||||
{
|
||||
// dd($this->aif->openPEF()->getData());
|
||||
return view('Frontend.Pages.alternative-investment-fund.private-equity-fund', [
|
||||
'openPEF' => $this->aif->openPEF()->getData(),
|
||||
'fullyFundedPEF' => $this->aif->fullyFundedPEF()->getData(),
|
||||
'resalePEF' => $this->aif->resalePEF()->getData(),
|
||||
'learnMore' => $this->aif->privateEquityFundLearnMore()->getData()
|
||||
]);
|
||||
}
|
||||
|
||||
// public function debtFund()
|
||||
// {
|
||||
// // $debtFund = $this->debtFundAllData()->getData()->data;
|
||||
// // return view('Frontend.Pages.alternative-investment-fund.debt-fund', compact('debtFund'));
|
||||
// return view('Frontend.Pages.alternative-investment-fund.debt-fund', [
|
||||
// 'openDF' => $this->aif->openDF()->getData(),
|
||||
// 'fullyFundedDF' => $this->aif->fullyFundedDF()->getData(),
|
||||
// 'resaleDF' => $this->aif->resaleDF()->getData(),
|
||||
// 'learnMore' => $this->aif->debtFundLearnMore()->getData()
|
||||
// ]);
|
||||
// }
|
||||
|
||||
public function privateRealEstateFund()
|
||||
{
|
||||
// dd($this->aif->openPREF()->getData());
|
||||
return view('Frontend.Pages.alternative-investment-fund.private-real-estate-fund', [
|
||||
'openPREF' => $this->aif->openPREF()->getData(),
|
||||
'fullyFundedPREF' => $this->aif->fullyFundedPREF()->getData(),
|
||||
'resalePREF' => $this->aif->resalePREF()->getData(),
|
||||
'learnMore' => $this->aif->privateRealEstateFundLearnMore()->getData()
|
||||
]);
|
||||
}
|
||||
|
||||
public function fundForDistressedAsset()
|
||||
{
|
||||
// dd($this->aif->openFFDA()->getData());
|
||||
return view('Frontend.Pages.alternative-investment-fund.fund-for-distressed-asset', [
|
||||
'openFFDA' => $this->aif->openFFDA()->getData(),
|
||||
'fullyFundedFFDA' => $this->aif->fullyFundedFFDA()->getData(),
|
||||
'resaleFFDA' => $this->aif->resaleFFDA()->getData(),
|
||||
'learnMore' => $this->aif->fundForDistressedAssetLearnMore()->getData()
|
||||
]);
|
||||
}
|
||||
|
||||
public function hedgeFund()
|
||||
{
|
||||
return view('Frontend.Pages.alternative-investment-fund.hedge-fund', [
|
||||
'openHF' => $this->aif->openHF()->getData(),
|
||||
'fullyFundedHF' => $this->aif->fullyFundedHF()->getData(),
|
||||
'resaleHF' => $this->aif->resaleHF()->getData(),
|
||||
'learnMore' => $this->aif->hedgeFundLearnMore()->getData()
|
||||
]);
|
||||
}
|
||||
|
||||
public function privateInvestmentPublicEquity()
|
||||
{
|
||||
return view('Frontend.Pages.alternative-investment-fund.private-investment-public-equity', [
|
||||
'openPIPE' => $this->aif->openPIPE()->getData(),
|
||||
'fullyFundedPIPE' => $this->aif->fullyFundedPIPE()->getData(),
|
||||
'resalePIPE' => $this->aif->resalePIPE()->getData(),
|
||||
'learnMore' => $this->aif->pipeLearnMore()->getData()
|
||||
]);
|
||||
}
|
||||
|
||||
public function ventureCapitalFundProduct($slug)
|
||||
{
|
||||
$ventureCapitalFund = $this->ventureCapitalData($slug)->getData()->data;
|
||||
$otherVCP = AlternativeInvestmentFund::query()
|
||||
->join('products', 'alternative_investment_funds.products_id', 'products.id')
|
||||
->where(['status' => true, 'categories_id' => 28])
|
||||
->where('slug', '!=', $slug)
|
||||
->get();
|
||||
$productData = AlternativeInvestmentFund::where('slug', '=', $slug)->first();
|
||||
$productData = Product::where('id', '=', $productData->products_id)->first();
|
||||
// dd($ventureCapitalFund);
|
||||
return view('Frontend.Pages.alternative-investment-fund.venture-capital-fund-product', compact('ventureCapitalFund', 'otherVCP', 'productData'));
|
||||
}
|
||||
|
||||
public function infrastructureFundProduct($slug)
|
||||
{
|
||||
$infrastructureFund = $this->infrastructureData($slug)->getData()->data;
|
||||
$otherIF = AlternativeInvestmentFund::query()
|
||||
->join('products', 'alternative_investment_funds.products_id', 'products.id')
|
||||
->where(['status' => true, 'categories_id' => 29])
|
||||
->where('slug', '!=', $slug)
|
||||
->get();
|
||||
|
||||
$productData = AlternativeInvestmentFund::where('slug', '=', $slug)->first();
|
||||
$productData = Product::where('id', '=', $productData->products_id)->first();
|
||||
// dd($infrastructureFund);
|
||||
return view('Frontend.Pages.alternative-investment-fund.infrastructure-fund-product', compact('infrastructureFund', 'otherIF', 'productData'));
|
||||
}
|
||||
|
||||
public function angelFundProduct($slug)
|
||||
{
|
||||
$angelFund = $this->ventureCapitalData($slug)->getData()->data;
|
||||
$otherAF = AlternativeInvestmentFund::query()
|
||||
->join('products', 'alternative_investment_funds.products_id', 'products.id')
|
||||
->where(['status' => true, 'categories_id' => 30])
|
||||
->where('slug', '!=', $slug)
|
||||
->get();
|
||||
$productData = AlternativeInvestmentFund::where('slug', '=', $slug)->first();
|
||||
$productData = Product::where('id', '=', $productData->products_id)->first();
|
||||
// dd($angelFund);
|
||||
return view('Frontend.Pages.alternative-investment-fund.angel-fund-product', compact('angelFund', 'otherAF', 'productData'));
|
||||
}
|
||||
|
||||
public function privateEquityFundProduct($slug)
|
||||
{
|
||||
$privateEquityFund = $this->privateEquityData($slug)->getData()->data;
|
||||
$otherPEF = AlternativeInvestmentFund::query()
|
||||
->join('products', 'alternative_investment_funds.products_id', 'products.id')
|
||||
->join('companies', 'alternative_investment_funds.companies_id', 'companies.id')
|
||||
->where(['products.status' => true, 'categories_id' => 31])
|
||||
->where('slug', '!=', $slug)
|
||||
->get();
|
||||
$productData = AlternativeInvestmentFund::where('slug', '=', $slug)->first();
|
||||
$productData = Product::where('id', '=', $productData->products_id)->first();
|
||||
// dd($privateEquityFund);
|
||||
return view('Frontend.Pages.alternative-investment-fund.private-equity-fund-product', compact('privateEquityFund', 'otherPEF', 'productData'));
|
||||
}
|
||||
|
||||
public function debtFundProduct($slug)
|
||||
{
|
||||
$debtFund = $this->debtFundData($slug)->getData()->data;
|
||||
$otherDF = AlternativeInvestmentFund::query()
|
||||
->join('products', 'alternative_investment_funds.products_id', 'products.id')
|
||||
->join('companies', 'alternative_investment_funds.companies_id', 'companies.id')
|
||||
->where(['products.status' => true, 'categories_id' => 32])
|
||||
->where('slug', '!=', $slug)
|
||||
->get();
|
||||
$productData = AlternativeInvestmentFund::where('slug', '=', $slug)->first();
|
||||
$productData = Product::where('id', '=', $productData->products_id)->first();
|
||||
return view('Frontend.Pages.alternative-investment-fund.debt-fund-product', compact('debtFund', 'otherDF', 'productData'));
|
||||
}
|
||||
|
||||
public function fundForDistressedAssetProduct($slug)
|
||||
{
|
||||
$fundForDistressedAsset = $this->fundForDistressedAssetData($slug)->getData()->data;
|
||||
$otherFFDA = AlternativeInvestmentFund::query()
|
||||
->join('products', 'alternative_investment_funds.products_id', 'products.id')
|
||||
->join('companies', 'alternative_investment_funds.companies_id', 'companies.id')
|
||||
->where(['products.status' => true, 'categories_id' => 38])
|
||||
->where('slug', '!=', $slug)
|
||||
->get();
|
||||
$productData = AlternativeInvestmentFund::where('slug', '=', $slug)->first();
|
||||
$productData = Product::where('id', '=', $productData->products_id)->first();
|
||||
// dd($productData);
|
||||
return view('Frontend.Pages.alternative-investment-fund.fund-for-distressed-asset-product', compact('fundForDistressedAsset', 'otherFFDA', 'productData'));
|
||||
}
|
||||
|
||||
public function privateRealEstateFundProduct($slug)
|
||||
{
|
||||
$realEstate = $this->privateRealEstateFundData($slug)->getData()->data;
|
||||
$otherPREF = AlternativeInvestmentFund::query()
|
||||
->join('products', 'alternative_investment_funds.products_id', 'products.id')
|
||||
->join('companies', 'alternative_investment_funds.companies_id', 'companies.id')
|
||||
->where(['products.status' => true, 'categories_id' => 33])
|
||||
->where('slug', '!=', $slug)
|
||||
->get();
|
||||
$productData = AlternativeInvestmentFund::where('slug', '=', $slug)->first();
|
||||
$productData = Product::where('id', '=', $productData->products_id)->first();
|
||||
// dd($realEstate);
|
||||
return view('Frontend.Pages.alternative-investment-fund.private-real-estate-fund-product', compact('realEstate', 'otherPREF', 'productData'));
|
||||
}
|
||||
|
||||
public function hedgeFundProduct($slug)
|
||||
{
|
||||
$hedgeFund = $this->hedgeFundData($slug)->getData()->data;
|
||||
$otherHF = AlternativeInvestmentFund::query()
|
||||
->join('products', 'alternative_investment_funds.products_id', 'products.id')
|
||||
->where(['status' => true, 'categories_id' => 34])
|
||||
// ->where('status',false)
|
||||
->where('slug', '!=', $slug)
|
||||
// ->where('categories_id',26)
|
||||
->get();
|
||||
$productData = AlternativeInvestmentFund::where('slug', '=', $slug)->first();
|
||||
$productData = Product::where('id', '=', $productData->products_id)->first();
|
||||
// dd($productData);
|
||||
// dd($hedgeFund);
|
||||
return view('Frontend.Pages.alternative-investment-fund.hedge-fund-product', compact('hedgeFund', 'otherHF', 'productData'));
|
||||
}
|
||||
|
||||
public function privateInvestmentPublicEquityProduct($slug)
|
||||
{
|
||||
$pipe = $this->pipeData($slug)->getData()->data;
|
||||
// return $pipe;
|
||||
$otherPIPE = AlternativeInvestmentFund::query()
|
||||
->join('products', 'alternative_investment_funds.products_id', 'products.id')
|
||||
->where(['status' => true, 'categories_id' => 35])
|
||||
// ->where('status',false)
|
||||
->where('slug', '!=', $slug)
|
||||
// ->where('categories_id',26)
|
||||
->get();
|
||||
$productData = AlternativeInvestmentFund::where('slug', '=', $slug)->first();
|
||||
$productData = Product::where('id', '=', $productData->products_id)->first();
|
||||
// dd($pipe);
|
||||
return view('Frontend.Pages.alternative-investment-fund.private-investment-public-equity-product', compact('pipe', 'otherPIPE', 'productData'));
|
||||
}
|
||||
|
||||
// public function ventureCapital(){
|
||||
// $ventureCapital = Product::with('alternativeInvestmentFund', 'category')->ventureCapitalFund()->active()->get();
|
||||
// return $ventureCapital;
|
||||
// }
|
||||
|
||||
public function ventureCapital($type = 'Open')
|
||||
{
|
||||
try {
|
||||
return (new test(Product::has('alternativeInvestmentFund')->with('alternativeInvestmentFund.companies')->ventureCapitalFund()->where('type', $type)->active()->get()))
|
||||
->response()
|
||||
->setStatusCode(200);
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['message' => $e->getMessage()], 400);
|
||||
}
|
||||
}
|
||||
|
||||
public function ventureCapitalData($slug)
|
||||
{
|
||||
try {
|
||||
return (new VentureCapitalFundResource(AlternativeInvestmentFund::where('slug', $slug)->first()))
|
||||
->response()
|
||||
->setStatusCode(200);
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['message' => $e->getMessage()], 400);
|
||||
}
|
||||
}
|
||||
|
||||
public function infrastructure($type = 'Open')
|
||||
{
|
||||
try {
|
||||
return (new test(Product::has('alternativeInvestmentFund')->with('alternativeInvestmentFund.companies')->infrastructureFund()->active()->get()))
|
||||
->response()
|
||||
->setStatusCode(200);
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['message' => $e->getMessage()], 400);
|
||||
}
|
||||
}
|
||||
|
||||
public function infrastructureData($slug)
|
||||
{
|
||||
try {
|
||||
return (new InfrastructureFundResource(AlternativeInvestmentFund::where('slug', $slug)->first()))
|
||||
->response()
|
||||
->setStatusCode(200);
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['message' => $e->getMessage()], 400);
|
||||
}
|
||||
}
|
||||
|
||||
public function angelFundAllData($type = 'Open')
|
||||
{
|
||||
try {
|
||||
return (new test(Product::has('alternativeInvestmentFund')->with('alternativeInvestmentFund.companies')->angelFund()->active()->get()))
|
||||
->response()
|
||||
->setStatusCode(200);
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['message' => $e->getMessage()], 400);
|
||||
}
|
||||
}
|
||||
|
||||
public function angelFundData($slug)
|
||||
{
|
||||
try {
|
||||
return (new AngelFundResource(AlternativeInvestmentFund::where('slug', $slug)->first()))
|
||||
->response()
|
||||
->setStatusCode(200);
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['message' => $e->getMessage()], 400);
|
||||
}
|
||||
}
|
||||
|
||||
public function privateEquityAllData($type = 'Open')
|
||||
{
|
||||
try {
|
||||
return (new test(Product::has('alternativeInvestmentFund')->with('alternativeInvestmentFund.companies')->privateEquityFund()->active()->get()))
|
||||
->response()
|
||||
->setStatusCode(200);
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['message' => $e->getMessage()], 400);
|
||||
}
|
||||
}
|
||||
|
||||
public function privateEquityData($slug)
|
||||
{
|
||||
try {
|
||||
return (new PrivateEquityFundResource(AlternativeInvestmentFund::where('slug', $slug)->first()))
|
||||
->response()
|
||||
->setStatusCode(200);
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['message' => $e->getMessage()], 400);
|
||||
}
|
||||
}
|
||||
|
||||
public function debtFundAllData($type = 'Open')
|
||||
{
|
||||
try {
|
||||
return (new test(Product::has('alternativeInvestmentFund')->with('alternativeInvestmentFund.companies')->debtFund()->active()->get()))
|
||||
->response()
|
||||
->setStatusCode(200);
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['message' => $e->getMessage()], 400);
|
||||
}
|
||||
}
|
||||
|
||||
public function debtFundData($slug)
|
||||
{
|
||||
try {
|
||||
return (new DebtFundResource(AlternativeInvestmentFund::where('slug', $slug)->first()))
|
||||
->response()
|
||||
->setStatusCode(200);
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['message' => $e->getMessage()], 400);
|
||||
}
|
||||
}
|
||||
|
||||
public function privateRealEstateFundAllData($type = 'Open')
|
||||
{
|
||||
try {
|
||||
return (new test(Product::has('alternativeInvestmentFund')->with('alternativeInvestmentFund.companies')->privateRealEstateFund()->active()->get()))
|
||||
->response()
|
||||
->setStatusCode(200);
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['message' => $e->getMessage()], 400);
|
||||
}
|
||||
}
|
||||
|
||||
public function privateRealEstateFundData($slug)
|
||||
{
|
||||
try {
|
||||
return (new PrivateRealEstateFundResource(AlternativeInvestmentFund::where('slug', $slug)->first()))
|
||||
->response()
|
||||
->setStatusCode(200);
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['message' => $e->getMessage()], 400);
|
||||
}
|
||||
}
|
||||
|
||||
public function fundForDistressedAssetAllData($type = 'Open')
|
||||
{
|
||||
try {
|
||||
return (new test(Product::has('alternativeInvestmentFund')->with('alternativeInvestmentFund.companies')->fundForDistressedAsset()->active()->get()))
|
||||
->response()
|
||||
->setStatusCode(200);
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['message' => $e->getMessage()], 400);
|
||||
}
|
||||
}
|
||||
|
||||
public function fundForDistressedAssetData($slug)
|
||||
{
|
||||
try {
|
||||
return (new FundForDistressedAssetResource(AlternativeInvestmentFund::where('slug', $slug)->first()))
|
||||
->response()
|
||||
->setStatusCode(200);
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['message' => $e->getMessage()], 400);
|
||||
}
|
||||
}
|
||||
|
||||
public function hedgeFundAllData($type = 'Open')
|
||||
{
|
||||
try {
|
||||
return (new test(Product::has('alternativeInvestmentFund')->with('alternativeInvestmentFund.companies')->hedgeFund()->active()->get()))
|
||||
->response()
|
||||
->setStatusCode(200);
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['message' => $e->getMessage()], 400);
|
||||
}
|
||||
}
|
||||
|
||||
public function hedgeFundData($slug)
|
||||
{
|
||||
try {
|
||||
return (new HedgeFundResource(AlternativeInvestmentFund::where('slug', $slug)->first()))
|
||||
->response()
|
||||
->setStatusCode(200);
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['message' => $e->getMessage()], 400);
|
||||
}
|
||||
}
|
||||
|
||||
public function pipeAllData($type = 'Open')
|
||||
{
|
||||
try {
|
||||
return (new test(Product::has('alternativeInvestmentFund')->with('alternativeInvestmentFund.companies')->pipe()->where('type', $type)->active()->get()))
|
||||
->response()
|
||||
->setStatusCode(200);
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['message' => $e->getMessage()], 400);
|
||||
}
|
||||
}
|
||||
|
||||
public function pipeData($slug)
|
||||
{
|
||||
try {
|
||||
return (new PrivateInvestmentInPublicEquityFundResource(AlternativeInvestmentFund::where('slug', $slug)->first()))
|
||||
->response()
|
||||
->setStatusCode(200);
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['message' => $e->getMessage()], 400);
|
||||
}
|
||||
}
|
||||
|
||||
public function longOnlyEquityFund()
|
||||
{
|
||||
$learnMore = (new FractionalRealEstateFrontendController)->loefQuestionAndAnswer()->getData();
|
||||
return view('Frontend.Pages.long-only-equity-fund.index', ['learnMore' => $learnMore]);
|
||||
}
|
||||
|
||||
public function privateCreditFund()
|
||||
{
|
||||
|
||||
$learnMore = (new FractionalRealEstateFrontendController)->pcfQuestionAndAnswer()->getData();
|
||||
return view('Frontend.Pages.private-credit-fund.index', ['learnMore' => $learnMore]);
|
||||
}
|
||||
}
|
||||
110
app/Http/Controllers/Frontend/ChatBoxController.php
Normal file
110
app/Http/Controllers/Frontend/ChatBoxController.php
Normal file
@@ -0,0 +1,110 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Frontend;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Chat;
|
||||
use Illuminate\Support\Facades\View;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class ChatBoxController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
// dd(Chat::where('user_id', auth()->guard('users')->user()->id)->get());
|
||||
return view('Frontend.Pages.user-chat.index', [
|
||||
'chats' => Chat::where('user_id', auth()->guard('users')->user()->id)->get()
|
||||
]);
|
||||
}
|
||||
|
||||
public function sendMsg(Request $request)
|
||||
{
|
||||
$validation = \Validator::make($request->all(), [
|
||||
'message' => 'nullable|max:255',
|
||||
'user_file' => 'nullable|mimes:pdf,zip,jpg,png,jpeg|max:10240',
|
||||
]);
|
||||
if ($validation->fails()) {
|
||||
return response()->json(['status' => 403, 'message' => $validation->errors()]);
|
||||
}
|
||||
// dd($request->all());
|
||||
if ($request->user_file == '' && $request->message == '') {
|
||||
return response()->json(['status' => 400, 'message' => 'Please Drop A Message!']);
|
||||
}
|
||||
if ($request->user_file) {
|
||||
$attachmentImage = time() . '.' . $request->user_file->extension();
|
||||
$path = $request->user_file->storeAs('chat', $attachmentImage);
|
||||
}
|
||||
$addChat = Chat::create([
|
||||
'user_id' => auth()->guard('users')->user()->id,
|
||||
'message' => $request->message,
|
||||
'file' => $attachmentImage ?? null
|
||||
]);
|
||||
|
||||
if ($addChat) {
|
||||
return response()->json(['status' => 200, 'message' => 'Chat Send']);
|
||||
}
|
||||
return response()->json(['status' => 200, 'message' => 'Error Sending Message']);
|
||||
}
|
||||
|
||||
public function getFile($file_name)
|
||||
{
|
||||
return \Storage::download('chat/' . $file_name);
|
||||
}
|
||||
|
||||
public function getChat()
|
||||
{
|
||||
$chat = Chat::where('user_id', auth()->guard('users')->user()->id)->get();
|
||||
foreach ($chat as $row) {
|
||||
if ($row->file != null) {
|
||||
$row['file_name'] = $row->getRawOriginal('file');
|
||||
}
|
||||
}
|
||||
$chatPage = View::make('Frontend.Pages.user-chat.chats')->with('chats', $chat)->render();
|
||||
return $chatPage;
|
||||
}
|
||||
|
||||
public function getChatApi(Request $request)
|
||||
{
|
||||
$id = auth('sanctum')->user()->id;
|
||||
$getChat = Chat::where(['user_id'=>$id,'is_read'=>false])->get();
|
||||
foreach($getChat as $singleChat)
|
||||
{
|
||||
$updateChat = Chat::where('id',$singleChat->id)->update(['is_read'=>true,'read_at'=>Carbon::now()]);
|
||||
}
|
||||
$data['data'] = Chat::query()
|
||||
->join('users', 'chats.user_id', 'users.id')
|
||||
->where('user_id', $id)
|
||||
// ->where('user_id', $request->user()->id)
|
||||
->select('message', 'file', 'by', 'profile_image',\DB::raw('DATE_FORMAT(chats.created_at, "%d-%b-%Y %r") as time'))
|
||||
->latest('chats.created_at')
|
||||
->get();
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function sendMsgApi(Request $request)
|
||||
{
|
||||
if ($request->user_file == '' && $request->message == '') {
|
||||
return response()->json(['status' => 400, 'message' => 'Please Drop A Message!']);
|
||||
}
|
||||
if ($request->user_file) {
|
||||
$attachmentImage = time() . '.' . $request->user_file->extension();
|
||||
$path = $request->user_file->storeAs('chat', $attachmentImage);
|
||||
}
|
||||
$addChat = Chat::create([
|
||||
'user_id' => $request->user()->id,
|
||||
'message' => $request->message,
|
||||
'file' => $attachmentImage ?? null
|
||||
]);
|
||||
|
||||
if ($addChat) {
|
||||
return response()->json(['status' => 200, 'message' => 'Chat Send']);
|
||||
}
|
||||
return response()->json(['status' => 200, 'message' => 'Error Sending Message']);
|
||||
}
|
||||
|
||||
public function getFileApi($file_name)
|
||||
{
|
||||
return \Storage::download('chat/' . $file_name);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Frontend;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Resources\CleanAndGreenAssetsResource;
|
||||
use App\Models\CleanAndGreenAsset;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Product;
|
||||
use App\Http\Resources\FractionalRealEstate as test;
|
||||
use App\Http\Controllers\Admin\ManageFreeUInvestments\CleanAndGreenAssetsController as CleanAndGreenAssetsFontendController;
|
||||
use App\Http\Controllers\Admin\ManageFreeUInvestments\FractionalRealEstateController as FractionalRealEstateFrontendController;
|
||||
|
||||
class CleanAndGreenAssetsController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$cleanAndGreenAssets = $this->cleanAndGreenAssets()->getData();
|
||||
$learnMore = (new FractionalRealEstateFrontendController)->cleanAndGreenAssetsQuestionAndAnswer()->getData();
|
||||
$faqs = (new FractionalRealEstateFrontendController)->cleanAndGreenAssetsQuestionAndAnswerFaqs()->getData();
|
||||
return view('Frontend.Pages.clean-and-green-assets.index', compact('cleanAndGreenAssets','learnMore','faqs'));
|
||||
}
|
||||
|
||||
public function product($slug)
|
||||
{
|
||||
// $cleanAndGreenAsset = CleanAndGreenAsset::where('slug',$slug)->first();
|
||||
$cleanAndGreenAsset = $this->cleanAndGreenAssetsData($slug)->getData()->data;
|
||||
$otherCAGA = CleanAndGreenAsset::query()
|
||||
->join('products', 'clean_and_green_assets.products_id', 'products.id')
|
||||
->where(['status' => true, 'categories_id' => 26])
|
||||
// ->where('status',false)
|
||||
->where('slug', '!=', $slug)
|
||||
// ->where('categories_id',26)
|
||||
->get();
|
||||
|
||||
$productData = CleanAndGreenAsset::where('slug','=',$slug)->first();
|
||||
$productData = Product::where('id','=',$productData->products_id)->first();
|
||||
return view('Frontend.Pages.clean-and-green-assets.product', compact('cleanAndGreenAsset','otherCAGA','productData'));
|
||||
}
|
||||
|
||||
// public function cleanAndGreenAssets(){
|
||||
// $cleanAndGreenAssets = Product::with('cleanAndGreenAssets', 'category')->cleanAndGreenAssets()->active()->get();
|
||||
// return (object)[
|
||||
// 'status' => 200,
|
||||
// 'data' => $cleanAndGreenAssets
|
||||
// ];
|
||||
// // return $cleanAndGreenAssets;
|
||||
// }
|
||||
|
||||
public function cleanAndGreenAssets()
|
||||
{
|
||||
try {
|
||||
return (new test(Product::has('cleanAndGreenAssets')->with('cleanAndGreenAssets.companies')->active()->get()))
|
||||
->response()
|
||||
->setStatusCode(200);
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['message' => $e->getMessage()], 400);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function cleanAndGreenAssetsData($slug)
|
||||
{
|
||||
try {
|
||||
return (new CleanAndGreenAssetsResource(CleanAndGreenAsset::where('slug', $slug)->first()))
|
||||
->response()
|
||||
->setStatusCode(200);
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['message' => $e->getMessage()], 400);
|
||||
}
|
||||
}
|
||||
}
|
||||
26
app/Http/Controllers/Frontend/ContactController.php
Normal file
26
app/Http/Controllers/Frontend/ContactController.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Frontend;
|
||||
|
||||
use App\Models\ContactUs;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\ContactUsRequest;
|
||||
|
||||
class ContactController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
return view('Frontend.Pages.contact');
|
||||
}
|
||||
|
||||
public function contactUsForm(ContactUsRequest $request)
|
||||
{
|
||||
$validated = $request->validated();
|
||||
$contactUsData = ContactUs::create($validated);
|
||||
|
||||
if ($contactUsData) {
|
||||
return response()->json(['status' => 200, 'message' => 'Our team will get back to you!'], 200);
|
||||
}
|
||||
return response()->json(['status' => 400, 'message' => 'Error Submitting Contact Us Form!'], 400);
|
||||
}
|
||||
}
|
||||
1115
app/Http/Controllers/Frontend/DashboardController.php
Normal file
1115
app/Http/Controllers/Frontend/DashboardController.php
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Frontend;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\FractionalRealEstate;
|
||||
use App\Models\Product;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Resources\FractionalRealEstate as test;
|
||||
use App\Http\Resources\FractionalRealEstateResource;
|
||||
use App\Http\Controllers\Admin\ManageFreeUInvestments\FractionalRealEstateController as FractionalRealEstateFontendController;
|
||||
|
||||
class FractionalRealEstateController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$fractionalRealEstate = $this->fractData()->getData();
|
||||
$openFRE = Product::has('fractional_real_estate')->with('fractional_real_estate.companies','categorys')->open()->active()->latest()->get();
|
||||
$resaleFRE = Product::has('fractional_real_estate')->with('fractional_real_estate.companies','categorys')->resale()->active()->latest()->get();
|
||||
$fullyFundedFRE = Product::has('fractional_real_estate')->with('fractional_real_estate.companies','categorys')->fullyFunded()->active()->latest()->get();
|
||||
$learnMore = (new FractionalRealEstateFontendController)->fractionalRealEstateQuestionAndAnswer()->getData();
|
||||
// $faqs = (new FractionalRealEstateFontendController)->fractionalRealEstateQuestionAndAnswerFaqs()->getData();
|
||||
// dd($openFRE);
|
||||
return view('Frontend.Pages.fractional-real-estate.index', compact('fractionalRealEstate','learnMore','openFRE', 'resaleFRE', 'fullyFundedFRE'));
|
||||
}
|
||||
|
||||
public function product($slug)
|
||||
{
|
||||
$fractionalRealEstate = $this->fractionalRealEstateData($slug)->getData()->data;
|
||||
$otherFRE = FractionalRealEstate::query()
|
||||
->join('products', 'fractional_real_estates.products_id', 'products.id')
|
||||
->where(['status' => true, 'categories_id' => 2])
|
||||
->where('slug', '!=', $slug)
|
||||
->get();
|
||||
// dd($fractionalRealEstate);
|
||||
|
||||
$productData = FractionalRealEstate::where('slug','=',$slug)->first();
|
||||
$productData = Product::where('id','=',$productData->products_id)->first();
|
||||
// $productData['presentation_file'] = $productData->getRawOriginal('presentation');
|
||||
// $productData['fact_sheet_file'] = $productData->getRawOriginal('fact_sheet');
|
||||
// dd($fractionalRealEstate);
|
||||
return view('Frontend.Pages.fractional-real-estate.product', compact('fractionalRealEstate','otherFRE','productData'));
|
||||
}
|
||||
|
||||
public function downloadFilePersantation($filename){
|
||||
// dd($filename);
|
||||
if(\File::exists('public/uploads/product/presentation/'.$filename))
|
||||
{
|
||||
// dd('hello');
|
||||
return response()->download(public_path('/uploads/product/presentation/'.$filename));
|
||||
}
|
||||
else if(\File::exists('public/uploads/product/fact_sheet/'.$filename))
|
||||
{
|
||||
return response()->download(public_path('/uploads/product/fact_sheet/'.$filename));
|
||||
}else{
|
||||
return "file not found";
|
||||
}
|
||||
dd('hello');
|
||||
}
|
||||
|
||||
public function fractData()
|
||||
{
|
||||
try {
|
||||
$product = Product::has('fractional_real_estate')->with('fractional_real_estate.companies')->active()->get();
|
||||
foreach($product as $fre)
|
||||
{
|
||||
$fre->fractional_real_estate->property_img = $fre->fractional_real_estate->getRawOriginal('property_image');
|
||||
}
|
||||
return (new test($product))
|
||||
->response()
|
||||
->setStatusCode(200);
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['message' => $e->getMessage()], 400);
|
||||
}
|
||||
}
|
||||
|
||||
public function fractionalRealEstateData($slug){
|
||||
try {
|
||||
return (new FractionalRealEstateResource(FractionalRealEstate::where('slug',$slug)->first()))
|
||||
->response()
|
||||
->setStatusCode(200);
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['message' => $e->getMessage()], 400);
|
||||
}
|
||||
}
|
||||
}
|
||||
90
app/Http/Controllers/Frontend/GlobalBondController.php
Normal file
90
app/Http/Controllers/Frontend/GlobalBondController.php
Normal file
@@ -0,0 +1,90 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Frontend;
|
||||
|
||||
use App\Models\Product;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Bonds;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Resources\FractionalRealEstate as test;
|
||||
use App\Http\Resources\GlobalBondResource;
|
||||
use App\Http\Controllers\Admin\ManageFreeUInvestments\FractionalRealEstateController as FractionalRealEstateFrontendController;
|
||||
|
||||
class GlobalBondController extends Controller
|
||||
{
|
||||
public function index(){
|
||||
$learnMore = (new FractionalRealEstateFrontendController)->internationalBondsQuestionAndAnswer()->getData();
|
||||
$faqs = (new FractionalRealEstateFrontendController)->internationalBondsQuestionAndAnswerFaqs()->getData();
|
||||
return view('Frontend.Pages.bonds.index',compact('learnMore','faqs'));
|
||||
}
|
||||
|
||||
public function sovereignGovernmentBonds(){
|
||||
$bonds = $this->sovereignGovernmentBondsAllData()->getData();
|
||||
$learnMore = (new FractionalRealEstateFrontendController)->mutualFundsQuestionAndAnswer()->getData();
|
||||
return view('Frontend.Pages.bonds.sovereign-bonds',compact('bonds','learnMore'));
|
||||
}
|
||||
|
||||
public function investmentGradeBonds(){
|
||||
$bonds = $this->investmentGradeBondsAllData()->getData();
|
||||
$learnMore = (new FractionalRealEstateFrontendController)->mutualFundsQuestionAndAnswer()->getData();
|
||||
return view('Frontend.Pages.bonds.investment-bonds',compact('bonds','learnMore'));
|
||||
}
|
||||
|
||||
public function highYieldBonds(){
|
||||
$bonds = $this->highYieldBondsAllData()->getData();
|
||||
$learnMore = (new FractionalRealEstateFrontendController)->mutualFundsQuestionAndAnswer()->getData();
|
||||
return view('Frontend.Pages.bonds.high-yield-bonds',compact('bonds','learnMore'));
|
||||
}
|
||||
|
||||
public function product($slug){
|
||||
$bond = Bonds::where('slug',$slug)->first();
|
||||
$learnMore = (new FractionalRealEstateFrontendController)->mutualFundsQuestionAndAnswer()->getData();
|
||||
$productData = Bonds::where('slug','=',$slug)->first();
|
||||
$productData = Product::where('id','=',$productData->products_id)->first();
|
||||
return view('Frontend.Pages.bonds.products',compact('bond','productData'));
|
||||
}
|
||||
|
||||
public function sovereignGovernmentBondsAllData()
|
||||
{
|
||||
try {
|
||||
return (new test(Product::has('bonds')->with('bonds')->bonds()->sovereignGovernmentBond()->get()))
|
||||
->response()
|
||||
->setStatusCode(200);
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['message' => $e->getMessage()], 400);
|
||||
}
|
||||
}
|
||||
|
||||
public function investmentGradeBondsAllData()
|
||||
{
|
||||
try {
|
||||
return (new test(Product::has('bonds')->with('bonds')->bonds()->investmentGradeBond()->get()))
|
||||
->response()
|
||||
->setStatusCode(200);
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['message' => $e->getMessage()], 400);
|
||||
}
|
||||
}
|
||||
|
||||
public function highYieldBondsAllData()
|
||||
{
|
||||
try {
|
||||
return (new test(Product::has('bonds')->with('bonds')->bonds()->highYieldBond()->get()))
|
||||
->response()
|
||||
->setStatusCode(200);
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['message' => $e->getMessage()], 400);
|
||||
}
|
||||
}
|
||||
|
||||
public function bondData($slug)
|
||||
{
|
||||
try {
|
||||
return (new GlobalBondResource(Bonds::where('slug', $slug)->first()))
|
||||
->response()
|
||||
->setStatusCode(200);
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['message' => $e->getMessage()], 400);
|
||||
}
|
||||
}
|
||||
}
|
||||
51
app/Http/Controllers/Frontend/GlobalEquitiesController.php
Normal file
51
app/Http/Controllers/Frontend/GlobalEquitiesController.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Frontend;
|
||||
|
||||
use App\Http\Resources\FractionalRealEstate as test;
|
||||
use App\Models\Product;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Resources\GlobalEquityStockRealEstateResource;
|
||||
use App\Models\StockFundsRealEstateExchange;
|
||||
use App\Http\Controllers\Admin\ManageFreeUInvestments\FractionalRealEstateController as FractionalRealEstateFrontendController;
|
||||
|
||||
class GlobalEquitiesController extends Controller
|
||||
{
|
||||
public function index(){
|
||||
$equities = $this->equitiesAllData()->getData();
|
||||
$learnMore = (new FractionalRealEstateFrontendController)->equitiesQuestionAndAnswer()->getData();
|
||||
$faqs = (new FractionalRealEstateFrontendController)->equitiesQuestionAndAnswerFaqs()->getData();
|
||||
return view('Frontend.Pages.equities.index',compact('equities','learnMore','faqs'));
|
||||
}
|
||||
|
||||
public function product($slug = '')
|
||||
{
|
||||
$equities = StockFundsRealEstateExchange::where('slug',$slug)->first();
|
||||
$productData = StockFundsRealEstateExchange::where('slug','=',$slug)->first();
|
||||
$productData = Product::where('id','=',$productData->products_id)->first();
|
||||
return view('Frontend.Pages.equities.product',compact('equities','productData'));
|
||||
}
|
||||
|
||||
public function equitiesAllData()
|
||||
{
|
||||
try {
|
||||
return (new test(Product::has('exchanges')->with('exchanges')->equities()->get()))
|
||||
->response()
|
||||
->setStatusCode(200);
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['message' => $e->getMessage()], 400);
|
||||
}
|
||||
}
|
||||
|
||||
public function equityStockRealEstateData($slug)
|
||||
{
|
||||
try {
|
||||
return (new GlobalEquityStockRealEstateResource(StockFundsRealEstateExchange::where('slug', $slug)->first()))
|
||||
->response()
|
||||
->setStatusCode(200);
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['message' => $e->getMessage()], 400);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Frontend;
|
||||
|
||||
use App\Http\Resources\FractionalRealEstate as test;
|
||||
use App\Models\Product;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\StockFundsRealEstateExchange;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Admin\ManageFreeUInvestments\FractionalRealEstateController as FractionalRealEstateFrontendController;
|
||||
|
||||
class GlobalExchangeTradedFundsController extends Controller
|
||||
{
|
||||
public function index(){
|
||||
$etfs = $this->exchangeTradedFundsAllData()->getData();
|
||||
$openGETF = Product::has('exchanges')->with('exchanges','categorys')->exchangeTradedFund()->open()->active()->latest()->get();
|
||||
$resaleGETF = Product::has('exchanges')->with('exchanges','categorys')->exchangeTradedFund()->resale()->active()->latest()->get();
|
||||
$fullyFundedGETF = Product::has('exchanges')->with('exchanges','categorys')->exchangeTradedFund()->fullyFunded()->active()->latest()->get();
|
||||
$learnMore = (new FractionalRealEstateFrontendController)->exchangeTradedFundsQuestionAndAnswer()->getData();
|
||||
// $faqs = (new FractionalRealEstateFrontendController)->exchangeTradedFundsQuestionAndAnswerFaqs()->getData();
|
||||
// dd($openGETF);
|
||||
return view('Frontend.Pages.etfs.index',compact('etfs','learnMore', 'openGETF', 'resaleGETF', 'fullyFundedGETF'));
|
||||
}
|
||||
|
||||
public function product($slug = ''){
|
||||
$etf = StockFundsRealEstateExchange::where('slug',$slug)->first();
|
||||
$productData = StockFundsRealEstateExchange::where('slug','=',$slug)->first();
|
||||
$productData = Product::where('id','=',$productData->products_id)->first();
|
||||
// dd($etf);
|
||||
return view('Frontend.Pages.etfs.product',compact('etf','productData'));
|
||||
|
||||
}
|
||||
|
||||
public function exchangeTradedFundsAllData($type = 'Open')
|
||||
{
|
||||
try {
|
||||
return (new test(Product::has('exchanges')->with('exchanges')->exchangeTradedFund()->where('type',$type)->get()))
|
||||
->response()
|
||||
->setStatusCode(200);
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['message' => $e->getMessage()], 400);
|
||||
}
|
||||
}
|
||||
}
|
||||
44
app/Http/Controllers/Frontend/GlobalHedgeFundController.php
Normal file
44
app/Http/Controllers/Frontend/GlobalHedgeFundController.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Frontend;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Resources\FractionalRealEstate as test;
|
||||
use App\Models\Fund;
|
||||
use App\Models\Product;
|
||||
use App\Http\Controllers\Admin\ManageFreeUInvestments\FractionalRealEstateController as FractionalRealEstateFrontendController;
|
||||
|
||||
class GlobalHedgeFundController extends Controller
|
||||
{
|
||||
public function index(){
|
||||
$hedgeFunds = $this->hedgeFundAllData()->getData();
|
||||
$openGHF = Product::has('funds')->with('funds','categorys')->globalHedgeFund()->open()->active()->latest()->get();
|
||||
$resaleGHF = Product::has('funds')->with('funds','categorys')->globalHedgeFund()->resale()->active()->latest()->get();
|
||||
$fullyFundedGHF = Product::has('funds')->with('funds','categorys')->globalHedgeFund()->fullyFunded()->active()->latest()->get();
|
||||
$learnMore = (new FractionalRealEstateFrontendController)->globalHedgeFundQuestionAndAnswer()->getData();
|
||||
// $faqs = (new FractionalRealEstateFrontendController)->globalHedgeFundQuestionAndAnswerFaqs()->getData();
|
||||
// dd($openGHF);
|
||||
return view('Frontend.Pages.hedge-funds.index',compact('hedgeFunds','learnMore','openGHF','resaleGHF','fullyFundedGHF'));
|
||||
}
|
||||
|
||||
public function product($slug = '')
|
||||
{
|
||||
$hedgeFund = Fund::where('slug',$slug)->first();
|
||||
$productData = Fund::where('slug','=',$slug)->first();
|
||||
$productData = Product::where('id','=',$productData->products_id)->first();
|
||||
// dd($hedgeFund);
|
||||
return view('Frontend.Pages.hedge-funds.product',compact('hedgeFund','productData'));
|
||||
}
|
||||
|
||||
public function hedgeFundAllData()
|
||||
{
|
||||
try {
|
||||
return (new test(Product::has('funds')->with('funds')->funds()->globalHedgeFund()->get()))
|
||||
->response()
|
||||
->setStatusCode(200);
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['message' => $e->getMessage()], 400);
|
||||
}
|
||||
}
|
||||
}
|
||||
52
app/Http/Controllers/Frontend/GlobalMutualFundController.php
Normal file
52
app/Http/Controllers/Frontend/GlobalMutualFundController.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Frontend;
|
||||
|
||||
use App\Models\Product;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Resources\FractionalRealEstate as test;
|
||||
use App\Http\Resources\GlobalFundResource;
|
||||
use App\Models\Fund;
|
||||
use App\Http\Controllers\Admin\ManageFreeUInvestments\FractionalRealEstateController as FractionalRealEstateFrontendController;
|
||||
|
||||
class GlobalMutualFundController extends Controller
|
||||
{
|
||||
|
||||
public function index(){
|
||||
$mutualFund = $this->mutualFundAllData()->getData();
|
||||
$learnMore = (new FractionalRealEstateFrontendController)->mutualFundsQuestionAndAnswer()->getData();
|
||||
$faqs = (new FractionalRealEstateFrontendController)->mutualFundsQuestionAndAnswerFaqs()->getData();
|
||||
return view('Frontend.Pages.mutual-funds.index',compact('mutualFund','learnMore','faqs'));
|
||||
}
|
||||
|
||||
public function product($slug = '')
|
||||
{
|
||||
$mutualFund = Fund::where('slug',$slug)->first();
|
||||
$productData = Fund::where('slug','=',$slug)->first();
|
||||
$productData = Product::where('id','=',$productData->products_id)->first();
|
||||
return view('Frontend.Pages.mutual-funds.product',compact('mutualFund','productData'));
|
||||
}
|
||||
|
||||
public function mutualFundAllData()
|
||||
{
|
||||
try {
|
||||
return (new test(Product::has('funds')->with('funds')->funds()->mutualFund()->get()))
|
||||
->response()
|
||||
->setStatusCode(200);
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['message' => $e->getMessage()], 400);
|
||||
}
|
||||
}
|
||||
|
||||
public function fundData($slug)
|
||||
{
|
||||
try {
|
||||
return (new GlobalFundResource(Fund::where('slug', $slug)->first()))
|
||||
->response()
|
||||
->setStatusCode(200);
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['message' => $e->getMessage()], 400);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Frontend;
|
||||
|
||||
use App\Http\Resources\FractionalRealEstate as test;
|
||||
use App\Models\Product;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Fund;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Admin\ManageFreeUInvestments\FractionalRealEstateController as FractionalRealEstateFrontendController;
|
||||
|
||||
class GlobalPrivateEquityFundController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$privateEquity = $this->privateEquityFundAllData()->getData();
|
||||
$openGPEF = Product::has('funds')->with('funds', 'categorys')->funds()->privateEquityFund()->open()->active()->latest()->get();
|
||||
$resaleGPEF = Product::has('funds')->with('funds', 'categorys')->funds()->privateEquityFund()->resale()->active()->latest()->get();
|
||||
$fullyFundedGPEF = Product::has('funds')->with('funds', 'categorys')->funds()->privateEquityFund()->fullyFunded()->active()->latest()->get();
|
||||
$learnMore = (new FractionalRealEstateFrontendController)->globalPrivateEquityFundQuestionAndAnswer()->getData();
|
||||
// $faqs = (new FractionalRealEstateFrontendController)->globalPrivateEquityFundQuestionAndAnswerFaqs()->getData();
|
||||
// dd($openGPEF);
|
||||
return view('Frontend.Pages.private-equity-funds.index', compact('privateEquity', 'learnMore', 'openGPEF', 'resaleGPEF', 'fullyFundedGPEF'));
|
||||
}
|
||||
|
||||
public function globalPrivateEquityFundPage()
|
||||
{
|
||||
// $privateEquity = $this->privateEquityFundAllData()->getData();
|
||||
$openGPEF = Product::has('funds')->with('funds', 'categorys')->funds()->globalPrivateEquityFund()->open()->active()->latest()->get();
|
||||
$resaleGPEF = Product::has('funds')->with('funds', 'categorys')->funds()->globalPrivateEquityFund()->resale()->active()->latest()->get();
|
||||
$fullyFundedGPEF = Product::has('funds')->with('funds', 'categorys')->funds()->globalPrivateEquityFund()->fullyFunded()->active()->latest()->get();
|
||||
$learnMore = (new FractionalRealEstateFrontendController)->globalPrivateEquityFundQuestionAndAnswer()->getData();
|
||||
// $faqs = (new FractionalRealEstateFrontendController)->globalPrivateEquityFundQuestionAndAnswerFaqs()->getData();
|
||||
// dd($openGPEF);
|
||||
return view('Frontend.Pages.private-equity-funds.global-private-equity-fund', compact('learnMore', 'openGPEF', 'resaleGPEF', 'fullyFundedGPEF'));
|
||||
}
|
||||
|
||||
public function product($slug = '')
|
||||
{
|
||||
$privateEquityFund = Fund::where('slug', $slug)->first();
|
||||
$productData = Fund::where('slug', '=', $slug)->first();
|
||||
$productData = Product::where('id', '=', $productData->products_id)->first();
|
||||
// dd($privateEquityFund);
|
||||
return view('Frontend.Pages.private-equity-funds.product', compact('privateEquityFund', 'productData'));
|
||||
}
|
||||
|
||||
public function privateEquityFundAllData($type = 'Open')
|
||||
{
|
||||
try {
|
||||
return (new test(Product::has('funds')->with('funds')->funds()->globalPrivateEquityFund()->where('type', $type)->get()))
|
||||
->response()
|
||||
->setStatusCode(200);
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['message' => $e->getMessage()], 400);
|
||||
}
|
||||
}
|
||||
}
|
||||
44
app/Http/Controllers/Frontend/GlobalREITSController.php
Normal file
44
app/Http/Controllers/Frontend/GlobalREITSController.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Frontend;
|
||||
|
||||
use App\Http\Resources\FractionalRealEstate as test;
|
||||
use App\Models\Product;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\StockFundsRealEstateExchange;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Admin\ManageFreeUInvestments\FractionalRealEstateController as FractionalRealEstateFrontendController;
|
||||
|
||||
class GlobalREITSController extends Controller
|
||||
{
|
||||
public function index(){
|
||||
$reits = $this->reitsAllData()->getData();
|
||||
$openREITS = Product::has('exchanges')->with('exchanges','categorys')->reits()->open()->active()->latest()->get();
|
||||
$resaleREITS = Product::has('exchanges')->with('exchanges','categorys')->reits()->resale()->active()->latest()->get();
|
||||
$fullyFundedREITS = Product::has('exchanges')->with('exchanges','categorys')->reits()->fullyFunded()->active()->latest()->get();
|
||||
$learnMore = (new FractionalRealEstateFrontendController)->reitQuestionAndAnswer()->getData();
|
||||
// $faqs = (new FractionalRealEstateFrontendController)->reitQuestionAndAnswerFaqs()->getData();
|
||||
// dd($openREITS);
|
||||
return view('Frontend.Pages.reits.index',compact('reits','learnMore', 'openREITS', 'resaleREITS', 'fullyFundedREITS'));
|
||||
}
|
||||
|
||||
public function product($slug = ''){
|
||||
$reit = StockFundsRealEstateExchange::where('slug',$slug)->first();
|
||||
$productData = StockFundsRealEstateExchange::where('slug','=',$slug)->first();
|
||||
$productData = Product::where('id','=',$productData->products_id)->first();
|
||||
// dd($productData);
|
||||
return view('Frontend.Pages.reits.product',compact('reit','productData'));
|
||||
|
||||
}
|
||||
|
||||
public function reitsAllData($type = 'Open')
|
||||
{
|
||||
try {
|
||||
return (new test(Product::has('exchanges')->with('exchanges')->reits()->where('type',$type)->get()))
|
||||
->response()
|
||||
->setStatusCode(200);
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['message' => $e->getMessage()], 400);
|
||||
}
|
||||
}
|
||||
}
|
||||
85
app/Http/Controllers/Frontend/GlobalRealAssetController.php
Normal file
85
app/Http/Controllers/Frontend/GlobalRealAssetController.php
Normal file
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Frontend;
|
||||
|
||||
use App\Models\Product;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Frontend\GlobalRealEstateService;
|
||||
use App\Http\Resources\FractionalRealEstate as test;
|
||||
|
||||
class GlobalRealAssetController extends Controller
|
||||
{
|
||||
protected $gre;
|
||||
|
||||
public function __construct(GlobalRealEstateService $gre)
|
||||
{
|
||||
$this->gre = $gre;
|
||||
}
|
||||
public function index(){
|
||||
return view('Frontend.Pages.global-real-estate.index');
|
||||
}
|
||||
|
||||
public function industrial(){
|
||||
// dd($this->gre->openGIRE()->getData());
|
||||
return view('Frontend.Pages.global-real-estate.industrial',[
|
||||
'openGIRE' => $this->gre->openGIRE()->getData(),
|
||||
'fullyFundedGIRE' => $this->gre->fullyFundedGIRE()->getData(),
|
||||
'resaleGIRE' => $this->gre->resaleGIRE()->getData(),
|
||||
'learnMore' => $this->gre->globalIndustrialRealEstateLearnMore()->getData()
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
public function residential(){
|
||||
// dd($this->gre->openGRRE()->getData());
|
||||
return view('Frontend.Pages.global-real-estate.residential',[
|
||||
'openGRRE' => $this->gre->openGRRE()->getData(),
|
||||
'fullyFundedGRRE' => $this->gre->fullyFundedGRRE()->getData(),
|
||||
'resaleGRRE' => $this->gre->resaleGRRE()->getData(),
|
||||
'learnMore' => $this->gre->globalResidentialRealEstateLearnMore()->getData()
|
||||
]);
|
||||
}
|
||||
|
||||
public function commercial(){
|
||||
// dd($this->gre->openGCRE()->getData());
|
||||
return view('Frontend.Pages.global-real-estate.commercial',[
|
||||
'openGCRE' => $this->gre->openGCRE()->getData(),
|
||||
'fullyFundedGCRE' => $this->gre->fullyFundedGCRE()->getData(),
|
||||
'resaleGCRE' => $this->gre->resaleGCRE()->getData(),
|
||||
'learnMore' => $this->gre->globalCommercialRealEstateLearnMore()->getData()
|
||||
]);
|
||||
}
|
||||
|
||||
public function globalIndustrialRealEstateAllData($type = 'Open')
|
||||
{
|
||||
try {
|
||||
return (new test(Product::has('realEstate')->with('realEstate.photo')->globalIndustrialRealEstate()->where('type',$type)->active()->get()))
|
||||
->response()
|
||||
->setStatusCode(200);
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['message' => $e->getMessage()], 400);
|
||||
}
|
||||
}
|
||||
|
||||
public function globalResidentialRealEstateAllData($type = 'Open')
|
||||
{
|
||||
try {
|
||||
return (new test(Product::has('realEstate')->with('realEstate.photo')->globalResidentialRealEstate()->where('type',$type)->active()->get()))
|
||||
->response()
|
||||
->setStatusCode(200);
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['message' => $e->getMessage()], 400);
|
||||
}
|
||||
}
|
||||
|
||||
public function globalCommercialRealEstateAllData($type = 'Open')
|
||||
{
|
||||
try {
|
||||
return (new test(Product::has('realEstate')->with('realEstate.photo')->globalCommercialRealEstate()->where('type',$type)->active()->get()))
|
||||
->response()
|
||||
->setStatusCode(200);
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['message' => $e->getMessage()], 400);
|
||||
}
|
||||
}
|
||||
}
|
||||
45
app/Http/Controllers/Frontend/GlobalVentureCapitalFund.php
Normal file
45
app/Http/Controllers/Frontend/GlobalVentureCapitalFund.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Frontend;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Resources\FractionalRealEstate as test;
|
||||
use App\Models\Product;
|
||||
use App\Models\Fund;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Admin\ManageFreeUInvestments\FractionalRealEstateController as FractionalRealEstateFrontendController;
|
||||
|
||||
class GlobalVentureCapitalFund extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$ventureCapital = $this->ventureCapitalAllData()->getData();
|
||||
$openGVCF = Product::has('funds')->with('funds','categorys')->funds()->globalVentureCapitalFund()->open()->active()->latest()->get();
|
||||
$resaleGVCF = Product::has('funds')->with('funds','categorys')->funds()->globalVentureCapitalFund()->resale()->active()->latest()->get();
|
||||
$fullyFundedGVCF = Product::has('funds')->with('funds','categorys')->funds()->globalVentureCapitalFund()->fullyFunded()->active()->latest()->get();
|
||||
$learnMore = (new FractionalRealEstateFrontendController)->globalVentureCapitalFundQuestionAndAnswer()->getData();
|
||||
// $faqs = (new FractionalRealEstateFrontendController)->globalVentureCapitalFundQuestionAndAnswerFaqs()->getData();
|
||||
// dd($openGVCF);
|
||||
return view('Frontend.Pages.venture-capital-funds.index',compact('ventureCapital','learnMore','openGVCF', 'resaleGVCF', 'fullyFundedGVCF'));
|
||||
}
|
||||
|
||||
public function product($slug = '')
|
||||
{
|
||||
$ventureCapitalFund = Fund::where('slug',$slug)->first();
|
||||
$productData = Fund::where('slug','=',$slug)->first();
|
||||
$productData = Product::where('id','=',$productData->products_id)->first();
|
||||
// dd($ventureCapitalFund);
|
||||
return view('Frontend.Pages.venture-capital-funds.product',compact('ventureCapitalFund','productData'));
|
||||
}
|
||||
|
||||
public function ventureCapitalAllData()
|
||||
{
|
||||
try {
|
||||
return (new test(Product::has('funds')->with('funds')->funds()->globalVentureCapitalFund()->get()))
|
||||
->response()
|
||||
->setStatusCode(200);
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['message' => $e->getMessage()], 400);
|
||||
}
|
||||
}
|
||||
}
|
||||
146
app/Http/Controllers/Frontend/HandpickedInvestmentController.php
Normal file
146
app/Http/Controllers/Frontend/HandpickedInvestmentController.php
Normal file
@@ -0,0 +1,146 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Frontend;
|
||||
|
||||
use App\Models\Product;
|
||||
use App\Models\Category;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\FractionalRealEstate;
|
||||
|
||||
class HandpickedInvestmentController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$urlCategories = $this->decode_arr(request()->categories) ?? null;
|
||||
$assetType = request()->assetType ?? null;
|
||||
$geographicFocus = request()->geographicFocus ?? null;
|
||||
$products = $this->filterData(request()->search ?? '', $urlCategories, $assetType, $geographicFocus);
|
||||
$type = FractionalRealEstate::select('asset_type')->distinct()->get();
|
||||
$categories = Product::query()
|
||||
->join('categories', 'products.categories_id', 'categories.id')
|
||||
->select('categories.id', 'category_name')
|
||||
->distinct('categories_id')
|
||||
->where('categories.status', true)
|
||||
->get();
|
||||
// dd($products);
|
||||
return view('Frontend.Pages.handpicked-investment', compact('products', 'type', 'categories', 'urlCategories'));
|
||||
}
|
||||
|
||||
function fetchData(Request $request)
|
||||
{
|
||||
// dd($request->get('geographicFocus'));
|
||||
if ($request->ajax()) {
|
||||
$products = $this->filterData($request->get('query'), $request->get('categories'), $request->get('assetType'), $request->get('geographicFocus'));
|
||||
// dd($products);
|
||||
return view('Frontend.Pages.handpicked-investment.pagination', compact('products'))->render();
|
||||
}
|
||||
}
|
||||
|
||||
public function filterData($query, $categories, $assetType, $geographicFocus)
|
||||
{
|
||||
if (!is_array($categories) && $categories)
|
||||
$categories = explode(',', $categories);
|
||||
// dd($categories);
|
||||
$faCategoriesArr = [
|
||||
Category::FractionalRealEstateId,
|
||||
Category::VentureCapitalFundId,
|
||||
Category::InfrastructureFundId,
|
||||
Category::AngelFundId,
|
||||
Category::PrivateEquityFundId,
|
||||
Category::DebtFundId,
|
||||
Category::PrivateRealEstateFundId,
|
||||
Category::HedgeFundId,
|
||||
Category::PrivateInvestmentInPublicEquityFundId,
|
||||
Category::SovereignGovernmentBondId,
|
||||
Category::GlobalMutualFundId,
|
||||
Category::EquitiesId,
|
||||
Category::GlobalHedgeFundId,
|
||||
];
|
||||
|
||||
$reCategoriesArr = [
|
||||
Category::IndianResidentialRealEstateID,
|
||||
Category::IndianCommercialRealEstateID,
|
||||
Category::IndianIndustrialRealEstateID,
|
||||
Category::GlobalResidentialRealEstateID,
|
||||
Category::GlobalCommercialRealEstateID,
|
||||
Category::GlobalIndustrialRealEstateID,
|
||||
];
|
||||
|
||||
$products = Product::query()
|
||||
->select(DB::raw('products.id, products.categories_id as category_id, coalesce(fre.property_name_and_location,aif.fund_name,re.property_name,funds.fund_name) as product_name'), DB::raw('coalesce(companies.company_logo) as company_logo'), DB::raw('coalesce(fre.slug,aif.slug,re.slug, funds.slug) as slug'), DB::raw('coalesce(fre.geographic_focus,aif.geographic_focus,re.geographic_focus, funds.geographic_focus) as geographic_focus'), DB::raw('coalesce(aif.minimum_capital_commitment,fre.minimum_investment,funds.minimum_investment,re.total_price) as minimum_investment'), DB::raw('coalesce(aif.description,fre.property_description,re.remarks,funds.fund_description) as description'), DB::raw('coalesce(categories.category_name) as category_name'))
|
||||
->leftJoin('fractional_real_estates as fre', 'products.id', 'fre.products_id')
|
||||
->leftJoin('alternative_investment_funds as aif', 'products.id', 'aif.products_id')
|
||||
->leftJoin('companies', 'fre.companies_id', 'companies.id')
|
||||
->leftJoin('real_estates as re', 'products.id', 're.products_id')
|
||||
->leftJoin('categories', 'products.categories_id', 'categories.id')
|
||||
->leftJoin('funds', 'products.id', 'funds.products_id')
|
||||
->when($assetType == 'financial-assets', function ($query) use ($faCategoriesArr, $geographicFocus) {
|
||||
$query->whereIn('products.categories_id', $faCategoriesArr);
|
||||
$query->when($geographicFocus, function ($query) use ($geographicFocus) {
|
||||
$query->where(function ($query) use ($geographicFocus) {
|
||||
$query->where('fre.geographic_focus', $geographicFocus);
|
||||
$query->orWhere('aif.geographic_focus', $geographicFocus);
|
||||
$query->orWhere('funds.geographic_focus', $geographicFocus);
|
||||
});
|
||||
});
|
||||
})
|
||||
->when($assetType == 'real-assets', function ($query) use ($reCategoriesArr, $geographicFocus) {
|
||||
$query->whereIn('products.categories_id', $reCategoriesArr);
|
||||
$query->when($geographicFocus, function ($query) use ($geographicFocus) {
|
||||
$query->where('re.geographic_focus', $geographicFocus);
|
||||
});
|
||||
})
|
||||
->when($assetType == null && $geographicFocus, function ($query) use ($geographicFocus) {
|
||||
$query->where(function ($query) use ($geographicFocus) {
|
||||
$query->where('fre.geographic_focus', $geographicFocus)
|
||||
->orWhere('aif.geographic_focus', $geographicFocus)
|
||||
->orWhere('funds.geographic_focus', $geographicFocus)
|
||||
->orWhere('re.geographic_focus', $geographicFocus);
|
||||
});
|
||||
})
|
||||
// ->when($assetType && $geographicFocus, function ($query) use ($geographicFocus) {
|
||||
// $query->where(function ($query) use ($geographicFocus) {
|
||||
// $query->where('fre.geographic_focus', $geographicFocus)
|
||||
// ->orWhere('aif.geographic_focus', $geographicFocus)
|
||||
// ->orWhere('funds.geographic_focus', $geographicFocus)
|
||||
// ->orWhere('re.geographic_focus', $geographicFocus);
|
||||
// });
|
||||
// })
|
||||
// ->when($geographicFocus, function ($query) use ($geographicFocus, $categories){
|
||||
// $query->where('fre.geographic_focus', $geographicFocus);
|
||||
// $query->orWhere('aif.geographic_focus', $geographicFocus);
|
||||
// $query->orWhere('funds.geographic_focus', $geographicFocus);
|
||||
// $query->orWhere('re.geographic_focus', $geographicFocus);
|
||||
// $query->when($categories, function($query) use ($categories){
|
||||
// $query->whereIn('products.categories_id', $categories);
|
||||
// });
|
||||
// })
|
||||
->when($categories, function ($query) use ($categories) {
|
||||
$query->whereIn('products.categories_id', $categories);
|
||||
})
|
||||
->where(function($query){
|
||||
$query->where('products.status', true);
|
||||
$query->where('categories.status', true);
|
||||
})
|
||||
// ->orWhereIn('products.categories_id', ['2','28'])
|
||||
->paginate(6);
|
||||
// ->get();
|
||||
// return $categories;
|
||||
// return $products->toArray();
|
||||
$products->appends(['search' => $query, 'categories' => $this->encode_arr($categories)]);
|
||||
|
||||
return $products->withPath('/primary-investment');
|
||||
}
|
||||
|
||||
function encode_arr($data)
|
||||
{
|
||||
return base64_encode(serialize($data));
|
||||
}
|
||||
|
||||
function decode_arr($data)
|
||||
{
|
||||
return unserialize(base64_decode($data));
|
||||
}
|
||||
}
|
||||
65
app/Http/Controllers/Frontend/HighYieldFinanceController.php
Normal file
65
app/Http/Controllers/Frontend/HighYieldFinanceController.php
Normal file
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Frontend;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Product;
|
||||
use App\Http\Resources\FractionalRealEstate as test;
|
||||
use App\Http\Resources\HighYieldFinanceResource;
|
||||
use App\Models\HighYieldFinance;
|
||||
use App\Http\Controllers\Admin\ManageFreeUInvestments\HighYieldFinanceController as HighYieldFinanceFrontendController;
|
||||
use App\Http\Controllers\Admin\ManageFreeUInvestments\FractionalRealEstateController as FractionalRealEstateFrontendController;
|
||||
|
||||
class HighYieldFinanceController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$highYieldFinance = $this->highYieldFinance()->getData();
|
||||
$learnMore = (new FractionalRealEstateFrontendController)->highYieldFinanceQuestionAndAnswer()->getData();
|
||||
$faqs = (new FractionalRealEstateFrontendController)->highYieldFinanceQuestionAndAnswerFaqs()->getData();
|
||||
return view('Frontend.Pages.high-yield-finance.index', compact('highYieldFinance','learnMore','faqs'));
|
||||
}
|
||||
|
||||
public function product($slug)
|
||||
{
|
||||
$highYieldFinance = $this->highYieldFinanceData($slug)->getData()->data;
|
||||
$otherHYF = HighYieldFinance::query()
|
||||
->join('products', 'high_yield_finances.products_id', 'products.id')
|
||||
->where('status',true)
|
||||
->where('slug', '!=', $slug)
|
||||
->where('categories_id',1)
|
||||
->get();
|
||||
// dd($otherHYF);
|
||||
$productData = HighYieldFinance::where('slug','=',$slug)->first();
|
||||
$productData = Product::where('id','=',$productData->products_id)->first();
|
||||
return view('Frontend.Pages.high-yield-finance.product', compact('highYieldFinance','otherHYF','productData'));
|
||||
}
|
||||
|
||||
// public function highYieldFinance(){
|
||||
// $highYieldFinance = Product::with('highYieldFinances', 'category')->highYieldFinances()->active()->get();
|
||||
// return $highYieldFinance;
|
||||
// }
|
||||
|
||||
public function highYieldFinance()
|
||||
{
|
||||
try {
|
||||
return (new test(Product::has('highYieldFinances')->with('highYieldFinances')->active()->get()))
|
||||
->response()
|
||||
->setStatusCode(200);
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['message' => $e->getMessage()], 400);
|
||||
}
|
||||
}
|
||||
|
||||
public function highYieldFinanceData($slug)
|
||||
{
|
||||
try {
|
||||
return (new HighYieldFinanceResource(HighYieldFinance::where('slug', $slug)->first()))
|
||||
->response()
|
||||
->setStatusCode(200);
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['message' => $e->getMessage()], 400);
|
||||
}
|
||||
}
|
||||
}
|
||||
244
app/Http/Controllers/Frontend/HomeController.php
Normal file
244
app/Http/Controllers/Frontend/HomeController.php
Normal file
@@ -0,0 +1,244 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Frontend;
|
||||
|
||||
// use Mail;
|
||||
use App\Models\User;
|
||||
use App\Models\Lead;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\AlternativeInvestmentFund;
|
||||
use App\Models\Bonds;
|
||||
use App\Models\Product;
|
||||
use App\Models\CleanAndGreenAsset;
|
||||
use App\Models\FractionalRealEstate;
|
||||
use App\Models\Fund;
|
||||
use App\Models\Category;
|
||||
use App\Models\HighYieldFinance;
|
||||
use App\Models\InvoiceDiscounting;
|
||||
use App\Models\LeaseBasedFinancing;
|
||||
use App\Models\PeerToPeerLending;
|
||||
use App\Models\SecuritizedDebtInstrument;
|
||||
use App\Models\VentureDebt;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Notifications\UserAdmin;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
|
||||
class HomeController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
// dd($this->getAllTopPickProducts());
|
||||
return view('Frontend.Pages.index',[
|
||||
'topPicks' => $this->getAllTopPickProducts()
|
||||
]);
|
||||
}
|
||||
|
||||
public function getAllTopPickProducts(){
|
||||
$data['data'] = Product::getAllDetails()->where('top_pick',true)->get();
|
||||
// foreach($data['data'] as $row)
|
||||
// {
|
||||
// $category = Category::where('category_name', '=', $row->category_name)->first();
|
||||
// $row['category_id'] = $category->id;
|
||||
// }
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function productFilter(Request $request){
|
||||
$userInput = trim($request->filter[0],'[,]');
|
||||
|
||||
$minimumInvestment = [
|
||||
1 => [
|
||||
// 'symbol' => '>',
|
||||
'less_than' => 0,
|
||||
'greater_than' => 100000.00
|
||||
],
|
||||
2 => [
|
||||
// 'symbol' => '<',
|
||||
'less_than' => 100000.01,
|
||||
'greater_than' => 500000.00
|
||||
],
|
||||
3 => [
|
||||
// 'symbol' => '<',
|
||||
'less_than' => 500000.01,
|
||||
'greater_than' => 2500000.00
|
||||
],
|
||||
4 => [
|
||||
// 'symbol' => '<',
|
||||
'less_than' => 2500000.01,
|
||||
'greater_than' => 5000000.00
|
||||
],
|
||||
5 => [
|
||||
// 'symbol' => '<',
|
||||
'less_than' => 5000000.01,
|
||||
'greater_than' => 500000.00
|
||||
],
|
||||
];
|
||||
|
||||
$key['indian-financial-assets'] = false;
|
||||
$key['indian-real-assets'] = true;
|
||||
$key['global-financial-assets'] = false;
|
||||
$key['global-real-assets'] = true;
|
||||
foreach (explode(',',$userInput) as $filter) {
|
||||
if ($key['indian-financial-assets'] == false) {
|
||||
$key['indian-financial-assets'] = $this->checkIFAFilter($minimumInvestment[$filter]['less_than'], $minimumInvestment[$filter]['greater_than']);
|
||||
}
|
||||
if ($key['global-financial-assets'] == false) {
|
||||
$key['global-financial-assets'] = $this->checkGFAFilter($minimumInvestment[$filter]['less_than'], $minimumInvestment[$filter]['greater_than']);
|
||||
}
|
||||
}
|
||||
$data['data'] = $key;
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function checkIFAFilter($lessThan, $greaterThan)
|
||||
{
|
||||
if (FractionalRealEstate::whereBetween('minimum_investment_in_int', [$lessThan, $greaterThan])->exists() || AlternativeInvestmentFund::whereBetween('minimum_investment', [$lessThan, $greaterThan])->exists() || CleanAndGreenAsset::whereBetween('minimum_investment_in_int', [$lessThan, $greaterThan])->exists() || HighYieldFinance::whereBetween('minimum_investment_in_int', [$lessThan, $greaterThan])->exists() || InvoiceDiscounting::whereBetween('minimum_investment_in_int', [$lessThan, $greaterThan])->exists() || LeaseBasedFinancing::whereBetween('minimum_investment_in_int', [$lessThan, $greaterThan])->exists() || PeerToPeerLending::whereBetween('minimum_investment_in_int', [$lessThan, $greaterThan])->exists() || SecuritizedDebtInstrument::whereBetween('minimum_investment_in_int', [$lessThan, $greaterThan])->exists() || VentureDebt::whereBetween('minimum_investment_in_int', [$lessThan, $greaterThan])->exists()) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function checkGFAFilter($lessThan, $greaterThan)
|
||||
{
|
||||
if (Bonds::whereBetween('minimum_investment', [$lessThan, $greaterThan])->exists() || Fund::whereBetween('minimum_investment', [$lessThan, $greaterThan])->exists()) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function investNow(Request $request)
|
||||
{
|
||||
$validator = Validator::make($request->all(), [
|
||||
'product_id' => 'required',
|
||||
], [
|
||||
'required' => 'Please Select a product!!',
|
||||
]);
|
||||
$validationMessage = $this->validationError($validator);
|
||||
if ($validationMessage) {
|
||||
return response()->json(['status' => 400, 'message' => $validationMessage]);
|
||||
}
|
||||
if (!auth()->guard('users')->check()) {
|
||||
return response()->json(['status' => 201, 'message' => 'Please Login To Invest']);
|
||||
}
|
||||
|
||||
$checkUserBlock = User::where(['id' => auth()->guard('users')->user()->id, 'status' => 1 ])->doesntExist();
|
||||
if($checkUserBlock){
|
||||
return response()->json(['status' => 403, 'message' => "Please contact us"]);
|
||||
}
|
||||
|
||||
$addLead = Lead::create([
|
||||
'users_id' => auth()->guard('users')->user()->id,
|
||||
'lead_owner' => null,
|
||||
'products_id' => $request->product_id,
|
||||
'first_name' => auth()->guard('users')->user()->name,
|
||||
'email' => auth()->guard('users')->user()->email,
|
||||
'mobile' => auth()->guard('users')->user()->contact_number,
|
||||
'lead_status' => 'New'
|
||||
]);
|
||||
|
||||
if ($addLead) {
|
||||
$userName = auth()->guard('users')->user()->name;
|
||||
$notify['message'] = "$userName is interested in a product!";
|
||||
$type = "Buyer Form";
|
||||
$users = User::admins()->get();
|
||||
foreach ($users as $data) {
|
||||
$data->notify(new UserAdmin($notify, $type));
|
||||
}
|
||||
}
|
||||
return response()->json(['status' => 200, 'message' => 'Invest Now Successfull']);
|
||||
}
|
||||
|
||||
public function investNowAPI(Request $request)
|
||||
{
|
||||
$validator = Validator::make($request->all(), [
|
||||
'product_id' => 'required',
|
||||
], [
|
||||
'required' => 'Please Select a product!!',
|
||||
]);
|
||||
$validationMessage = $this->validationError($validator);
|
||||
if ($validationMessage) {
|
||||
return response()->json(['status' => 400, 'message' => $validationMessage]);
|
||||
}
|
||||
// if (!auth()->guard('users')->check()) {
|
||||
// return response()->json(['status' => 200, 'message' => 'Please Login To Invest']);
|
||||
// }
|
||||
|
||||
$addLead = Lead::create([
|
||||
'users_id' => $request->user()->id,
|
||||
'lead_owner' => null,
|
||||
'products_id' => $request->product_id,
|
||||
'first_name' => $request->user()->name,
|
||||
'email' => $request->user()->email,
|
||||
'mobile' => $request->user()->contact_number,
|
||||
'lead_status' => 'New'
|
||||
]);
|
||||
|
||||
if ($addLead) {
|
||||
$userName = auth()->guard('users')->user()->name;
|
||||
$notify['message'] = "$userName is interested in a product!";
|
||||
$type = "Buyer Form";
|
||||
$users = User::admins()->get();
|
||||
foreach ($users as $data) {
|
||||
$data->notify(new UserAdmin($notify, $type));
|
||||
}
|
||||
}
|
||||
|
||||
return response()->json(['status' => 200, 'message' => 'Invest Now Successfull']);
|
||||
}
|
||||
|
||||
public function updateAllNotification()
|
||||
{
|
||||
$user = User::find(auth()->guard('users')->user()->id);
|
||||
$checkNotificationsRead = $user->notifications->markAsRead();
|
||||
return response()->json(['status' => 200, 'message' => 'All Notifications mark as read']);
|
||||
}
|
||||
|
||||
public function getAllNotificationsApi(Request $request)
|
||||
{
|
||||
$user = User::find($request->user()->id);
|
||||
$dataArray = array();
|
||||
foreach($user->unreadNotifications as $data)
|
||||
{
|
||||
$notify['id'] = $data->id;
|
||||
$notify['message'] = $data->data['message'];
|
||||
$notify['time'] = $data->created_at->diffForHumans();
|
||||
array_push($dataArray,$notify);
|
||||
}
|
||||
// array_push($notificationArray,$dataArray);
|
||||
$notificationArray['data'] = $dataArray;
|
||||
return $notificationArray;
|
||||
}
|
||||
|
||||
public function updateSingleNotification($id){
|
||||
if(!$id){
|
||||
return response()->json(['status' => 400, 'message' => 'Error Marking it as read!'],400);
|
||||
};
|
||||
$user = User::find(request()->user()->id);
|
||||
$user->notifications->where('id', $id)->markAsRead();
|
||||
return response()->json(['status' => 200, 'message' => 'Notification mark as read']);
|
||||
}
|
||||
|
||||
public function checkPin(Request $request){
|
||||
if(!$request->pin){
|
||||
return response()->json(['message'=> 'Please Enter Pin!'],400);
|
||||
}
|
||||
$pin = User::find($request->user()->id);
|
||||
if($request->pin == $pin->pin){
|
||||
return response()->json(['message'=> 'Pin Matched!'],200);
|
||||
}
|
||||
return response()->json(['message'=> 'Pin did not matched!'],400);
|
||||
|
||||
}
|
||||
|
||||
public function validationError($validator)
|
||||
{
|
||||
if ($validator->fails()) {
|
||||
$errors = $validator->errors();
|
||||
$messages = '';
|
||||
foreach ($errors->all() as $message) {
|
||||
$messages .= $message . '</br>';
|
||||
}
|
||||
return $messages;
|
||||
}
|
||||
}
|
||||
}
|
||||
106
app/Http/Controllers/Frontend/IndianRealAssetController.php
Normal file
106
app/Http/Controllers/Frontend/IndianRealAssetController.php
Normal file
@@ -0,0 +1,106 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Frontend;
|
||||
|
||||
use App\Models\Product;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Resources\FractionalRealEstate as test;
|
||||
use App\Http\Resources\RealEstateResource;
|
||||
use App\Models\RealEstate;
|
||||
use App\Http\Controllers\Admin\ManageFreeUInvestments\FractionalRealEstateController as FractionalRealEstateFrontendController;
|
||||
|
||||
class IndianRealAssetController extends Controller
|
||||
{
|
||||
|
||||
public function index()
|
||||
{
|
||||
return view('Frontend.Pages.indian-real-estate.index');
|
||||
}
|
||||
|
||||
public function industrial()
|
||||
{
|
||||
$realEstate = $this->indianIndustrialRealEstateAllData()->getData();
|
||||
$openIIRE = Product::has('realEstate')->with('realEstate','categorys')->indianIndustrialRealEstate()->open()->active()->get();
|
||||
$resaleIIRE = Product::has('realEstate')->with('realEstate','categorys')->indianIndustrialRealEstate()->resale()->active()->get();
|
||||
$fullyFundedIIRE = Product::has('realEstate')->with('realEstate','categorys')->indianIndustrialRealEstate()->fullyFunded()->active()->get();
|
||||
$learnMore = (new FractionalRealEstateFrontendController)->indianIndustrialRealEstateQuestionAndAnswer()->getData();
|
||||
// dd($openIIRE);
|
||||
return view('Frontend.Pages.indian-real-estate.industrial', compact('realEstate', 'learnMore', 'openIIRE', 'resaleIIRE', 'fullyFundedIIRE'));
|
||||
}
|
||||
|
||||
public function residential()
|
||||
{
|
||||
$realEstate = $this->indianResidentialRealEstateAllData()->getData();
|
||||
$openIRRE = Product::has('realEstate')->with('realEstate','categorys')->indianResidentialRealEstate()->open()->active()->get();
|
||||
$resaleIRRE = Product::has('realEstate')->with('realEstate','categorys')->indianResidentialRealEstate()->resale()->active()->get();
|
||||
$fullyFundedIRRE = Product::has('realEstate')->with('realEstate','categorys')->indianResidentialRealEstate()->fullyFunded()->active()->get();
|
||||
$learnMore = (new FractionalRealEstateFrontendController)->indianResidentialRealEstateQuestionAndAnswer()->getData();
|
||||
// dd($openIRRE);
|
||||
return view('Frontend.Pages.indian-real-estate.residential', compact('realEstate', 'learnMore', 'openIRRE', 'resaleIRRE', 'fullyFundedIRRE'));
|
||||
}
|
||||
|
||||
public function commercial()
|
||||
{
|
||||
$realEstate = $this->indianCommercialRealEstateAllData()->getData();
|
||||
$openICRE = Product::has('realEstate')->with('realEstate','categorys')->indianCommercialRealEstate()->open()->active()->get();
|
||||
$resaleICRE = Product::has('realEstate')->with('realEstate','categorys')->indianCommercialRealEstate()->resale()->active()->get();
|
||||
$fullyFundedICRE = Product::has('realEstate')->with('realEstate','categorys')->indianCommercialRealEstate()->fullyFunded()->active()->get();
|
||||
$learnMore = (new FractionalRealEstateFrontendController)->indianCommercialRealEstateQuestionAndAnswer()->getData();
|
||||
// dd($openICRE);
|
||||
return view('Frontend.Pages.indian-real-estate.commercial', compact('realEstate', 'learnMore', 'openICRE', 'resaleICRE', 'fullyFundedICRE'));
|
||||
}
|
||||
|
||||
public function product($slug)
|
||||
{
|
||||
$realEstate = RealEstate::with('realEstatePhoto')->where('slug', $slug)->first();
|
||||
$productData = RealEstate::where('slug', '=', $slug)->first();
|
||||
$productData = Product::where('id', '=', $productData->products_id)->first();
|
||||
// dd($realEstate);
|
||||
return view('Frontend.Pages.indian-real-estate.product', compact('realEstate', 'productData'));
|
||||
}
|
||||
|
||||
public function indianIndustrialRealEstateAllData($type = 'Open')
|
||||
{
|
||||
try {
|
||||
return (new test(Product::has('realEstate')->with('realEstate.photo')->indianIndustrialRealEstate()->where('type',$type)->active()->get()))
|
||||
->response()
|
||||
->setStatusCode(200);
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['message' => $e->getMessage()], 400);
|
||||
}
|
||||
}
|
||||
|
||||
public function indianResidentialRealEstateAllData($type = 'Open')
|
||||
{
|
||||
try {
|
||||
return (new test(Product::has('realEstate')->with('realEstate.photo')->indianResidentialRealEstate()->where('type',$type)->active()->get()))
|
||||
->response()
|
||||
->setStatusCode(200);
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['message' => $e->getMessage()], 400);
|
||||
}
|
||||
}
|
||||
|
||||
public function indianCommercialRealEstateAllData($type = 'Open')
|
||||
{
|
||||
try {
|
||||
return (new test(Product::has('realEstate')->with('realEstate.photo')->indianCommercialRealEstate()->where('type',$type)->active()->get()))
|
||||
->response()
|
||||
->setStatusCode(200);
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['message' => $e->getMessage()], 400);
|
||||
}
|
||||
}
|
||||
|
||||
public function realEstateData($slug)
|
||||
{
|
||||
try {
|
||||
return (new RealEstateResource(RealEstate::where('slug', $slug)->first()))
|
||||
->response()
|
||||
->setStatusCode(200);
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['message' => $e->getMessage()], 400);
|
||||
}
|
||||
}
|
||||
}
|
||||
157
app/Http/Controllers/Frontend/InsightsController.php
Normal file
157
app/Http/Controllers/Frontend/InsightsController.php
Normal file
@@ -0,0 +1,157 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Frontend;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Admin\Tag;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Admin\Blog;
|
||||
|
||||
class InsightsController extends Controller
|
||||
{
|
||||
//
|
||||
public function index()
|
||||
{
|
||||
$blogs = $this->filterData(request()->search ?? '');
|
||||
// $blogs = $this->filterData('');
|
||||
$recent_post = Blog::where('is_active', true)->latest()->paginate(6);
|
||||
// $recent_post = Blog::where('is_active', true)->latest()->take(6)->get();
|
||||
$categories = Tag::whereHas('blogs', function ($query) {
|
||||
$query->where('is_active', true);
|
||||
})->withcount('blogs')->get();
|
||||
$tags = Tag::all();
|
||||
// dd($recent_post);
|
||||
return view('Frontend.Pages.resources.insights', compact('blogs', 'recent_post', 'categories', 'tags'));
|
||||
}
|
||||
|
||||
public function readMore($slug)
|
||||
{
|
||||
$blogs = Blog::where('is_active', true)->where('slug', $slug)->firstorFail();
|
||||
// dd($blogs);
|
||||
// return $blog;
|
||||
$all_blogs = Blog::where('is_active', true)->where('slug', '!=', $slug)->take(2)->get();
|
||||
$recent_post = Blog::where('is_active', true)->where('slug', '!=', $slug)->latest()->take(4)->get();
|
||||
$categories = Tag::whereHas('blogs', function ($query) {
|
||||
$query->where('is_active', true);
|
||||
})->withcount('blogs')->get();
|
||||
return view('Frontend.Pages.resources.readmore', compact('blogs', 'recent_post', 'all_blogs', 'categories'));
|
||||
}
|
||||
|
||||
public function tagDetail(Request $request)
|
||||
{
|
||||
$id = $request->get('id');
|
||||
|
||||
$blogs = Blog::query()
|
||||
->leftJoin('tags', 'blog.tag_id', 'tags.id')
|
||||
->when(request('id') !== '0', function ($query) use ($id) {
|
||||
return $query->where('tags.id', $id);
|
||||
})
|
||||
->select('blog.*')
|
||||
->get();
|
||||
|
||||
|
||||
$data = '';
|
||||
|
||||
foreach ($blogs as $blog) {
|
||||
$date = $blog->created_at->format('F jS, Y');
|
||||
$route = route('readmore', $blog->slug);
|
||||
$blog_title = mb_strimwidth($blog->blog_title, 0, 50, "...");
|
||||
$description = mb_strimwidth($blog->blog_description, 0, 150, "...");
|
||||
$data .= "<div class='col-md-6' style='height: 425px; margin-bottom:20px;'>
|
||||
<div class='insight-card h-100'>
|
||||
<img src='$blog->blog_image' />
|
||||
<h2>$blog_title</h2>
|
||||
<span>
|
||||
<i class='fa fa-calendar-minus-o' aria-hidden='true'></i>
|
||||
$date-
|
||||
</span>
|
||||
$description</p>
|
||||
<a href='$route'>Read More</a>
|
||||
</div>
|
||||
</div>";
|
||||
}
|
||||
|
||||
if ($data) {
|
||||
return $data;
|
||||
}
|
||||
return 'No Data Found';
|
||||
}
|
||||
|
||||
public function getAllTags()
|
||||
{
|
||||
$tags = Tag::has('blogs')->select('id', 'tag_name')->get();
|
||||
return response()->json([
|
||||
"status" => "success",
|
||||
"code" => 200,
|
||||
"data" => $tags
|
||||
]);
|
||||
}
|
||||
|
||||
public function getAllBlogs(Request $request)
|
||||
{
|
||||
if ($request->method() == 'POST') {
|
||||
$search = $request->search;
|
||||
$tag_id = $request->tag_id;
|
||||
}
|
||||
|
||||
$blogs = Blog::query()->when(request('search'), function ($query) use ($search) {
|
||||
$query->where('blog_title', 'like', '%' . $search . '%')
|
||||
->orWhere('blog_description', 'like', '%' . $search . '%');
|
||||
})->when(request('tag_id'), function ($query) use ($tag_id) {
|
||||
$query->where('tag_id', $tag_id);
|
||||
})
|
||||
->where('is_active', true)
|
||||
->select('id', 'blog_image', 'blog_title', 'blog_description', \DB::raw("DATE_FORMAT(created_at, '%M %d,%Y') as date"), 'blog_description as minutes_to_read')
|
||||
->get();
|
||||
|
||||
if ($blogs) {
|
||||
return response()->json([
|
||||
"status" => "success",
|
||||
"code" => 200,
|
||||
"data" => $blogs
|
||||
]);
|
||||
} else {
|
||||
return response()->json([
|
||||
"status" => "failed",
|
||||
"code" => 400,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
public function singleBlog($id)
|
||||
{
|
||||
$blog = Blog::where('is_active', true)->findOrFail($id);
|
||||
return response()->json([
|
||||
"status" => "success",
|
||||
"code" => 200,
|
||||
"data" => $blog
|
||||
]);
|
||||
}
|
||||
|
||||
function fetchBlog(Request $request)
|
||||
{
|
||||
if ($request->ajax()) {
|
||||
$blogs = $this->filterData($request->get('query'));
|
||||
// dd($blogs);
|
||||
return view('Frontend.Pages.resources.insights-component', compact('blogs'))->render();
|
||||
}
|
||||
}
|
||||
|
||||
public function filterData($query)
|
||||
{
|
||||
$blogs = Blog::where('is_active', 1)
|
||||
// ->count();
|
||||
// ->orWhere('blog_title', 'like', '%' . $query . '%')
|
||||
->where(function ($q) use ($query) {
|
||||
$q->orWhere('blog_title', 'like', '%' . $query . '%');
|
||||
$q->orWhere('blog_description', 'like', '%' . $query . '%');
|
||||
})
|
||||
// ->whereAny(['blog_title','blog_description'], 'LIKE',"%' $query%")
|
||||
// ->orWhere('blog_description', 'like', '%' . $query . '%')
|
||||
->latest()
|
||||
->paginate(6);
|
||||
// return $blogs;
|
||||
$blogs->appends(['search' => $query]);
|
||||
return $blogs->withPath('/insights');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Frontend;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\InvoiceDiscounting;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Product;
|
||||
use App\Http\Resources\FractionalRealEstate as test;
|
||||
use App\Http\Resources\InvoiceDiscountingResource;
|
||||
use App\Http\Controllers\Admin\ManageFreeUInvestments\InvoiceDiscountingController as InvoiceDiscountingFontendController;
|
||||
use App\Http\Controllers\Admin\ManageFreeUInvestments\FractionalRealEstateController as FractionalRealEstateFrontendController;
|
||||
|
||||
class InvoiceDiscountingController extends Controller
|
||||
{
|
||||
public function index(){
|
||||
$invoiceDiscounting = $this->invoiceDiscounting()->getData();
|
||||
$learnMore = (new FractionalRealEstateFrontendController)->invoiceDiscountingQuestionAndAnswer()->getData();
|
||||
$faqs = (new FractionalRealEstateFrontendController)->invoiceDiscountingQuestionAndAnswerFaqs()->getData();
|
||||
return view('Frontend.Pages.invoice-discounting.index',compact('invoiceDiscounting','learnMore','faqs'));
|
||||
}
|
||||
|
||||
public function product($slug){
|
||||
// $invoiceDiscounting = InvoiceDiscounting::where('slug',$slug)->first();
|
||||
$invoiceDiscounting = $this->invoiceDiscountingData($slug)->getData()->data;
|
||||
$otherID = InvoiceDiscounting::query()
|
||||
->join('products', 'invoice_discountings.products_id', 'products.id')
|
||||
->where(['status' => true, 'categories_id' => 27])
|
||||
// ->where('status',false)
|
||||
->where('slug', '!=', $slug)
|
||||
// ->where('categories_id',26)
|
||||
->get();
|
||||
$productData = InvoiceDiscounting::where('slug','=',$slug)->first();
|
||||
$productData = Product::where('id','=',$productData->products_id)->first();
|
||||
$productData['presentation_file'] = $productData->getRawOriginal('presentation');
|
||||
$productData['fact_sheet_file'] = $productData->getRawOriginal('fact_sheet');
|
||||
// dd($productData);
|
||||
|
||||
return view('Frontend.Pages.invoice-discounting.product',compact('invoiceDiscounting','otherID','productData'));
|
||||
}
|
||||
|
||||
// public function invoiceDiscounting(){
|
||||
// $invoiceDiscounting = Product::with('invoiceDiscounting', 'category')->invoiceDiscounting()->active()->get();
|
||||
// return (object)[
|
||||
// 'status' => 200,
|
||||
// 'data' => $invoiceDiscounting
|
||||
// ];
|
||||
// // return $invoiceDiscounting;
|
||||
// }
|
||||
|
||||
public function invoiceDiscounting()
|
||||
{
|
||||
try {
|
||||
return (new test(Product::has('invoiceDiscounting')->with('invoiceDiscounting')->active()->get()))
|
||||
->response()
|
||||
->setStatusCode(200);
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['message' => $e->getMessage()], 400);
|
||||
}
|
||||
}
|
||||
|
||||
public function invoiceDiscountingData($slug)
|
||||
{
|
||||
try {
|
||||
return (new InvoiceDiscountingResource(InvoiceDiscounting::where('slug',$slug)->first()))
|
||||
->response()
|
||||
->setStatusCode(200);
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['message' => $e->getMessage()], 400);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Frontend;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\LeaseBasedFinancing;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Product;
|
||||
use App\Http\Resources\FractionalRealEstate as test;
|
||||
use App\Http\Resources\LeaseBasedFinancingResource;
|
||||
use App\Http\Controllers\Admin\ManageFreeUInvestments\FractionalRealEstateController as FractionalRealEstateFontendController;
|
||||
|
||||
|
||||
class LeaseBasedFinancingController extends Controller
|
||||
{
|
||||
public function index(){
|
||||
$leadBasedFinancings = $this->leadBasedFinancing()->getData();
|
||||
$learnMore = (new FractionalRealEstateFontendController)->leaseBasedFinancingQuestionAndAnswer()->getData();
|
||||
$faqs = (new FractionalRealEstateFontendController)->leaseBasedFinancingQuestionAndAnswerFaqs()->getData();
|
||||
return view('Frontend.Pages.lease-based-financing.index',compact('leadBasedFinancings','learnMore','faqs'));
|
||||
}
|
||||
|
||||
public function product($slug){
|
||||
// $leaseBasedFinancing = LeaseBasedFinancing::where('slug',$slug)->first();
|
||||
$leaseBasedFinancing = $this->leadBasedFinancingData($slug)->getData()->data;
|
||||
$otherLBF = LeaseBasedFinancing::query()
|
||||
->join('products', 'lease_based_financings.products_id', 'products.id')
|
||||
->where(['status' => true, 'categories_id' => 24])
|
||||
// ->where('status',false)
|
||||
->where('slug', '!=', $slug)
|
||||
// ->where('categories_id',26)
|
||||
->get();
|
||||
|
||||
$productData = LeaseBasedFinancing::where('slug','=',$slug)->first();
|
||||
$productData = Product::where('id','=',$productData->products_id)->first();
|
||||
// $productData['presentation_file'] = $productData->getRawOriginal('presentation');
|
||||
// $productData['fact_sheet_file'] = $productData->getRawOriginal('fact_sheet');
|
||||
return view('Frontend.Pages.lease-based-financing.product',compact('leaseBasedFinancing','otherLBF','productData'));
|
||||
}
|
||||
|
||||
// public function leadBasedFinancing(){
|
||||
// $leadBasedFinancings = Product::with('leaseBasedFinancing', 'category')->leaseBasedFinancing()->active()->get();
|
||||
// return (object)[
|
||||
// 'status' => 200,
|
||||
// 'data' => $leadBasedFinancings
|
||||
// ];
|
||||
// // return $leadBasedFinancings;
|
||||
// }
|
||||
|
||||
public function leadBasedFinancing()
|
||||
{
|
||||
try {
|
||||
return (new test(Product::has('leaseBasedFinancing')->with('leaseBasedFinancing')->active()->get()))
|
||||
->response()
|
||||
->setStatusCode(200);
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['message' => $e->getMessage()], 400);
|
||||
}
|
||||
}
|
||||
|
||||
public function leadBasedFinancingData($slug)
|
||||
{
|
||||
try {
|
||||
return (new LeaseBasedFinancingResource(LeaseBasedFinancing::where('slug',$slug)->first()))
|
||||
->response()
|
||||
->setStatusCode(200);
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['message' => $e->getMessage()], 400);
|
||||
}
|
||||
}
|
||||
}
|
||||
459
app/Http/Controllers/Frontend/LoginController.php
Normal file
459
app/Http/Controllers/Frontend/LoginController.php
Normal file
@@ -0,0 +1,459 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Frontend;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\User;
|
||||
use Carbon\Carbon;
|
||||
use Validator;
|
||||
use Mail;
|
||||
use App\Mail\OtpMail;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Session;
|
||||
|
||||
|
||||
class LoginController extends Controller
|
||||
{
|
||||
|
||||
public function index()
|
||||
{
|
||||
return view('Frontend.Pages.login');
|
||||
}
|
||||
|
||||
public function register()
|
||||
{
|
||||
return view('Frontend.Pages.register');
|
||||
}
|
||||
|
||||
public function registerInvestor()
|
||||
{
|
||||
return view('Frontend.Pages.register-investor');
|
||||
}
|
||||
|
||||
public function registerAssetManagers()
|
||||
{
|
||||
return view('Frontend.Pages.register-asset-managers');
|
||||
}
|
||||
|
||||
public function registerIntermediaries()
|
||||
{
|
||||
return view('Frontend.Pages.register-intermediaries');
|
||||
}
|
||||
|
||||
public function registerOtp()
|
||||
{
|
||||
return view('Frontend.Pages.register_otp');
|
||||
}
|
||||
|
||||
public function forgetPassword(){
|
||||
return view('Frontend.Pages.forget_password_request');
|
||||
}
|
||||
|
||||
public function resetPassword(){
|
||||
return view('Frontend.Pages.forget_password');
|
||||
}
|
||||
|
||||
// login method with mobile
|
||||
public function login_by_mobile(Request $request)
|
||||
{
|
||||
// validating data
|
||||
$validator = Validator::make($request->all(), [
|
||||
'contact_number' => 'required|exists:users,contact_number|min:10|max:10',
|
||||
'g-recaptcha-response' => 'sometimes|required'
|
||||
], [
|
||||
'required' => 'The :attribute field is required',
|
||||
'exists' => 'Contact Number is not registered!',
|
||||
'min' => 'Contact Number should be 10 digits!',
|
||||
'max' => 'Contact Number should be 10 digits!',
|
||||
'g-recaptcha-response.required' => 'Please verify captcha!'
|
||||
]);
|
||||
|
||||
$validationMessage = $this->validationError($validator);
|
||||
if ($validationMessage) {
|
||||
return response()->json(['status' => 400, 'message' => $validationMessage], 400);
|
||||
}
|
||||
|
||||
// $user = User::where('contact_number', $request->contact_number)->first();
|
||||
$user = User::where(['contact_number'=>$request->contact_number,'role'=>0])->first();
|
||||
if(!$user)
|
||||
{
|
||||
return response()->json(['status'=>201,'error'=>"Contact number not exist"]);
|
||||
}
|
||||
|
||||
$contactNumber = [
|
||||
'contact_number' => $request->contact_number,
|
||||
];
|
||||
Session::forget('phone_for_otp');
|
||||
Session::put('phone_for_otp', $contactNumber);
|
||||
|
||||
$otp = rand(1000, 9999);
|
||||
$sendOtp = $this->thirdPartyOTP($user->contact_number, $otp);
|
||||
|
||||
if ($sendOtp) {
|
||||
$user->otp = $otp;
|
||||
$user->expire_at = Carbon::now('Asia/colombo')->addMinutes(2);
|
||||
$user->update();
|
||||
return response()->json(['message' => 'OTP has been sent to phone', 'status' => 200]);
|
||||
} else {
|
||||
return response()->json(['message' => 'Error Sending OTP', 'status' => 400], 400);
|
||||
}
|
||||
}
|
||||
// otp verification in login by mobile
|
||||
public function verify_mobile_otp(Request $request)
|
||||
{
|
||||
// validating data
|
||||
$validator = Validator::make($request->all(), [
|
||||
// 'user_id' => 'required',
|
||||
'otp' => 'required'
|
||||
]);
|
||||
|
||||
// validation fail handling
|
||||
if ($validator->fails()) {
|
||||
return response()->json(['error' => $validator->errors(), 'status' => 204],204);
|
||||
}
|
||||
|
||||
$otp = $request->otp;
|
||||
|
||||
$contactNumber = Session::get('phone_for_otp');
|
||||
// validating otp
|
||||
$user = User::where('contact_number', $contactNumber['contact_number'])->first();
|
||||
|
||||
// otp verification failed handling
|
||||
$current_time = Carbon::now('Asia/colombo');
|
||||
if ($otp !== $user->otp) {
|
||||
return response()->json(['error' => 'Your OTP is not correct', 'status' => 400],400);
|
||||
} elseif ($current_time && $current_time->isAfter($user->expire_at)) {
|
||||
return response()->json(['error' => 'Your OTP has been expired', 'status' => 400],400);
|
||||
}
|
||||
|
||||
// Session::forget('phone_for_otp');
|
||||
|
||||
// $otp->otp = null;
|
||||
// $otp->expire_at = null;
|
||||
// $otp->update();
|
||||
\Auth::guard('users')->login($user);
|
||||
|
||||
return response()->json([
|
||||
'status' => 200,
|
||||
'user_id' => $user->id,
|
||||
'message' => 'logged in successfully',
|
||||
'token' => $user->createToken("API TOKEN")->plainTextToken
|
||||
], 200);
|
||||
}
|
||||
|
||||
// otp verification for password change
|
||||
public function verify_reset_password_otp(Request $request)
|
||||
{
|
||||
// dd($request->all());
|
||||
// validating data
|
||||
$validator = Validator::make($request->all(), [
|
||||
// 'user_id' => 'required|exists:users,id',
|
||||
'otp' => 'required',
|
||||
]);
|
||||
|
||||
// validation fail handling
|
||||
if ($validator->fails()) {
|
||||
return response()->json(['error' => 'Invalid request', 'status' => 204]);
|
||||
}
|
||||
|
||||
// validating otp
|
||||
$otp = User::where('id', $request->user_id)->first();
|
||||
|
||||
// otp verification failed handling
|
||||
$current_time = Carbon::now('Asia/colombo');
|
||||
if ($otp->otp != $request->otp) {
|
||||
return response()->json(['error' => 'Your OTP is not correct', 'status' => 400]);
|
||||
} elseif ($otp && $current_time->isAfter($otp->expire_at)) {
|
||||
return response()->json(['error' => 'Your OTP has been expired', 'status' => 400]);
|
||||
}
|
||||
|
||||
// $otp->otp = null;
|
||||
// $otp->expire_at = null;
|
||||
// $otp->update();
|
||||
|
||||
return response()->json(['message' => 'Otp verified successfully', 'status' => 200]);
|
||||
}
|
||||
|
||||
// login with email and password
|
||||
public function loginByEmail(Request $request)
|
||||
{
|
||||
// validating data
|
||||
$validator = Validator::make($request->all(), [
|
||||
'email' => 'required|exists:users,email',
|
||||
'password' => 'required|min:8',
|
||||
'g-recaptcha-response' => 'sometimes|required'
|
||||
], [
|
||||
'required' => 'The :attribute field is required',
|
||||
'unique' => 'The :attribute field should be unique',
|
||||
'exists' => 'Email is not registered!',
|
||||
'g-recaptcha-response.required' => 'Please verify captcha!'
|
||||
]);
|
||||
|
||||
$validationMessage = $this->validationError($validator);
|
||||
if ($validationMessage) {
|
||||
return response()->json(['status' => 400, 'message' => $validationMessage]);
|
||||
}
|
||||
|
||||
// handling validation error
|
||||
// if ($validator->fails())
|
||||
// {
|
||||
// return response()->json(['error'=>'Email is not registered', 'status' => 204]);
|
||||
// }
|
||||
|
||||
if (!Auth::guard('users')->attempt($request->only(['email', 'password']))) {
|
||||
return response()->json([
|
||||
'status' => 400,
|
||||
'message' => 'Credentials does not match!',
|
||||
]);
|
||||
}
|
||||
|
||||
$user = User::where(['email'=>$request->email,'role'=>0])->first();
|
||||
if(!$user)
|
||||
{
|
||||
return response()->json(['status'=>400,'message'=>"Credentials does not match!"]);
|
||||
}
|
||||
|
||||
return response()->json([
|
||||
'status' => 200,
|
||||
'user_id' => $user->id,
|
||||
'message' => 'Logged in successfully',
|
||||
'token' => $user->createToken("API TOKEN")->plainTextToken
|
||||
], 200);
|
||||
}
|
||||
|
||||
// forget password by email or phone
|
||||
public function forget_password(Request $request)
|
||||
{
|
||||
// checking input is email or phone
|
||||
$loginWith = filter_var($request->emailorphone, FILTER_VALIDATE_EMAIL) ? 'email' : 'contact_number';
|
||||
|
||||
// validating data
|
||||
$validator = Validator::make(
|
||||
$request->all(),
|
||||
[
|
||||
'emailorphone' => "required|exists:users,$loginWith",
|
||||
]
|
||||
);
|
||||
|
||||
// handling validation error
|
||||
if ($validator->fails()) {
|
||||
|
||||
// $errorName = $loginWith == 'email' ? 'email' : 'contact number';
|
||||
// $errorName = is_int($request->emailorphone) ? 'contact number' : 'email';
|
||||
// return response()->json(['error' => $errorName . " is not registered", 'status' => 204]);
|
||||
return response()->json(['error' => "Enter valid credential", 'status' => 204]);
|
||||
}
|
||||
|
||||
// checking user exits or not
|
||||
if ($loginWith == 'contact_number') {
|
||||
try {
|
||||
$otp = $this->otpGenerate($request->email);
|
||||
$sendOTP = $this->thirdPartyOTP($request->emailorphone,$otp);
|
||||
$user = User::where('contact_number', $request->emailorphone)->first();
|
||||
// dd($user->id);
|
||||
Session::forget('phone_email_forgot');
|
||||
Session::put('phone_email_forgot', $request->emailorphone);
|
||||
$user->otp = $otp;
|
||||
$user->expire_at = Carbon::now('Asia/colombo')->addMinutes(2);
|
||||
$user->update();
|
||||
// Session::forget('user_id');
|
||||
// Session::put('user_id', $user->id);
|
||||
return response()->json(['user_id' => $user->id, 'status' => 200]);
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['error' => 'Netwrok Error! Please try again after sometime.', 'status' => 500]);
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
$otp = $this->otpGenerate($request->emailorphone);
|
||||
$mailData = [
|
||||
'title' => 'Mail from Freeu.in',
|
||||
'body' => 'This is for testing email using smtp.'
|
||||
];
|
||||
// $otp = $this->otpGenerate($request->email);
|
||||
Mail::to($request->emailorphone)->send(new OtpMail($mailData, $otp));
|
||||
$user = User::where('email', $request->emailorphone)->first();
|
||||
// dd($user);
|
||||
Session::forget('phone_email_forgot');
|
||||
Session::put('phone_email_forgot', $request->emailorphone);
|
||||
$user->otp = $otp;
|
||||
$user->expire_at = Carbon::now('Asia/colombo')->addMinutes(2);
|
||||
$user->update();
|
||||
// Session::forget('user_id');
|
||||
// Session::put('user_id', $user->id);
|
||||
return response()->json(['user_id' => $user->id, 'status' => 200]);
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['error' => 'Netwrok Error! Please try again after sometime.', 'status' => 500]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// update password with otp
|
||||
public function update_password(Request $request)
|
||||
{
|
||||
// validating data
|
||||
$validator = Validator::make($request->all(), [
|
||||
// 'user_id' => 'required|exists:users,id',
|
||||
'password' => 'required|confirmed|min:8',
|
||||
'otp' => 'required'
|
||||
]);
|
||||
|
||||
// handling validation error
|
||||
if ($validator->fails()) {
|
||||
// dd($validator->errors());
|
||||
return response()->json(['error' => $validator->errors(), 'status' => 204]);
|
||||
}
|
||||
|
||||
|
||||
$phoneOrEmail = Session::get('phone_email_forgot');
|
||||
|
||||
// $checkOtp = User::where(['email'=>$phoneOrEmail,'otp'=>$request->otp])->orWhere(['email'=>$phoneOrEmail,'otp'=>$request->otp])
|
||||
// $user = User::where('contact_number', $phoneOrEmail)->orWhere('email',$phoneOrEmail)->first();
|
||||
// $user = User::where(['contact_number'=>$phoneOrEmail,'otp'=>$request->otp])->orWhere(['email'=>$phoneOrEmail,'otp'=>$request->otp])->first();
|
||||
// $user = User::where('id', $request->user_id)->where('otp', $request->otp)->first();
|
||||
|
||||
$user = User::where('otp','=',$request->otp)
|
||||
->where( function ($query) use ($phoneOrEmail){
|
||||
return $query
|
||||
->where('contact_number','=',$phoneOrEmail)
|
||||
->orWhere('email','=',$phoneOrEmail);
|
||||
})
|
||||
->first();
|
||||
|
||||
$current_time = Carbon::now('Asia/colombo');
|
||||
if (!$user) {
|
||||
return response()->json(['error' => 'Your OTP is not correct', 'status' => 400]);
|
||||
}
|
||||
elseif ($user && $current_time->isAfter($user->expire_at)) {
|
||||
return response()->json(['error' => 'Your OTP has been expired', 'status' => 400]);
|
||||
} else {
|
||||
try {
|
||||
$user->password = Hash::make($request->password);
|
||||
$user->update();
|
||||
|
||||
return response()->json(['message' => 'Password has been updated successfully', 'status' => 200]);
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['error' => 'Netwrok Error! Please try again after sometime.', 'status' => 500]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// resend otp while login
|
||||
public function request_otp(Request $request)
|
||||
{
|
||||
|
||||
$validator = Validator::make(
|
||||
$request->all(),
|
||||
[
|
||||
// 'user_id' => 'required|exists:users,id',
|
||||
]
|
||||
);
|
||||
|
||||
if ($validator->fails()) {
|
||||
return response()->json(['error' => $validator->errors()], 204);
|
||||
}
|
||||
|
||||
$contactNumber = Session::get('phone_for_otp');
|
||||
$user = User::where('contact_number', $contactNumber['contact_number'])->first();
|
||||
$otp = rand(1000, 9999);
|
||||
$sendOTP = $this->thirdPartyOTP($user->contact_number, $otp);
|
||||
|
||||
try {
|
||||
if ($sendOTP) {
|
||||
$user->otp = $otp;
|
||||
$user->expire_at = Carbon::now('Asia/colombo')->addMinutes(2);
|
||||
$user->update();
|
||||
|
||||
return response()->json(['message' => 'otp send successfully on your registered phone number - ' . $user->contact_number . ' and email - ' . $user->email, 'status' => 200]);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['error' => 'Netwrok Error! Please try again after sometime.', 'status' => 500]);
|
||||
}
|
||||
}
|
||||
|
||||
public function signOut()
|
||||
{
|
||||
\Session::flush();
|
||||
\Auth::guard('users')->logout();
|
||||
// return redirect()->route('admin.login');
|
||||
return redirect()->back();
|
||||
}
|
||||
|
||||
public function validationError($validator)
|
||||
{
|
||||
if ($validator->fails()) {
|
||||
$errors = $validator->errors();
|
||||
$messages = '';
|
||||
foreach ($errors->all() as $message) {
|
||||
$messages .= $message . '</br>';
|
||||
}
|
||||
return $messages;
|
||||
}
|
||||
}
|
||||
|
||||
public function otpGenerate($email)
|
||||
{
|
||||
$otp = rand(1000, 9999);
|
||||
return $otp;
|
||||
}
|
||||
|
||||
public function thirdPartyOTP($number, $otp)
|
||||
{
|
||||
$curl = curl_init();
|
||||
|
||||
curl_setopt_array($curl, array(
|
||||
CURLOPT_URL => 'https://restapi.smscountry.com/v0.1/Accounts/4F7T5SbGyV7HBrEHxmX4/SMSes/',
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_ENCODING => '',
|
||||
CURLOPT_MAXREDIRS => 10,
|
||||
CURLOPT_TIMEOUT => 0,
|
||||
CURLOPT_FOLLOWLOCATION => true,
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
CURLOPT_CUSTOMREQUEST => 'POST',
|
||||
CURLOPT_POSTFIELDS => '{
|
||||
"Text": "Dear Investor, Your login OTP is ' . $otp . '. - Blue Feather Ventures Pvt Ltd.",
|
||||
"Number": "91' . $number . '",
|
||||
"SenderId": "BLUFVL",
|
||||
"DRNotifyUrl": "https://www.domainname.com/notifyurl",
|
||||
"DRNotifyHttpMethod": "POST",
|
||||
"Tool": "API"
|
||||
}',
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
'Content-Type: application/json',
|
||||
'Authorization: Basic NEY3VDVTYkd5VjdIQnJFSHhtWDQ6emFXdFEyTlV3ZlZROHB6dGRvVlRZUFdibG01Y1AxRldsbWl2WlVrbg=='
|
||||
),
|
||||
));
|
||||
|
||||
$response = curl_exec($curl);
|
||||
|
||||
curl_close($curl);
|
||||
return $response;
|
||||
// return true;
|
||||
}
|
||||
|
||||
public function searchEmail(Request $request)
|
||||
{
|
||||
$email = $request->email;
|
||||
// dd($email);
|
||||
$user = User::where('email',$email)->exists();
|
||||
if(!$user)
|
||||
{
|
||||
return response()->json(
|
||||
[
|
||||
"status"=>201,
|
||||
"message"=>"Please enter valid email",
|
||||
]
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
return response()->json(
|
||||
[
|
||||
"status"=>200,
|
||||
// "message"=>"Email is invalid !, Please enter valid email",
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
410
app/Http/Controllers/Frontend/MarketPlaceController.php
Normal file
410
app/Http/Controllers/Frontend/MarketPlaceController.php
Normal file
@@ -0,0 +1,410 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Frontend;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\MarketplaceAlternativeInvestmentFundSeller;
|
||||
use App\Models\MarketplaceBuyerForm;
|
||||
use App\Models\MarketplaceFractionalRealEstateSeller;
|
||||
use App\Models\MarketplaceOtherProductsSeller;
|
||||
use App\Models\MarketplaceSellerForm;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use App\Models\User as ModelsUser;
|
||||
use App\Notifications\UserAdmin;
|
||||
|
||||
class MarketPlaceController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$spotlightMarketPlaceListed = $this->spotlightInvestment()['data'];
|
||||
$featuredMarketplaceListed = $this->featuredInvestments();
|
||||
$nonFeaturedMarketplaceListed = $this->nonFeaturedInvestments();
|
||||
return view('Frontend.Pages.marketplace.index', compact('spotlightMarketPlaceListed', 'featuredMarketplaceListed', 'nonFeaturedMarketplaceListed'));
|
||||
}
|
||||
|
||||
public function spotlightInvestment()
|
||||
{
|
||||
$data = null;
|
||||
if (MarketplaceFractionalRealEstateSeller::where('listing_status', 'Spotlight')->exists()) {
|
||||
$data = MarketplaceFractionalRealEstateSeller::where('listing_status', 'Spotlight')->first();
|
||||
$table = 'fractional-real-estate';
|
||||
} elseif (MarketplaceAlternativeInvestmentFundSeller::where('listing_status', 'Spotlight')->exists()) {
|
||||
$data = MarketplaceAlternativeInvestmentFundSeller::where('listing_status', 'Spotlight')->first();
|
||||
$table = 'alternative-investment-fund';
|
||||
} elseif (MarketplaceOtherProductsSeller::where('listing_status', 'Spotlight')->exists()) {
|
||||
$data = MarketplaceOtherProductsSeller::where('listing_status', 'Spotlight')->first();
|
||||
$table = 'other-products';
|
||||
}
|
||||
if ($data) {
|
||||
$expectedSale = $data->getRawOriginal('expected_selling_price') ?? $data->getRawOriginal('expected_sale_per_unit') ?? $data->getRawOriginal('expected_sale_price_per_unit');
|
||||
$data = [
|
||||
'data' => [
|
||||
'product_name' => $data->property_name ?? $data->name_of_the_aif_fund ?? $data->security_name,
|
||||
'expected_sale' => $this->IND_money_format($expectedSale),
|
||||
'category' => $data->type_of_fund ?? $data->product_category ?? 'Fractional Real Estate',
|
||||
'slug' => $data->slug,
|
||||
'table' => $table
|
||||
]
|
||||
];
|
||||
} else {
|
||||
$data = [
|
||||
'data' => []
|
||||
];
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function featuredInvestments()
|
||||
{
|
||||
$freMarketplace['fractional-real-estate'] = MarketplaceFractionalRealEstateSeller::where(['status' => 'Approved', 'listing_status' => 'Featured'])
|
||||
->select('id', 'property_name', 'asset_type', 'fractional_real_estate_platform', 'property_address', 'expected_selling_price', 'annual_rental_yield_earned', 'slug', 'rental_escalation', 'property_grade', 'current_market_value_of_the_property', 'id as sold_status', 'id as category', 'id as discount', 'id as bid')
|
||||
->get();
|
||||
$aifMarketplace['alternative-investment-fund'] = MarketplaceAlternativeInvestmentFundSeller::where(['status' => 'Approved', 'listing_status' => 'Featured'])
|
||||
->select('id', 'name_of_the_aif_fund', 'current_or_latest_nav', 'credit_rating', 'fund_category', 'type_of_fund', 'expected_sale_per_unit', 'no_of_units_you_wish_to_sell', 'slug', 'id as sold_status', 'id as discount', 'id as bid')
|
||||
->get();
|
||||
$opMarketplace['other-products'] = MarketplaceOtherProductsSeller::where(['status' => 'Approved', 'listing_status' => 'Featured'])
|
||||
->select('id', 'face_value_per_unit', 'security_name', 'product_category', 'instrument_issuer', 'no_of_units_offered_for_sale', 'expected_sale_price_per_unit', 'slug', 'principal_repaid', 'id as sold_status', 'payout_frequency', 'id as discount', 'id as bid')
|
||||
->get();
|
||||
$marketplaceListed = [];
|
||||
array_push($marketplaceListed, $freMarketplace);
|
||||
array_push($marketplaceListed, $aifMarketplace);
|
||||
array_push($marketplaceListed, $opMarketplace);
|
||||
|
||||
return [
|
||||
'data' => $marketplaceListed
|
||||
];
|
||||
|
||||
// return [
|
||||
// 'fractional-real-estate' => $freMarketplace,
|
||||
// 'alternative-investment-fund' => $aifMarketplace,
|
||||
// 'other-products' => $opMarketplace
|
||||
// ];
|
||||
}
|
||||
|
||||
public function nonFeaturedInvestments()
|
||||
{
|
||||
$freMarketplace['fractional-real-estate'] = MarketplaceFractionalRealEstateSeller::where(['status' => 'Approved', 'listing_status' => 'Non-Featured'])->select('id', 'property_name', 'asset_type', 'fractional_real_estate_platform', 'property_address', 'expected_selling_price', 'annual_rental_yield_earned', 'slug', 'rental_escalation', 'property_grade', 'current_market_value_of_the_property', 'id as sold_status', 'id as category', 'id as discount', 'id as bid')->get();
|
||||
$aifMarketplace['alternative-investment-fund'] = MarketplaceAlternativeInvestmentFundSeller::where(['status' => 'Approved', 'listing_status' => 'Non-Featured'])->select('id', 'name_of_the_aif_fund', 'current_or_latest_nav', 'credit_rating', 'fund_category', 'type_of_fund', 'expected_sale_per_unit', 'no_of_units_you_wish_to_sell', 'slug', 'id as sold_status', 'id as discount', 'id as bid')
|
||||
->get();
|
||||
$opMarketplace['other-products'] = MarketplaceOtherProductsSeller::where(['status' => 'Approved', 'listing_status' => 'Non-Featured'])->select('id', 'face_value_per_unit', 'security_name', 'product_category', 'instrument_issuer', 'no_of_units_offered_for_sale', 'expected_sale_price_per_unit', 'slug', 'principal_repaid', 'id as sold_status', 'payout_frequency', 'id as discount', 'id as bid')
|
||||
->get();
|
||||
$marketplaceListed = [];
|
||||
array_push($marketplaceListed, $freMarketplace);
|
||||
array_push($marketplaceListed, $aifMarketplace);
|
||||
array_push($marketplaceListed, $opMarketplace);
|
||||
|
||||
// return $marketplaceListed;
|
||||
return [
|
||||
'data' => $marketplaceListed
|
||||
];
|
||||
// return [
|
||||
// 'fractional-real-estate' => $freMarketplace,
|
||||
// 'alternative-investment-fund' => $aifMarketplace,
|
||||
// 'other-products' => $opMarketplace
|
||||
// ];
|
||||
}
|
||||
|
||||
public function viewOffering($slug)
|
||||
{
|
||||
$offering = $this->viewOfferingData($slug);
|
||||
$invested = $offering['invested'];
|
||||
$totalInterestedBuyers = $offering['total-interested-buyers'];
|
||||
$type = $offering['type'];
|
||||
$ownProduct = $offering['own-product'];
|
||||
$logged_in = auth()->guard('users')->check() == true ? true : false;
|
||||
return view('Frontend.Pages.marketplace.view-offering', compact('offering', 'type', 'invested', 'totalInterestedBuyers', 'logged_in', 'ownProduct'));
|
||||
}
|
||||
|
||||
public function viewOfferingData($slug)
|
||||
{
|
||||
// if(auth()->guard('users')->id())
|
||||
// {
|
||||
// }
|
||||
$user_id = auth()->guard('users')->id();
|
||||
$offering = array();
|
||||
if (!auth()->guard('users')->check()) {
|
||||
$offering['invested'] = false;
|
||||
};
|
||||
if (MarketplaceFractionalRealEstateSeller::where('slug', $slug)->exists()) {
|
||||
$offering['type'] = 'fractional-real-estate';
|
||||
$marketFRE = MarketplaceFractionalRealEstateSeller::where('slug', $slug)->first();
|
||||
// if($user_id){
|
||||
$offering['own-product'] = $user_id != null ? MarketplaceSellerForm::where(['id' => $marketFRE->seller_forms_id, 'users_id' => $user_id])->exists() : '';
|
||||
// }
|
||||
$offering['data'] = $marketFRE;
|
||||
$offering['invested'] = $this->checkInvestmentInterested($offering['data'], 'marketplace_fre_sellers')['interested-status'];
|
||||
$offering['total-interested-buyers'] = $this->checkInvestmentInterested($offering['data'], 'marketplace_fre_sellers')['total-interested-buyers'];
|
||||
} elseif (MarketplaceAlternativeInvestmentFundSeller::where('slug', $slug)->exists()) {
|
||||
$offering['type'] = 'alternative-investment-funds';
|
||||
$marketAIF = MarketplaceAlternativeInvestmentFundSeller::where('slug', $slug)->first();
|
||||
$offering['own-product'] = $user_id != null ? MarketplaceSellerForm::where(['id' => $marketAIF->seller_forms_id, 'users_id' => $user_id])->exists() : '';
|
||||
$offering['data'] = $marketAIF;
|
||||
$offering['invested'] = $this->checkInvestmentInterested($offering['data'], 'marketplace_aif_sellers')['interested-status'];
|
||||
$offering['total-interested-buyers'] = $this->checkInvestmentInterested($offering['data'], 'marketplace_aif_sellers')['total-interested-buyers'];
|
||||
} elseif (MarketplaceOtherProductsSeller::where('slug', $slug)->exists()) {
|
||||
$offering['type'] = 'other-products';
|
||||
$marketOP = MarketplaceOtherProductsSeller::where('slug', $slug)->first();
|
||||
$offering['own-product'] = $user_id != null ? MarketplaceSellerForm::where(['id' => $marketOP->seller_forms_id, 'users_id' => $user_id])->exists() : '';
|
||||
$offering['data'] = $marketOP;
|
||||
$offering['invested'] = $this->checkInvestmentInterested($offering['data'], 'marketplace_op_sellers')['interested-status'];
|
||||
$offering['total-interested-buyers'] = $this->checkInvestmentInterested($offering['data'], 'marketplace_op_sellers')['total-interested-buyers'];
|
||||
}
|
||||
return $offering;
|
||||
}
|
||||
|
||||
public function checkInvestmentInterested($offering, $table)
|
||||
{
|
||||
$interestedStatus = false;
|
||||
if (auth()->guard('users')->check()) {
|
||||
$interestedStatus = MarketplaceBuyerForm::where(['users_id' => auth()->guard('users')->user()->id, 'table' => $table, 'associated_id' => $offering->id])->exists();
|
||||
}
|
||||
$totalInterestedBuyers = MarketplaceBuyerForm::where(['table' => $table, 'associated_id' => $offering->id])->count();
|
||||
return [
|
||||
'total-interested-buyers' => $totalInterestedBuyers . ' buyer(s) interested!',
|
||||
'interested-status' => $interestedStatus
|
||||
];
|
||||
}
|
||||
|
||||
public function buyerForm($slug)
|
||||
{
|
||||
$offering = $this->viewOfferingData($slug);
|
||||
$table = $offering['type'];
|
||||
$id = $offering['data']->id;
|
||||
$userData = array();
|
||||
$user = ModelsUser::find(auth()->guard('users')->user()->id);
|
||||
$userData = (object)[
|
||||
'name' => $user->name ?? null,
|
||||
'contact_number' => $user->contact_number ?? null,
|
||||
'email' => $user->email ?? $user->email,
|
||||
];
|
||||
return view('Frontend.Pages.profile.market-list.buyer-form', compact('table', 'id', 'userData'));
|
||||
}
|
||||
|
||||
public function buyerFormSubmit(Request $request)
|
||||
{
|
||||
$validator = Validator::make($request->all(), [
|
||||
'id' => 'required',
|
||||
'table' => 'required',
|
||||
'name' => 'required',
|
||||
'city' => 'required',
|
||||
'country' => 'required',
|
||||
'contact_number' => 'required|numeric|digits:10',
|
||||
'email_id' => 'required',
|
||||
'no_of_units_you_wish_to_buy' => 'required|numeric',
|
||||
'offer_price_per_unit' => 'required|numeric',
|
||||
], [
|
||||
'required' => 'The :attribute field must be required',
|
||||
'numeric' => 'The :attribute field must be in digits',
|
||||
'digits' => 'The :attribute field must have 10 digits',
|
||||
]);
|
||||
|
||||
|
||||
$validationMessage = $this->validationError($validator);
|
||||
if ($validationMessage) {
|
||||
return response()->json(['status' => 400, 'message' => $validationMessage]);
|
||||
}
|
||||
|
||||
if ($request->table == 'fractional-real-estate') {
|
||||
$table = 'marketplace_fre_sellers';
|
||||
$productName = \DB::table($table)->where('id', $request->id)->value('property_name');
|
||||
} elseif ($request->table == 'alternative-investment-funds') {
|
||||
$table = 'marketplace_aif_sellers';
|
||||
$productName = \DB::table($table)->where('id', $request->id)->value('name_of_the_aif_fund');
|
||||
} elseif ($request->table == 'other-products') {
|
||||
$table = 'marketplace_op_sellers';
|
||||
$productName = \DB::table($table)->where('id', $request->id)->value('security_name');
|
||||
}
|
||||
|
||||
$buyerForm = MarketplaceBuyerForm::create([
|
||||
'users_id' => auth()->guard('users')->user()->id,
|
||||
'associated_id' => $request->id,
|
||||
'table' => $table,
|
||||
'name' => $request->name,
|
||||
'city' => $request->city,
|
||||
'country' => $request->country,
|
||||
'contact_number' => $request->contact_number,
|
||||
'email_id' => $request->email_id,
|
||||
'no_of_units_you_wish_to_buy' => $request->no_of_units_you_wish_to_buy,
|
||||
'offer_price_per_unit' => $request->offer_price_per_unit,
|
||||
'total_purchase_value' => $request->total_purchase_value,
|
||||
]);
|
||||
if ($buyerForm) {
|
||||
$name = auth()->guard('users')->user()->name;
|
||||
$notify['message'] = "$name has submitted a buyer form for $productName!";
|
||||
$type = 'Buyer Form';
|
||||
$users = ModelsUser::admins()->get();
|
||||
foreach ($users as $data) {
|
||||
$data->notify(new UserAdmin($notify, $type));
|
||||
}
|
||||
return response()->json(['status' => 200, 'message' => "Buyer Form Submitted For Review"]);
|
||||
}
|
||||
return response()->json(['status' => 400, 'message' => "Buyer Form Could Not Be Submitted!"]);
|
||||
}
|
||||
|
||||
public function buyerFormAPI($slug)
|
||||
{
|
||||
$offering = $this->viewOfferingData($slug);
|
||||
$table = $offering['type'];
|
||||
$id = $offering['data']->id;
|
||||
$userData = array();
|
||||
$user = ModelsUser::find(request()->user()->id);
|
||||
$userData = (object)[
|
||||
'name' => $user->name ?? null,
|
||||
'contact_number' => $user->contact_number ?? null,
|
||||
'email' => $user->email ?? $user->email,
|
||||
];
|
||||
$data['data'] = [
|
||||
'table' => $offering['type'],
|
||||
'id' => $offering['data']->id,
|
||||
'user' => $userData
|
||||
];
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function buyerFormSubmitAPI(Request $request)
|
||||
{
|
||||
$validator = Validator::make($request->all(), [
|
||||
'id' => 'required',
|
||||
'table' => 'required',
|
||||
'name' => 'required',
|
||||
'city' => 'required',
|
||||
'country' => 'required',
|
||||
'contact_number' => 'required|numeric|digits:10',
|
||||
'email_id' => 'required',
|
||||
'no_of_units_you_wish_to_buy' => 'required|numeric',
|
||||
'offer_price_per_unit' => 'required|numeric',
|
||||
], [
|
||||
'required' => 'The :attribute field must be required',
|
||||
'numeric' => 'The :attribute field must be in digits',
|
||||
'digits' => 'The :attribute field must have 10 digits',
|
||||
]);
|
||||
|
||||
|
||||
$validationMessage = $this->validationError($validator);
|
||||
if ($validationMessage) {
|
||||
return response()->json(['status' => 400, 'message' => $validationMessage], 400);
|
||||
}
|
||||
|
||||
if ($request->table == 'fractional-real-estate') {
|
||||
$table = 'marketplace_fre_sellers';
|
||||
$productName = \DB::table($table)->where('id', $request->id)->value('property_name');
|
||||
} elseif ($request->table == 'alternative-investment-funds') {
|
||||
$table = 'marketplace_aif_sellers';
|
||||
$productName = \DB::table($table)->where('id', $request->id)->value('name_of_the_aif_fund');
|
||||
} elseif ($request->table == 'other-products') {
|
||||
$table = 'marketplace_op_sellers';
|
||||
$productName = \DB::table($table)->where('id', $request->id)->value('security_name');
|
||||
}
|
||||
|
||||
$buyerForm = MarketplaceBuyerForm::create([
|
||||
'users_id' => $request->user()->id,
|
||||
'associated_id' => $request->id,
|
||||
'table' => $table,
|
||||
'name' => $request->name,
|
||||
'city' => $request->city,
|
||||
'country' => $request->country,
|
||||
'contact_number' => $request->contact_number,
|
||||
'email_id' => $request->email_id,
|
||||
'no_of_units_you_wish_to_buy' => $request->no_of_units_you_wish_to_buy,
|
||||
'offer_price_per_unit' => $request->offer_price_per_unit,
|
||||
// 'total_purchase_value' => $request->total_purchase_value,
|
||||
'total_purchase_value' => $request->no_of_units_you_wish_to_buy * $request->offer_price_per_unit
|
||||
]);
|
||||
$user = ModelsUser::find($request->user()->id);
|
||||
if ($buyerForm) {
|
||||
$name = $user->name;
|
||||
$notify['message'] = "$name has submitted a buyer form for $productName!";
|
||||
$type = 'Buyer Form';
|
||||
$users = ModelsUser::admins()->get();
|
||||
foreach ($users as $data) {
|
||||
$data->notify(new UserAdmin($notify, $type));
|
||||
}
|
||||
return response()->json(['status' => 200, 'message' => "Buyer Form Submitted For Review"]);
|
||||
}
|
||||
return response()->json(['status' => 400, 'message' => "Buyer Form Could Not Be Submitted!"], 400);
|
||||
}
|
||||
|
||||
public function viewOfferingDataAPI($slug)
|
||||
{
|
||||
$offering = array();
|
||||
if (request()->user()) {
|
||||
$offering['invested'] = false;
|
||||
};
|
||||
if (MarketplaceFractionalRealEstateSeller::where('slug', $slug)->exists()) {
|
||||
$offering['type'] = 'fractional-real-estate';
|
||||
$marketFRE = MarketplaceFractionalRealEstateSeller::where('slug', $slug)->first();
|
||||
$offering['own-product'] = MarketplaceSellerForm::where(['id' => $marketFRE->seller_forms_id, 'users_id' => auth('sanctum')->id()])->exists();
|
||||
$offering['data'] = $marketFRE;
|
||||
$offering['invested'] = $this->checkInvestmentInterestedAPI($offering['data'], 'marketplace_fre_sellers')['interested-status'];
|
||||
$offering['total-interested-buyers'] = $this->checkInvestmentInterestedAPI($offering['data'], 'marketplace_fre_sellers')['total-interested-buyers'];
|
||||
} elseif (MarketplaceAlternativeInvestmentFundSeller::where('slug', $slug)->exists()) {
|
||||
$offering['type'] = 'alternative-investment-funds';
|
||||
$marketAIF = MarketplaceAlternativeInvestmentFundSeller::where('slug', $slug)->first();
|
||||
$offering['own-product'] = MarketplaceSellerForm::where(['id' => $marketAIF->seller_forms_id, 'users_id' => auth('sanctum')->id()])->exists();
|
||||
$offering['data'] = $marketAIF;
|
||||
$offering['invested'] = $this->checkInvestmentInterestedAPI($offering['data'], 'marketplace_aif_sellers')['interested-status'];
|
||||
$offering['total-interested-buyers'] = $this->checkInvestmentInterestedAPI($offering['data'], 'marketplace_aif_sellers')['total-interested-buyers'];
|
||||
} elseif (MarketplaceOtherProductsSeller::where('slug', $slug)->exists()) {
|
||||
$offering['type'] = 'other-products';
|
||||
$marketOP = MarketplaceOtherProductsSeller::where('slug', $slug)->first();
|
||||
$offering['own-product'] = MarketplaceSellerForm::where(['id' => $marketOP->seller_forms_id, 'users_id' => auth('sanctum')->id()])->exists();
|
||||
$offering['data'] = $marketOP;
|
||||
$offering['invested'] = $this->checkInvestmentInterestedAPI($offering['data'], 'marketplace_op_sellers')['interested-status'];
|
||||
$offering['total-interested-buyers'] = $this->checkInvestmentInterestedAPI($offering['data'], 'marketplace_op_sellers')['total-interested-buyers'];
|
||||
}
|
||||
return $offering;
|
||||
}
|
||||
|
||||
public function checkInvestmentInterestedAPI($offering, $table)
|
||||
{
|
||||
$interestedStatus = false;
|
||||
if (request()->user()) {
|
||||
$interestedStatus = MarketplaceBuyerForm::where(['users_id' => request()->user()->id, 'table' => $table, 'associated_id' => $offering->id])->exists();
|
||||
}
|
||||
$totalInterestedBuyers = MarketplaceBuyerForm::where(['table' => $table, 'associated_id' => $offering->id])->count();
|
||||
return [
|
||||
'total-interested-buyers' => $totalInterestedBuyers . ' buyer(s) interested!',
|
||||
'interested-status' => $interestedStatus
|
||||
];
|
||||
}
|
||||
|
||||
function IND_money_format($number)
|
||||
{
|
||||
$decimal = (string)($number - floor($number));
|
||||
$money = floor($number);
|
||||
$length = strlen($money);
|
||||
$delimiter = '';
|
||||
$money = strrev($money);
|
||||
|
||||
for ($i = 0; $i < $length; $i++) {
|
||||
if (($i == 3 || ($i > 3 && ($i - 1) % 2 == 0)) && $i != $length) {
|
||||
$delimiter .= ',';
|
||||
}
|
||||
$delimiter .= $money[$i];
|
||||
}
|
||||
|
||||
$result = strrev($delimiter);
|
||||
$decimal = preg_replace("/0\./i", ".", $decimal);
|
||||
$decimal = substr($decimal, 0, 3);
|
||||
|
||||
if ($decimal != '0') {
|
||||
$result = $result . $decimal;
|
||||
}
|
||||
|
||||
return '₹ ' . $result;
|
||||
}
|
||||
|
||||
public function validationError($validator)
|
||||
{
|
||||
if ($validator->fails()) {
|
||||
$errors = $validator->errors();
|
||||
$messages = '';
|
||||
foreach ($errors->all() as $message) {
|
||||
$messages .= $message . '</br>';
|
||||
}
|
||||
return $messages;
|
||||
}
|
||||
}
|
||||
}
|
||||
21
app/Http/Controllers/Frontend/NewsInsightsController.php
Normal file
21
app/Http/Controllers/Frontend/NewsInsightsController.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Frontend;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Admin\News;
|
||||
|
||||
class NewsInsightsController extends Controller
|
||||
{
|
||||
public function get_all_news()
|
||||
{
|
||||
try {
|
||||
$data = News::where('status',1)->get();
|
||||
|
||||
return response()->json(['data'=>$data]);
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['error' => 'Netwrok Error! Please try again after sometime.']);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Frontend;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\PeerToPeerLending;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Product;
|
||||
use App\Http\Resources\FractionalRealEstate as test;
|
||||
use App\Http\Resources\PeerToPeerLendingResource;
|
||||
use App\Http\Controllers\Admin\ManageFreeUInvestments\PeerToPeerLendingController as PeerToPeerLendingFontendController;
|
||||
use App\Http\Controllers\Admin\ManageFreeUInvestments\FractionalRealEstateController as FractionalRealEstateFrontendController;
|
||||
|
||||
class PeerToPeerLendingController extends Controller
|
||||
{
|
||||
public function index(){
|
||||
$peerToPeerLendings = $this->peerToPeerLending()->getData();
|
||||
$learnMore = (new FractionalRealEstateFrontendController)->peerToPeerLendingQuestionAndAnswer()->getData();
|
||||
$faqs = (new FractionalRealEstateFrontendController)->peerToPeerLendingQuestionAndAnswerFaqs()->getData();
|
||||
return view('Frontend.Pages.peer-to-peer-lending.index',compact('peerToPeerLendings','learnMore','faqs'));
|
||||
}
|
||||
|
||||
public function product($slug){
|
||||
// $peerToPeerLending = PeerToPeerLending::where('slug',$slug)->first();
|
||||
$peerToPeerLending = $this->peerToPeerLendingData($slug)->getData()->data;
|
||||
$otherP2P = PeerToPeerLending::query()
|
||||
->join('products', 'peer_to_peer_lendings.products_id', 'products.id')
|
||||
->where(['status' => true, 'categories_id' => 3])
|
||||
// ->where('status',false)
|
||||
->where('slug', '!=', $slug)
|
||||
// ->where('categories_id',26)
|
||||
->get();
|
||||
|
||||
$productData = PeerToPeerLending::where('slug','=',$slug)->first();
|
||||
$productData = Product::where('id','=',$productData->products_id)->first();
|
||||
// $productData['presentation_file'] = $productData->getRawOriginal('presentation');
|
||||
// $productData['fact_sheet_file'] = $productData->getRawOriginal('fact_sheet');
|
||||
return view('Frontend.Pages.peer-to-peer-lending.product',compact('peerToPeerLending','otherP2P','productData'));
|
||||
}
|
||||
|
||||
public function downloadFilePersantation($filename){
|
||||
// dd($filename);
|
||||
if(\File::exists('public/uploads/product/presentation/'.$filename))
|
||||
{
|
||||
return response()->download(public_path('/uploads/product/presentation/'.$filename));
|
||||
}
|
||||
else if(\File::exists('public/uploads/product/fact_sheet/'.$filename))
|
||||
{
|
||||
return response()->download(public_path('/uploads/product/fact_sheet/'.$filename));
|
||||
}else{
|
||||
return "file not found";
|
||||
}
|
||||
}
|
||||
// public function downloadpeertopeer($filename){
|
||||
// // dd($filename);
|
||||
// if(\File::exists('public/uploads/product/presentation/'.$filename))
|
||||
// {
|
||||
// return response()->download(public_path('/uploads/product/presentation/'.$filename));
|
||||
// }
|
||||
// else if(\File::exists('public/uploads/product/fact_sheet/'.$filename))
|
||||
// {
|
||||
// return response()->download(public_path('/uploads/product/fact_sheet/'.$filename));
|
||||
// }else{
|
||||
// return "file not found";
|
||||
// }
|
||||
// }
|
||||
|
||||
// public function peerToPeerLending(){
|
||||
// $peerToPeerLendings = Product::with('peerToPeers', 'category')->peerToPeers()->active()->get();
|
||||
// return (object)[
|
||||
// 'status' => 200,
|
||||
// 'data' => $peerToPeerLendings
|
||||
// ];
|
||||
// // return $peerToPeerLendings;
|
||||
// }
|
||||
|
||||
public function peerToPeerLending()
|
||||
{
|
||||
try {
|
||||
return (new test(Product::has('peerToPeers')->with('peerToPeers')->active()->get()))
|
||||
->response()
|
||||
->setStatusCode(200);
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['message' => $e->getMessage()], 400);
|
||||
}
|
||||
}
|
||||
|
||||
public function peerToPeerLendingData($slug)
|
||||
{
|
||||
try {
|
||||
return (new PeerToPeerLendingResource(PeerToPeerLending::where('slug',$slug)->first()))
|
||||
->response()
|
||||
->setStatusCode(200);
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['message' => $e->getMessage()], 400);
|
||||
}
|
||||
}
|
||||
}
|
||||
183
app/Http/Controllers/Frontend/ProfileController.php
Normal file
183
app/Http/Controllers/Frontend/ProfileController.php
Normal file
@@ -0,0 +1,183 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Frontend;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use App\Models\User;
|
||||
|
||||
class ProfileController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$user = $this->getUser();
|
||||
return view('Frontend.Pages.profile.investor-profile', compact('user'));
|
||||
}
|
||||
|
||||
public function edit()
|
||||
{
|
||||
$user = $this->getUser();
|
||||
|
||||
return view('Frontend.Pages.profile.investor-profile-edit', compact('user'));
|
||||
}
|
||||
|
||||
public function update(Request $request)
|
||||
{
|
||||
// dd($request->all());
|
||||
$validator = Validator::make($request->all(), [
|
||||
'name' => 'required|regex:/^[a-zA-Z ]+$/u|max:255',
|
||||
'email' => 'required|unique:users,email,' . $request->id . '',
|
||||
'contact_number' => 'required|numeric|digits:10|unique:users,contact_number,' . $request->id . '',
|
||||
'profile_image' => 'image|mimes:jpeg,jpg,png|max:2000',
|
||||
'address' => 'required'
|
||||
], [
|
||||
'required' => 'The :attribute field must be required',
|
||||
'unique' => 'The :attribute field must be unique',
|
||||
'numeric' => 'The :attribute field must be in digits',
|
||||
'digits' => 'The :attribute field must have 10 digits',
|
||||
// 'profile_image.mimes' => 'The :attribute can only be of type jpeg,jpg,png'
|
||||
]);
|
||||
|
||||
$validationMessage = $this->validationError($validator);
|
||||
if ($validationMessage) {
|
||||
return response()->json(['status' => 400, 'message' => $validationMessage]);
|
||||
}
|
||||
// dd($request->all());
|
||||
$user = User::where('id', $request->id)->first();
|
||||
|
||||
// dd($user,$user['profile_image'] ,$user->profile_image,$request->profile_image);
|
||||
|
||||
|
||||
// return $user->getRawOriginal('profile_image');
|
||||
|
||||
// if ($request->has('profile_image')) {
|
||||
// if (\File::exists(public_path('/uploads/profile/img/' . $user->getRawOriginal('profile_image') . ''))) {
|
||||
// \File::delete(public_path('/uploads/profile/img/' . $user->getRawOriginal('profile_image') . ''));
|
||||
// }
|
||||
// $profileImageName = time() . '.' . $request->profile_image->extension();
|
||||
// $request->profile_image->move(public_path('/uploads/profile/img'), $profileImageName);
|
||||
// $updateCompanyLogo = User::where('id', $request->id)->update([
|
||||
// 'profile_image' => $profileImageName,
|
||||
// ]);
|
||||
// }
|
||||
// dd($request->profile_image);
|
||||
|
||||
// dd($this->imageUpload($request->profile_image,$request->id));
|
||||
$image = $request->has('profile_image') ? $this->imageUpload($request->profile_image, $request->id) : $user->getRawOriginal('profile_image');
|
||||
// if($request->has('profile_image'))
|
||||
// {
|
||||
// $image = $this->imageUpload($request->profile_image,$request->id);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// $image = $user->profile_image;
|
||||
// }
|
||||
// dd($image);
|
||||
|
||||
$addUser = User::where('id', $request->id)->update([
|
||||
'name' => $request->name,
|
||||
'contact_number' => $request->contact_number,
|
||||
'address' => $request->address,
|
||||
'email' => $request->email,
|
||||
'profile_image' => $image,
|
||||
]);
|
||||
|
||||
if ($addUser) {
|
||||
return response()->json(['status' => 200, 'message' => 'Details Updated Successfully!']);
|
||||
}
|
||||
return response()->json(['status' => 400, 'message' => 'Error Updating Details!']);
|
||||
}
|
||||
|
||||
public function imageUpload($image, $id)
|
||||
{
|
||||
$user = User::where('id', $id)->first();
|
||||
if ($image) {
|
||||
if (\File::exists(public_path('/uploads/profile/img/' . $user->getRawOriginal('profile_image') . ''))) {
|
||||
\File::delete(public_path('/uploads/profile/img/' . $user->getRawOriginal('profile_image') . ''));
|
||||
}
|
||||
$profileImageName = time() . '.' . $image->extension();
|
||||
$image->move(public_path('/uploads/profile/img'), $profileImageName);
|
||||
return $profileImageName;
|
||||
// $updateCompanyLogo = User::where('id', $request->id)->update([
|
||||
// 'profile_image' => $profileImageName,
|
||||
// ]);
|
||||
}
|
||||
}
|
||||
|
||||
public function updateAPI(Request $request)
|
||||
{
|
||||
|
||||
$validator = Validator::make($request->all(), [
|
||||
'name' => 'required',
|
||||
'email' => 'required',
|
||||
'contact_number' => 'required|min:10|max:10|unique:users,contact_number,' . $request->user()->id . '',
|
||||
// 'profile_image' => 'required',
|
||||
'address' => 'required'
|
||||
], [
|
||||
'required' => 'The :attribute field must be required',
|
||||
'unique' => 'The :attribute field must be unique',
|
||||
'min' => 'The :attribute field must be :min digits',
|
||||
'max' => 'The :attribute field must be :max digits'
|
||||
]);
|
||||
|
||||
$validationMessage = $this->validationError($validator);
|
||||
if ($validationMessage) {
|
||||
return response()->json(['status' => 400, 'message' => $validationMessage], 400);
|
||||
}
|
||||
|
||||
$user = User::find($request->user()->id);
|
||||
if ($request->has('profile_image')) {
|
||||
if (\File::exists(public_path('/uploads/profile/img/' . $user->profile_image . ''))) {
|
||||
\File::delete(public_path('/uploads/profile/img/' . $user->profile_image . ''));
|
||||
}
|
||||
$profileImageName = time() . '.' . $request->profile_image->extension();
|
||||
$request->profile_image->move(public_path('/uploads/profile/img'), $profileImageName);
|
||||
$updateCompanyLogo = User::where('id', $request->user()->id)->update([
|
||||
'profile_image' => $profileImageName,
|
||||
]);
|
||||
}
|
||||
|
||||
$addUser = User::where('id', $request->user()->id)->update([
|
||||
'name' => $request->name,
|
||||
'email' => $request->email,
|
||||
'contact_number' => $request->contact_number,
|
||||
'address' => $request->address
|
||||
]);
|
||||
if ($addUser) {
|
||||
return response()->json(['status' => 200, 'message' => 'Details Updated Successfully!']);
|
||||
}
|
||||
return response()->json(['status' => 400, 'message' => 'Error Updating Details!'], 400);
|
||||
}
|
||||
|
||||
public function getUser()
|
||||
{
|
||||
try {
|
||||
$user = User::find(auth()->guard('users')->user()->id);
|
||||
$user = collect([
|
||||
'name' => $user->name,
|
||||
'email' => $user->email,
|
||||
'contact_number' => $user->contact_number,
|
||||
'address' => $user->address,
|
||||
'profile_image' => $user->profile_image,
|
||||
]);
|
||||
return ($user);
|
||||
// ->response()
|
||||
// ->setStatusCode(200);
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['message' => $e->getMessage()], 400);
|
||||
}
|
||||
}
|
||||
|
||||
public function validationError($validator)
|
||||
{
|
||||
if ($validator->fails()) {
|
||||
$errors = $validator->errors();
|
||||
$messages = '';
|
||||
foreach ($errors->all() as $message) {
|
||||
$messages .= $message . '</br>';
|
||||
}
|
||||
return $messages;
|
||||
}
|
||||
}
|
||||
}
|
||||
104
app/Http/Controllers/Frontend/RegistrationController.php
Normal file
104
app/Http/Controllers/Frontend/RegistrationController.php
Normal file
@@ -0,0 +1,104 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Frontend;
|
||||
|
||||
use Mail;
|
||||
use App\Mail\OtpMail;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use Validator;
|
||||
use Carbon\Carbon;
|
||||
use App\Models\Frontend\User;
|
||||
use App\Models\Tempuser;
|
||||
use Illuminate\Support\Facades\Session;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
|
||||
class RegistrationController extends Controller
|
||||
{
|
||||
// verify otp
|
||||
public function verify_otp(Request $request)
|
||||
{
|
||||
// print_r($request->all());
|
||||
// die();
|
||||
$validator = Validator::make($request->all(), [
|
||||
'user_id' => 'required',
|
||||
// 'otp' => 'required'
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
return response()->json(['error' => 'Please enter Otp', 'status' => 204]);
|
||||
}
|
||||
|
||||
$temp_user = Tempuser::where('id', $request->user_id)->first();
|
||||
|
||||
// otp verification failed handling
|
||||
$current_time = Carbon::now('Asia/colombo');
|
||||
if ($temp_user->otp != $request->otp) {
|
||||
return response()->json(['error' => 'Incorret OTP', 'status' => 400]);
|
||||
} elseif ($temp_user->otp == $request->otp && $current_time->isAfter($temp_user->expire_at)) {
|
||||
return response()->json(['error' => 'Your OTP has been expired', 'status' => 400]);
|
||||
}
|
||||
|
||||
// validating otp
|
||||
if ($temp_user->otp == $request->otp) {
|
||||
$user = new User();
|
||||
$user->name = $temp_user->name;
|
||||
$user->email = $temp_user->email;
|
||||
$user->contact_number = $temp_user->contact_number;
|
||||
$user->password = $temp_user->password;
|
||||
$user->is_verified = "1";
|
||||
$user->expire_at = $temp_user->expire_at;
|
||||
$user->save();
|
||||
if ($user->id != '') {
|
||||
$temp_user->delete();
|
||||
return response()->json(['message' => 'OTP has been sent to your mail and phone', 'status' => 200]);
|
||||
} else {
|
||||
return response()->json(['error' => 'registration failed', 'status' => 404]);
|
||||
}
|
||||
} else {
|
||||
return response()->json(['error' => 'Incorrect otp, please try again', 'status' => 204]);
|
||||
}
|
||||
}
|
||||
|
||||
// resend otp while login
|
||||
public function request_otp(Request $request)
|
||||
{
|
||||
// $validator = Validator::make(
|
||||
// $request->all(),
|
||||
// [
|
||||
// 'user_id' => 'required|exists:temp_users,id',
|
||||
// ]
|
||||
// );
|
||||
|
||||
// if ($validator->fails()) {
|
||||
// return response()->json(['error' => $validator->errors()], 204);
|
||||
// }
|
||||
|
||||
if (Session::has('user-registration')) {
|
||||
$session = Session::get('user-registration');
|
||||
$otp = rand(1000, 9999);
|
||||
$session['otp'] = $otp;
|
||||
$mailData = [
|
||||
'title' => 'Mail from ItSolutionStuff.com',
|
||||
'body' => 'This is for testing email using smtp.'
|
||||
];
|
||||
Mail::to($session['email'])->send(new OtpMail($mailData, $otp));
|
||||
Session::put('user-registration', $session);
|
||||
return response()->json(['message' => 'OTP has been sent to your mail and phone', 'status' => 200]);
|
||||
} else {
|
||||
return redirect()->route('register');
|
||||
}
|
||||
|
||||
$user = Tempuser::where('id', $request->user_id)->first();
|
||||
try {
|
||||
if ($user) {
|
||||
$user->expires_at = Carbon::now('Asia/colombo')->addMinutes(2);
|
||||
$user->update();
|
||||
|
||||
return response()->json(['message' => 'OTP has been sent to your mail and phone', 'status' => 200]);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['error' => 'Netwrok Error! Please try again after sometime.', 'status' => 500]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Frontend;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Admin\ManageFreeUInvestments\FractionalRealEstateController as FractionalRealEstateFontendController;
|
||||
|
||||
class RevenueBasedFinancingController extends Controller
|
||||
{
|
||||
public function index(){
|
||||
$learnMore = (new FractionalRealEstateFontendController)->revenueBasedFinancingQuestionAndAnswer()->getData();
|
||||
$faqs = (new FractionalRealEstateFontendController)->revenueBasedFinancingQuestionAndAnswerFaqs()->getData();
|
||||
return view('Frontend.Pages.revenue-based-financing.index',compact('learnMore','faqs'));
|
||||
}
|
||||
|
||||
public function product(){
|
||||
return view('Frontend.Pages.revenue-based-financing.product');
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user