Initial commit: add CMS Launchpad module
This commit is contained in:
commit
062c41b4d3
|
@ -0,0 +1,25 @@
|
|||
<IfModule mod_rewrite.c>
|
||||
<IfModule mod_negotiation.c>
|
||||
Options -MultiViews -Indexes
|
||||
</IfModule>
|
||||
|
||||
RewriteEngine On
|
||||
|
||||
# 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]
|
||||
|
||||
# Handle Front Controller...
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteRule ^ index.php [L]
|
||||
</IfModule>
|
||||
|
||||
# php -- BEGIN cPanel-generated handler, do not edit
|
||||
# Set the “ea-php81” package as the default “PHP” programming language.
|
||||
# php -- END cPanel-generated handler, do not edit
|
|
@ -0,0 +1,89 @@
|
|||
APP_NAME=CIFO
|
||||
APP_ENV=local
|
||||
APP_KEY=base64:1wy3vbqvu0NyfqN5i6gFvFQapA2YHxIPbqeyzyiL3aY=
|
||||
APP_DEBUG=true
|
||||
APP_URL=http://localhost
|
||||
|
||||
LOG_CHANNEL=stack
|
||||
|
||||
DB_CONNECTION=mysql
|
||||
DB_HOST=localhost
|
||||
DB_PORT=3306
|
||||
DB_DATABASE=dev_webcifo_token
|
||||
DB_USERNAME=mincreng
|
||||
DB_PASSWORD="citranetbd9"
|
||||
|
||||
BROADCAST_DRIVER=log
|
||||
CACHE_DRIVER=file
|
||||
QUEUE_CONNECTION=sync
|
||||
SESSION_DRIVER=file
|
||||
SESSION_LIFETIME=120
|
||||
|
||||
REDIS_HOST=127.0.0.1
|
||||
REDIS_PASSWORD=null
|
||||
REDIS_PORT=6379
|
||||
|
||||
MAIL_DRIVER=smtp
|
||||
MAIL_HOST=YOUR_SMTP_HOST_NAME
|
||||
MAIL_PORT=YOUR_SMTP_PORT
|
||||
MAIL_USERNAME=YOUR_SMTP_USERNAME
|
||||
MAIL_PASSWORD=YOUR_SMTP_USERNAME_PASSWORD
|
||||
MAIL_ENCRYPTION=YOUR_SMTP_ENCRIPTION
|
||||
MAIL_FROM_ADDRESS=null
|
||||
MAIL_FROM_NAME="${APP_NAME}"
|
||||
|
||||
AWS_ACCESS_KEY_ID=
|
||||
AWS_SECRET_ACCESS_KEY=
|
||||
AWS_DEFAULT_REGION=us-east-1
|
||||
AWS_BUCKET=
|
||||
|
||||
PUSHER_APP_ID=
|
||||
PUSHER_APP_KEY=
|
||||
PUSHER_APP_SECRET=
|
||||
PUSHER_APP_CLUSTER=mt1
|
||||
|
||||
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
|
||||
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
|
||||
|
||||
|
||||
PAYSTACK_PUBLIC_KEY=pk_test_081a8fcd9423dede2de7b4c3143375b5e5415290
|
||||
PAYSTACK_SECRET_KEY=sk_test_c874d38f8d08760efc517fc83d8cd574b906374f
|
||||
PAYSTACK_PAYMENT_URL=https://api.paystack.co
|
||||
MERCHANT_EMAIL=dvrobin4@gmail.com
|
||||
|
||||
XGENIOUS_API_URL="https://xgenious.com/api/"
|
||||
XGENIOUS_API_KEY="NB2GLtODUjYOc9bFkPq2pKI8uma3G6WX"
|
||||
XGENIOUS_API_ACTION="license_verify"
|
||||
XGENIOUS_API_AUTHOR="xgenious"
|
||||
XGENIOUS_NEXELIT_VERSION=3.6.0
|
||||
|
||||
RSS_FEED_URL="/feeds"
|
||||
RSS_FEED_TITLE="My feeds"
|
||||
RSS_FEED_DESCRIPTION="The description of the feed."
|
||||
RSS_FEED_LANGUAGE=en
|
||||
|
||||
MOLLIE_KEY=test_SMWtwR6W48QN2UwFQBUqRDKWhaQEvw
|
||||
|
||||
FLW_PUBLIC_KEY=FLWPUBK_TEST-86cce2ec43c63e09a517290a8347fcab-X
|
||||
FLW_SECRET_KEY=FLWSECK_TEST-d37a42d8917db84f1b2f47c125252d0a-X
|
||||
FLW_SECRET_HASH="nexelit"
|
||||
|
||||
PAYPAL_CLIENT_ID=ATx-SYQyPtXHw1bZaBDhJUZabxbutIqAqqZORgvgEoK_-9MrAkUzYkbt8pSnUyKNEdNN3aJt8tcpcY1I
|
||||
PAYPAL_SECRET=ELJCWPUabUnnMamfw5-ZxaUsvir3KAJrPnAcSeS11znsroi45HP0p7y7vGZcYsBsAAi7Ou6kelCpj69K
|
||||
PAYPAL_MODE=sandbox
|
||||
|
||||
PAYTM_ENVIRONMENT=local
|
||||
PAYTM_MERCHANT_ID=Digita57697814558795
|
||||
PAYTM_MERCHANT_KEY=dv0XtmsPYpewNag&
|
||||
PAYTM_MERCHANT_WEBSITE=WEBSTAGING
|
||||
PAYTM_CHANNEL=WEB
|
||||
PAYTM_INDUSTRY_TYPE=Retail
|
||||
|
||||
SITE_UNIQUE_KEY="NB2GLtODUjYOc9bFkPq2pKI8uma3G6WX"
|
||||
|
||||
FACEBOOK_CLIENT_ID=""
|
||||
FACEBOOK_CLIENT_SECRET=""
|
||||
FACEBOOK_CALLBACK_URL=""
|
||||
GOOGLE_CLIENT_ID=""
|
||||
GOOGLE_CLIENT_SECRET=""
|
||||
GOOGLE_CALLBACK_URL=""
|
|
@ -0,0 +1,8 @@
|
|||
# Disable index view
|
||||
Options -Indexes
|
||||
|
||||
# Hide a specific file
|
||||
<Files .env>
|
||||
Order allow,deny
|
||||
Deny from all
|
||||
</Files>
|
|
@ -0,0 +1,79 @@
|
|||
<p align="center"><img src="https://res.cloudinary.com/dtfbvvkyp/image/upload/v1566331377/laravel-logolockup-cmyk-red.svg" width="400"></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://poser.pugx.org/laravel/framework/d/total.svg" alt="Total Downloads"></a>
|
||||
<a href="https://packagist.org/packages/laravel/framework"><img src="https://poser.pugx.org/laravel/framework/v/stable.svg" alt="Latest Stable Version"></a>
|
||||
<a href="https://packagist.org/packages/laravel/framework"><img src="https://poser.pugx.org/laravel/framework/license.svg" 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).
|
||||
|
||||
- **[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)**
|
||||
- **[British Software Development](https://www.britishsoftware.co)**
|
||||
- **[Webdock, Fast VPS Hosting](https://www.webdock.io/en)**
|
||||
- **[DevSquad](https://devsquad.com)**
|
||||
- [UserInsights](https://userinsights.com)
|
||||
- [Fragrantica](https://www.fragrantica.com)
|
||||
- [SOFTonSOFA](https://softonsofa.com/)
|
||||
- [User10](https://user10.com)
|
||||
- [Soumettre.fr](https://soumettre.fr/)
|
||||
- [CodeBrisk](https://codebrisk.com)
|
||||
- [1Forge](https://1forge.com)
|
||||
- [TECPRESSO](https://tecpresso.co.jp/)
|
||||
- [Runtime Converter](http://runtimeconverter.com/)
|
||||
- [WebL'Agence](https://weblagence.com/)
|
||||
- [Invoice Ninja](https://www.invoiceninja.com)
|
||||
- [iMi digital](https://www.imi-digital.de/)
|
||||
- [Earthlink](https://www.earthlink.ro/)
|
||||
- [Steadfast Collective](https://steadfastcollective.com/)
|
||||
- [We Are The Robots Inc.](https://watr.mx/)
|
||||
- [Understand.io](https://www.understand.io/)
|
||||
- [Abdel Elrafa](https://abdelelrafa.com)
|
||||
- [Hyper Host](https://hyper.host)
|
||||
- [Appoly](https://www.appoly.co.uk)
|
||||
- [OP.GG](https://op.gg)
|
||||
- [云软科技](http://www.yunruan.ltd/)
|
||||
|
||||
## 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).
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
|
||||
namespace App\Actions;
|
||||
|
||||
class SlugChecker
|
||||
{
|
||||
public static function Check($request,$model){
|
||||
$user_given_slug = $request->slug;
|
||||
if (!empty($request->lang)){
|
||||
$model->where('lang' , $request->lang);
|
||||
}
|
||||
$slug_count = $model->count();
|
||||
|
||||
if ($request->type === 'new' && $slug_count > 0){
|
||||
return $user_given_slug.'-'.$slug_count;
|
||||
}elseif ($request->type === 'update' && $slug_count > 1){
|
||||
return $user_given_slug.'-'.$slug_count;
|
||||
}
|
||||
return $user_given_slug;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
|
||||
class Admin extends Authenticatable
|
||||
{
|
||||
use Notifiable;
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'email',
|
||||
'image',
|
||||
'role',
|
||||
'password',
|
||||
'username',
|
||||
'email_verified'
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be hidden for arrays.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $hidden = [
|
||||
'password',
|
||||
'remember_token',
|
||||
];
|
||||
|
||||
public function admin_role(){
|
||||
return $this->hasOne('App\AdminRole','id');
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class AdminRole extends Model
|
||||
{
|
||||
protected $table = 'admin_roles';
|
||||
protected $fillable = ['name' ,'permission'];
|
||||
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Advertisement extends Model
|
||||
{
|
||||
protected $table = 'advertisements';
|
||||
protected $fillable = ['type','size','image','slot','embed_code','redirect_url','click','impression','status','title'];
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Appointment extends Model
|
||||
{
|
||||
protected $table = 'appointments';
|
||||
protected $fillable = ['image','categories_id','booking_time_ids','status','appointment_status','max_appointment','price'];
|
||||
|
||||
public function setAppointmentStatusAttribute($value){
|
||||
$this->attributes['appointment_status'] = !empty($value) ? 'yes' : 'no';
|
||||
}
|
||||
public function category(){
|
||||
return $this->belongsTo(AppointmentCategory::class,'categories_id');
|
||||
}
|
||||
|
||||
public function getBookingTimeIdsAttribute($value){
|
||||
$all_booking_time = AppointmentBookingTime::whereIn('id',explode(',',$value))->get();
|
||||
$all_times = $all_booking_time->map(function ($item){
|
||||
return ['id' => $item->id, 'time' => $item->time];
|
||||
})->toArray();
|
||||
return $all_times;
|
||||
}
|
||||
|
||||
public function reviews(){
|
||||
return $this->hasMany(AppointmentLang::class,'appointment_id','appointment_id');
|
||||
}
|
||||
public function lang(){
|
||||
return $this->hasOne(AppointmentLang::class,'appointment_id')->where(['lang' => get_default_language()]);
|
||||
}
|
||||
public function lang_front(){
|
||||
return $this->hasOne(AppointmentLang::class,'appointment_id')->where(['lang' => get_user_lang()]);
|
||||
}
|
||||
public function lang_all(){
|
||||
return $this->hasMany(AppointmentLang::class,'appointment_id');
|
||||
}
|
||||
public function lang_query(){
|
||||
return $this->hasOne(AppointmentLang::class,'appointment_id');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class AppointmentBooking extends Model
|
||||
{
|
||||
protected $table = 'appointment_bookings';
|
||||
protected $fillable = ['all_attachment','custom_fields','email','name','total','appointment_id','user_id','payment_gateway','payment_track','transaction_id','payment_status','status','booking_time_id','booking_date','manual_payment_attachment'];
|
||||
|
||||
public function user(){
|
||||
return $this->belongsTo(User::class,'user_id');
|
||||
}
|
||||
public function booking_time(){
|
||||
return $this->belongsTo(AppointmentBookingTime::class,'booking_time_id');
|
||||
}
|
||||
public function appointment(){
|
||||
return $this->belongsTo(Appointment::class,'appointment_id');
|
||||
}
|
||||
|
||||
public function setCustomFieldsAttribute($value){
|
||||
$final_value = $value ?? [];
|
||||
$test = $final_value;
|
||||
unset($test["manual_payment_attachment"]);
|
||||
$this->attributes['custom_fields'] = serialize($test) ;
|
||||
unset($test);
|
||||
}
|
||||
|
||||
public function getCustomFieldsAttribute($value){
|
||||
return unserialize($value,['class' => false]);
|
||||
}
|
||||
public function setAllAttachmentAttribute($value){
|
||||
$final_value = $value ?? [];
|
||||
$this->attributes['all_attachment'] = serialize($final_value);
|
||||
}
|
||||
public function getAllAttachmentAttribute($value){
|
||||
return unserialize($value,['class' => false]);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class AppointmentBookingTime extends Model
|
||||
{
|
||||
protected $fillable = ['time','status'];
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class AppointmentCategory extends Model
|
||||
{
|
||||
protected $fillable = ['status'];
|
||||
public function lang(){
|
||||
return $this->hasOne(AppointmentCategoryLang::class,'cat_id')->where(['lang' => get_default_language()]);
|
||||
}
|
||||
public function lang_front(){
|
||||
return $this->hasOne(AppointmentCategoryLang::class,'cat_id')->where(['lang' => get_user_lang()]);
|
||||
}
|
||||
public function lang_all(){
|
||||
return $this->hasMany(AppointmentCategoryLang::class,'cat_id');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class AppointmentCategoryLang extends Model
|
||||
{
|
||||
protected $table = 'appointment_category_langs';
|
||||
protected $fillable = ['cat_id','title','lang'];
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class AppointmentLang extends Model
|
||||
{
|
||||
protected $table = 'appointment_langs';
|
||||
protected $fillable = [
|
||||
'description',
|
||||
'additional_info',
|
||||
'experience_info',
|
||||
'specialized_info',
|
||||
'location',
|
||||
'meta_description',
|
||||
'meta_title',
|
||||
'meta_tags',
|
||||
'slug',
|
||||
'short_description',
|
||||
'lang',
|
||||
'appointment_id',
|
||||
'title',
|
||||
'designation',
|
||||
];
|
||||
|
||||
public function setAdditionalInfoAttribute($value){
|
||||
$final_value = $value ?? [];
|
||||
$this->attributes['additional_info'] = serialize($final_value);
|
||||
}
|
||||
public function setExperienceInfoAttribute($value){
|
||||
$final_value = $value ?? [];
|
||||
$this->attributes['experience_info'] = serialize($final_value);
|
||||
}
|
||||
public function setSpecializedInfoAttribute($value){
|
||||
$final_value = $value ?? [];
|
||||
$this->attributes['specialized_info'] = serialize($final_value);
|
||||
}
|
||||
|
||||
public function getAdditionalInfoAttribute($value){
|
||||
$val = unserialize($value,['class' => false]) ?? [];
|
||||
return $val;
|
||||
}
|
||||
public function getExperienceInfoAttribute($value){
|
||||
$val = unserialize($value,['class' => false]) ?? [];
|
||||
return $val;
|
||||
}
|
||||
public function getSpecializedInfoAttribute($value){
|
||||
$val = unserialize($value,['class' => false]) ?? [];
|
||||
return $val;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class AppointmentReview extends Model
|
||||
{
|
||||
protected $table = 'appointment_reviews';
|
||||
protected $fillable = ['user_id','ratings','appointment_id','message'];
|
||||
|
||||
public function appointment(){
|
||||
return $this->belongsTo(Appointment::class,'appointment_id');
|
||||
}
|
||||
|
||||
public function user(){
|
||||
return $this->belongsTo(User::class,'user_id');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Spatie\Feed\Feedable;
|
||||
use Spatie\Feed\FeedItem;
|
||||
|
||||
|
||||
class Blog extends Model implements Feedable
|
||||
{
|
||||
protected $table = 'blogs';
|
||||
protected $fillable = ['title','lang','status','author','slug','meta_description','meta_tags','excerpt','content','blog_categories_id','tags','image','user_id','breaking_news','video_url'];
|
||||
|
||||
public function category(){
|
||||
return $this->belongsTo('App\BlogCategory','blog_categories_id');
|
||||
}
|
||||
public function user(){
|
||||
return $this->belongsTo('App\Admin','user_id');
|
||||
}
|
||||
|
||||
protected $casts = [
|
||||
'breaking_news' => 'integer',
|
||||
'user_id' => 'integer'
|
||||
];
|
||||
|
||||
public function toFeedItem() : FeedItem
|
||||
{
|
||||
return FeedItem::create([
|
||||
'id' => $this->id,
|
||||
'title' => $this->title,
|
||||
'summary' => $this->excerpt,
|
||||
'updated' => $this->updated_at,
|
||||
'link' => route('frontend.blog.single',$this->slug),
|
||||
'author' => $this->author,
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getAllFeedItems()
|
||||
{
|
||||
return Blog::all();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class BlogCategory extends Model
|
||||
{
|
||||
protected $table ='blog_categories';
|
||||
protected $fillable = ['name','lang','status','image'];
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Brand extends Model
|
||||
{
|
||||
protected $table ='brands';
|
||||
protected $fillable =['title','image','url'];
|
||||
}
|
|
@ -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');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ContactInfoItem extends Model
|
||||
{
|
||||
protected $table = 'contact_info_items';
|
||||
protected $fillable = [ 'title','icon','lang','description'];
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Counterup extends Model
|
||||
{
|
||||
protected $table = 'counterups';
|
||||
protected $fillable = ['icon','number','title','extra_text','lang'];
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Course extends Model
|
||||
{
|
||||
protected $table = 'courses';
|
||||
protected $fillable = ['image','status','duration','duration_type','max_student','enrolled_student','featured','external_url','price','sale_price','enroll_required','og_meta_image','instructor_id','curriculum_id','categories_id'];
|
||||
|
||||
|
||||
public function setCurriculumIdAttribute($value)
|
||||
{
|
||||
$val = $value ?? [];
|
||||
$this->attributes['curriculum_id'] = serialize($val);
|
||||
}
|
||||
public function setFeaturedAttribute($value)
|
||||
{
|
||||
$this->attributes['featured'] = !empty($value) ? 'yes' : 'no';
|
||||
}
|
||||
public function setEnrollRequiredAttribute($value)
|
||||
{
|
||||
$this->attributes['enroll_required'] = !empty($value) ? 'yes' : 'no';
|
||||
}
|
||||
|
||||
public function lang_query(){
|
||||
return $this->hasOne(CourseLang::class,'course_id');
|
||||
}
|
||||
public function lang(){
|
||||
return $this->hasOne(CourseLang::class,'course_id')->where('lang',get_default_language());
|
||||
}
|
||||
public function lang_front(){
|
||||
return $this->hasOne(CourseLang::class,'course_id')->where('lang',get_user_lang());
|
||||
}
|
||||
public function lang_all(){
|
||||
return $this->hasMany(CourseLang::class,'course_id');
|
||||
}
|
||||
public function category(){
|
||||
return $this->belongsTo(CoursesCategory::class,'categories_id');
|
||||
}
|
||||
public function instructor(){
|
||||
return $this->belongsTo(CourseInstructor::class,'instructor_id');
|
||||
}
|
||||
public function curriculum(){
|
||||
return $this->hasMany(CourseCurriculm::class,'course_id');
|
||||
}
|
||||
public function lesson_count(){
|
||||
return $this->hasMany(CourseLession::class,'course_id');
|
||||
}
|
||||
public function reviews(){
|
||||
return $this->hasMany(CourseReview::class,'course_id');
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class CourseCertificate extends Model
|
||||
{
|
||||
protected $fillable = ['course_id','user_id','status'];
|
||||
|
||||
public function course(){
|
||||
return $this->belongsTo(Course::class,'course_id');
|
||||
}
|
||||
public function user(){
|
||||
return $this->belongsTo(User::class,'user_id');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class CourseCoupon extends Model
|
||||
{
|
||||
protected $table = 'course_coupons';
|
||||
protected $fillable = ['code','discount','discount_type','expire_date','status'];
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class CourseCurriculm extends Model
|
||||
{
|
||||
protected $table = 'course_curriculms';
|
||||
protected $fillable = ['course_id'];
|
||||
|
||||
public function lang_all(){
|
||||
return $this->hasMany(CourseCurriculmLang::class,'curriculum_id');
|
||||
}
|
||||
public function lesson(){
|
||||
return $this->hasMany(CourseLession::class,'curriculum_id');
|
||||
}
|
||||
public function lang_front(){
|
||||
return $this->hasOne(CourseCurriculmLang::class,'curriculum_id')->where(['lang' => get_user_lang()]);
|
||||
}
|
||||
public function lang_query(){
|
||||
return $this->hasOne(CourseCurriculmLang::class,'curriculum_id');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class CourseCurriculmLang extends Model
|
||||
{
|
||||
protected $table = 'course_curriculm_langs';
|
||||
protected $fillable = ['curriculum_id','description','title','lang'];
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class CourseEnroll extends Model
|
||||
{
|
||||
protected $table = 'course_enrolls';
|
||||
protected $fillable = ['total','name','email','user_id','payment_gateway','payment_track','transaction_id','payment_status','status','course_id','coupon','coupon_discounted','manual_payment_attachment'];
|
||||
|
||||
public function course(){
|
||||
return $this->belongsTo(Course::class,'course_id');
|
||||
}
|
||||
public function user(){
|
||||
return $this->belongsTo(User::class,'user_id');
|
||||
}
|
||||
|
||||
public function certificate(){
|
||||
return $this->belongsTo(CourseCertificate::class,'course_id','course_id')
|
||||
->where('user_id',Auth::guard('web')->id());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class CourseInstructor extends Model
|
||||
{
|
||||
protected $table = 'course_instructors';
|
||||
protected $fillable = ['image','social_icons','name','designation','social_icon_url'];
|
||||
|
||||
public function setSocialIconsAttribute($value){
|
||||
$final_value = $value ?? [];
|
||||
$this->attributes['social_icons'] = serialize($final_value);
|
||||
}
|
||||
public function getSocialIconsAttribute($value){
|
||||
return unserialize($value,['class'=>false]);
|
||||
}
|
||||
public function getSocialIconUrlAttribute($value){
|
||||
return unserialize($value,['class'=>false]);
|
||||
}
|
||||
public function setSocialIconUrlAttribute($value){
|
||||
$final_value = $value ?? [];
|
||||
$this->attributes['social_icon_url'] = serialize($final_value);
|
||||
}
|
||||
|
||||
public function lang(){
|
||||
return $this->hasOne(CourseInstructorLang::class,'instructor_id')->where('lang',get_default_language());
|
||||
}
|
||||
public function lang_query(){
|
||||
return $this->hasOne(CourseInstructorLang::class,'instructor_id');
|
||||
}
|
||||
public function lang_front(){
|
||||
return $this->hasOne(CourseInstructorLang::class,'instructor_id')->where('lang',get_user_lang());
|
||||
}
|
||||
public function lang_all(){
|
||||
return $this->hasMany(CourseInstructorLang::class,'instructor_id');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class CourseInstructorLang extends Model
|
||||
{
|
||||
protected $table = 'course_instructor_langs';
|
||||
protected $fillable = ['instructor_id','description','lang'];
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class CourseLang extends Model
|
||||
{
|
||||
protected $table = 'course_langs';
|
||||
protected $fillable = ['lang','title','description','meta_tag','meta_title','meta_description','og_meta_title','course_id','slug'];
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class CourseLession extends Model
|
||||
{
|
||||
protected $table = 'course_lessions';
|
||||
protected $fillable = ['course_id','curriculum_id','video_embed_code','status','duration','duration_type','preview','file'];
|
||||
|
||||
public function setPreviewAttribute($value){
|
||||
$this->attributes['preview'] = $value ? 'yes' : 'no';
|
||||
}
|
||||
public function lang(){
|
||||
return $this->hasOne(CourseLessionLang::class,'lession_id')->where('lang',get_default_language());
|
||||
}
|
||||
|
||||
public function lang_query(){
|
||||
return $this->hasOne(CourseLessionLang::class,'lession_id');
|
||||
}
|
||||
public function lang_all(){
|
||||
return $this->hasMany(CourseLessionLang::class,'lession_id');
|
||||
}
|
||||
public function lang_front(){
|
||||
return $this->hasOne(CourseLessionLang::class,'lession_id')->where('lang',get_user_lang());
|
||||
}
|
||||
public function course(){
|
||||
return $this->hasOne(CourseLang::class,'course_id','course_id')->where('lang',get_default_language());
|
||||
}
|
||||
public function curriculum(){
|
||||
return $this->hasOne(CourseCurriculmLang::class,'curriculum_id','curriculum_id')->where('lang',get_default_language());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class CourseLessionLang extends Model
|
||||
{
|
||||
protected $table = 'course_lession_langs';
|
||||
protected $fillable = ['lession_id','lang','title','description'];
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class CourseReview extends Model
|
||||
{
|
||||
protected $table = 'course_reviews';
|
||||
protected $fillable = ['ratings','message','course_id','user_id'];
|
||||
|
||||
public function user(){
|
||||
return $this->belongsTo(User::class,'user_id');
|
||||
}
|
||||
public function course(){
|
||||
return $this->belongsTo(Course::class,'course_id');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class CoursesCategory extends Model
|
||||
{
|
||||
protected $table = 'courses_categories';
|
||||
protected $fillable = ['status','icon'];
|
||||
|
||||
public function lang(){
|
||||
return $this->hasOne(CoursesCategoryLang::class,'cat_id')->where(['lang' => get_default_language()]);
|
||||
}
|
||||
public function lang_front(){
|
||||
return $this->hasOne(CoursesCategoryLang::class,'cat_id')->where(['lang' => get_user_lang()]);
|
||||
}
|
||||
public function course(){
|
||||
return $this->hasMany(Course::class,'categories_id');
|
||||
}
|
||||
public function lang_all(){
|
||||
return $this->hasMany(CoursesCategoryLang::class,'cat_id');
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class CoursesCategoryLang extends Model
|
||||
{
|
||||
protected $table = 'courses_category_langs';
|
||||
protected $fillable = ['cat_id','title','lang'];
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Donation extends Model
|
||||
{
|
||||
protected $table = 'donations';
|
||||
protected $fillable = ['title','donation_content','amount','raised','status','lang','slug','image','meta_tags','meta_description'];
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class DonationLogs extends Model
|
||||
{
|
||||
protected $table = 'donation_logs';
|
||||
protected $fillable = ['donation_id','email','name','status','amount','transaction_id','payment_gateway','track','user_id','anonymous'];
|
||||
|
||||
public function donation(){
|
||||
return $this->belongsTo('App\Donation','donation_id');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class EventAttendance extends Model
|
||||
{
|
||||
protected $table = 'event_attendances';
|
||||
protected $fillable = ['status','payment_status','quantity','event_id','event_name','checkout_type','user_id','event_cost','custom_fields','attachment'];
|
||||
|
||||
public function event(){
|
||||
return $this->belongsTo('App\Events','event_id');
|
||||
}
|
||||
public function payment(){
|
||||
return $this->hasOne(EventPaymentLogs::class,'attendance_id');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class EventPaymentLogs extends Model
|
||||
{
|
||||
protected $table = 'event_payment_logs';
|
||||
protected $fillable = ['email','name','event_name','event_cost','event_gateway','attendance_id','package_gateway','status','transaction_id','track'];
|
||||
public function attendance_logs(){
|
||||
return $this->belongsTo('App\EventAttendance','attendance_id');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Events extends Model
|
||||
{
|
||||
protected $table = 'events';
|
||||
protected $fillable = ['title','status','lang','date','image','time','cost','available_tickets','organizer','organizer_email','organizer_phone','slug','organizer_website','venue','venue_location','venue_phone','content','category_id','meta_description','meta_tags'];
|
||||
|
||||
public function category(){
|
||||
return $this->hasOne('App\EventsCategory','id','category_id');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
|
||||
namespace App\Events;
|
||||
|
||||
use Illuminate\Broadcasting\Channel;
|
||||
use Illuminate\Broadcasting\InteractsWithSockets;
|
||||
use Illuminate\Broadcasting\PresenceChannel;
|
||||
use Illuminate\Broadcasting\PrivateChannel;
|
||||
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
|
||||
use Illuminate\Foundation\Events\Dispatchable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class AppointmentBooking
|
||||
{
|
||||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||
public $data;
|
||||
|
||||
public function __construct(array $data)
|
||||
{
|
||||
$this->data = $data;
|
||||
}
|
||||
|
||||
public function broadcastOn()
|
||||
{
|
||||
return new PrivateChannel('channel-name');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
|
||||
namespace App\Events;
|
||||
|
||||
use Illuminate\Broadcasting\Channel;
|
||||
use Illuminate\Broadcasting\InteractsWithSockets;
|
||||
use Illuminate\Broadcasting\PresenceChannel;
|
||||
use Illuminate\Broadcasting\PrivateChannel;
|
||||
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
|
||||
use Illuminate\Foundation\Events\Dispatchable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class AttendanceBooking
|
||||
{
|
||||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||
public $data;
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(array $data)
|
||||
{
|
||||
$this->data = $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the channels the event should broadcast on.
|
||||
*
|
||||
* @return \Illuminate\Broadcasting\Channel|array
|
||||
*/
|
||||
public function broadcastOn()
|
||||
{
|
||||
return new PrivateChannel('channel-name');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
|
||||
namespace App\Events;
|
||||
|
||||
use Illuminate\Broadcasting\Channel;
|
||||
use Illuminate\Broadcasting\InteractsWithSockets;
|
||||
use Illuminate\Broadcasting\PresenceChannel;
|
||||
use Illuminate\Broadcasting\PrivateChannel;
|
||||
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
|
||||
use Illuminate\Foundation\Events\Dispatchable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class CourseEnrollSuccess
|
||||
{
|
||||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||
public $data;
|
||||
|
||||
public function __construct(array $data)
|
||||
{
|
||||
$this->data = $data;
|
||||
}
|
||||
|
||||
public function broadcastOn()
|
||||
{
|
||||
return new PrivateChannel('channel-name');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
|
||||
namespace App\Events;
|
||||
|
||||
use Illuminate\Broadcasting\Channel;
|
||||
use Illuminate\Broadcasting\InteractsWithSockets;
|
||||
use Illuminate\Broadcasting\PresenceChannel;
|
||||
use Illuminate\Broadcasting\PrivateChannel;
|
||||
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
|
||||
use Illuminate\Foundation\Events\Dispatchable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class DonationSuccess
|
||||
{
|
||||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||
public $data;
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(array $data)
|
||||
{
|
||||
$this->data = $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the channels the event should broadcast on.
|
||||
*
|
||||
* @return \Illuminate\Broadcasting\Channel|array
|
||||
*/
|
||||
public function broadcastOn()
|
||||
{
|
||||
return new PrivateChannel('channel-name');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
|
||||
namespace App\Events;
|
||||
|
||||
use Illuminate\Broadcasting\Channel;
|
||||
use Illuminate\Broadcasting\InteractsWithSockets;
|
||||
use Illuminate\Broadcasting\PresenceChannel;
|
||||
use Illuminate\Broadcasting\PrivateChannel;
|
||||
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
|
||||
use Illuminate\Foundation\Events\Dispatchable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class JobApplication
|
||||
{
|
||||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||
public $data;
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(array $data)
|
||||
{
|
||||
$this->data = $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the channels the event should broadcast on.
|
||||
*
|
||||
* @return \Illuminate\Broadcasting\Channel|array
|
||||
*/
|
||||
public function broadcastOn()
|
||||
{
|
||||
return new PrivateChannel('channel-name');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
|
||||
namespace App\Events;
|
||||
|
||||
use Illuminate\Broadcasting\Channel;
|
||||
use Illuminate\Broadcasting\InteractsWithSockets;
|
||||
use Illuminate\Broadcasting\PresenceChannel;
|
||||
use Illuminate\Broadcasting\PrivateChannel;
|
||||
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
|
||||
use Illuminate\Foundation\Events\Dispatchable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class PackagesOrderSuccess
|
||||
{
|
||||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||
public $orders;
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(array $orders)
|
||||
{
|
||||
$this->orders = $orders;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the channels the event should broadcast on.
|
||||
*
|
||||
* @return \Illuminate\Broadcasting\Channel|array
|
||||
*/
|
||||
public function broadcastOn()
|
||||
{
|
||||
return new PrivateChannel('channel-name');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
|
||||
namespace App\Events;
|
||||
|
||||
use Illuminate\Broadcasting\Channel;
|
||||
use Illuminate\Broadcasting\InteractsWithSockets;
|
||||
use Illuminate\Broadcasting\PresenceChannel;
|
||||
use Illuminate\Broadcasting\PrivateChannel;
|
||||
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
|
||||
use Illuminate\Foundation\Events\Dispatchable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class ProductOrders
|
||||
{
|
||||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||
public $order_details;
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(array $order_details)
|
||||
{
|
||||
$this->order_details = $order_details;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the channels the event should broadcast on.
|
||||
*
|
||||
* @return \Illuminate\Broadcasting\Channel|array
|
||||
*/
|
||||
public function broadcastOn()
|
||||
{
|
||||
return new PrivateChannel('channel-name');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
|
||||
namespace App\Events;
|
||||
|
||||
use Illuminate\Broadcasting\Channel;
|
||||
use Illuminate\Broadcasting\InteractsWithSockets;
|
||||
use Illuminate\Broadcasting\PresenceChannel;
|
||||
use Illuminate\Broadcasting\PrivateChannel;
|
||||
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
|
||||
use Illuminate\Foundation\Events\Dispatchable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class SupportMessage
|
||||
{
|
||||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||
public $message;
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($message)
|
||||
{
|
||||
$this->message = $message;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the channels the event should broadcast on.
|
||||
*
|
||||
* @return \Illuminate\Broadcasting\Channel|array
|
||||
*/
|
||||
public function broadcastOn()
|
||||
{
|
||||
return new PrivateChannel('channel-name');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class EventsCategory extends Model
|
||||
{
|
||||
protected $table = 'events_categories';
|
||||
protected $fillable = ['title','status','lang'];
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
|
||||
namespace App\Exceptions;
|
||||
|
||||
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
||||
use Throwable;
|
||||
|
||||
class Handler extends ExceptionHandler
|
||||
{
|
||||
|
||||
protected $dontReport = [
|
||||
//
|
||||
];
|
||||
|
||||
protected $dontFlash = [
|
||||
'password',
|
||||
'password_confirmation',
|
||||
];
|
||||
|
||||
|
||||
public function report(Throwable $exception)
|
||||
{
|
||||
parent::report($exception);
|
||||
}
|
||||
|
||||
public function render($request, Throwable $exception)
|
||||
{
|
||||
if ($this->isHttpException($exception)) {
|
||||
if ($exception->getStatusCode() == 404) {
|
||||
return response()->view('frontend.pages.404');
|
||||
}
|
||||
if ($exception->getStatusCode() == 500 ) {
|
||||
return response()->view('frontend.pages.500');
|
||||
}
|
||||
}
|
||||
return parent::render($request, $exception);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
|
||||
namespace App\Facades;
|
||||
|
||||
|
||||
use Illuminate\Support\Facades\Facade;
|
||||
|
||||
class Cart extends Facade
|
||||
{
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return 'Cart';
|
||||
}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
|
||||
namespace App\Facades;
|
||||
|
||||
use App\Newsletter;
|
||||
use App\User;
|
||||
use Illuminate\Support\Facades\Facade;
|
||||
|
||||
|
||||
class EmailTemplate extends Facade
|
||||
{
|
||||
public static function getFacadeAccessor()
|
||||
{
|
||||
return 'EmailTemplate';
|
||||
}
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
|
||||
namespace App\Facades;
|
||||
|
||||
use Illuminate\Support\Facades\Facade;
|
||||
|
||||
class InstagramFeed extends Facade
|
||||
{
|
||||
public static function getFacadeAccessor()
|
||||
{
|
||||
return 'InstagramFeed';
|
||||
}
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
|
||||
namespace App\Facades;
|
||||
|
||||
|
||||
use Illuminate\Support\Facades\Facade;
|
||||
|
||||
class Wishlist extends Facade
|
||||
{
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return 'Wishlist';
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Faq extends Model
|
||||
{
|
||||
protected $table = 'faqs';
|
||||
protected $fillable = ['title','lang','status','is_open','description'];
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Feedback extends Model
|
||||
{
|
||||
protected $table = 'feedback';
|
||||
protected $fillable = ['name','email','description','ratings','custom_fields','attachment'];
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class FormBuilder extends Model
|
||||
{
|
||||
protected $table = 'form_builders';
|
||||
protected $fillable = ['title','email','button_text','fields','success_message'];
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class HeaderSlider extends Model
|
||||
{
|
||||
protected $table = 'header_sliders';
|
||||
protected $fillable = ['title','subtitle','lang','description','btn_01_status','btn_01_text','btn_01_url','image','video_btn_status','video_btn_text','video_btn_url',];
|
||||
}
|
|
@ -0,0 +1,473 @@
|
|||
<?php
|
||||
|
||||
namespace App\Helpers;
|
||||
|
||||
use Illuminate\Support\Facades\Session;
|
||||
use phpDocumentor\Reflection\Types\Collection;
|
||||
|
||||
class CartHelper
|
||||
{
|
||||
|
||||
public function add(array $item_info): array
|
||||
{
|
||||
$old_items = $this->items();
|
||||
if ($this->has($item_info)) {
|
||||
$this->update($item_info);
|
||||
} else {
|
||||
$old_items[] = $item_info;
|
||||
Session::put('cart_items',$old_items);
|
||||
}
|
||||
|
||||
return $item_info;
|
||||
}
|
||||
|
||||
private function update(array $item,$quantity =1)
|
||||
{
|
||||
$single = $this->existing_item_index($item);
|
||||
|
||||
$existing_items = $this->items();
|
||||
$existing_item = $existing_items[$single];
|
||||
$existing_items[$single]['quantity'] = $existing_item['quantity'] + $quantity;
|
||||
|
||||
$this->session_update($existing_items);
|
||||
}
|
||||
|
||||
public function updateCart(array $item_index,array $quantity)
|
||||
{
|
||||
$existing_items = $this->items();
|
||||
foreach ($item_index as $index => $item){
|
||||
if (isset($existing_items[$item])){
|
||||
$existing_items[$item]['quantity'] = $quantity[$index];
|
||||
}
|
||||
}
|
||||
$this->session_update($existing_items);
|
||||
}
|
||||
|
||||
public function remove($index)
|
||||
{
|
||||
$existing_items = $this->items();
|
||||
unset($existing_items[$index]);
|
||||
$this->session_update($existing_items);
|
||||
}
|
||||
|
||||
public function subtotal()
|
||||
{
|
||||
$all_items = $this->items();
|
||||
$subtotal = 0;
|
||||
foreach ($all_items as $item) {
|
||||
$product_details = \App\Products::select(['id','sale_price'])->find( $item['id']);
|
||||
$price_with_variant = 0;
|
||||
if (isset($item['variant']) && !empty($item['variant'])) {
|
||||
$variants = json_decode($item['variant']);
|
||||
|
||||
foreach($variants as $variants){
|
||||
|
||||
$variant = get_product_variant_list_by_id($variants->variantID);
|
||||
if (!empty($variant)) {
|
||||
$index = array_search($variants->term, json_decode($variant->terms, true));
|
||||
$prices = json_decode($variant->price) ?? [];
|
||||
if (isset($prices[$index]) && !empty($prices[$index])) {
|
||||
$price_with_variant += $prices[$index];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$subtotal += $price_with_variant * $item['quantity'];
|
||||
$subtotal += $product_details->sale_price * $item['quantity'];
|
||||
}
|
||||
return $subtotal;
|
||||
}
|
||||
|
||||
public function total()
|
||||
{
|
||||
$total_amount = $this->subtotal();
|
||||
$total_amount -= $this->coupon();
|
||||
if ($this->is_tax_enable()) {
|
||||
$total_amount += $this->cartTax();
|
||||
}
|
||||
if ($this->is_shipping_available()) {
|
||||
$total_amount += $this->cartShipping();
|
||||
}
|
||||
return $total_amount;
|
||||
}
|
||||
|
||||
public function tax()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function shipping()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function coupon()
|
||||
{
|
||||
$get_coupon_discount = session()->get('coupon_discount');
|
||||
$return_val = 0;
|
||||
|
||||
if (!empty($get_coupon_discount)) {
|
||||
$coupon_details = \App\ProductCoupon::where('code', $get_coupon_discount)->first();
|
||||
if ($coupon_details->discount_type === 'percentage') {
|
||||
$return_val = ($this->subtotal() / 100 ) * $coupon_details->discount;
|
||||
} elseif ($coupon_details->discount_type === 'amount') {
|
||||
$return_val = (float) $coupon_details->discount;
|
||||
}
|
||||
}
|
||||
|
||||
return $return_val;
|
||||
}
|
||||
|
||||
private function has($item)
|
||||
{
|
||||
if (is_null($this->items())){
|
||||
return false;
|
||||
}
|
||||
$result = array_filter($this->items(),function ($cart_item) use ($item){
|
||||
if (isset($item['variant']) && !empty($item['variant'])){
|
||||
return $item['id'] === $cart_item['id'] && $item['variant'] === $cart_item['variant'];
|
||||
}
|
||||
return $item['id'] === $cart_item['id'];
|
||||
});
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function count(): int
|
||||
{
|
||||
$items = is_null($this->items()) ? [] : $this->items();
|
||||
return array_sum(array_column($items, 'quantity'));
|
||||
}
|
||||
|
||||
public function items()
|
||||
{
|
||||
return Session::get('cart_items');
|
||||
}
|
||||
|
||||
private function session_update($items)
|
||||
{
|
||||
Session::put('cart_items',$items );
|
||||
}
|
||||
|
||||
private function existing_item_index(array $item)
|
||||
{
|
||||
foreach ($this->items() as $index => $cart_item){
|
||||
if (isset($item['variant']) && !empty($item['variant']) && $item['id'] === $cart_item['id']){
|
||||
$old_terms = json_decode($cart_item['variant'],true);
|
||||
$new_terms = json_decode($item['variant'],true);
|
||||
if (current($old_terms)['term'] === current($new_terms)['term']){
|
||||
return $index;
|
||||
}
|
||||
|
||||
}elseif ($item['id'] === $cart_item['id'] && empty($item['variant'])){
|
||||
return $index;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function cartTable(): string
|
||||
{
|
||||
|
||||
$output = '';
|
||||
$all_cart_item = $this->items();
|
||||
if (!is_null($all_cart_item)) {
|
||||
$output = '<div class="table-responsive cart-table"><form id="cart_update_form" method="post"><table class="table table-bordered">';
|
||||
$output .= "\t" . '<thead><tr>';
|
||||
$colspan = 7;
|
||||
$output .= "\n\t" . '<th>' . __('Serial') . '</th>';
|
||||
$output .= "\n\t" . '<th>' . __('Thumbnail') . '</th>';
|
||||
$output .= "\n\t" . '<th>' . __('Product Name') . '</th>';
|
||||
$output .= "\n\t" . '<th>' . __('Quantity') . '</th>';
|
||||
$output .= "\n\t" . '<th>' . __('Unit Price') . '</th>';
|
||||
if ($this->is_tax_enable() && get_static_option('product_tax_type') === 'individual') {
|
||||
$output .= "\n\t" . '<th>' . __('Tax') . '</th>';
|
||||
$colspan = 8;
|
||||
}
|
||||
$output .= "\n\t" . '<th>' . __('Subtotal') . '</th>';
|
||||
$output .= "\n\t" . '<th>' . __('Action') . '</th>';
|
||||
$output .= "\n\t" . '</tr></thead>';
|
||||
|
||||
$output .= "\n\t" . '<tbody>';
|
||||
$a = 1;
|
||||
|
||||
foreach ($all_cart_item as $key => $item) {
|
||||
$single_product = \App\Products::find($item['id']);
|
||||
if (empty($single_product)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$output .= '<tr>';
|
||||
$output .= '<td>' . $a . '<input name="cart_index[]" type="hidden" value="' . $key . '">' . '</td>';
|
||||
$output .= $this->cartThumbnail($single_product);
|
||||
$price_with_variant = $this->cartTitle($single_product,$item)['price_with_variant']; // need to get
|
||||
$output .= $this->cartTitle($single_product,$item)['markup']; // need to get
|
||||
//add variant
|
||||
|
||||
$output .= '<td><input type="number" name="product_quantity[]" class="quantity" min="1" value="' . $item['quantity'] . '"></td>';
|
||||
$output .= '<td class="unit_price">' . amount_with_currency_symbol($single_product->sale_price + $price_with_variant) . '</td>';
|
||||
|
||||
$cartTaxInfo = $this->cartTaxAmount($single_product,$price_with_variant,$item['quantity']);
|
||||
$tax_amount = $cartTaxInfo['tax_amount'];
|
||||
$colspan = $cartTaxInfo['colspan'];
|
||||
$final_price = $cartTaxInfo['final_price'];
|
||||
$output .= $cartTaxInfo['markup'];
|
||||
$output .= $this->cartSubtotal($final_price,$item,$tax_amount);
|
||||
$output .= $this->cartAction($key);
|
||||
$output .= '</tr>';
|
||||
$a++;
|
||||
}
|
||||
|
||||
$output .= "\n\t" . '</tbody>';
|
||||
$output .= $this->cartFooter($colspan);
|
||||
|
||||
$output .= '</table></form></div>';
|
||||
return $output;
|
||||
}
|
||||
|
||||
return '<div class="alert alert-warning">' . __('No Item In Cart!') . '</div>';
|
||||
}
|
||||
|
||||
public function is_tax_enable() : bool
|
||||
{
|
||||
return get_static_option('product_tax') && get_static_option('product_tax_system') === 'exclusive';
|
||||
}
|
||||
|
||||
private function ajaxPreloader() : string
|
||||
{
|
||||
return <<<HTML
|
||||
<div class="ajax-loading-wrap hide">
|
||||
<div class="sk-fading-circle">
|
||||
<div class="sk-circle1 sk-circle"></div>
|
||||
<div class="sk-circle2 sk-circle"></div>
|
||||
<div class="sk-circle3 sk-circle"></div>
|
||||
<div class="sk-circle4 sk-circle"></div>
|
||||
<div class="sk-circle5 sk-circle"></div>
|
||||
<div class="sk-circle6 sk-circle"></div>
|
||||
<div class="sk-circle7 sk-circle"></div>
|
||||
<div class="sk-circle8 sk-circle"></div>
|
||||
<div class="sk-circle9 sk-circle"></div>
|
||||
<div class="sk-circle10 sk-circle"></div>
|
||||
<div class="sk-circle11 sk-circle"></div>
|
||||
<div class="sk-circle12 sk-circle"></div>
|
||||
</div>
|
||||
</div>
|
||||
HTML;
|
||||
|
||||
}
|
||||
|
||||
private function cartFooter($colspan = 0) : string
|
||||
{
|
||||
$ajax_preloader = $this->ajaxPreloader();
|
||||
$update_cart = __('Update Cart');
|
||||
$coupon_code = __('Coupon Code');
|
||||
$submit = __('Submit');
|
||||
return <<<HTML
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="{$colspan}">
|
||||
<div class="cart-table-footer-wrap">
|
||||
<div class="coupon-wrap">
|
||||
<input type="text" class="form-control" name="coupon_code" placeholder="{$coupon_code}">
|
||||
<button class="btn-boxed add_coupon_code_btn">{$submit}</button>
|
||||
{$ajax_preloader}
|
||||
</div>
|
||||
<div class="update-cart-wrap">{$ajax_preloader}
|
||||
<button class="btn-boxed update_cart_items_btn">{$update_cart}</button>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
HTML;
|
||||
|
||||
}
|
||||
|
||||
private function cartThumbnail($single_product)
|
||||
{
|
||||
$image_markup = render_image_markup_by_attachment_id($single_product->image, '', 'thumb');
|
||||
return <<<HTML
|
||||
<td>
|
||||
<div class="thumbnail">{$image_markup}</div>
|
||||
</td>
|
||||
HTML;
|
||||
|
||||
}
|
||||
|
||||
private function cartTitle($single_product,$item)
|
||||
{
|
||||
$route = route('frontend.products.single', $single_product->slug);
|
||||
$title = $single_product->title;
|
||||
|
||||
$variant_markup = '';
|
||||
$price_with_variant = 0;
|
||||
if (!empty($item['variant'])){
|
||||
foreach(json_decode($item['variant']) as $variants){
|
||||
$variant = get_product_variant_list_by_id($variants->variantID);
|
||||
|
||||
if(!empty($variant)){
|
||||
$index = array_search($variants->term, json_decode($variant->terms,true));
|
||||
$prices = json_decode($variant->price) ?? [];
|
||||
$terms = json_decode($variant->terms) ?? [];
|
||||
$variant_markup .= '<div class="product-variant-list-wrapper"><h5 class="title">'.$variant->title.'</h5><ul class="product-variant-list">';
|
||||
$variant_markup .= '<li>'.$terms[$index] ?? '' ;
|
||||
if (isset($prices[$index]) && !empty($prices[$index])){
|
||||
$variant_markup .= '<small> +'. amount_with_currency_symbol($prices[$index]) .'</small>';
|
||||
$price_with_variant += $prices[$index];
|
||||
}
|
||||
|
||||
$variant_markup .= '</li>';
|
||||
$variant_markup .= '</ul></div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
$markup = <<<HTML
|
||||
<td>
|
||||
<h4 class="product-title">
|
||||
<a href="{$route}">{$title}</a>
|
||||
</h4>
|
||||
{$variant_markup}
|
||||
</td>
|
||||
HTML;
|
||||
return [
|
||||
'markup' => $markup,
|
||||
'price_with_variant' => $price_with_variant
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
private function cartTaxAmount($single_product,$price_with_variant,$quantity=1)
|
||||
{
|
||||
$output = '';
|
||||
$tax_amount = 0;
|
||||
$colspan = 0;
|
||||
$final_price = !empty($price_with_variant) ? $price_with_variant + $single_product->sale_price : $single_product->sale_price ;
|
||||
if ($this->is_tax_enable() && get_static_option('product_tax_type') === 'individual') {
|
||||
$tax_amount = ($final_price / 100) * $single_product->tax_percentage;
|
||||
$output = '<td class="tax_amount">' . amount_with_currency_symbol($tax_amount) . '(' . $single_product->tax_percentage . '%)</td>';
|
||||
$colspan = 8;
|
||||
}
|
||||
return [
|
||||
'colspan' => $colspan,
|
||||
'tax_amount' => $tax_amount,
|
||||
'markup' => $output,
|
||||
'final_price' => $final_price
|
||||
];
|
||||
}
|
||||
|
||||
private function cartSubtotal($final_price,$item,$tax_amount)
|
||||
{
|
||||
$subtotal = (get_static_option('product_tax_type') === 'individual') ? ($final_price + $tax_amount) * $item['quantity'] : $final_price * $item['quantity'];
|
||||
return '<td>' . amount_with_currency_symbol($subtotal) . '</td>';
|
||||
}
|
||||
|
||||
private function cartAction($cart_index) : string
|
||||
{
|
||||
return'<td><div class="cart-action-wrap"><a href="#" class="btn btn-sm btn-danger ajax_remove_cart_item" data-cartindex="' . $cart_index. '"><i class="fas fa-trash-alt"></i></a>' . $this->ajaxPreloader() . '</div></td>';
|
||||
}
|
||||
|
||||
public function cartSummery() : string
|
||||
{
|
||||
$output = '';
|
||||
|
||||
$car_total = $this->items();
|
||||
if ($this->count() > 0) {
|
||||
$output .= '<h4 class="title">' . __('Order Summery') . '</h4><div class="cart-total-table-wrap">';
|
||||
$output .= ' <div class="cart-total-table table-responsive"><table class="table table-bordered"> <tbody>';
|
||||
$output .= ' <tr><th>' . __('Subtotal') . '</th><td>' . amount_with_currency_symbol($this->subtotal()) . '</td></tr>'; // subtotal done
|
||||
$output .= ' <tr><th>' . __('Coupon Discount') . '</th><td>-' . amount_with_currency_symbol($this->coupon()) . '</td></tr> ';
|
||||
if ($this->is_tax_enable()) {
|
||||
$tax_percentage = get_static_option('product_tax_type') === 'total' ? ' (' . get_static_option('product_tax_percentage') . '%)' : '';
|
||||
$output .= ' <tr><th>' . __('Tax') . $tax_percentage . '</th><td>+ ' . amount_with_currency_symbol($this->cartTax()) . '</td></tr>';
|
||||
}
|
||||
if ($this->is_shipping_available()) {
|
||||
$output .= ' <tr><th>' . __('Shipping Cost') . '</th><td>+ ' . amount_with_currency_symbol($this->cartShipping()) . '</td></tr>';
|
||||
}
|
||||
$output .= ' <tr><th>' . __('Total') . '</th><td><strong>' . amount_with_currency_symbol($this->total()) . '</strong></td></tr>';
|
||||
$output .= '</tbody></table></div>';
|
||||
$output .= '</div><a href="' . route('frontend.products.checkout') . '" class="btn-boxed">' . __('Process To Checkout') . '</a></div>';
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
private function cartTax()
|
||||
{
|
||||
$tax_percentage = get_static_option('product_tax_percentage') ?: 0;
|
||||
$taxable_amount = $this->subtotal() - $this->coupon();
|
||||
$tax_amount = ($taxable_amount / 100) * (int)$tax_percentage;
|
||||
if (get_static_option('product_tax_type') === 'individual') {
|
||||
$all_cart_items = $this->items();
|
||||
$all_individual_tax = [];
|
||||
foreach ($all_cart_items as $item) {
|
||||
$product_details = \App\Products::find($item['id']);
|
||||
if (empty($product_details)) {
|
||||
continue;
|
||||
}
|
||||
$price_with_variant = $this->cartTitle($product_details,$item)['price_with_variant'];
|
||||
$cart_tax_amount = $this->cartTaxAmount($product_details,$price_with_variant)['tax_amount'];
|
||||
$price = $cart_tax_amount * $item['quantity'];
|
||||
$all_individual_tax[] = $price;
|
||||
}
|
||||
$tax_amount = array_sum($all_individual_tax);
|
||||
}
|
||||
|
||||
return $tax_amount;
|
||||
}
|
||||
|
||||
private function is_shipping_available(): bool
|
||||
{
|
||||
$all_cart_item = $this->items();
|
||||
$return_val = true;
|
||||
$cart_item_type = !empty($all_cart_item) ? array_unique(array_column($all_cart_item,'type')) : [];
|
||||
if (count($cart_item_type) === 1 && in_array('digital', $cart_item_type, true)){
|
||||
$return_val = false;
|
||||
}
|
||||
return $return_val;
|
||||
}
|
||||
|
||||
public function cartShipping()
|
||||
{
|
||||
$get_shipping_charge = session()->get('shipping_charge');
|
||||
$return_val = 0;
|
||||
|
||||
if (!empty($get_shipping_charge)) {
|
||||
$shipping_details = \App\ProductShipping::where('id', $get_shipping_charge)->first();
|
||||
if (!is_null($shipping_details)){
|
||||
$return_val = $shipping_details->cost;
|
||||
}
|
||||
}
|
||||
return $this->is_shipping_available() ? $return_val : 0;
|
||||
}
|
||||
|
||||
public function cart_tax_for_mail_template($cart_items,$order_details){
|
||||
$tax_percentage = get_static_option('product_tax_percentage') ?: 0;
|
||||
$cart_sub_total = $order_details->subtotal;
|
||||
$get_coupon_discount = $order_details->coupon_code;
|
||||
|
||||
$return_val = $cart_sub_total;
|
||||
|
||||
if (!empty($get_coupon_discount)) {
|
||||
$return_val = $cart_sub_total - (int) $order_details->coupon_discount;
|
||||
}
|
||||
|
||||
$tax_amount = ($return_val / 100) * (int) $tax_percentage;
|
||||
|
||||
if (get_static_option('product_tax_type') === 'individual') {
|
||||
//write code for all individual tax amount and sum all of them
|
||||
$all_cart_items = $cart_items;
|
||||
$all_individual_tax = [];
|
||||
foreach ($all_cart_items as $item) {
|
||||
$product_details = \App\Products::find($item['id']);
|
||||
if (empty($product_details)) {
|
||||
continue;
|
||||
}
|
||||
$price = $product_details->sale_price * $item['quantity'];
|
||||
$tax_percentage = ($price / 100) * $product_details->tax_percentage;
|
||||
$all_individual_tax[] = $tax_percentage;
|
||||
}
|
||||
$tax_amount = array_sum($all_individual_tax);
|
||||
|
||||
}
|
||||
|
||||
return $tax_amount;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
namespace App\Helpers;
|
||||
|
||||
class CsvReader
|
||||
{
|
||||
protected $file;
|
||||
protected $file_path;
|
||||
public function __construct($file){
|
||||
$this->file = fopen($file,'r');
|
||||
$this->file_path = $file;
|
||||
}
|
||||
public function rows(){
|
||||
while(!feof($this->file)){
|
||||
$row = fgetcsv($this->file);
|
||||
yield $row;
|
||||
}
|
||||
return;
|
||||
}
|
||||
public function head(){
|
||||
$first_row = [];
|
||||
foreach ($this->rows() as $key => $row){
|
||||
if ($key === 0){
|
||||
$first_row[] = $row;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return $first_row;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,69 @@
|
|||
<?php
|
||||
|
||||
namespace App\Helpers;
|
||||
|
||||
use App\PaymentLogs;
|
||||
use App\PricePlan;
|
||||
use App\Traits\EmailTemplate\AppointmentEmailTemplates;
|
||||
use App\Traits\EmailTemplate\CourseEmailTemplate;
|
||||
use App\Traits\EmailTemplate\DonationEmailTemplate;
|
||||
use App\Traits\EmailTemplate\EventEmailTemplate;
|
||||
use App\Traits\EmailTemplate\ProductEmailTemplate;
|
||||
use App\Traits\EmailTemplateHelperTrait;
|
||||
use App\Traits\EmailTemplate\JobEmailTemplate;
|
||||
use App\Traits\EmailTemplate\NewsletterEmailTemplate;
|
||||
use App\Traits\EmailTemplate\PackageOrderEmailTemplate;
|
||||
use App\Traits\EmailTemplate\QuoteEmailTemplate;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class EmailTemplateHelper
|
||||
{
|
||||
use EmailTemplateHelperTrait,
|
||||
PackageOrderEmailTemplate,
|
||||
QuoteEmailTemplate,
|
||||
CourseEmailTemplate,
|
||||
JobEmailTemplate,
|
||||
EventEmailTemplate,
|
||||
ProductEmailTemplate,
|
||||
AppointmentEmailTemplates,
|
||||
DonationEmailTemplate,
|
||||
NewsletterEmailTemplate;
|
||||
|
||||
|
||||
/**
|
||||
* send userVerifyMail
|
||||
* */
|
||||
public function userVerifyMail($user)
|
||||
{
|
||||
$message = get_static_option('user_email_verify_' . LanguageHelper::user_lang_slug() . '_message');
|
||||
$message = $this->parseUserInfo($message, $user);
|
||||
return [
|
||||
'subject' => get_static_option('user_email_verify_' . LanguageHelper::user_lang_slug() . '_subject'),
|
||||
'message' => $message,
|
||||
];
|
||||
}
|
||||
|
||||
/*
|
||||
* Parse user info for mail
|
||||
* */
|
||||
private function parseUserInfo(string $message, $user)
|
||||
{
|
||||
$message = str_replace(
|
||||
[
|
||||
'@name',
|
||||
'@username',
|
||||
'@verify_code',
|
||||
'@site_title',
|
||||
],
|
||||
[
|
||||
$user->name,
|
||||
$user->username,
|
||||
'<span class="verify-code">' . $user->email_verify_token . '</span>',
|
||||
get_static_option('site_' . LanguageHelper::user_lang_slug() . '_title')
|
||||
], $message);
|
||||
return $message;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,251 @@
|
|||
<?php
|
||||
|
||||
namespace App\Helpers;
|
||||
|
||||
use App\FormBuilder;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class FormBuilderCustom
|
||||
{
|
||||
|
||||
public static function render_form($id,$form_id = null,$action = null,$button_class = null,$form_class = null){
|
||||
$form_details = FormBuilder::find($id);
|
||||
if (empty($form_details)){
|
||||
return __('form not found');
|
||||
}
|
||||
|
||||
$fields = self::render_fields($form_details->fields);
|
||||
$render_submit_button = self::render_submit_button($form_details->button_text,$button_class);
|
||||
$action = $action ?? route('frontend.form.builder.custom.submit');
|
||||
$rand = Str::random(10);
|
||||
return <<<HTML
|
||||
<form action="{$action}" {$form_id} method="post" id="custom_form_builder_{$rand}" class="custom-form-builder-form {$form_class}" enctype="multipart/form-data">
|
||||
<input type="hidden" name="custom_form_id" value="{$id}">
|
||||
<input type="hidden" name="captcha_token" id="gcaptcha_token">
|
||||
<div class="error-message"></div>
|
||||
{$fields}
|
||||
{$render_submit_button}
|
||||
</form>
|
||||
HTML;
|
||||
|
||||
}
|
||||
private static function render_fields($fields) :string
|
||||
{
|
||||
$fields = json_decode($fields);
|
||||
|
||||
$output = '';
|
||||
$select_index = 0;
|
||||
$options = [];
|
||||
|
||||
foreach ($fields->field_type as $key => $value) {
|
||||
if (!empty($value)) {
|
||||
if ($value === 'select') {
|
||||
$options = explode("\n", $fields->select_options[$select_index]);
|
||||
}
|
||||
$required = $fields->field_required->$key ?? '';
|
||||
$mimes = isset($fields->mimes_type->$key) ? $fields->mimes_type->$key : '';
|
||||
$output .= self::get_field_by_type($value, $fields->field_name[$key], $fields->field_placeholder[$key], $options, $required, $mimes);
|
||||
if ($value === 'select') {
|
||||
$select_index++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
private static function render_submit_button($text,$button_class = '') :string
|
||||
{
|
||||
$text = __($text);
|
||||
$preloader = self::render_submit_preloader();
|
||||
return <<<HTML
|
||||
<div class="btn-wrapper">
|
||||
<button type="submit" class="submit-btn custom_submit_form_button {$button_class}">{$text}</button>
|
||||
{$preloader}
|
||||
</div>
|
||||
HTML;
|
||||
|
||||
}
|
||||
private static function render_submit_preloader() :string
|
||||
{
|
||||
return <<<HTML
|
||||
<div class="ajax-loading-wrap hide">
|
||||
<div class="sk-fading-circle">
|
||||
<div class="sk-circle1 sk-circle"></div>
|
||||
<div class="sk-circle2 sk-circle"></div>
|
||||
<div class="sk-circle3 sk-circle"></div>
|
||||
<div class="sk-circle4 sk-circle"></div>
|
||||
<div class="sk-circle5 sk-circle"></div>
|
||||
<div class="sk-circle6 sk-circle"></div>
|
||||
<div class="sk-circle7 sk-circle"></div>
|
||||
<div class="sk-circle8 sk-circle"></div>
|
||||
<div class="sk-circle9 sk-circle"></div>
|
||||
<div class="sk-circle10 sk-circle"></div>
|
||||
<div class="sk-circle11 sk-circle"></div>
|
||||
<div class="sk-circle12 sk-circle"></div>
|
||||
</div>
|
||||
</div>
|
||||
HTML;
|
||||
}
|
||||
|
||||
private static function get_field_by_type($type, $name, $placeholder, $options = [], $requried = null, $mimes = null)
|
||||
{
|
||||
if (empty($name)){
|
||||
return;
|
||||
}
|
||||
$markup = '';
|
||||
$name = SanitizeInput::esc_html($name);
|
||||
$placeholder = SanitizeInput::esc_html($placeholder);
|
||||
$required_markup_html = 'required="required"';
|
||||
switch ($type) {
|
||||
case('email'):
|
||||
$required_markup = !empty($requried) ? $required_markup_html : '';
|
||||
$markup = ' <div class="form-group"> <label for="' . $name . '">' . __($placeholder) . '</label> <input type="email" id="' . $name . '" name="' . $name . '" class="form-control" placeholder="' . __($placeholder) . '" ' . $required_markup . '></div>';
|
||||
break;
|
||||
case('tel'):
|
||||
$required_markup = !empty($requried) ? $required_markup_html : '';
|
||||
$markup = ' <div class="form-group"> <label for="' . $name . '">' . __($placeholder) . '</label> <input type="tel" id="' . $name . '" name="' . $name . '" class="form-control" placeholder="' . __($placeholder) . '" ' . $required_markup . '></div>';
|
||||
break;
|
||||
case('date'):
|
||||
$required_markup = !empty($requried) ? $required_markup_html : '';
|
||||
$markup = ' <div class="form-group"><label for="' . $name . '">' . __($placeholder) . '</label> <input type="date" id="' . $name . '" name="' . $name . '" class="form-control" placeholder="' . __($placeholder) . '" ' . $required_markup . '></div>';
|
||||
break;
|
||||
case('url'):
|
||||
$required_markup = !empty($requried) ? $required_markup_html : '';
|
||||
$markup = ' <div class="form-group"><label for="' . $name . '">' . __($placeholder) . '</label> <input type="url" id="' . $name . '" name="' . $name . '" class="form-control" placeholder="' . __($placeholder) . '" ' . $required_markup . '></div>';
|
||||
break;
|
||||
case('textarea'):
|
||||
$required_markup = !empty($requried) ? $required_markup_html : '';
|
||||
$markup = ' <div class="form-group textarea"><label for="' . $name . '">' . __($placeholder) . '</label> <textarea name="' . $name . '" id="' . $name . '" cols="30" rows="5" class="form-control" placeholder="' . __($placeholder) . '" ' . $required_markup . '></textarea></div>';
|
||||
break;
|
||||
case('file'):
|
||||
$required_markup = !empty($requried) ? $required_markup_html : '';
|
||||
$mimes_type_markup = str_replace('mimes:', __('Accept File Type:') . ' ', $mimes);
|
||||
$markup = ' <div class="form-group file"> <label for="' . $name . '">' . __($placeholder) . '</label> <input type="file" id="' . $name . '" name="' . $name . '" ' . $required_markup . ' class="form-control" > <span class="help-info">' . $mimes_type_markup . '</span></div>';
|
||||
break;
|
||||
case('checkbox'):
|
||||
$required_markup = !empty($requried) ? $required_markup_html : '';
|
||||
$markup = ' <div class="form-group checkbox"> <input type="checkbox" id="' . $name . '" name="' . $name . '" class="form-control" ' . $required_markup . '> <label for="' . $name . '">' . __($placeholder) . '</label></div>';
|
||||
break;
|
||||
case('select'):
|
||||
$option_markup = '';
|
||||
$required_markup = !empty($requried) ? $required_markup_html : '';
|
||||
foreach ($options as $opt) {
|
||||
$option_markup .= '<option value="' . Str::slug($opt) . '">' . $opt . '</option>';
|
||||
}
|
||||
$markup = ' <div class="form-group select"> <label for="' . $name . '">' . __($placeholder) . '</label> <select id="' . $name . '" name="' . $name . '" class="form-control" ' . $required_markup . '>' . $option_markup . '</select></div>';
|
||||
break;
|
||||
default:
|
||||
$required_markup = !empty($requried) ? $required_markup_html : '';
|
||||
$markup = ' <div class="form-group"><label for="' . $name . '">' . __($placeholder) . '</label> <input type="text" id="' . $name . '" name="' . $name . '" class="form-control" placeholder="' . __($placeholder) . '" ' . $required_markup . '></div>';
|
||||
break;
|
||||
}
|
||||
|
||||
return $markup;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static function render_drag_drop_form_builder($content = '')
|
||||
{
|
||||
$output = '';
|
||||
|
||||
$form_fields = json_decode($content);
|
||||
$output .= '<ul id="sortable" class="available-form-field main-fields">';
|
||||
if (!empty($form_fields)) {
|
||||
$select_index = 0;
|
||||
foreach ($form_fields->field_type as $key => $ftype) {
|
||||
$args = [];
|
||||
$required_field = '';
|
||||
if (property_exists($form_fields, 'field_required')) {
|
||||
$filed_requirement = (array)$form_fields->field_required;
|
||||
$required_field = !empty($filed_requirement[$key]) ? 'on' : '';
|
||||
}
|
||||
if ($ftype === 'select') {
|
||||
$args['select_option'] = $form_fields->select_options[$select_index] ?? '';
|
||||
$select_index++;
|
||||
}
|
||||
if ($ftype === 'file') {
|
||||
$args['mimes_type'] = $form_fields->mimes_type->$key ?? '';
|
||||
}
|
||||
$output .= self::form_builder_field_markup($key, $ftype, $form_fields->field_name[$key], $form_fields->field_placeholder[$key], $required_field, $args);
|
||||
}
|
||||
} else {
|
||||
$output .= self::form_builder_field_markup('1', 'text', 'your-name', 'Your Name', '');
|
||||
}
|
||||
|
||||
$output .= '</ul>';
|
||||
return $output;
|
||||
}
|
||||
|
||||
private static function form_builder_field_markup($key, $type, $name, $placeholder, $required, $args = [])
|
||||
{
|
||||
$name = SanitizeInput::esc_html($name);
|
||||
$placeholder = SanitizeInput::esc_html($placeholder);
|
||||
$required_check = !empty($required) ? 'checked' : '';
|
||||
$output = '<li class="ui-state-default">
|
||||
<span class="ui-icon ui-icon-arrowthick-2-n-s"></span>
|
||||
<span class="remove-fields">x</span>
|
||||
<a data-toggle="collapse" href="#fileds_collapse_' . $key . '" role="button"
|
||||
aria-expanded="false" aria-controls="collapseExample">
|
||||
' . ucfirst($type) . ': <span
|
||||
class="placeholder-name">' . $placeholder . '</span>
|
||||
</a>';
|
||||
$output .= '<div class="collapse" id="fileds_collapse_' . $key . '">
|
||||
<div class="card card-body margin-top-30">
|
||||
<input type="hidden" class="form-control" name="field_type[]"
|
||||
value="' . $type . '">
|
||||
<div class="form-group">
|
||||
<label>' . __('Name') . '</label>
|
||||
<input type="text" class="form-control " name="field_name[]"
|
||||
placeholder="' . __('enter field name') . '"
|
||||
value="' . $name . '" >
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>' . __('Placeholder/Label') . '</label>
|
||||
<input type="text" class="form-control field-placeholder"
|
||||
name="field_placeholder[]" placeholder="' . __('enter field placeholder/label') . '"
|
||||
value="' . $placeholder . '" >
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label ><strong>' . __('Required') . '</strong></label>
|
||||
<label class="switch">
|
||||
<input type="checkbox" class="field-required" ' . $required_check . ' name="field_required[' . $key . ']">
|
||||
<span class="slider onff"></span>
|
||||
</label>
|
||||
</div>';
|
||||
if ($type === 'select') {
|
||||
$output .= '<div class="form-group">
|
||||
<label>' . __('Options') . '</label>
|
||||
<textarea name="select_options[]" class="form-control max-height-120" cols="30" rows="10"
|
||||
required>' . SanitizeInput::esc_html($args['select_option']) . '</textarea>
|
||||
<small>' . __('separate option by new line') . '</small>
|
||||
</div>';
|
||||
}
|
||||
if ($type === 'file') {
|
||||
$output .= '<div class="form-group"><label>' . __('File Type') . '</label><select name="mimes_type[' . $key . ']" class="form-control mime-type">';
|
||||
$output .= '<option value="mimes:jpg,jpeg,png"';
|
||||
if (isset($args['mimes_type']) && $args['mimes_type'] == 'mimes:jpg,jpeg,png') {
|
||||
$output .= "selected";
|
||||
}
|
||||
$output .= '>' . __('mimes:jpg,jpeg,png') . '</option>';
|
||||
|
||||
$output .= '<option value="mimes:txt,pdf"';
|
||||
if (isset($args['mimes_type']) && $args['mimes_type'] == 'mimes:txt,pdf') {
|
||||
$output .= "selected";
|
||||
}
|
||||
$output .= '>' . __('mimes:txt,pdf') . '</option>';
|
||||
|
||||
$output .= '<option value="mimes:doc,docx"';
|
||||
if (isset($args['mimes_type']) && $args['mimes_type'] == 'mimes:mimes:doc,docx') {
|
||||
$output .= "selected";
|
||||
}
|
||||
$output .= '>' . __('mimes:mimes:doc,docx') . '</option>';
|
||||
|
||||
$output .= '</select></div>';
|
||||
}
|
||||
$output .= '</div></div></li>';
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,47 @@
|
|||
<?php
|
||||
|
||||
namespace App\Helpers;
|
||||
|
||||
use Illuminate\Support\Facades\Http;
|
||||
|
||||
class InstagramFeedHelper
|
||||
{
|
||||
private $access_token;
|
||||
protected $base_url = 'https://graph.instagram.com/me/media?';
|
||||
private $fields = ['caption','id','media_type','media_url','permalink','thumbnail_url','timestamp','username'];
|
||||
public function __construct()
|
||||
{
|
||||
$this->access_token = get_static_option('instagram_access_token');
|
||||
}
|
||||
|
||||
public function get_base_url(){
|
||||
return $this->base_url;
|
||||
}
|
||||
|
||||
public function get_fields(){
|
||||
return implode(',',$this->fields);
|
||||
}
|
||||
|
||||
public function get_access_token(){
|
||||
return $this->access_token;
|
||||
}
|
||||
|
||||
public function fetch($limit = null){
|
||||
$data = [
|
||||
'fields' => $this->get_fields(),
|
||||
'access_token' => $this->get_access_token(),
|
||||
|
||||
];
|
||||
if (!is_null($limit)){
|
||||
$data['limit'] = $limit;
|
||||
}
|
||||
|
||||
$response = Http::get($this->get_base_url(),$data);
|
||||
if ($response->ok()){
|
||||
return $response->object();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,87 @@
|
|||
<?php
|
||||
|
||||
namespace App\Helpers;
|
||||
|
||||
use App\Language;
|
||||
|
||||
class LanguageHelper
|
||||
{
|
||||
private static $language = null;
|
||||
private static $default = null;
|
||||
private static $user_lang_slug = null;
|
||||
private static $default_slug = null;
|
||||
private static $user_lang = null;
|
||||
private static $all_language = null;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
self::lang_instance();
|
||||
}
|
||||
|
||||
private static function lang_instance()
|
||||
{
|
||||
if (self::$language === null) {
|
||||
self::$language = new Language();
|
||||
}
|
||||
return self::$language;
|
||||
}
|
||||
|
||||
public static function user_lang()
|
||||
{
|
||||
if (self::$user_lang === null) {
|
||||
$session_lang = session()->get('lang');
|
||||
if ( !empty($session_lang) && $session_lang !== self::default_slug()){
|
||||
self::$user_lang = self::lang_instance()->where('slug',session()->get('lang'))->first();
|
||||
}else{
|
||||
self::$user_lang = self::default();
|
||||
}
|
||||
|
||||
}
|
||||
return self::$user_lang;
|
||||
}
|
||||
|
||||
public static function default()
|
||||
{
|
||||
if (self::$default === null) {
|
||||
$default = self::lang_instance()->where('default', '1')->first();
|
||||
self::$default = $default;
|
||||
}
|
||||
return self::$default;
|
||||
}
|
||||
|
||||
public static function default_slug()
|
||||
{
|
||||
if (self::$default_slug === null) {
|
||||
$default = self::lang_instance()->where('default', '1')->first();
|
||||
self::$default_slug = $default->slug;
|
||||
}
|
||||
return self::$default_slug;
|
||||
}
|
||||
public static function default_dir()
|
||||
{
|
||||
if (self::$default === null) {
|
||||
$default = self::lang_instance()->where('default', '1')->first();
|
||||
self::$default = $default;
|
||||
}
|
||||
return self::$default->direction;
|
||||
}
|
||||
public static function user_lang_slug(){
|
||||
if (self::$user_lang_slug === null) {
|
||||
$default = self::lang_instance()->where('default', '1')->first();
|
||||
self::$user_lang_slug = session()->get('lang') ?? $default->slug;
|
||||
}
|
||||
return self::$user_lang_slug;
|
||||
}
|
||||
public static function user_lang_dir()
|
||||
{
|
||||
return self::user_lang()->direction;
|
||||
}
|
||||
|
||||
public static function all_languages(string $type = 'publish')
|
||||
{
|
||||
if (self::$all_language === null) {
|
||||
self::$all_language = self::lang_instance()->where(['status' => 'publish'])->get();
|
||||
}
|
||||
return self::$all_language;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,63 @@
|
|||
<?php
|
||||
namespace App\Helpers;
|
||||
/**
|
||||
* this class will contain all helper method for nexelit
|
||||
* @since 2.0.4
|
||||
* */
|
||||
class NexelitHelpers{
|
||||
public static function database_upgrade($msg = null){
|
||||
return [
|
||||
'msg' => __('Database Upgrade Success'),
|
||||
'type' => 'success'
|
||||
];
|
||||
}
|
||||
public static function payment_approved($msg = null){
|
||||
return [
|
||||
'msg' => __('Payment Approved'),
|
||||
'type' => 'success'
|
||||
];
|
||||
}
|
||||
public static function reminder_mail($msg = null){
|
||||
return [
|
||||
'msg' => __('Reminder mail send'),
|
||||
'type' => 'success'
|
||||
];
|
||||
}
|
||||
public static function somethig_wrong($msg = null){
|
||||
return [
|
||||
'type' => 'danger',
|
||||
'msg' => $msg ?? __('Something Went Wrong!!. Try Again Later')
|
||||
];
|
||||
}
|
||||
public static function settings_update($msg = null){
|
||||
return [
|
||||
'type' => 'success',
|
||||
'msg' => $msg ?? __('Settings Updated')
|
||||
];
|
||||
}
|
||||
public static function item_update($msg = null){
|
||||
return [
|
||||
'type' => 'success',
|
||||
'msg' => $msg ?? __('Item Updated')
|
||||
];
|
||||
}
|
||||
public static function item_new($msg = null){
|
||||
return [
|
||||
'type' => 'success',
|
||||
'msg' => $msg ?? __('Item Added')
|
||||
];
|
||||
}
|
||||
public static function item_delete($msg = null){
|
||||
return [
|
||||
'type' => 'danger',
|
||||
'msg' => $msg ?? __('Item Delete')
|
||||
];
|
||||
}
|
||||
public static function item_clone($msg = null){
|
||||
return [
|
||||
'type' => 'success',
|
||||
'msg' => $msg ?? __('Item Cloned')
|
||||
];
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -0,0 +1,280 @@
|
|||
<?php
|
||||
|
||||
namespace App\Helpers;
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
use Xgenious\Paymentgateway\Facades\XgPaymentGateway;
|
||||
|
||||
class PaymentGatewayCredential
|
||||
{
|
||||
public static function exchange_rate_usd_to_inr(){
|
||||
return get_static_option('site_usd_to_inr_exchange_rate') ?? 74;
|
||||
}
|
||||
|
||||
public static function exchange_rate_usd_to_ngn(){
|
||||
return get_static_option('site_usd_to_ngn_exchange_rate') ?? 74;
|
||||
}
|
||||
//site_inr_to_usd_exchange_rate
|
||||
public static function exchange_rate_usd(){
|
||||
return get_static_option('site_'.strtolower(getenv('SITE_GLOBAL_CURRENCY')).'_to_usd_exchange_rate') ?? 74;
|
||||
}
|
||||
public static function get_global_currency(){
|
||||
return get_static_option('site_global_currency');
|
||||
}
|
||||
public static function get_paypal_credential() : object
|
||||
{
|
||||
$mode = get_static_option('paypal_test_mode') == 'on' ? true : false;
|
||||
|
||||
$paypal_client_id = $mode ? get_static_option('paypal_sandbox_client_id') : get_static_option('paypal_live_client_id');
|
||||
$paypal_client_secret = $mode? get_static_option('paypal_sandbox_client_secret') : get_static_option('paypal_live_client_secret');
|
||||
$paypal_app_id = $mode ? get_static_option('paypal_sandbox_app_id') : get_static_option('paypal_live_app_id');
|
||||
$paypal = XgPaymentGateway::paypal();
|
||||
$paypal->setClientId($paypal_client_id);
|
||||
$paypal->setClientSecret($paypal_client_secret);
|
||||
$paypal->setAppId($paypal_app_id);
|
||||
$paypal->setCurrency(self::get_global_currency());
|
||||
$paypal->setEnv($mode);
|
||||
$paypal->setExchangeRate(self::exchange_rate_usd());
|
||||
|
||||
return $paypal;
|
||||
}
|
||||
|
||||
public static function get_paytm_credential() : object
|
||||
{
|
||||
$mode = get_static_option('paypal_test_mode') == 'on' ? true : false;
|
||||
$paytm = XgPaymentGateway::paytm();
|
||||
$paytm->setMerchantId(getenv('PAYTM_MERCHANT_ID'));
|
||||
$paytm->setMerchantKey(getenv('PAYTM_MERCHANT_KEY'));
|
||||
$paytm->setMerchantWebsite(getenv('PAYTM_MERCHANT_WEBSITE'));
|
||||
$paytm->setChannel(getenv('PAYTM_CHANNEL'));
|
||||
$paytm->setIndustryType(getenv('PAYTM_INDUSTRY_TYPE'));
|
||||
$paytm->setCurrency(self::get_global_currency());
|
||||
$paytm->setEnv($mode);
|
||||
$paytm->setExchangeRate(self::exchange_rate_usd_to_inr());
|
||||
|
||||
return $paytm;
|
||||
}
|
||||
|
||||
public static function get_stripe_credential() : object
|
||||
{
|
||||
$stripe = XgPaymentGateway::stripe();
|
||||
$stripe->setSecretKey(getenv('STRIPE_SECRET_KEY'));
|
||||
$stripe->setPublicKey(getenv('STRIPE_PUBLIC_KEY'));
|
||||
$stripe->setCurrency(self::get_global_currency());
|
||||
$stripe->setEnv(getenv('STRIPE_TEST_MODE'));
|
||||
$stripe->setExchangeRate(self::exchange_rate_usd_to_inr());
|
||||
|
||||
return $stripe;
|
||||
}
|
||||
|
||||
public static function get_razorpay_credential() : object
|
||||
{
|
||||
$razorpay = XgPaymentGateway::razorpay();
|
||||
$razorpay->setApiKey(getenv('RAZORPAY_API_KEY'));
|
||||
$razorpay->setApiSecret(getenv('RAZORPAY_API_SECRET'));
|
||||
$razorpay->setCurrency(self::get_global_currency());
|
||||
$razorpay->setEnv(getenv('RAZORPAY_TESTMODE'));
|
||||
$razorpay->setExchangeRate(self::exchange_rate_usd_to_inr());
|
||||
|
||||
return $razorpay;
|
||||
}
|
||||
|
||||
public static function get_paystack_credential() : object
|
||||
{
|
||||
$paystack = XgPaymentGateway::paystack();
|
||||
$paystack->setPublicKey(getenv('PAYSTACK_PUBLIC_KEY'));
|
||||
$paystack->setSecretKey(getenv('PAYSTACK_SECRET_KEY'));
|
||||
$paystack->setMerchantEmail(getenv('MERCHANT_EMAIL'));
|
||||
$paystack->setCurrency(self::get_global_currency());
|
||||
$paystack->setEnv(getenv('PAYSTACK_TEST_MODE'));
|
||||
$paystack->setExchangeRate(self::exchange_rate_usd_to_ngn());
|
||||
|
||||
return $paystack;
|
||||
}
|
||||
|
||||
public static function get_mollie_credential() : object
|
||||
{
|
||||
$mollie = XgPaymentGateway::mollie();
|
||||
$mollie->setApiKey(getenv('MOLLIE_KEY'));
|
||||
$mollie->setCurrency(self::get_global_currency());
|
||||
$mollie->setEnv(getenv('MOLLIE_TEST_MODE'));
|
||||
$mollie->setExchangeRate(self::exchange_rate_usd_to_inr());
|
||||
|
||||
return $mollie;
|
||||
}
|
||||
|
||||
public static function get_flutterwave_credential() : object
|
||||
{
|
||||
$flutterwave = XgPaymentGateway::flutterwave();
|
||||
$flutterwave->setPublicKey(getenv('FLW_PUBLIC_KEY'));
|
||||
$flutterwave->setSecretKey(getenv('FLW_SECRET_KEY'));
|
||||
$flutterwave->setCurrency(self::get_global_currency());
|
||||
$flutterwave->setEnv(getenv('FLW_TEST_MODE'));
|
||||
$flutterwave->setExchangeRate(self::exchange_rate_usd_to_ngn());
|
||||
|
||||
return $flutterwave;
|
||||
}
|
||||
|
||||
public static function get_midtrans_credential() : object
|
||||
{
|
||||
$midtrans = XgPaymentGateway::midtrans();
|
||||
$midtrans->setClientKey(getenv('MIDTRANS_CLIENT_KEY'));
|
||||
$midtrans->setServerKey(getenv('MIDTRANS_SERVER_KEY'));
|
||||
$midtrans->setCurrency(self::get_global_currency());
|
||||
$midtrans->setEnv(getenv('MIDTRANS_ENVIRONTMENT'));
|
||||
$midtrans->setExchangeRate(get_static_option('site_usd_to_idr_exchange_rate'));
|
||||
|
||||
return $midtrans;
|
||||
}
|
||||
|
||||
public static function get_payfast_credential() : object
|
||||
{
|
||||
$payfast = XgPaymentGateway::payfast();
|
||||
$payfast->setMerchantId(getenv('PF_MERCHANT_ID'));
|
||||
$payfast->setMerchantKey(getenv('PF_MERCHANT_KEY'));
|
||||
$payfast->setPassphrase(getenv('PAYFAST_PASSPHRASE'));
|
||||
$payfast->setCurrency(self::get_global_currency());
|
||||
$payfast->setEnv(getenv('PF_MERCHANT_ENV'));
|
||||
$payfast->setExchangeRate(get_static_option('site_usd_to_zar_exchange_rate'));
|
||||
|
||||
return $payfast;
|
||||
}
|
||||
|
||||
public static function get_cashfree_credential() : object
|
||||
{
|
||||
$cashfree = XgPaymentGateway::cashfree();
|
||||
$cashfree->setAppId(getenv('CASHFREE_APP_ID'));
|
||||
$cashfree->setSecretKey(getenv('CASHFREE_SECRET_KEY'));
|
||||
$cashfree->setCurrency(self::get_global_currency());
|
||||
$cashfree->setEnv(getenv('CASHFREE_TEST_MODE'));
|
||||
$cashfree->setExchangeRate(self::exchange_rate_usd_to_inr());
|
||||
|
||||
return $cashfree;
|
||||
}
|
||||
|
||||
public static function get_instamojo_credential() : object
|
||||
{
|
||||
$instamojo = XgPaymentGateway::instamojo();
|
||||
$instamojo->setClientId(getenv('INSTAMOJO_CLIENT_ID'));
|
||||
$instamojo->setSecretKey(getenv('INSTAMOJO_CLIENT_SECRET'));
|
||||
$instamojo->setCurrency(self::get_global_currency());
|
||||
$instamojo->setEnv(getenv('INSTAMOJO_TEST_MODE'));
|
||||
$instamojo->setExchangeRate(self::exchange_rate_usd_to_inr());
|
||||
|
||||
return $instamojo;
|
||||
}
|
||||
|
||||
public static function get_marcadopago_credential() : object
|
||||
{
|
||||
$marcadopago = XgPaymentGateway::marcadopago();
|
||||
$marcadopago->setClientId(getenv('MERCADO_PAGO_CLIENT_ID'));
|
||||
$marcadopago->setClientSecret(getenv('MERCADO_PAGO_CLIENT_SECRET'));
|
||||
$marcadopago->setCurrency(self::get_global_currency());
|
||||
$marcadopago->setEnv(getenv('MERCADO_PAGO_TEST_MODE'));
|
||||
$marcadopago->setExchangeRate(get_static_option('site_usd_to_brl_exchange_rate'));
|
||||
|
||||
return $marcadopago;
|
||||
}
|
||||
|
||||
public static function get_squareup_credential() : object
|
||||
{
|
||||
$squareup = XgPaymentGateway::squareup();
|
||||
$squareup->setLocationId(getenv('SQUAREUP_LOCATION_ID'));
|
||||
$squareup->setAccessToken(getenv('SQUAREUP_ACCESS_TOKEN'));
|
||||
$squareup->setApplicationId('12515');
|
||||
$squareup->setCurrency(self::get_global_currency());
|
||||
$squareup->setEnv(getenv('SQUAREUP_ACCESS_TEST_MODE'));
|
||||
$squareup->setExchangeRate(self::exchange_rate_usd_to_inr());
|
||||
|
||||
return $squareup;
|
||||
}
|
||||
|
||||
public static function get_cinetpay_credential() : object
|
||||
{
|
||||
$cinetpay = XgPaymentGateway::cinetpay();
|
||||
$cinetpay->setAppKey(getenv('CINETPAY_API_KEY'));
|
||||
$cinetpay->setSiteId(getenv('CINETPAY_SITE_ID'));
|
||||
$cinetpay->setCurrency(self::get_global_currency());
|
||||
$cinetpay->setEnv(getenv('CINETPAY_TEST_MODE'));
|
||||
$cinetpay->setExchangeRate(self::exchange_rate_usd_to_inr());
|
||||
|
||||
return $cinetpay;
|
||||
}
|
||||
|
||||
public static function get_paytabs_credential() : object
|
||||
{
|
||||
$paytabs = XgPaymentGateway::paytabs();
|
||||
$paytabs->setProfileId(getenv('PAYTABS_PROFILE_ID'));
|
||||
$paytabs->setRegion(getenv('PAYTABS_REGION'));
|
||||
$paytabs->setServerKey(getenv('PAYTABS_SERVER_KEY'));
|
||||
$paytabs->setCurrency(self::get_global_currency());
|
||||
$paytabs->setEnv(getenv('PAYTABS_TEST_MODE'));
|
||||
$paytabs->setExchangeRate(74);
|
||||
|
||||
return $paytabs;
|
||||
}
|
||||
|
||||
public static function get_billplz_credential() : object
|
||||
{
|
||||
$billplz = XgPaymentGateway::billplz();
|
||||
$billplz->setKey(getenv('BILLPLZ_KEY'));
|
||||
$billplz->setVersion(getenv('BILLPLZ_VERSION'));
|
||||
$billplz->setXsignature(getenv('BILLPLZ_X_SIGNATURE'));
|
||||
$billplz->setCollectionName(getenv('BILLPLZ_COLLECTION_NAME'));
|
||||
$billplz->setCurrency(self::get_global_currency());
|
||||
$billplz->setEnv(getenv('BILLPLZ_TEST_MODE'));
|
||||
$billplz->setExchangeRate(get_static_option('site_usd_to_myr_exchange_rate'));
|
||||
|
||||
return $billplz;
|
||||
}
|
||||
|
||||
public static function get_zitopay_credential() : object
|
||||
{
|
||||
|
||||
$zitopay = XgPaymentGateway::zitopay();
|
||||
$zitopay->setUsername(get_static_option('zitopay_username'));
|
||||
$zitopay->setCurrency(self::get_global_currency());
|
||||
$zitopay->setEnv(get_static_option('zitopay_test_mode'));
|
||||
$zitopay->setExchangeRate(get_static_option('site_usd_to_myr_exchange_rate'));
|
||||
|
||||
return $zitopay;
|
||||
}
|
||||
|
||||
public static function get_toyyibpay_credential() : object
|
||||
{
|
||||
$toyyibpay = XgPaymentGateway::toyyibpay();
|
||||
$toyyibpay->setUserSecretKey(get_static_option('toyyibpay_set_user_secret_key'));
|
||||
$toyyibpay->setCategoryCode(get_static_option('toyyibpay_set_category_code'));
|
||||
$toyyibpay->setCurrency(self::get_global_currency());
|
||||
$toyyibpay->setEnv(get_static_option('toyyibpay_test_mode'));
|
||||
|
||||
return $toyyibpay;
|
||||
}
|
||||
|
||||
public static function get_pagalipay_credential() : object
|
||||
{
|
||||
$pagali = XgPaymentGateway::pagalipay();
|
||||
$pagali->setPageId(get_static_option('pagalipay_set_page_id'));
|
||||
$pagali->setEntityId(get_static_option('pagalipay_set_entity_id'));
|
||||
$pagali->setCurrency(self::get_global_currency());
|
||||
$pagali->setEnv(get_static_option('pagalipay_test_mode'));
|
||||
|
||||
return $pagali;
|
||||
}
|
||||
|
||||
public static function get_authorizenet_credential() : object
|
||||
{
|
||||
|
||||
$authorizenet = XgPaymentGateway::authorizenet();
|
||||
$authorizenet->setMerchantLoginId(get_static_option('authorizenet_set_merchant_login_id'));
|
||||
$authorizenet->setMerchantTransactionId(get_static_option('authorizenet_set_merchant_transaction_id'));
|
||||
$authorizenet->setCurrency(self::get_global_currency());
|
||||
$authorizenet->setEnv(get_static_option('authorizenet_test_mode'));
|
||||
|
||||
return $authorizenet;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,153 @@
|
|||
<?php
|
||||
namespace App\Helpers;
|
||||
|
||||
use App\ProductCoupon;
|
||||
use App\Products;
|
||||
use Illuminate\Http\Request;
|
||||
use phpDocumentor\Reflection\Types\Static_;
|
||||
|
||||
class ProductModuleHelper{
|
||||
private $cart_items = [];
|
||||
private $coupon_code;
|
||||
|
||||
public function add_to_cart($id,$qty,$variant = null): array
|
||||
{
|
||||
$product_details = Products::find($id);
|
||||
$new_cart_item = [
|
||||
'id' => $product_details->id,
|
||||
'title' => $product_details->title,
|
||||
'variant' => $variant,
|
||||
'quantity' => $qty,
|
||||
'type' => !empty($product_details->is_downloadable) ? 'digital' : 'physical',
|
||||
'price' => $product_details->sale_price * $qty
|
||||
];
|
||||
$this->add_new_item_to_cart($new_cart_item);
|
||||
return $this->cart_items;
|
||||
}
|
||||
|
||||
private function add_new_item_to_cart($new_item) : void
|
||||
{
|
||||
if (!empty( $this->cart_items)) {
|
||||
if (array_key_exists($new_item['id'], $this->cart_items)) {
|
||||
//existing item of cart
|
||||
$existing_item = $this->cart_items[$new_item['id']];
|
||||
$old_cart_item[$new_item['id']]['quantity'] = $new_item['quantity'] + $existing_item['quantity'];
|
||||
$old_cart_item[$new_item['id']]['price'] = $existing_item['price'] + $new_item['price'];
|
||||
$old_cart_item[$new_item['id']]['variant'] = $new_item['variant'] ;
|
||||
} else {
|
||||
|
||||
|
||||
$product_details = Products::find($new_item['id']);
|
||||
//add new item in existing cart
|
||||
$this->cart_items[$new_item['id']] = [
|
||||
'id' => $new_item['id'],
|
||||
'title' => $new_item['title'],
|
||||
'variant' => $new_item['variant'],
|
||||
'quantity' => $new_item['quantity'],
|
||||
'type' => !empty($product_details->is_downloadable) ? 'digital' : 'physical',
|
||||
'price' => $new_item['price']
|
||||
];
|
||||
}
|
||||
|
||||
} else {
|
||||
$product_details = Products::find($new_item['id']);
|
||||
//new item in cart
|
||||
$this->cart_items[$new_item['id']] = [
|
||||
'id' => $new_item['id'],
|
||||
'title' => $new_item['title'],
|
||||
'quantity' => $new_item['quantity'],
|
||||
'variant' => $new_item['variant'],
|
||||
'type' => !empty($product_details->is_downloadable) ? 'digital' : 'physical',
|
||||
'price' => $new_item['price']
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
public function subtotal(){
|
||||
$return_val = 0;
|
||||
if (!empty($this->cart_items)) {
|
||||
$return_val = 0;
|
||||
foreach ($this->cart_items as $product_id => $cat_data) {
|
||||
$return_val += (int) $cat_data['price'];
|
||||
}
|
||||
return $return_val;
|
||||
}
|
||||
|
||||
return $return_val;
|
||||
}
|
||||
|
||||
public function total($shipping_id,$coupon_code = null){
|
||||
$cart_sub_total = $this->subtotal();
|
||||
$get_coupon_discount = $this->coupon_discount($coupon_code);
|
||||
$get_shipping_charge = $this->shipping_cost($shipping_id);
|
||||
|
||||
$return_val = $cart_sub_total + $get_shipping_charge + $this->get_tax($get_coupon_discount);
|
||||
|
||||
if (!empty($get_coupon_discount)) {
|
||||
$coupon_details = \App\ProductCoupon::where('code', $get_coupon_discount)->first();
|
||||
if ($coupon_details->discount_type === 'percentage') {
|
||||
$discount_bal = ($cart_sub_total / 100) * (int) $coupon_details->discount;
|
||||
$return_val = $cart_sub_total - $discount_bal;
|
||||
} elseif ($coupon_details->discount_type === 'amount') {
|
||||
$return_val = $cart_sub_total - (int) $coupon_details->discount;
|
||||
}
|
||||
|
||||
return $return_val + $get_shipping_charge + $this->get_tax();
|
||||
}
|
||||
|
||||
return $return_val;
|
||||
}
|
||||
|
||||
public function shipping_cost($shipping_id){
|
||||
if (!empty($shipping_id)) {
|
||||
$shipping_details = \App\ProductShipping::where('id', $shipping_id)->first();
|
||||
$shipping_details = $shipping_details ?? 0;
|
||||
$return_val = (int) $shipping_details->cost;
|
||||
}
|
||||
return $return_val ?? 0;
|
||||
}
|
||||
|
||||
private function coupon_discount($coupon_code)
|
||||
{
|
||||
if ($coupon_code){
|
||||
$coupon_details = ProductCoupon::where('code',$coupon_code)->first();
|
||||
if ($coupon_details->discount_type === 'percentage') {
|
||||
$discount_bal = ($this->subtotal() / 100) * (int)$coupon_details->discount;
|
||||
$return_val = $this->subtotal()- $discount_bal;
|
||||
} elseif ($coupon_details->discount_type === 'amount') {
|
||||
$return_val = $this->subtotal() - (int)$coupon_details->discount;
|
||||
}
|
||||
}
|
||||
|
||||
return $return_val ?? 0;
|
||||
}
|
||||
|
||||
private function get_tax($coupon_discount_amount = null)
|
||||
{
|
||||
$tax_percentage = get_static_option('product_tax_percentage') ?? 0;
|
||||
$cart_sub_total = $this->subtotal();
|
||||
|
||||
$return_val = $cart_sub_total - (int)$coupon_discount_amount;
|
||||
|
||||
$tax_amount = ($return_val / 100) * (int)$tax_percentage; // get tax by percentage
|
||||
|
||||
if (get_static_option('product_tax_type') === 'individual') {
|
||||
//write code for all individual tax amount and sum all of them
|
||||
$all_cart_items = $this->cart_items;
|
||||
$all_individual_tax = [];
|
||||
foreach ($all_cart_items as $item) {
|
||||
$product_details = \App\Products::find($item['id']);
|
||||
if (empty($product_details)) {
|
||||
continue;
|
||||
}
|
||||
$price = $product_details->sale_price * $item['quantity'];
|
||||
$tax_percentage = ($price / 100) * $product_details->tax_percentage;
|
||||
$all_individual_tax[] = $tax_percentage;
|
||||
}
|
||||
$tax_amount = array_sum($all_individual_tax);
|
||||
}
|
||||
|
||||
return $tax_amount;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
<?php
|
||||
|
||||
|
||||
namespace App\Helpers;
|
||||
|
||||
|
||||
use Mews\Purifier\Facades\Purifier;
|
||||
|
||||
class SanitizeInput
|
||||
{
|
||||
/**
|
||||
* sanitize string to remove script
|
||||
* */
|
||||
public static function esc_html($val): string
|
||||
{
|
||||
return htmlspecialchars(strip_tags($val));
|
||||
}
|
||||
|
||||
/**
|
||||
* sanitize url to remove script
|
||||
* */
|
||||
public static function esc_url($val): string
|
||||
{
|
||||
return htmlspecialchars(filter_var($val, FILTER_SANITIZE_URL));
|
||||
}
|
||||
|
||||
/**kses_basic
|
||||
* kses will allow given html tag with attribute
|
||||
* */
|
||||
public static function kses($val, array $args): string
|
||||
{
|
||||
return strip_tags($val, $args);
|
||||
}
|
||||
|
||||
/**
|
||||
* kses will allow given html tag with attribute
|
||||
* */
|
||||
public static function kses_basic($val): string
|
||||
{
|
||||
return Purifier::clean($val);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,334 @@
|
|||
<?php
|
||||
|
||||
namespace App\Helpers;
|
||||
|
||||
use Illuminate\Support\Facades\Session;
|
||||
use phpDocumentor\Reflection\Types\Collection;
|
||||
|
||||
class WishlistHelper
|
||||
{
|
||||
|
||||
public function add(array $item_info): array
|
||||
{
|
||||
$old_items = $this->items();
|
||||
if ($this->has($item_info)) {
|
||||
$this->update($item_info);
|
||||
} else {
|
||||
$old_items[] = $item_info;
|
||||
Session::put('wishlist_items',$old_items);
|
||||
}
|
||||
|
||||
return $item_info;
|
||||
}
|
||||
|
||||
private function update(array $item,$quantity =1)
|
||||
{
|
||||
$single = $this->existing_item_index($item);
|
||||
|
||||
$existing_items = $this->items();
|
||||
$existing_item = $existing_items[$single];
|
||||
$existing_items[$single]['quantity'] = $existing_item['quantity'] + $quantity;
|
||||
|
||||
$this->session_update($existing_items);
|
||||
}
|
||||
|
||||
public function updateWishlist(array $item_index,array $quantity)
|
||||
{
|
||||
$existing_items = $this->items();
|
||||
foreach ($item_index as $index => $item){
|
||||
if (isset($existing_items[$item])){
|
||||
$existing_items[$item]['quantity'] = $quantity[$index];
|
||||
}
|
||||
}
|
||||
$this->session_update($existing_items);
|
||||
}
|
||||
|
||||
public function remove($index)
|
||||
{
|
||||
$existing_items = $this->items();
|
||||
unset($existing_items[$index]);
|
||||
$this->session_update($existing_items);
|
||||
}
|
||||
|
||||
public function subtotal()
|
||||
{
|
||||
$all_items = $this->items();
|
||||
$subtotal = 0;
|
||||
foreach ($all_items as $item) {
|
||||
$price_with_variant = 0;
|
||||
if (isset($item['variant']) && !empty($item['variant'])) {
|
||||
$variants = current(json_decode($item['variant']));
|
||||
$variant = get_product_variant_list_by_id($variants->variantID);
|
||||
if (!empty($variant)) {
|
||||
$index = array_search($variants->term, json_decode($variant->terms, true));
|
||||
$prices = json_decode($variant->price) ?? [];
|
||||
if (isset($prices[$index]) && !empty($prices[$index])) {
|
||||
$price_with_variant = $prices[$index];
|
||||
}
|
||||
}
|
||||
}
|
||||
$subtotal += $price_with_variant;
|
||||
$subtotal += $item['price'] * $item['quantity'];
|
||||
}
|
||||
return $subtotal;
|
||||
}
|
||||
|
||||
public function total()
|
||||
{
|
||||
$total_amount = $this->subtotal();
|
||||
$total_amount -= $this->coupon();
|
||||
if ($this->is_tax_enable()) {
|
||||
$total_amount += $this->cartTax();
|
||||
}
|
||||
if ($this->is_shipping_available()) {
|
||||
$total_amount += $this->cartShipping();
|
||||
}
|
||||
return $total_amount;
|
||||
}
|
||||
|
||||
public function tax()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function shipping()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function coupon()
|
||||
{
|
||||
$get_coupon_discount = session()->get('coupon_discount');
|
||||
$return_val = 0;
|
||||
|
||||
if (!empty($get_coupon_discount)) {
|
||||
$coupon_details = \App\ProductCoupon::where('code', $get_coupon_discount)->first();
|
||||
if ($coupon_details->discount_type === 'percentage') {
|
||||
$return_val = ($this->subtotal() / 100 ) * $coupon_details->discount;
|
||||
} elseif ($coupon_details->discount_type === 'amount') {
|
||||
$return_val = (float) $coupon_details->discount;
|
||||
}
|
||||
}
|
||||
|
||||
return $return_val;
|
||||
}
|
||||
|
||||
private function has($item)
|
||||
{
|
||||
if (is_null($this->items())){
|
||||
return false;
|
||||
}
|
||||
$result = array_filter($this->items(),function ($cart_item) use ($item){
|
||||
if (isset($item['variant']) && !empty($item['variant'])){
|
||||
return $item['id'] === $cart_item['id'] && $item['variant'] === $cart_item['variant'];
|
||||
}
|
||||
return $item['id'] === $cart_item['id'];
|
||||
});
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function count(): int
|
||||
{
|
||||
$items = is_null($this->items()) ? [] : $this->items();
|
||||
return array_sum(array_column($items, 'quantity'));
|
||||
}
|
||||
|
||||
public function items()
|
||||
{
|
||||
return Session::get('wishlist_items');
|
||||
}
|
||||
|
||||
private function session_update($items)
|
||||
{
|
||||
Session::put('wishlist_items',$items );
|
||||
}
|
||||
|
||||
private function existing_item_index(array $item)
|
||||
{
|
||||
foreach ($this->items() as $index => $cart_item){
|
||||
if (isset($item['variant']) && !empty($item['variant']) && $item['id'] === $cart_item['id']){
|
||||
$old_terms = json_decode($cart_item['variant'],true);
|
||||
$new_terms = json_decode($item['variant'],true);
|
||||
if (current($old_terms)['term'] === current($new_terms)['term']){
|
||||
return $index;
|
||||
}
|
||||
|
||||
}elseif ($item['id'] === $cart_item['id'] && empty($item['variant'])){
|
||||
return $index;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function wishlistTable(): string
|
||||
{
|
||||
|
||||
$output = '';
|
||||
$all_cart_item = $this->items();
|
||||
if (!is_null($all_cart_item)) {
|
||||
$output = '<div class="table-responsive cart-table"><form id="cart_update_form" method="post"><table class="table table-bordered">';
|
||||
$output .= "\t" . '<thead><tr>';
|
||||
$colspan = 7;
|
||||
$output .= "\n\t" . '<th>' . __('Sl#') . '</th>';
|
||||
$output .= "\n\t" . '<th>' . __('Thumbnail') . '</th>';
|
||||
$output .= "\n\t" . '<th>' . __('Product Name') . '</th>';
|
||||
$output .= "\n\t" . '<th>' . __('Price') . '</th>';
|
||||
$output .= "\n\t" . '<th>' . __('Action') . '</th>';
|
||||
$output .= "\n\t" . '</tr></thead>';
|
||||
|
||||
$output .= "\n\t" . '<tbody>';
|
||||
$a = 1;
|
||||
|
||||
foreach ($all_cart_item as $key => $item) {
|
||||
$single_product = \App\Products::find($item['id']);
|
||||
if (empty($single_product)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$output .= '<tr>';
|
||||
$output .= '<td>' . $a . '<input name="cart_index[]" type="hidden" value="' . $key . '">' . '</td>';
|
||||
$output .= $this->cartThumbnail($single_product);
|
||||
$output .= $this->cartTitle($single_product,$item)['markup']; // need to get
|
||||
|
||||
$output .= $this->price($single_product->sale_price);
|
||||
$output .= $this->cartAction($key,$item);
|
||||
$output .= '</tr>';
|
||||
$a++;
|
||||
}
|
||||
|
||||
$output .= "\n\t" . '</tbody>';
|
||||
// $output .= $this->cartFooter($colspan);
|
||||
|
||||
$output .= '</table></form></div>';
|
||||
return $output;
|
||||
}
|
||||
|
||||
return '<div class="alert alert-warning">' . __('No Item In Wishlist..!') . '</div>';
|
||||
}
|
||||
|
||||
|
||||
private function ajaxPreloader() : string
|
||||
{
|
||||
return <<<HTML
|
||||
<div class="ajax-loading-wrap hide">
|
||||
<div class="sk-fading-circle">
|
||||
<div class="sk-circle1 sk-circle"></div>
|
||||
<div class="sk-circle2 sk-circle"></div>
|
||||
<div class="sk-circle3 sk-circle"></div>
|
||||
<div class="sk-circle4 sk-circle"></div>
|
||||
<div class="sk-circle5 sk-circle"></div>
|
||||
<div class="sk-circle6 sk-circle"></div>
|
||||
<div class="sk-circle7 sk-circle"></div>
|
||||
<div class="sk-circle8 sk-circle"></div>
|
||||
<div class="sk-circle9 sk-circle"></div>
|
||||
<div class="sk-circle10 sk-circle"></div>
|
||||
<div class="sk-circle11 sk-circle"></div>
|
||||
<div class="sk-circle12 sk-circle"></div>
|
||||
</div>
|
||||
</div>
|
||||
HTML;
|
||||
|
||||
}
|
||||
|
||||
private function cartFooter($colspan = 0) : string
|
||||
{
|
||||
$ajax_preloader = $this->ajaxPreloader();
|
||||
$update_cart = __('Clear Wishlist');
|
||||
return <<<HTML
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="{$colspan}">
|
||||
<div class="cart-table-footer-wrap">
|
||||
<div class="coupon-wrap">
|
||||
|
||||
{$ajax_preloader}
|
||||
</div>
|
||||
<div class="update-cart-wrap">{$ajax_preloader}
|
||||
<button class="btn-boxed update_cart_items_btn">{$update_cart}</button>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
HTML;
|
||||
|
||||
}
|
||||
|
||||
private function cartThumbnail($single_product)
|
||||
{
|
||||
$image_markup = render_image_markup_by_attachment_id($single_product->image, '', 'thumb');
|
||||
return <<<HTML
|
||||
<td>
|
||||
<div class="thumbnail">{$image_markup}</div>
|
||||
</td>
|
||||
HTML;
|
||||
|
||||
}
|
||||
|
||||
private function cartTitle($single_product,$item)
|
||||
{
|
||||
$route = route('frontend.products.single', $single_product->slug);
|
||||
$title = $single_product->title;
|
||||
|
||||
$variant_markup = '';
|
||||
$price_with_variant = 0;
|
||||
if (!empty($item['variant'])){
|
||||
foreach(json_decode($item['variant']) as $variants){
|
||||
$variant = get_product_variant_list_by_id($variants->variantID);
|
||||
if(!empty($variant)){
|
||||
$index = array_search($variants->term, json_decode($variant->terms,true));
|
||||
$prices = json_decode($variant->price) ?? [];
|
||||
$terms = json_decode($variant->terms) ?? [];
|
||||
$variant_markup .= '<div class="product-variant-list-wrapper"><h5 class="title">'.$variant->title.'</h5><ul class="product-variant-list">';
|
||||
$variant_markup .= '<li>'.$terms[$index] ?? '' ;
|
||||
if (isset($prices[$index]) && !empty($prices[$index])){
|
||||
$variant_markup .= '<small> +'. amount_with_currency_symbol($prices[$index]) .'</small>';
|
||||
$price_with_variant = $prices[$index];
|
||||
}
|
||||
|
||||
$variant_markup .= '</li>';
|
||||
$variant_markup .= '</ul></div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
$markup = <<<HTML
|
||||
<td>
|
||||
<h4 class="product-title">
|
||||
<a href="{$route}">{$title}</a>
|
||||
</h4>
|
||||
{$variant_markup}
|
||||
</td>
|
||||
HTML;
|
||||
return [
|
||||
'markup' => $markup,
|
||||
'price_with_variant' => $price_with_variant
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
private function price($final_price)
|
||||
{
|
||||
return '<td>'. amount_with_currency_symbol($final_price) .'</td>';
|
||||
}
|
||||
|
||||
private function cartAction($wishlist_index,$value) : string
|
||||
{
|
||||
return'<td>
|
||||
<div class="cart-action-wrap">
|
||||
'.$this->ajaxPreloader().'
|
||||
<a href="#" class="btn btn-sm btn-success ajax_add_to_cart_with_icon mr-2"
|
||||
data-product_id="'.$value["id"].'"
|
||||
data-product_title="'.$value["title"].'"
|
||||
data-product_quantity="1"
|
||||
>
|
||||
<i class="fas fa-shopping-cart"></i>
|
||||
</a>'.
|
||||
|
||||
'<a href="#" class="btn btn-sm btn-danger ajax_remove_wishlist_item" data-wishlistindex="'.$wishlist_index.'">
|
||||
<i class="fas fa-trash-alt"></i>
|
||||
</a>'.$this->ajaxPreloader().
|
||||
|
||||
'</div>
|
||||
</td>';
|
||||
}
|
||||
|
||||
}
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,669 @@
|
|||
<?php
|
||||
|
||||
use App\Widgets;
|
||||
use App\Menu;
|
||||
use App\Blog;
|
||||
use App\Services;
|
||||
use App\Works;
|
||||
|
||||
|
||||
/**
|
||||
* all widget will be here
|
||||
* */
|
||||
|
||||
/**
|
||||
* about us widgets
|
||||
* it will be used for drag & drop Widget Builder
|
||||
* */
|
||||
function about_us_widget($type = 'new', $id = null)
|
||||
{
|
||||
$output = '';
|
||||
$widget_data = !empty($id) ? Widgets::find($id) : '';
|
||||
$widget_order = !empty($widget_data) ? $widget_data->widget_order : '';
|
||||
$output .= get_widget_default_fields($type, 'about_us_widget', 'render_about_us_widget', 'About Us', $id, $widget_order);
|
||||
|
||||
$widget_saved_values = !empty($widget_data) ? unserialize($widget_data->widget_content) : '';
|
||||
$image_val = !empty($widget_saved_values) ? $widget_saved_values['site_logo'] : '';
|
||||
$image_preview = '';
|
||||
if (!empty($widget_saved_values)) {
|
||||
$image_markup = render_image_markup_by_attachment_id($widget_saved_values['site_logo']);
|
||||
$image_preview = '<div class="attachment-preview"><div class="thumbnail"><div class="centered">' . $image_markup . '</div></div></div>';
|
||||
}
|
||||
$output .= '<div class="form-group"><label for="site_logo"><strong>' . __('Logo') . '</strong></label>';
|
||||
$output .= '<div class="media-upload-btn-wrapper"><div class="img-wrap">' . $image_preview . '</div><input type="hidden" id="site_logo" name="site_logo" value="' . $image_val . '">';
|
||||
$output .= '<button type="button" class="btn btn-info btn-xs media_upload_form_btn" data-btntitle="Select Image" data-modaltitle="Upload Image" data-toggle="modal" data-target="#media_upload_modal">';
|
||||
$output .= __('Logo') . '</button></div>';
|
||||
$output .= '<small class="form-text text-muted">' . __('allowed image format: jpg,jpeg,png. Recommended image size 160x50') . '</small></div>';
|
||||
//start multi langual tab option
|
||||
$all_languages = get_all_language();
|
||||
$output .= '<nav><div class="nav nav-tabs" role="tablist">';
|
||||
foreach ($all_languages as $key => $lang) {
|
||||
$active_class = $key == 0 ? 'nav-item nav-link active' : 'nav-item nav-link';
|
||||
$output .= '<a class="' . $active_class . '" data-toggle="tab" href="#nav-home-' . $lang->slug . '" role="tab" aria-selected="true">' . $lang->name . '</a>';
|
||||
}
|
||||
$output .= '</div></nav>';
|
||||
|
||||
$output .= '<div class="tab-content margin-top-30" >';
|
||||
foreach ($all_languages as $key => $lang) {
|
||||
$active_tab_class = $key == 0 ? 'tab-pane fade show active' : 'tab-pane fade';
|
||||
$output .= '<div class="' . $active_tab_class . '" id="nav-home-' . $lang->slug . '" role="tabpanel">';
|
||||
$description = !empty($widget_saved_values) && isset($widget_saved_values['description_' . $lang->slug]) ? $widget_saved_values['description_' . $lang->slug] : '';
|
||||
$output .= '<div class="form-group"><textarea name="description_' . $lang->slug . '" id="description_' . $lang->slug . '" class="form-control" cols="30" rows="5" placeholder="' . __('Description') . '">' . $description . '</textarea></div>';
|
||||
$output .= '</div>';
|
||||
}
|
||||
$output .= '</div>';
|
||||
//end multi langual tab option
|
||||
$output .= '<button class="btn btn-info btn-xs widget_save_change_button">' . __('Save Changes') . '</button>';
|
||||
$output .= '</form>';
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* about us widgets
|
||||
* it will be used for render content in frontend
|
||||
* */
|
||||
function render_about_us_widget($id)
|
||||
{
|
||||
$widget_data = !empty($id) ? Widgets::find($id) : '';
|
||||
$widget_saved_values = !empty($widget_data) ? unserialize($widget_data->widget_content) : '';
|
||||
$description = !empty($widget_saved_values) && isset($widget_saved_values['description_' .get_user_lang()]) ? $widget_saved_values['description_' . get_user_lang()] : '';
|
||||
$image_val = !empty($widget_saved_values) ? $widget_saved_values['site_logo'] : '';
|
||||
|
||||
$output = '<div class="col-lg-3 col-md-6"><div class="footer-widget widget"><div class="about_us_widget">';
|
||||
$output .= render_image_markup_by_attachment_id($image_val,'footer-logo');
|
||||
$output .= '<p>'.$description.'</p>';
|
||||
$output .= '</div></div></div>';
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* default filed
|
||||
* */
|
||||
function get_widget_default_fields($type, $admin_func, $front_func, $widget_name, $id, $widget_order = null)
|
||||
{
|
||||
|
||||
$output = '';
|
||||
$action = $type == 'new' ? route('admin.widgets.new') : route('admin.widgets.update');
|
||||
$id = !empty($id) ? '<input type="hidden" name="id" value="' . $id . '">' : '';
|
||||
$output .= '<form method="post" action="' . $action . '" enctype="multipart/form-data"><input type="hidden" value="' . csrf_token() . '" name="_token">' . $id;
|
||||
$output .= '<input type="hidden" value="' . $front_func . '" name="frontend_render_function">';
|
||||
$output .= '<input type="hidden" value="' . $admin_func . '" name="admin_render_function">';
|
||||
$output .= '<input type="hidden" value="' . $type . '" name="widget_type">';
|
||||
$output .= '<input type="hidden" value="' . $widget_name . '" name="widget_name">';
|
||||
$output .= '<input type="hidden" value="' . $widget_order . '" name="widget_order">';
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* contact us widget admin function
|
||||
* it will be used for drag & drop Widget Builder
|
||||
* **/
|
||||
|
||||
function contact_info_widget($type = 'new', $id = null){
|
||||
$output = '';
|
||||
$widget_data = !empty($id) ? Widgets::find($id) : '';
|
||||
$widget_order = !empty($widget_data) ? $widget_data->widget_order : '';
|
||||
$output .= get_widget_default_fields($type, 'contact_info_widget', 'render_contact_info_widget', 'Contact Info', $id, $widget_order);
|
||||
|
||||
$widget_saved_values = !empty($widget_data) ? unserialize($widget_data->widget_content) : '';
|
||||
|
||||
//start multi langual tab option
|
||||
$all_languages = get_all_language();
|
||||
$output .= '<nav><div class="nav nav-tabs" role="tablist">';
|
||||
foreach ($all_languages as $key => $lang) {
|
||||
$active_class = $key == 0 ? 'nav-item nav-link active' : 'nav-item nav-link';
|
||||
$output .= '<a class="' . $active_class . '" data-toggle="tab" href="#nav-contact-info-' . $lang->slug . '" role="tab" aria-selected="true">' . $lang->name . '</a>';
|
||||
}
|
||||
$output .= '</div></nav>';
|
||||
|
||||
$output .= '<div class="tab-content margin-top-30" >';
|
||||
foreach ($all_languages as $key => $lang) {
|
||||
$active_tab_class = $key == 0 ? 'tab-pane fade show active' : 'tab-pane fade';
|
||||
$output .= '<div class="' . $active_tab_class . '" id="nav-contact-info-' . $lang->slug . '" role="tabpanel">';
|
||||
$widget_title = !empty($widget_saved_values) && isset($widget_saved_values['widget_title_' . $lang->slug]) ? $widget_saved_values['widget_title_' . $lang->slug] : '';
|
||||
$location = !empty($widget_saved_values) && isset($widget_saved_values['location_' . $lang->slug]) ? $widget_saved_values['location_' . $lang->slug] : '';
|
||||
$phone = !empty($widget_saved_values) && isset($widget_saved_values['phone_' . $lang->slug]) ? $widget_saved_values['phone_' . $lang->slug] : '';
|
||||
$email = !empty($widget_saved_values) && isset($widget_saved_values['email_' . $lang->slug]) ? $widget_saved_values['email_' . $lang->slug] : '';
|
||||
|
||||
$output .= '<div class="form-group"><input type="text" name="widget_title_' . $lang->slug . '" id="widget_title_' . $lang->slug . '" class="form-control" placeholder="' . __('Widget Title') . '" value="'. $widget_title .'"></div>';
|
||||
$output .= '<div class="form-group"><input type="text" name="location_' . $lang->slug . '" id="location_' . $lang->slug . '" class="form-control" placeholder="' . __('Location') . '" value="'. $location .'"></div>';
|
||||
$output .= '<div class="form-group"><input type="text" name="phone_' . $lang->slug . '" id="phone_' . $lang->slug . '" class="form-control" placeholder="' . __('Phone') . '" value="'. $phone .'"></div>';
|
||||
$output .= '<div class="form-group"><input type="email" name="email_' . $lang->slug . '" id="email_' . $lang->slug . '" class="form-control" placeholder="' . __('Email') . '" value="'. $email .'"></div>';
|
||||
|
||||
$output .= '</div>';
|
||||
}
|
||||
$output .= '</div>';
|
||||
//end multi langual tab option
|
||||
$output .= '<button class="btn btn-info btn-xs widget_save_change_button">' . __('Save Changes') . '</button>';
|
||||
$output .= '</form>';
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* contact us widgets
|
||||
* it will be used for render content in frontend
|
||||
* */
|
||||
function render_contact_info_widget($id){
|
||||
$widget_data = !empty($id) ? Widgets::find($id) : '';
|
||||
$widget_saved_values = !empty($widget_data) ? unserialize($widget_data->widget_content) : '';
|
||||
$widget_title = !empty($widget_saved_values) && isset($widget_saved_values['widget_title_' . get_user_lang()]) ? $widget_saved_values['widget_title_' . get_user_lang()] : '';
|
||||
$location = !empty($widget_saved_values) && isset($widget_saved_values['location_' .get_user_lang()]) ? $widget_saved_values['location_' . get_user_lang()] : '';
|
||||
$phone = !empty($widget_saved_values) && isset($widget_saved_values['phone_' . get_user_lang()]) ? $widget_saved_values['phone_' . get_user_lang()] : '';
|
||||
$email = !empty($widget_saved_values) && isset($widget_saved_values['email_' . get_user_lang()]) ? $widget_saved_values['email_' . get_user_lang()] : '';
|
||||
|
||||
$output = '<div class="col-lg-3 col-md-6"><div class="footer-widget widget">';
|
||||
if (!empty($widget_title)){
|
||||
$output .= '<h4 class="widget-title">'.$widget_title.'</h4>';
|
||||
}
|
||||
$output .= '<ul class="contact_info_list">';
|
||||
if(!empty($location)){
|
||||
$output .= ' <li class="single-info-item">
|
||||
<div class="icon">
|
||||
<i class="fa fa-home"></i>
|
||||
</div>
|
||||
<div class="details">
|
||||
'.$location.'
|
||||
</div>
|
||||
</li>';
|
||||
}
|
||||
if(!empty($phone)){
|
||||
$output .= '<li class="single-info-item">
|
||||
<div class="icon">
|
||||
<i class="fa fa-phone"></i>
|
||||
</div>
|
||||
<div class="details">
|
||||
'.$phone.'
|
||||
</div>
|
||||
</li>';
|
||||
}
|
||||
if(!empty($email)){
|
||||
$output .= '<li class="single-info-item">
|
||||
<div class="icon">
|
||||
<i class="fas fa-envelope-open"></i>
|
||||
</div>
|
||||
<div class="details">
|
||||
'.$email.'
|
||||
</div>
|
||||
</li>';
|
||||
}
|
||||
$output .= '</ul>';
|
||||
$output .= '</div></div>';
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* navigation widget widget admin function
|
||||
* it will be used for drag & drop Widget Builder
|
||||
* **/
|
||||
|
||||
function navigation_menu_widget($type = 'new', $id = null){
|
||||
$output = '';
|
||||
$widget_data = !empty($id) ? Widgets::find($id) : '';
|
||||
$widget_order = !empty($widget_data) ? $widget_data->widget_order : '';
|
||||
$output .= get_widget_default_fields($type, 'navigation_menu_widget', 'render_navigation_menu_widget', 'Navigation Menu', $id, $widget_order);
|
||||
|
||||
$widget_saved_values = !empty($widget_data) ? unserialize($widget_data->widget_content) : '';
|
||||
|
||||
//start multi langual tab option
|
||||
$all_languages = get_all_language();
|
||||
$output .= '<nav><div class="nav nav-tabs" role="tablist">';
|
||||
foreach ($all_languages as $key => $lang) {
|
||||
$active_class = $key == 0 ? 'nav-item nav-link active' : 'nav-item nav-link';
|
||||
$output .= '<a class="' . $active_class . '" data-toggle="tab" href="#nav-recent-post-' . $lang->slug . '" role="tab" aria-selected="true">' . $lang->name . '</a>';
|
||||
}
|
||||
$output .= '</div></nav>';
|
||||
|
||||
$output .= '<div class="tab-content margin-top-30" >';
|
||||
|
||||
foreach ($all_languages as $key => $lang) {
|
||||
$active_tab_class = $key == 0 ? 'tab-pane fade show active' : 'tab-pane fade';
|
||||
$output .= '<div class="' . $active_tab_class . '" id="nav-recent-post-' . $lang->slug . '" role="tabpanel">';
|
||||
$widget_title = !empty($widget_saved_values) && isset($widget_saved_values['widget_title_'. $lang->slug]) ? $widget_saved_values['widget_title_'. $lang->slug] : '';
|
||||
$selected_menu_id = !empty($widget_saved_values) && isset($widget_saved_values['menu_id_'. $lang->slug]) ? $widget_saved_values['menu_id_'. $lang->slug] : '';
|
||||
|
||||
$output .= '<div class="form-group"><input type="text" name="widget_title_'. $lang->slug . '" id="widget_title_'. $lang->slug . '" class="form-control" placeholder="' . __('Widget Title') . '" value="'. $widget_title .'"></div>';
|
||||
|
||||
$output .= '<div class="form-group">';
|
||||
$output .= '<select class="form-control" name="menu_id_'. $lang->slug.'">';
|
||||
|
||||
$navigation_menus = Menu::where(['lang' => $lang->slug])->get();
|
||||
|
||||
foreach($navigation_menus as $menu_item){
|
||||
$selected = $selected_menu_id == $menu_item->id ? 'selected' : '';
|
||||
$output .= '<option value="'.$menu_item->id.'" '.$selected.'>'.$menu_item->title.'</option>';
|
||||
}
|
||||
$output .= '</select>';
|
||||
$output .= '</div>';
|
||||
|
||||
$output .= '</div>';
|
||||
}
|
||||
$output .= '</div>';
|
||||
//end multi langual tab option
|
||||
$output .= '<button class="btn btn-info btn-xs widget_save_change_button">' . __('Save Changes') . '</button>';
|
||||
$output .= '</form>';
|
||||
|
||||
return $output;
|
||||
}
|
||||
/**
|
||||
* navigation menu widgets
|
||||
* it will be used for render content in frontend
|
||||
* */
|
||||
function render_navigation_menu_widget($id){
|
||||
$widget_data = !empty($id) ? Widgets::find($id) : '';
|
||||
$widget_saved_values = !empty($widget_data) ? unserialize($widget_data->widget_content) : '';
|
||||
$widget_title = !empty($widget_saved_values) && isset($widget_saved_values['widget_title_'. get_user_lang()]) ? $widget_saved_values['widget_title_'. get_user_lang()] : '';
|
||||
$menu_id = !empty($widget_saved_values) && isset($widget_saved_values['menu_id_'.get_user_lang()]) ? $widget_saved_values['menu_id_'. get_user_lang()] : '';
|
||||
|
||||
$output = '<div class="col-lg-3 col-md-6"><div class="footer-widget widget">';
|
||||
if (!empty($widget_title)){
|
||||
$output .= '<h4 class="widget-title">'.$widget_title.'</h4>';
|
||||
}
|
||||
$output .= '<div class="widget-ul-wrapper">';
|
||||
$output .= '<ul>';
|
||||
$output .= render_menu_by_id($menu_id);
|
||||
$output .= '</ul>';
|
||||
$output .= '</div>';
|
||||
$output .= '</div></div>';
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* recent post widget widget admin function
|
||||
* it will be used for drag & drop Widget Builder
|
||||
* **/
|
||||
|
||||
function recent_post_widget($type = 'new', $id = null){
|
||||
$output = '';
|
||||
$widget_data = !empty($id) ? Widgets::find($id) : '';
|
||||
$widget_order = !empty($widget_data) ? $widget_data->widget_order : '';
|
||||
$output .= get_widget_default_fields($type, 'recent_post_widget', 'render_recent_post_widget', 'Recent Post', $id, $widget_order);
|
||||
|
||||
$widget_saved_values = !empty($widget_data) ? unserialize($widget_data->widget_content) : '';
|
||||
|
||||
//start multi langual tab option
|
||||
$all_languages = get_all_language();
|
||||
$output .= '<nav><div class="nav nav-tabs" role="tablist">';
|
||||
foreach ($all_languages as $key => $lang) {
|
||||
$active_class = $key == 0 ? 'nav-item nav-link active' : 'nav-item nav-link';
|
||||
$output .= '<a class="' . $active_class . '" data-toggle="tab" href="#nav-recent-post-' . $lang->slug . '" role="tab" aria-selected="true">' . $lang->name . '</a>';
|
||||
}
|
||||
$output .= '</div></nav>';
|
||||
|
||||
$output .= '<div class="tab-content margin-top-30" >';
|
||||
|
||||
foreach ($all_languages as $key => $lang) {
|
||||
$active_tab_class = $key == 0 ? 'tab-pane fade show active' : 'tab-pane fade';
|
||||
$output .= '<div class="' . $active_tab_class . '" id="nav-recent-post-' . $lang->slug . '" role="tabpanel">';
|
||||
$widget_title = !empty($widget_saved_values) && isset($widget_saved_values['widget_title_'. $lang->slug]) ? $widget_saved_values['widget_title_'. $lang->slug] : '';
|
||||
$post_items = !empty($widget_saved_values) && isset($widget_saved_values['post_items']) ? $widget_saved_values['post_items'] : '';
|
||||
|
||||
$output .= '<div class="form-group"><input type="text" name="widget_title_'. $lang->slug . '" id="widget_title_'. $lang->slug . '" class="form-control" placeholder="' . __('Widget Title') . '" value="'. $widget_title .'"></div>';
|
||||
$output .= '</div>';
|
||||
}
|
||||
$output .= '<div class="form-group"><input type="text" name="post_items" id="post_items" class="form-control" placeholder="' . __('Post Items') . '" value="'. $post_items .'"></div>';
|
||||
$output .= '</div>';
|
||||
//end multi langual tab option
|
||||
$output .= '<button class="btn btn-info btn-xs widget_save_change_button">' . __('Save Changes') . '</button>';
|
||||
$output .= '</form>';
|
||||
|
||||
return $output;
|
||||
}
|
||||
/**
|
||||
* recent post widgets
|
||||
* it will be used for render content in frontend
|
||||
* */
|
||||
function render_recent_post_widget($id){
|
||||
$widget_data = !empty($id) ? Widgets::find($id) : '';
|
||||
$widget_saved_values = !empty($widget_data) ? unserialize($widget_data->widget_content) : '';
|
||||
$widget_title = !empty($widget_saved_values) && isset($widget_saved_values['widget_title_'. get_user_lang()]) ? $widget_saved_values['widget_title_'. get_user_lang()] : '';
|
||||
$post_items = !empty($widget_saved_values) && isset($widget_saved_values['post_items']) ? $widget_saved_values['post_items'] : '';
|
||||
$blog_posts = Blog::where(['lang' => get_user_lang(),'status' => 'publish'])->orderBy('id','DESC')->take($post_items)->get();
|
||||
$output = '<div class="col-lg-3 col-md-6"><div class="footer-widget widget">';
|
||||
if (!empty($widget_title)){
|
||||
$output .= '<h4 class="widget-title">'.$widget_title.'</h4>';
|
||||
}
|
||||
$output .= '<ul class="recent_post_item">';
|
||||
|
||||
foreach ($blog_posts as $post){
|
||||
$output .= '<li class="single-recent-post-item">
|
||||
<div class="thumb">'.render_image_markup_by_attachment_id($post->image,'','thumb').'</div>
|
||||
<div class="content">
|
||||
<h4 class="title"><a href="'.route('frontend.blog.single',$post->slug).'">'.$post->title.'</a></h4>
|
||||
<span class="time"> '.date_format($post->created_at,'D M Y').'</span>
|
||||
</div>
|
||||
</li>';
|
||||
}
|
||||
$output .= '</ul>';
|
||||
$output .= '</div></div>';
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* recent service widget widget admin function
|
||||
* it will be used for drag & drop Widget Builder
|
||||
* **/
|
||||
|
||||
function recent_service_widget($type = 'new', $id = null){
|
||||
$output = '';
|
||||
$widget_data = !empty($id) ? Widgets::find($id) : '';
|
||||
$widget_order = !empty($widget_data) ? $widget_data->widget_order : '';
|
||||
$output .= get_widget_default_fields($type, 'recent_service_widget', 'render_recent_service_widget', 'Recent Services', $id, $widget_order);
|
||||
|
||||
$widget_saved_values = !empty($widget_data) ? unserialize($widget_data->widget_content) : '';
|
||||
|
||||
//start multi langual tab option
|
||||
$all_languages = get_all_language();
|
||||
$output .= '<nav><div class="nav nav-tabs" role="tablist">';
|
||||
foreach ($all_languages as $key => $lang) {
|
||||
$active_class = $key == 0 ? 'nav-item nav-link active' : 'nav-item nav-link';
|
||||
$output .= '<a class="' . $active_class . '" data-toggle="tab" href="#nav-recent-service-' . $lang->slug . '" role="tab" aria-selected="true">' . $lang->name . '</a>';
|
||||
}
|
||||
$output .= '</div></nav>';
|
||||
|
||||
$output .= '<div class="tab-content margin-top-30" >';
|
||||
|
||||
foreach ($all_languages as $key => $lang) {
|
||||
$active_tab_class = $key == 0 ? 'tab-pane fade show active' : 'tab-pane fade';
|
||||
$output .= '<div class="' . $active_tab_class . '" id="nav-recent-service-' . $lang->slug . '" role="tabpanel">';
|
||||
$widget_title = !empty($widget_saved_values) && isset($widget_saved_values['widget_title_'. $lang->slug]) ? $widget_saved_values['widget_title_'. $lang->slug] : '';
|
||||
$post_items = !empty($widget_saved_values) && isset($widget_saved_values['post_items']) ? $widget_saved_values['post_items'] : '';
|
||||
|
||||
$output .= '<div class="form-group"><input type="text" name="widget_title_'. $lang->slug . '" id="widget_title_'. $lang->slug . '" class="form-control" placeholder="' . __('Widget Title') . '" value="'. $widget_title .'"></div>';
|
||||
$output .= '</div>';
|
||||
}
|
||||
$output .= '<div class="form-group"><input type="text" name="post_items" id="post_items" class="form-control" placeholder="' . __('Post Items') . '" value="'. $post_items .'"></div>';
|
||||
$output .= '</div>';
|
||||
//end multi langual tab option
|
||||
$output .= '<button class="btn btn-info btn-xs widget_save_change_button">' . __('Save Changes') . '</button>';
|
||||
$output .= '</form>';
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* recent services widgets
|
||||
* it will be used for render content in frontend
|
||||
* */
|
||||
function render_recent_service_widget($id){
|
||||
$widget_data = !empty($id) ? Widgets::find($id) : '';
|
||||
$widget_saved_values = !empty($widget_data) ? unserialize($widget_data->widget_content) : '';
|
||||
$widget_title = !empty($widget_saved_values) && isset($widget_saved_values['widget_title_'. get_user_lang()]) ? $widget_saved_values['widget_title_'. get_user_lang()] : '';
|
||||
$post_items = !empty($widget_saved_values) && isset($widget_saved_values['post_items']) ? $widget_saved_values['post_items'] : '';
|
||||
$service_posts = Services::where(['lang' => get_user_lang(),'status' => 'publish'])->orderBy('id','DESC')->take($post_items)->get();
|
||||
$output = '<div class="col-lg-3 col-md-6"><div class="footer-widget widget">';
|
||||
if (!empty($widget_title)){
|
||||
$output .= '<h4 class="widget-title">'.$widget_title.'</h4>';
|
||||
}
|
||||
$output .= '<ul class="recent_post_item">';
|
||||
|
||||
foreach ($service_posts as $service){
|
||||
$output .= '<li class="single-recent-post-item">
|
||||
<div class="thumb">'.render_image_markup_by_attachment_id($service->image,'','thumb').'</div>
|
||||
<div class="content">
|
||||
<h4 class="title"><a href="'.route('frontend.services.single',$service->slug).'">'.$service->title.'</a></h4>
|
||||
<span class="time"> '.date_format($service->created_at,'D M Y').'</span>
|
||||
</div>
|
||||
</li>';
|
||||
}
|
||||
$output .= '</ul>';
|
||||
$output .= '</div></div>';
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* recent service widget widget admin function
|
||||
* it will be used for drag & drop Widget Builder
|
||||
* **/
|
||||
|
||||
function recent_case_study_widget($type = 'new', $id = null){
|
||||
$output = '';
|
||||
$widget_data = !empty($id) ? Widgets::find($id) : '';
|
||||
$widget_order = !empty($widget_data) ? $widget_data->widget_order : '';
|
||||
$output .= get_widget_default_fields($type, 'recent_case_study_widget', 'render_recent_case_study_widget', 'Recent Case Study', $id, $widget_order);
|
||||
|
||||
$widget_saved_values = !empty($widget_data) ? unserialize($widget_data->widget_content) : '';
|
||||
|
||||
//start multi langual tab option
|
||||
$all_languages = get_all_language();
|
||||
$output .= '<nav><div class="nav nav-tabs" role="tablist">';
|
||||
foreach ($all_languages as $key => $lang) {
|
||||
$active_class = $key == 0 ? 'nav-item nav-link active' : 'nav-item nav-link';
|
||||
$output .= '<a class="' . $active_class . '" data-toggle="tab" href="#nav-recent-case-study-' . $lang->slug . '" role="tab" aria-selected="true">' . $lang->name . '</a>';
|
||||
}
|
||||
$output .= '</div></nav>';
|
||||
|
||||
$output .= '<div class="tab-content margin-top-30" >';
|
||||
|
||||
foreach ($all_languages as $key => $lang) {
|
||||
$active_tab_class = $key == 0 ? 'tab-pane fade show active' : 'tab-pane fade';
|
||||
$output .= '<div class="' . $active_tab_class . '" id="nav-recent-case-study-' . $lang->slug . '" role="tabpanel">';
|
||||
$widget_title = !empty($widget_saved_values) && isset($widget_saved_values['widget_title_'. $lang->slug]) ? $widget_saved_values['widget_title_'. $lang->slug] : '';
|
||||
$post_items = !empty($widget_saved_values) && isset($widget_saved_values['post_items']) ? $widget_saved_values['post_items'] : '';
|
||||
|
||||
$output .= '<div class="form-group"><input type="text" name="widget_title_'. $lang->slug . '" id="widget_title_'. $lang->slug . '" class="form-control" placeholder="' . __('Widget Title') . '" value="'. $widget_title .'"></div>';
|
||||
$output .= '</div>';
|
||||
}
|
||||
$output .= '<div class="form-group"><input type="text" name="post_items" id="post_items" class="form-control" placeholder="' . __('Post Items') . '" value="'. $post_items .'"></div>';
|
||||
$output .= '</div>';
|
||||
//end multi langual tab option
|
||||
$output .= '<button class="btn btn-info btn-xs widget_save_change_button">' . __('Save Changes') . '</button>';
|
||||
$output .= '</form>';
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* recent case study widgets
|
||||
* it will be used for render content in frontend
|
||||
* */
|
||||
function render_recent_case_study_widget($id){
|
||||
$widget_data = !empty($id) ? Widgets::find($id) : '';
|
||||
$widget_saved_values = !empty($widget_data) ? unserialize($widget_data->widget_content) : '';
|
||||
$widget_title = !empty($widget_saved_values) && isset($widget_saved_values['widget_title_'. get_user_lang()]) ? $widget_saved_values['widget_title_'. get_user_lang()] : '';
|
||||
$post_items = !empty($widget_saved_values) && isset($widget_saved_values['post_items']) ? $widget_saved_values['post_items'] : '';
|
||||
$service_posts = Works::where(['lang' => get_user_lang(),'status' => 'publish'])->orderBy('id','DESC')->take($post_items)->get();
|
||||
$output = '<div class="col-lg-3 col-md-6"><div class="footer-widget widget">';
|
||||
if (!empty($widget_title)){
|
||||
$output .= '<h4 class="widget-title">'.$widget_title.'</h4>';
|
||||
}
|
||||
$output .= '<ul class="recent_post_item">';
|
||||
|
||||
foreach ($service_posts as $service){
|
||||
$output .= '<li class="single-recent-post-item">
|
||||
<div class="thumb">'.render_image_markup_by_attachment_id($service->image,'','thumb').'</div>
|
||||
<div class="content">
|
||||
<h4 class="title"><a href="'.route('frontend.work.single',$service->slug).'">'.$service->title.'</a></h4>
|
||||
<span class="time"> '.date_format($service->created_at,'D M Y').'</span>
|
||||
</div>
|
||||
</li>';
|
||||
}
|
||||
$output .= '</ul>';
|
||||
$output .= '</div></div>';
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* newsletter widget widget admin function
|
||||
* it will be used for drag & drop Widget Builder
|
||||
* **/
|
||||
|
||||
function newsletter_widget($type = 'new', $id = null){
|
||||
$output = '';
|
||||
$widget_data = !empty($id) ? Widgets::find($id) : '';
|
||||
$widget_order = !empty($widget_data) ? $widget_data->widget_order : '';
|
||||
$output .= get_widget_default_fields($type, 'newsletter_widget', 'render_newsletter_widget', 'Newsletter', $id, $widget_order);
|
||||
|
||||
$widget_saved_values = !empty($widget_data) ? unserialize($widget_data->widget_content) : '';
|
||||
|
||||
//start multi langual tab option
|
||||
$all_languages = get_all_language();
|
||||
$output .= '<nav><div class="nav nav-tabs" role="tablist">';
|
||||
foreach ($all_languages as $key => $lang) {
|
||||
$active_class = $key == 0 ? 'nav-item nav-link active' : 'nav-item nav-link';
|
||||
$output .= '<a class="' . $active_class . '" data-toggle="tab" href="#nav-newsletter-' . $lang->slug . '" role="tab" aria-selected="true">' . $lang->name . '</a>';
|
||||
}
|
||||
$output .= '</div></nav>';
|
||||
|
||||
$output .= '<div class="tab-content margin-top-30" >';
|
||||
|
||||
foreach ($all_languages as $key => $lang) {
|
||||
$active_tab_class = $key == 0 ? 'tab-pane fade show active' : 'tab-pane fade';
|
||||
$output .= '<div class="' . $active_tab_class . '" id="nav-newsletter-' . $lang->slug . '" role="tabpanel">';
|
||||
$widget_title = !empty($widget_saved_values) && isset($widget_saved_values['widget_title_'. $lang->slug]) ? $widget_saved_values['widget_title_'. $lang->slug] : '';
|
||||
$description = !empty($widget_saved_values) && isset($widget_saved_values['description_'. $lang->slug]) ? $widget_saved_values['description_'. $lang->slug] : '';
|
||||
|
||||
$output .= '<div class="form-group"><input type="text" name="widget_title_'. $lang->slug . '" id="widget_title_'. $lang->slug . '" class="form-control" placeholder="' . __('Widget Title') . '" value="'. $widget_title .'"></div>';
|
||||
$output .= '<div class="form-group"><input type="text" name="description_'.$lang->slug.'" id="description_'.$lang->slug.'" class="form-control" placeholder="' . __('Description') . '" value="'. $description .'"></div>';
|
||||
$output .= '</div>';
|
||||
}
|
||||
$output .= '</div>';
|
||||
//end multi langual tab option
|
||||
$output .= '<button class="btn btn-info btn-xs widget_save_change_button">' . __('Save Changes') . '</button>';
|
||||
$output .= '</form>';
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* newsletter widgets
|
||||
* it will be used for render content in frontend
|
||||
* */
|
||||
function render_newsletter_widget($id){
|
||||
$widget_data = !empty($id) ? Widgets::find($id) : '';
|
||||
$widget_saved_values = !empty($widget_data) ? unserialize($widget_data->widget_content) : '';
|
||||
$widget_title = !empty($widget_saved_values) && isset($widget_saved_values['widget_title_'. get_user_lang()]) ? $widget_saved_values['widget_title_'. get_user_lang()] : '';
|
||||
$description = !empty($widget_saved_values) && isset($widget_saved_values['description_'.get_user_lang()]) ? $widget_saved_values['description_'.get_user_lang()] : '';
|
||||
|
||||
$output = '<div class="col-lg-3 col-md-6"><div class="footer-widget widget newsletter-widget">';
|
||||
if (!empty($widget_title)){
|
||||
$output .= '<h4 class="widget-title">'.$widget_title.'</h4>';
|
||||
}
|
||||
$output .= '<p>'.$description.'</p>';
|
||||
$output .= '<div class="form-message-show"></div><div class="newsletter-form-wrap">';
|
||||
|
||||
$output .= '<form action="'.route('frontend.subscribe.newsletter').'" method="post" enctype="multipart/form-data">';
|
||||
|
||||
$output .= '<input type="hidden" name="_token" value="'.csrf_token().'">
|
||||
<div class="form-group">
|
||||
<input type="email" name="email" placeholder="'.__('your email').'" class="form-control">
|
||||
</div>
|
||||
<button type="submit" class="submit-btn"><i class="fas fa-paper-plane"></i></button>
|
||||
</form>';
|
||||
|
||||
$output .= '</div></div></div>';
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* raw HTML widget admin function
|
||||
* it will be used for drag & drop Widget Builder
|
||||
* **/
|
||||
|
||||
function raw_html_widget($type = 'new', $id = null){
|
||||
$output = '';
|
||||
$widget_data = !empty($id) ? Widgets::find($id) : '';
|
||||
$widget_order = !empty($widget_data) ? $widget_data->widget_order : '';
|
||||
$output .= get_widget_default_fields($type, 'raw_html_widget', 'render_raw_html_widget', 'Raw HTML', $id, $widget_order);
|
||||
|
||||
$widget_saved_values = !empty($widget_data) ? unserialize($widget_data->widget_content) : '';
|
||||
$raw_html = !empty($widget_saved_values) && isset($widget_saved_values['raw_html']) ? $widget_saved_values['raw_html'] : '';
|
||||
|
||||
$output .= '<div class="form-group">';
|
||||
$output .= '<textarea name="raw_html" class="form-control custom_html_area" cols="30" rows="10">'.$raw_html.'</textarea>';
|
||||
$output .= '</div>';
|
||||
//end multi langual tab option
|
||||
$output .= '<button class="btn btn-info btn-xs widget_save_change_button">' . __('Save Changes') . '</button>';
|
||||
$output .= '</form>';
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* raw html widgets
|
||||
* it will be used for render content in frontend
|
||||
* */
|
||||
function render_raw_html_widget($id){
|
||||
$widget_data = !empty($id) ? Widgets::find($id) : '';
|
||||
$widget_saved_values = !empty($widget_data) ? unserialize($widget_data->widget_content) : '';
|
||||
$raw_html = !empty($widget_saved_values) && isset($widget_saved_values['raw_html']) ? $widget_saved_values['raw_html'] : '';
|
||||
|
||||
$output = '<div class="col-lg-3 col-md-6"><div class="footer-widget widget newsletter-widget">';
|
||||
$output .= '<div class="custom-html-widget">'.$raw_html.'</div>';
|
||||
|
||||
$output .= '</div></div>';
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Image widget admin function
|
||||
* it will be used for drag & drop Widget Builder
|
||||
* **/
|
||||
|
||||
function single_image_widget($type = 'new', $id = null){
|
||||
$output = '';
|
||||
$widget_data = !empty($id) ? Widgets::find($id) : '';
|
||||
$widget_order = !empty($widget_data) ? $widget_data->widget_order : '';
|
||||
$output .= get_widget_default_fields($type, 'single_image_widget', 'render_single_image_widget', 'Image', $id, $widget_order);
|
||||
|
||||
$widget_saved_values = !empty($widget_data) ? unserialize($widget_data->widget_content) : '';
|
||||
|
||||
$image_val = !empty($widget_saved_values) ? $widget_saved_values['single_image'] : '';
|
||||
$image_preview = '';
|
||||
if (!empty($widget_saved_values)) {
|
||||
$image_markup = render_image_markup_by_attachment_id($widget_saved_values['single_image']);
|
||||
$image_preview = '<div class="attachment-preview"><div class="thumbnail"><div class="centered">' . $image_markup . '</div></div></div>';
|
||||
}
|
||||
$output .= '<div class="form-group"><label for="single_image"><strong>' . __('Image') . '</strong></label>';
|
||||
$output .= '<div class="media-upload-btn-wrapper"><div class="img-wrap">' . $image_preview . '</div><input type="hidden" name="single_image" value="' . $image_val . '">';
|
||||
$output .= '<button type="button" class="btn btn-info btn-xs media_upload_form_btn" data-btntitle="Select Image" data-modaltitle="Upload Image" data-toggle="modal" data-target="#media_upload_modal">';
|
||||
$output .= __('Select Image') . '</button></div></div>';
|
||||
|
||||
$output .= '<button class="btn btn-info btn-xs widget_save_change_button margin-top-40">' . __('Save Changes') . '</button>';
|
||||
$output .= '</form>';
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* image widgets
|
||||
* it will be used for render content in frontend
|
||||
* */
|
||||
function render_single_image_widget($id){
|
||||
$widget_data = !empty($id) ? Widgets::find($id) : '';
|
||||
$widget_saved_values = !empty($widget_data) ? unserialize($widget_data->widget_content) : '';
|
||||
$widget_title = !empty($widget_saved_values) && isset($widget_saved_values['widget_title_'. get_user_lang()]) ? $widget_saved_values['widget_title_'. get_user_lang()] : '';
|
||||
$image_val = !empty($widget_saved_values) ? $widget_saved_values['single_image'] : '';
|
||||
|
||||
$output = '<div class="col-lg-3 col-md-6"><div class="footer-widget widget">';
|
||||
if (!empty($widget_title)){
|
||||
$output .= '<h4 class="widget-title">'.$widget_title.'</h4>';
|
||||
}
|
||||
$output .= '<div class="single-wrap">';
|
||||
$output .= render_image_markup_by_attachment_id($image_val,'footer-logo');
|
||||
$output .= '</div></div></div>';
|
||||
|
||||
return $output;
|
||||
}
|
|
@ -0,0 +1,215 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Helpers\NexelitHelpers;
|
||||
use App\KnowAbout;
|
||||
use App\Language;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class AboutPageController extends Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth:admin');
|
||||
}
|
||||
|
||||
public function about_page_about_section(){
|
||||
$all_language = Language::all();
|
||||
return view('backend.pages.about-page.about-section')->with(['all_languages' => $all_language]);
|
||||
}
|
||||
public function about_page_update_about_section(Request $request){
|
||||
|
||||
$all_language = Language::all();
|
||||
|
||||
foreach ($all_language as $lang){
|
||||
$this->validate($request ,[
|
||||
'about_page_'.$lang->slug.'_about_section_title' => 'nullable|string',
|
||||
'about_page_'.$lang->slug.'_about_section_description' => 'nullable|string',
|
||||
'about_page_'.$lang->slug.'_about_section_quote_text' => 'nullable|string',
|
||||
]);
|
||||
$fields = [
|
||||
'about_page_'.$lang->slug.'_about_section_title',
|
||||
'about_page_'.$lang->slug.'_about_section_description',
|
||||
'about_page_'.$lang->slug.'_about_section_quote_text'
|
||||
];
|
||||
foreach ($fields as $field){
|
||||
update_static_option($field,$request->$field);
|
||||
}
|
||||
}
|
||||
update_static_option('about_page_image_two',$request->about_page_image_two);
|
||||
update_static_option('about_page_image_one',$request->about_page_image_one);
|
||||
|
||||
|
||||
return redirect()->back()->with(NexelitHelpers::settings_update());
|
||||
}
|
||||
public function about_page_global_network_section(){
|
||||
$all_language = Language::all();
|
||||
return view('backend.pages.about-page.global-network-section')->with(['all_languages' => $all_language]);
|
||||
}
|
||||
|
||||
public function about_page_update_global_network_section(Request $request){
|
||||
$this->validate($request,[
|
||||
'about_page_global_network_image' => 'nullable|string',
|
||||
]);
|
||||
$all_language = Language::all();
|
||||
|
||||
foreach ($all_language as $lang){
|
||||
$this->validate($request ,[
|
||||
'about_page_'.$lang->slug.'_global_network_button_url' => 'nullable|string',
|
||||
'about_page_'.$lang->slug.'_global_network_button_title' => 'nullable|string',
|
||||
'about_page_'.$lang->slug.'_global_network_button_status' => 'nullable|string',
|
||||
'about_page_'.$lang->slug.'_global_network_description' => 'nullable|string',
|
||||
'about_page_'.$lang->slug.'_global_network_title' => 'nullable|string',
|
||||
]);
|
||||
$fields = [
|
||||
'about_page_'.$lang->slug.'_global_network_button_url',
|
||||
'about_page_'.$lang->slug.'_global_network_button_title',
|
||||
'about_page_'.$lang->slug.'_global_network_button_status',
|
||||
'about_page_'.$lang->slug.'_global_network_description',
|
||||
'about_page_'.$lang->slug.'_global_network_title'
|
||||
];
|
||||
foreach ($fields as $field){
|
||||
update_static_option($field,$request->$field);
|
||||
}
|
||||
}
|
||||
update_static_option('about_page_global_network_image',$request->about_page_global_network_image);
|
||||
|
||||
return redirect()->back()->with(NexelitHelpers::settings_update());
|
||||
}
|
||||
public function about_page_experience_section(){
|
||||
$all_language = Language::all();
|
||||
return view('backend.pages.about-page.experience-section')->with(['all_languages' => $all_language]);
|
||||
}
|
||||
|
||||
public function about_page_update_experience_section(Request $request){
|
||||
$this->validate($request,[
|
||||
'about_page_experience_signature_image' => 'nullable|string',
|
||||
'about_page_experience_video_background_image' => 'nullable|string',
|
||||
]);
|
||||
$all_language = Language::all();
|
||||
|
||||
foreach ($all_language as $lang){
|
||||
$this->validate($request ,[
|
||||
'about_page_'.$lang->slug.'_experience_title' => 'nullable|string',
|
||||
'about_page_'.$lang->slug.'_experience_description' => 'nullable|string',
|
||||
'about_page_'.$lang->slug.'_quote_text' => 'nullable|string',
|
||||
'about_page_'.$lang->slug.'_experience_video_url' => 'nullable|string',
|
||||
]);
|
||||
|
||||
$experience_title = 'about_page_'.$lang->slug.'_experience_title';
|
||||
$experience_description = 'about_page_'.$lang->slug.'_experience_description';
|
||||
$quote_text = 'about_page_'.$lang->slug.'_quote_text';
|
||||
$_experience_video_url = 'about_page_'.$lang->slug.'_experience_video_url';
|
||||
|
||||
update_static_option('about_page_'.$lang->slug.'_experience_title',$request->$experience_title);
|
||||
update_static_option('about_page_'.$lang->slug.'_experience_description',$request->$experience_description);
|
||||
update_static_option('about_page_'.$lang->slug.'_experience_video_url',$request->$_experience_video_url);
|
||||
update_static_option('about_page_'.$lang->slug.'_quote_text',$request->$quote_text);
|
||||
}
|
||||
update_static_option('about_page_experience_signature_image',$request->about_page_experience_signature_image);
|
||||
update_static_option('about_page_experience_video_background_image',$request->about_page_experience_video_background_image);
|
||||
|
||||
return redirect()->back()->with([
|
||||
'msg' => __('Settings Updated ...'),
|
||||
'type' => 'success'
|
||||
]);
|
||||
}
|
||||
|
||||
public function about_page_testimonial_section(){
|
||||
$all_language = Language::all();
|
||||
return view('backend.pages.about-page.testimonial-section')->with(['all_languages' => $all_language]);
|
||||
}
|
||||
|
||||
public function about_page_update_testimonial_section(Request $request){
|
||||
|
||||
$this->validate($request,[
|
||||
'about_page_testimonial_background_image' => 'nullable|string',
|
||||
'about_page_testimonial_item' => 'nullable|string',
|
||||
]);
|
||||
|
||||
$all_language = Language::all();
|
||||
|
||||
foreach ($all_language as $lang){
|
||||
$this->validate($request ,[
|
||||
'about_page_'.$lang->slug.'_testimonial_title' => 'nullable|string',
|
||||
]);
|
||||
|
||||
$testimonial_title = 'about_page_'.$lang->slug.'_testimonial_title';
|
||||
|
||||
update_static_option('about_page_'.$lang->slug.'_testimonial_title',$request->$testimonial_title);
|
||||
}
|
||||
|
||||
update_static_option('about_page_testimonial_background_image',$request->about_page_testimonial_background_image);
|
||||
update_static_option('about_page_testimonial_item',$request->about_page_testimonial_item);
|
||||
|
||||
return redirect()->back()->with([
|
||||
'msg' => __('Settings Updated ...'),
|
||||
'type' => 'success'
|
||||
]);
|
||||
}
|
||||
public function about_page_team_member_section(){
|
||||
$all_language = Language::all();
|
||||
return view('backend.pages.about-page.team-section')->with(['all_languages' => $all_language]);
|
||||
}
|
||||
|
||||
public function about_page_update_team_member_section (Request $request){
|
||||
$this->validate($request,[
|
||||
'about_page_team_member_item' => 'nullable|string',
|
||||
]);
|
||||
|
||||
$all_language = Language::all();
|
||||
|
||||
foreach ($all_language as $lang){
|
||||
$this->validate($request ,[
|
||||
'about_page_'.$lang->slug.'_team_member_section_title' => 'nullable|string',
|
||||
'about_page_'.$lang->slug.'_team_member_section_description' => 'nullable|string',
|
||||
]);
|
||||
|
||||
$experience_title = 'about_page_'.$lang->slug.'_team_member_section_title';
|
||||
$experience_description = 'about_page_'.$lang->slug.'_team_member_section_description';
|
||||
|
||||
update_static_option('about_page_'.$lang->slug.'_team_member_section_title',$request->$experience_title);
|
||||
update_static_option('about_page_'.$lang->slug.'_team_member_section_description',$request->$experience_description);
|
||||
}
|
||||
update_static_option('about_page_team_member_item',$request->about_page_team_member_item);
|
||||
|
||||
return redirect()->back()->with([
|
||||
'msg' => __('Settings Updated ...'),
|
||||
'type' => 'success'
|
||||
]);
|
||||
}
|
||||
|
||||
public function about_page_section_manage(){
|
||||
return view('backend.pages.about-page.section-manage');
|
||||
}
|
||||
|
||||
public function about_page_update_section_manage(Request $request){
|
||||
|
||||
$this->validate($request,[
|
||||
'about_page_about_us_section_status' => 'nullable|string',
|
||||
'about_page_brand_logo_section_status' => 'nullable|string',
|
||||
'about_page_team_member_section_status' => 'nullable|string',
|
||||
'about_page_testimonial_section_status' => 'nullable|string',
|
||||
'about_page_experience_section_status' => 'nullable|string',
|
||||
'about_page_key_feature_section_status' => 'nullable|string',
|
||||
'about_page_global_network_section_status' => 'nullable|string',
|
||||
]);
|
||||
$fields = [
|
||||
'about_page_testimonial_section_status',
|
||||
'about_page_about_us_section_status',
|
||||
'about_page_brand_logo_section_status',
|
||||
'about_page_team_member_section_status',
|
||||
'about_page_experience_section_status',
|
||||
'about_page_key_feature_section_status',
|
||||
'about_page_global_network_section_status',
|
||||
];
|
||||
foreach ($fields as $field){
|
||||
update_static_option($field,$request->$field);
|
||||
}
|
||||
|
||||
return redirect()->back()->with(NexelitHelpers::settings_update());
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,100 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Advertisement;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class AdvertisementController extends Controller
|
||||
{
|
||||
private const BASE_PATH = 'backend.pages.advertisement.';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth:admin');
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$all_advertisements = Advertisement::latest()->get();
|
||||
return view(self::BASE_PATH.'index',compact('all_advertisements'));
|
||||
}
|
||||
|
||||
public function new_advertisement()
|
||||
{
|
||||
return view(self::BASE_PATH.'new');
|
||||
}
|
||||
|
||||
public function store_advertisement(Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
'title'=>'required|string',
|
||||
'type'=>'required|string',
|
||||
'size'=> 'required',
|
||||
'status'=> 'required',
|
||||
'slot'=> 'nullable',
|
||||
'embed_code'=> 'nullable',
|
||||
'redirect_url'=> 'nullable',
|
||||
'image'=> 'nullable'
|
||||
]);
|
||||
|
||||
Advertisement::create([
|
||||
'title' => $request->title,
|
||||
'type' => $request->type,
|
||||
'size' => $request->size,
|
||||
'status' => $request->status,
|
||||
'slot' => $request->slot,
|
||||
'embed_code' => $request->embed_code,
|
||||
'redirect_url' => purify_html($request->redirect_url),
|
||||
'image' => $request->image,
|
||||
]);
|
||||
|
||||
return redirect()->back()->with(['msg' => __('New Advertisement Created Successfully'), 'type' => 'success']);
|
||||
}
|
||||
|
||||
public function edit_advertisement($id)
|
||||
{
|
||||
$add = Advertisement::find($id);
|
||||
return view(self::BASE_PATH.'edit',compact('add'));
|
||||
}
|
||||
|
||||
public function update_advertisement(Request $request,$id)
|
||||
{
|
||||
$request->validate([
|
||||
'title'=>'required|string',
|
||||
'type'=>'required|string',
|
||||
'size'=> 'required',
|
||||
'status'=> 'required',
|
||||
'slot'=> 'nullable',
|
||||
'embed_code'=> 'nullable',
|
||||
'redirect_url'=> 'nullable',
|
||||
'image'=> 'nullable'
|
||||
]);
|
||||
|
||||
$add_id = Advertisement::where('id',$id)->update([
|
||||
'title' => purify_html( $request->title),
|
||||
'type' => purify_html($request->type),
|
||||
'size' => $request->size,
|
||||
'status' => $request->status,
|
||||
'slot' => $request->slot,
|
||||
'embed_code' => $request->embed_code,
|
||||
'redirect_url' => purify_html($request->redirect_url),
|
||||
'image' => $request->image,
|
||||
]);
|
||||
|
||||
return redirect()->back()->with(['msg' => __('Advertisement Updated Successfully'), 'type' => 'success']);
|
||||
}
|
||||
|
||||
|
||||
public function delete_advertisement($id){
|
||||
Advertisement::find($id)->delete();
|
||||
return redirect()->back()->with(['msg' => __('Advertisement Deleted Successfully'), 'type' => 'danger']);
|
||||
}
|
||||
|
||||
public function bulk_action(Request $request){
|
||||
Advertisement::whereIn('id',$request->ids)->delete();
|
||||
return response()->json(['status' => 'ok']);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Helpers\LanguageHelper;
|
||||
use App\Helpers\NexelitHelpers;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Traits\EmailTemplateHelperTrait;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class AppointmentEmailTempalteController extends Controller
|
||||
{
|
||||
use EmailTemplateHelperTrait;
|
||||
const BASE_PATH = 'backend.email-template.appointment.';
|
||||
|
||||
|
||||
public function appointment_reminder_mail(){
|
||||
return view(self::BASE_PATH.'reminder-mail')->with(['all_languages' => LanguageHelper::all_languages()]);
|
||||
}
|
||||
public function update_appointment_reminder_mail(Request $request){
|
||||
$this->save_data('appointment_reminder_mail_',$request);
|
||||
return back()->with(NexelitHelpers::settings_update());
|
||||
}
|
||||
|
||||
public function appointment_payment_accept(){
|
||||
return view(self::BASE_PATH.'payment-accept')->with(['all_languages' => LanguageHelper::all_languages()]);
|
||||
}
|
||||
|
||||
public function update_appointment_payment_accept(Request $request){
|
||||
$this->save_data('appointment_payment_accept_',$request);
|
||||
return back()->with(NexelitHelpers::settings_update());
|
||||
}
|
||||
|
||||
public function appointment_booking_admin(){
|
||||
return view(self::BASE_PATH.'booking-admin')->with(['all_languages' => LanguageHelper::all_languages()]);
|
||||
}
|
||||
|
||||
public function update_appointment_booking_admin(Request $request){
|
||||
$this->save_data('appointment_booking_admin_',$request);
|
||||
return back()->with(NexelitHelpers::settings_update());
|
||||
}
|
||||
|
||||
public function appointment_booking_update(){
|
||||
return view(self::BASE_PATH.'booking-update')->with(['all_languages' => LanguageHelper::all_languages()]);
|
||||
}
|
||||
public function update_appointment_booking_update(Request $request){
|
||||
$this->save_data('appointment_booking_update_',$request);
|
||||
return back()->with(NexelitHelpers::settings_update());
|
||||
}
|
||||
|
||||
public function appointment_booking_user(){
|
||||
return view(self::BASE_PATH.'booking-user')->with(['all_languages' => LanguageHelper::all_languages()]);
|
||||
}
|
||||
|
||||
public function update_appointment_booking_user(Request $request){
|
||||
$this->save_data('appointment_booking_user_',$request);
|
||||
return back()->with(NexelitHelpers::settings_update());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\CourseCertificate;
|
||||
use App\Helpers\NexelitHelpers;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Barryvdh\DomPDF\Facade as PDF;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class CourseCertificateController extends Controller
|
||||
{
|
||||
public function __construct() {
|
||||
$this->middleware('auth:admin');
|
||||
}
|
||||
|
||||
public function all(){
|
||||
$all_certificates = CourseCertificate::all();
|
||||
return view('backend.courses.certificate.index',compact('all_certificates'));
|
||||
}
|
||||
|
||||
public function delete($id){
|
||||
CourseCertificate::find($id)->delete();
|
||||
return back()->with(NexelitHelpers::item_delete());
|
||||
}
|
||||
|
||||
public function bulk_action(Request $request){
|
||||
CourseCertificate::whereIn('id',$request->ids)->delete();
|
||||
return back()->with(NexelitHelpers::item_delete());
|
||||
}
|
||||
|
||||
public function approved(Request $request){
|
||||
|
||||
$this->validate($request,[
|
||||
'course_id' => 'required',
|
||||
'user_id' => 'required',
|
||||
]);
|
||||
|
||||
CourseCertificate::where(['course_id' => $request->course_id,'user_id' => $request->user_id])->update([
|
||||
'status' => 1
|
||||
]);
|
||||
|
||||
return back()->with(NexelitHelpers::settings_update(__('Certificate Request Approve..')));
|
||||
}
|
||||
|
||||
public function download($id){
|
||||
$course_certificate = CourseCertificate::with(['course','user'])->find($id);
|
||||
abort_if(is_null($course_certificate),404);
|
||||
$pdf = PDF::loadView('certificate.course', ['course_certificate' => $course_certificate])->setPaper('a4', 'landscape');
|
||||
return $pdf->download('certificate'.Str::random(10).'.pdf');
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Helpers\LanguageHelper;
|
||||
use App\Helpers\NexelitHelpers;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Traits\EmailTemplateHelperTrait;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class CourseEmailTemplateController extends Controller
|
||||
{
|
||||
use EmailTemplateHelperTrait;
|
||||
const BASE_PATH = 'backend.email-template.course.';
|
||||
|
||||
public function course_enroll_admin(){
|
||||
return view(self::BASE_PATH.'enroll-admin')->with(['all_languages' => LanguageHelper::all_languages()]);
|
||||
}
|
||||
|
||||
public function course_enroll_user(){
|
||||
return view(self::BASE_PATH.'enroll-user')->with(['all_languages' => LanguageHelper::all_languages()]);
|
||||
}
|
||||
|
||||
public function course_payment_accept(){
|
||||
return view(self::BASE_PATH.'payment-accept')->with(['all_languages' => LanguageHelper::all_languages()]);
|
||||
}
|
||||
public function course_reminder_mail(){
|
||||
return view(self::BASE_PATH.'reminder-mail')->with(['all_languages' => LanguageHelper::all_languages()]);
|
||||
}
|
||||
|
||||
public function update_courese_enroll_admin(Request $request){
|
||||
$this->save_data('course_enroll_admin_',$request);
|
||||
|
||||
return back()->with(NexelitHelpers::settings_update());
|
||||
}
|
||||
|
||||
public function update_course_enroll_user(Request $request){
|
||||
$this->save_data('course_enroll_user_',$request);
|
||||
|
||||
return back()->with(NexelitHelpers::settings_update());
|
||||
}
|
||||
public function update_course_payment_accept(Request $request){
|
||||
$this->save_data('course_payment_accept_',$request);
|
||||
|
||||
return back()->with(NexelitHelpers::settings_update());
|
||||
}
|
||||
public function update_course_reminder_mail(Request $request){
|
||||
$this->save_data('course_reminder_mail_',$request);
|
||||
|
||||
return back()->with(NexelitHelpers::settings_update());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,326 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Helpers\LanguageHelper;
|
||||
use App\Helpers\NexelitHelpers;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class CreativeAgencyHomePageManageController extends Controller
|
||||
{
|
||||
const BASE_PATH = 'backend.pages.home.creative-agency-two.';
|
||||
public function __construct() {
|
||||
$this->middleware('auth:admin');
|
||||
}
|
||||
public function header_area(){
|
||||
return view(self::BASE_PATH.'header-area')->with(['all_languages' => LanguageHelper::all_languages() ]);
|
||||
}
|
||||
public function services_area(){
|
||||
return view(self::BASE_PATH.'services-area')->with(['all_languages' => LanguageHelper::all_languages() ]);
|
||||
}
|
||||
public function project_area(){
|
||||
return view(self::BASE_PATH.'project-area')->with(['all_languages' => LanguageHelper::all_languages() ]);
|
||||
}
|
||||
public function counterup_area(){
|
||||
return view(self::BASE_PATH.'counterup-area')->with(['all_languages' => LanguageHelper::all_languages() ]);
|
||||
}
|
||||
public function blog_area(){
|
||||
return view(self::BASE_PATH.'blog-area')->with(['all_languages' => LanguageHelper::all_languages() ]);
|
||||
}
|
||||
public function testimonial_area(){
|
||||
return view(self::BASE_PATH.'testimonial-area')->with(['all_languages' => LanguageHelper::all_languages() ]);
|
||||
}
|
||||
public function contact_area(){
|
||||
return view(self::BASE_PATH.'contact-area')->with(['all_languages' => LanguageHelper::all_languages() ]);
|
||||
}
|
||||
public function newsletter_area(){
|
||||
return view(self::BASE_PATH.'newsletter-area')->with(['all_languages' => LanguageHelper::all_languages() ]);
|
||||
}
|
||||
public function header_area_update(Request $request){
|
||||
$this->validate($request,[
|
||||
'home21_header_section_background_image' => 'nullable|string',
|
||||
'home21_header_section_right_image' => 'nullable|string',
|
||||
'home21_header_section_text_image' => 'nullable|string',
|
||||
'home21_header_section_title_shape_image' => 'nullable|string',
|
||||
'home21_header_section_shape_01_image' => 'nullable|string',
|
||||
'home21_header_section_shape_02_image' => 'nullable|string',
|
||||
'home21_header_section_shape_03_image' => 'nullable|string',
|
||||
'home21_header_section_button_one_url' => 'nullable|string',
|
||||
'home21_header_section_button_two_url' => 'nullable|string',
|
||||
]);
|
||||
//todo save data to db serialize data
|
||||
foreach (LanguageHelper::all_languages() as $lang){
|
||||
$this->validate($request,[
|
||||
'home_21_header_section_'.$lang->slug.'_social_text' => 'nullable|array',
|
||||
'home_21_header_section_'.$lang->slug.'_social_text.*' => 'nullable|string',
|
||||
'home21_header_section_social_url' => 'required|array',
|
||||
'home21_header_section_social_url.*' => 'required|string',
|
||||
]);
|
||||
|
||||
//save repeater values
|
||||
$all_fields = [
|
||||
'home_21_header_section_'.$lang->slug.'_social_text',
|
||||
'home21_header_section_social_url'
|
||||
];
|
||||
foreach ($all_fields as $field){
|
||||
$value = $request->$field ?? [];
|
||||
update_static_option($field,serialize($value));
|
||||
}
|
||||
}
|
||||
|
||||
//todo save langauge wise data
|
||||
foreach (LanguageHelper::all_languages() as $lang){
|
||||
$this->validate($request,[
|
||||
'home_21_header_section_'.$lang->slug.'_title' => 'nullable|string',
|
||||
'home_21_header_section_'.$lang->slug.'_description' => 'nullable|string',
|
||||
'home_21_header_section_'.$lang->slug.'_button_one_text' => 'nullable|string',
|
||||
'home_21_header_section_'.$lang->slug.'_button_two_text' => 'nullable|string',
|
||||
'home_21_header_section_'.$lang->slug.'_button_two_info_text' => 'nullable|string',
|
||||
]);
|
||||
|
||||
$field_list = [
|
||||
'home_21_header_section_'.$lang->slug.'_title',
|
||||
'home_21_header_section_'.$lang->slug.'_description',
|
||||
'home_21_header_section_'.$lang->slug.'_button_one_text',
|
||||
'home_21_header_section_'.$lang->slug.'_button_two_text',
|
||||
'home_21_header_section_'.$lang->slug.'_button_two_info_text'
|
||||
];
|
||||
|
||||
foreach ($field_list as $field){
|
||||
update_static_option($field,$request->$field);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//todo save normal field to db
|
||||
$fields = [
|
||||
'home21_header_section_background_image',
|
||||
'home21_header_section_right_image',
|
||||
'home21_header_section_text_image',
|
||||
'home21_header_section_title_shape_image',
|
||||
'home21_header_section_shape_01_image',
|
||||
'home21_header_section_shape_02_image',
|
||||
'home21_header_section_shape_03_image',
|
||||
'home21_header_section_button_one_url',
|
||||
'home21_header_section_button_two_url',
|
||||
];
|
||||
foreach ($fields as $field){
|
||||
update_static_option($field,$request->$field);
|
||||
}
|
||||
|
||||
return back()->with(NexelitHelpers::item_update());
|
||||
}
|
||||
|
||||
public function services_area_update(Request $request){
|
||||
$this->validate($request,[
|
||||
'home_21_service_section_button_one_url' => 'nullable|string',
|
||||
'home_page_01_service_area_items' => 'nullable|string',
|
||||
]);
|
||||
|
||||
//todo save langauge wise data
|
||||
foreach (LanguageHelper::all_languages() as $lang){
|
||||
$this->validate($request,[
|
||||
'home_21_service_section_'.$lang->slug.'_button_one_text' => 'nullable|string',
|
||||
'home_21_service_section_'.$lang->slug.'_description' => 'nullable|string',
|
||||
'home_21_service_section_'.$lang->slug.'_title' => 'nullable|string',
|
||||
'home_21_service_section_'.$lang->slug.'_subtitle' => 'nullable|string',
|
||||
]);
|
||||
|
||||
$field_list = [
|
||||
'home_21_service_section_'.$lang->slug.'_button_one_text',
|
||||
'home_21_service_section_'.$lang->slug.'_description',
|
||||
'home_21_service_section_'.$lang->slug.'_title',
|
||||
'home_21_service_section_'.$lang->slug.'_subtitle',
|
||||
'home_21_service_section_'.$lang->slug.'_item_explore_one_text',
|
||||
];
|
||||
|
||||
foreach ($field_list as $field){
|
||||
update_static_option($field,$request->$field);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//todo save normal field to db
|
||||
$fields = [
|
||||
'home_21_service_section_button_one_url',
|
||||
'home_page_01_service_area_items',
|
||||
'home21_services_section_right_shape_image',
|
||||
'home21_services_section_left_shape_image',
|
||||
];
|
||||
foreach ($fields as $field){
|
||||
update_static_option($field,$request->$field);
|
||||
}
|
||||
|
||||
return back()->with(NexelitHelpers::item_update());
|
||||
}
|
||||
|
||||
public function project_area_update(Request $request){
|
||||
|
||||
//todo save langauge wise data
|
||||
foreach (LanguageHelper::all_languages() as $lang){
|
||||
$this->validate($request,[
|
||||
'home_21_project_section_'.$lang->slug.'_item_explore_one_text' => 'nullable|string',
|
||||
'home_21_project_section_'.$lang->slug.'_title' => 'nullable|string',
|
||||
'home_21_project_section_'.$lang->slug.'_subtitle' => 'nullable|string',
|
||||
]);
|
||||
|
||||
$field_list = [
|
||||
'home_21_project_section_'.$lang->slug.'_item_explore_one_text',
|
||||
'home_21_project_section_'.$lang->slug.'_title',
|
||||
'home_21_project_section_'.$lang->slug.'_subtitle',
|
||||
];
|
||||
|
||||
foreach ($field_list as $field){
|
||||
update_static_option($field,$request->$field);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return back()->with(NexelitHelpers::item_update());
|
||||
}
|
||||
public function counterup_area_update(Request $request){
|
||||
|
||||
//todo save langauge wise data
|
||||
foreach (LanguageHelper::all_languages() as $lang){
|
||||
$this->validate($request,[
|
||||
'home_21_counterup_section_'.$lang->slug.'_description' => 'nullable|string',
|
||||
'home_21_counterup_section_'.$lang->slug.'_title' => 'nullable|string',
|
||||
]);
|
||||
|
||||
$field_list = [
|
||||
'home_21_counterup_section_'.$lang->slug.'_description',
|
||||
'home_21_counterup_section_'.$lang->slug.'_title',
|
||||
];
|
||||
|
||||
foreach ($field_list as $field){
|
||||
update_static_option($field,$request->$field);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return back()->with(NexelitHelpers::item_update());
|
||||
}
|
||||
|
||||
public function blog_area_update(Request $request){
|
||||
|
||||
//todo save langauge wise data
|
||||
foreach (LanguageHelper::all_languages() as $lang){
|
||||
$this->validate($request,[
|
||||
'home_21_blog_section_'.$lang->slug.'_item_keep_reading_text' => 'nullable|string',
|
||||
'home_21_blog_section_'.$lang->slug.'_title' => 'nullable|string',
|
||||
'home_21_blog_section_'.$lang->slug.'_subtitle' => 'nullable|string',
|
||||
]);
|
||||
|
||||
$field_list = [
|
||||
'home_21_blog_section_'.$lang->slug.'_item_keep_reading_text',
|
||||
'home_21_blog_section_'.$lang->slug.'_subtitle',
|
||||
'home_21_blog_section_'.$lang->slug.'_title',
|
||||
];
|
||||
|
||||
foreach ($field_list as $field){
|
||||
update_static_option($field,$request->$field);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return back()->with(NexelitHelpers::item_update());
|
||||
}
|
||||
|
||||
|
||||
public function testimonial_area_update(Request $request){
|
||||
foreach (LanguageHelper::all_languages() as $lang){
|
||||
$this->validate($request,[
|
||||
'home_21_testimonial_section_'.$lang->slug.'_title' => 'nullable|string',
|
||||
'home_21_testimonial_section_'.$lang->slug.'_subtitle' => 'nullable|string',
|
||||
]);
|
||||
|
||||
$field_list = [
|
||||
'home_21_testimonial_section_'.$lang->slug.'_subtitle',
|
||||
'home_21_testimonial_section_'.$lang->slug.'_title',
|
||||
];
|
||||
|
||||
foreach ($field_list as $field){
|
||||
update_static_option($field,$request->$field);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return back()->with(NexelitHelpers::item_update());
|
||||
}
|
||||
|
||||
public function contact_area_update(Request $request){
|
||||
|
||||
//todo save data to db serialize data
|
||||
foreach (LanguageHelper::all_languages() as $lang){
|
||||
$this->validate($request,[
|
||||
'home_21_contact_section_'.$lang->slug.'_info_item_title' => 'nullable|array',
|
||||
'home_21_contact_section_'.$lang->slug.'_info_item_title.*' => 'nullable|string',
|
||||
'home_21_contact_section_'.$lang->slug.'_info_item_details' => 'nullable|array',
|
||||
'home_21_contact_section_'.$lang->slug.'_info_item_details.*' => 'nullable|string',
|
||||
'home21_contact_section_info_item_icon' => 'required|array',
|
||||
'home21_contact_section_info_item_icon.*' => 'required|string',
|
||||
]);
|
||||
|
||||
//save repeater values
|
||||
$all_fields = [
|
||||
'home_21_contact_section_'.$lang->slug.'_info_item_details',
|
||||
'home_21_contact_section_'.$lang->slug.'_info_item_title',
|
||||
'home21_contact_section_info_item_icon'
|
||||
];
|
||||
foreach ($all_fields as $field){
|
||||
$value = $request->$field ?? [];
|
||||
update_static_option($field,serialize($value));
|
||||
}
|
||||
}
|
||||
|
||||
//todo save langauge wise data
|
||||
foreach (LanguageHelper::all_languages() as $lang){
|
||||
$this->validate($request,[
|
||||
'home_21_contact_section_'.$lang->slug.'_title' => 'nullable|string',
|
||||
'home_21_contact_section_'.$lang->slug.'_button_text' => 'nullable|string',
|
||||
]);
|
||||
|
||||
$field_list = [
|
||||
'home_21_contact_section_'.$lang->slug.'_title',
|
||||
'home_21_contact_section_'.$lang->slug.'_button_text',
|
||||
];
|
||||
|
||||
foreach ($field_list as $field){
|
||||
update_static_option($field,$request->$field);
|
||||
}
|
||||
}
|
||||
|
||||
return back()->with(NexelitHelpers::item_update());
|
||||
}
|
||||
|
||||
public function newsletter_area_update(Request $request){
|
||||
//todo save langauge wise data
|
||||
$this->validate($request,[
|
||||
'home_21_newsletter_section_shape_image' => 'nullable|integer'
|
||||
]);
|
||||
foreach (LanguageHelper::all_languages() as $lang){
|
||||
$this->validate($request,[
|
||||
'home_21_newsletter_section_'.$lang->slug.'_subtitle' => 'nullable|string',
|
||||
'home_21_newsletter_section_'.$lang->slug.'_title' => 'nullable|string',
|
||||
'home_21_newsletter_section_'.$lang->slug.'_placeholder_text' => 'nullable|string',
|
||||
]);
|
||||
|
||||
$field_list = [
|
||||
'home_21_newsletter_section_'.$lang->slug.'_title',
|
||||
'home_21_newsletter_section_'.$lang->slug.'_subtitle',
|
||||
'home_21_newsletter_section_'.$lang->slug.'_placeholder_text',
|
||||
];
|
||||
|
||||
foreach ($field_list as $field){
|
||||
update_static_option($field,$request->$field);
|
||||
}
|
||||
}
|
||||
update_static_option('home_21_newsletter_section_shape_image',$request->home_21_newsletter_section_shape_image);
|
||||
|
||||
return back()->with(NexelitHelpers::item_update());
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,82 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\FormBuilder;
|
||||
use App\Helpers\NexelitHelpers;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class CustomFormBuilderController extends Controller
|
||||
{
|
||||
protected const BASE_PATH = 'backend.form-builder.custom.';
|
||||
public function __construct(){
|
||||
$this->middleware('auth:admin');
|
||||
}
|
||||
public function all(){
|
||||
$all_forms = FormBuilder::all();
|
||||
return view(self::BASE_PATH.'all',compact('all_forms'));
|
||||
}
|
||||
public function bulk_action(Request $request){
|
||||
FormBuilder::whereIn('id',$request->ids)->delete();
|
||||
return response()->json('ok');
|
||||
}
|
||||
public function edit($id){
|
||||
$form = FormBuilder::findOrFail($id);
|
||||
return view(self::BASE_PATH.'edit',compact('form'));
|
||||
}
|
||||
public function update(Request $request){
|
||||
$this->validate($request,[
|
||||
'title' => 'required|string',
|
||||
'email' => 'required|string',
|
||||
'button_title' => 'required|string',
|
||||
'field_name' => 'required|max:191',
|
||||
'field_placeholder' => 'required|max:191',
|
||||
'success_message' => 'required',
|
||||
]);
|
||||
$id = $request->id;
|
||||
$title = $request->title;
|
||||
$email = $request->email;
|
||||
$button_title = $request->button_title;
|
||||
unset($request['_token'],$request['email'],$request['button_title'],$request['title'],$request['id']);
|
||||
$all_fields_name = [];
|
||||
$all_request_except_token = $request->all();
|
||||
foreach ($request->field_name as $fname){
|
||||
$all_fields_name[] = strtolower(Str::slug($fname));
|
||||
}
|
||||
$all_request_except_token['field_name'] = $all_fields_name;
|
||||
$json_encoded_data = json_encode($all_request_except_token);
|
||||
|
||||
FormBuilder::findOrfail($id)->update([
|
||||
'title' => $title,
|
||||
'email' => $email,
|
||||
'button_text' => $button_title,
|
||||
'success_message' => $request->success_message,
|
||||
'fields' => $json_encoded_data
|
||||
]);
|
||||
|
||||
return back()->with(NexelitHelpers::item_update());
|
||||
}
|
||||
|
||||
public function store(Request $request){
|
||||
$this->validate($request,[
|
||||
'title' => 'required|string',
|
||||
'email' => 'required|string',
|
||||
'button_title' => 'required|string',
|
||||
'success_message' => 'required|string',
|
||||
]);
|
||||
FormBuilder::create([
|
||||
'title' => $request->title,
|
||||
'email' => $request->email,
|
||||
'button_text' => $request->button_title,
|
||||
'success_message' => $request->success_message,
|
||||
]);
|
||||
return back()->with(NexelitHelpers::item_new());
|
||||
}
|
||||
|
||||
public function delete($id){
|
||||
FormBuilder::findOrFail($id)->delete();
|
||||
return back()->with(NexelitHelpers::item_delete());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Helpers\LanguageHelper;
|
||||
use App\Helpers\NexelitHelpers;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Traits\EmailTemplateHelperTrait;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class DonationEmailTemplateController extends Controller
|
||||
{
|
||||
use EmailTemplateHelperTrait;
|
||||
const BASE_PATH = 'backend.email-template.donation.';
|
||||
|
||||
public function donation_mail_reminder_mail(){
|
||||
return view(self::BASE_PATH.'reminder-mail')->with(['all_languages' => LanguageHelper::all_languages()]);
|
||||
}
|
||||
|
||||
public function update_donation_mail_reminder_mail(Request $request){
|
||||
$this->save_data('donation_payment_reminder_mail_',$request);
|
||||
return back()->with(NexelitHelpers::settings_update());
|
||||
}
|
||||
public function donation_mail_payment_accept(){
|
||||
return view(self::BASE_PATH.'payment-accept-mail')->with(['all_languages' => LanguageHelper::all_languages()]);
|
||||
}
|
||||
|
||||
public function update_donation_mail_payment_accept(Request $request){
|
||||
$this->save_data('donation_payment_accept_mail_',$request);
|
||||
return back()->with(NexelitHelpers::settings_update());
|
||||
}
|
||||
|
||||
public function donation_mail_admin(){
|
||||
return view(self::BASE_PATH.'admin-mail')->with(['all_languages' => LanguageHelper::all_languages()]);
|
||||
}
|
||||
|
||||
public function update_donation_mail_admin(Request $request){
|
||||
$this->save_data('donation_admin_mail_',$request);
|
||||
return back()->with(NexelitHelpers::settings_update());
|
||||
}
|
||||
|
||||
public function donation_mail_user(){
|
||||
return view(self::BASE_PATH.'user-mail')->with(['all_languages' => LanguageHelper::all_languages()]);
|
||||
}
|
||||
|
||||
public function update_donation_mail_user(Request $request){
|
||||
$this->save_data('donation_user_mail_',$request);
|
||||
return back()->with(NexelitHelpers::settings_update());
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,80 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Helpers\LanguageHelper;
|
||||
use App\Helpers\NexelitHelpers;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Traits\EmailTemplateHelperTrait;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class EmailTemplateController extends Controller
|
||||
{
|
||||
use EmailTemplateHelperTrait;
|
||||
const BASE_PATH = 'backend.email-template.';
|
||||
|
||||
public function all(){
|
||||
return view(self::BASE_PATH.'all');
|
||||
}
|
||||
public function quote_admin_mail(){
|
||||
return view(self::BASE_PATH.'quote-admin-mail')->with(['all_languages' => LanguageHelper::all_languages()]);
|
||||
}
|
||||
public function admin_password_reset(){
|
||||
return view(self::BASE_PATH.'admin-reset-password')->with(['all_languages' => LanguageHelper::all_languages()]);
|
||||
}
|
||||
|
||||
public function user_email_verify(){
|
||||
return view(self::BASE_PATH.'user-email-verify')->with(['all_languages' => LanguageHelper::all_languages()]);
|
||||
}
|
||||
public function newsletter_verify(){
|
||||
return view(self::BASE_PATH.'newsletter-verify')->with(['all_languages' => LanguageHelper::all_languages()]);
|
||||
}
|
||||
public function update_admin_password_reset(Request $request){
|
||||
$this->save_data('admin_reset_password_',$request);
|
||||
return back()->with(NexelitHelpers::settings_update());
|
||||
}
|
||||
|
||||
public function update_quote_admin_mail(Request $request){
|
||||
$this->save_data('quote_admin_mail_',$request);
|
||||
|
||||
return back()->with(NexelitHelpers::settings_update());
|
||||
}
|
||||
public function update_newsletter_verify(Request $request){
|
||||
$this->save_data('newsletter_verify_',$request);
|
||||
|
||||
return back()->with(NexelitHelpers::settings_update());
|
||||
}
|
||||
|
||||
public function update_user_email_verify(Request $request){
|
||||
|
||||
$this->save_data('user_email_verify_',$request);
|
||||
|
||||
return back()->with(NexelitHelpers::settings_update());
|
||||
}
|
||||
|
||||
public function user_password_reset(){
|
||||
return view(self::BASE_PATH.'user-reset-password')->with(['all_languages' => LanguageHelper::all_languages()]);
|
||||
}
|
||||
|
||||
public function update_user_password_reset(Request $request){
|
||||
|
||||
foreach (LanguageHelper::all_languages() as $lang){
|
||||
$this->validate($request,[
|
||||
'user_reset_password_'.$lang->slug.'_subject',
|
||||
'user_reset_password_'.$lang->slug.'_message',
|
||||
]);
|
||||
$fields_list = [
|
||||
'user_reset_password_'.$lang->slug.'_subject',
|
||||
'user_reset_password_'.$lang->slug.'_message',
|
||||
];
|
||||
foreach ($fields_list as $field){
|
||||
update_static_option($field,$request->$field);
|
||||
}
|
||||
}
|
||||
|
||||
return back()->with(NexelitHelpers::settings_update());
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Helpers\LanguageHelper;
|
||||
use App\Helpers\NexelitHelpers;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Traits\EmailTemplateHelperTrait;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class EventEmailTemplateController extends Controller
|
||||
{
|
||||
use EmailTemplateHelperTrait;
|
||||
const BASE_PATH = 'backend.email-template.event.';
|
||||
|
||||
public function event_attendance_mail_admin(){
|
||||
return view(self::BASE_PATH.'booking-mail-admin')->with(['all_languages' => LanguageHelper::all_languages()]);
|
||||
}
|
||||
|
||||
public function event_attendance_mail_user(){
|
||||
return view(self::BASE_PATH.'booking-mail-user')->with(['all_languages' => LanguageHelper::all_languages()]);
|
||||
}
|
||||
|
||||
public function event_attendance_mail_payment_accept(){
|
||||
return view(self::BASE_PATH.'booking-payment-accept')->with(['all_languages' => LanguageHelper::all_languages()]);
|
||||
}
|
||||
public function event_attendance_mail_reminder_mail(){
|
||||
return view(self::BASE_PATH.'booking-reminder-mail')->with(['all_languages' => LanguageHelper::all_languages()]);
|
||||
}
|
||||
|
||||
public function update_event_attendance_mail_reminder_mail(Request $request){
|
||||
$this->save_data('event_booking_reminder_',$request);
|
||||
return back()->with(NexelitHelpers::settings_update());
|
||||
}
|
||||
|
||||
public function update_event_attendance_mail_payment_accept(Request $request){
|
||||
$this->save_data('event_booking_payment_accept_',$request);
|
||||
|
||||
return back()->with(NexelitHelpers::settings_update());
|
||||
}
|
||||
|
||||
public function update_event_attendance_mail_admin(Request $request){
|
||||
$this->save_data('event_booking_admin_mail_',$request);
|
||||
|
||||
return back()->with(NexelitHelpers::settings_update());
|
||||
}
|
||||
public function update_event_attendance_mail_user(Request $request){
|
||||
$this->save_data('event_booking_user_mail_',$request);
|
||||
|
||||
return back()->with(NexelitHelpers::settings_update());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,291 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\BlogCategory;
|
||||
use App\Helpers\LanguageHelper;
|
||||
use App\Helpers\NexelitHelpers;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\ProductCategory;
|
||||
use App\Products;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class FashionEcommerceHomePageController extends Controller
|
||||
{
|
||||
const BASE_PATH = 'backend.pages.home.fashion.';
|
||||
|
||||
public function __construct() {
|
||||
$this->middleware('auth:admin');
|
||||
}
|
||||
|
||||
public function header_area(){
|
||||
return view(self::BASE_PATH.'header-area')->with(['all_languages' => LanguageHelper::all_languages()]);
|
||||
}
|
||||
|
||||
public function header_area_update(Request $request){
|
||||
|
||||
foreach (LanguageHelper::all_languages() as $lang){
|
||||
$this->validate($request,[
|
||||
'home_19_header_section_'.$lang->slug.'_button_text' => 'nullable|array',
|
||||
'home_19_header_section_'.$lang->slug.'_title' => 'nullable|array',
|
||||
'home_19_header_section_'.$lang->slug.'_subtitle' => 'nullable|array',
|
||||
'home19_header_section_button_url' => 'required|array',
|
||||
'home19_header_section_button_url.*' => 'required|string',
|
||||
'home19_header_section_button_image' => 'nullable|array',
|
||||
'home19_header_section_button_image.*' => 'nullable|string',
|
||||
]);
|
||||
|
||||
//save repeater values
|
||||
$all_fields = [
|
||||
'home_19_header_section_'.$lang->slug.'_button_text',
|
||||
'home_19_header_section_'.$lang->slug.'_title',
|
||||
'home_19_header_section_'.$lang->slug.'_subtitle',
|
||||
'home19_header_section_button_url',
|
||||
'home19_header_section_image'
|
||||
];
|
||||
|
||||
foreach ($all_fields as $field){
|
||||
$value = $request->$field ?? [];
|
||||
update_static_option($field,serialize($value));
|
||||
}
|
||||
}
|
||||
return back()->with(NexelitHelpers::item_update());
|
||||
}
|
||||
|
||||
public function todays_deal_area(){
|
||||
$all_products = Products::where(['status' => 'publish','lang' => LanguageHelper::user_lang_slug()])->get();
|
||||
return view(self::BASE_PATH.'todays-deal-area')->with(['all_languages' => LanguageHelper::all_languages(), 'all_products'=> $all_products]);
|
||||
}
|
||||
|
||||
public function todays_deal_area_update(Request $request){
|
||||
|
||||
foreach (LanguageHelper::all_languages() as $lang){
|
||||
$this->validate($request,[
|
||||
'home_page_19_'.$lang->slug.'_todays_deal_area_title' => 'nullable',
|
||||
'home_page_19_'.$lang->slug.'_todays_deal_area_right_text' => 'nullable',
|
||||
'home_page_19_'.$lang->slug.'_todays_deal_products' => 'nullable',
|
||||
]);
|
||||
|
||||
$products = 'home_page_19_'.$lang->slug.'_todays_deal_products';
|
||||
|
||||
//save repeater values
|
||||
$all_fields = [
|
||||
'home_page_19_'.$lang->slug.'_todays_deal_area_title' ,
|
||||
'home_page_19_'.$lang->slug.'_todays_deal_area_right_text',
|
||||
];
|
||||
|
||||
foreach ($all_fields as $field){
|
||||
update_static_option($field,$request->$field);
|
||||
}
|
||||
|
||||
update_static_option('home_page_19_'.$lang->slug.'_todays_deal_products',json_encode($request->$products));
|
||||
}
|
||||
return back()->with(NexelitHelpers::item_update());
|
||||
}
|
||||
|
||||
public function updated_area(){
|
||||
$all_products = Products::where(['status' => 'publish','lang' => LanguageHelper::user_lang_slug()])->get();
|
||||
return view(self::BASE_PATH.'updated-area')->with(['all_languages' => LanguageHelper::all_languages(), 'all_products'=> $all_products]);
|
||||
}
|
||||
|
||||
public function updated_area_update(Request $request){
|
||||
|
||||
foreach (LanguageHelper::all_languages() as $lang){
|
||||
$this->validate($request,[
|
||||
'home_19_updated_section_'.$lang->slug.'_button_text' => 'nullable|array',
|
||||
'home_19_updated_section_'.$lang->slug.'_title' => 'nullable|array',
|
||||
'home_19_updated_section_'.$lang->slug.'_subtitle' => 'nullable|array',
|
||||
'home19_updated_section_button_url' => 'required|array',
|
||||
'home19_updated_section_button_url.*' => 'required|string',
|
||||
'home19_updated_section_button_image' => 'nullable|array',
|
||||
'home19_updated_section_button_image.*' => 'nullable|string',
|
||||
]);
|
||||
|
||||
//save repeater values
|
||||
$all_fields = [
|
||||
'home_19_updated_section_'.$lang->slug.'_button_text',
|
||||
'home_19_updated_section_'.$lang->slug.'_title',
|
||||
'home_19_updated_section_'.$lang->slug.'_subtitle',
|
||||
'home19_updated_section_button_url',
|
||||
'home19_updated_section_image'
|
||||
];
|
||||
|
||||
foreach ($all_fields as $field){
|
||||
$value = $request->$field ?? [];
|
||||
update_static_option($field,serialize($value));
|
||||
}
|
||||
}
|
||||
return back()->with(NexelitHelpers::item_update());
|
||||
}
|
||||
|
||||
public function store_area(){
|
||||
$all_products_category = ProductCategory::where(['status' => 'publish','lang' => LanguageHelper::user_lang_slug()])->get();
|
||||
return view(self::BASE_PATH.'store-area')->with(['all_languages' => LanguageHelper::all_languages(), 'all_products_category'=> $all_products_category]);
|
||||
}
|
||||
|
||||
public function store_area_update(Request $request){
|
||||
|
||||
foreach (LanguageHelper::all_languages() as $lang){
|
||||
$this->validate($request,[
|
||||
'home19_store_'.$lang->slug.'_section_title' => 'nullable',
|
||||
'home19_store_button_'.$lang->slug.'_text' => 'nullable',
|
||||
'home19_store_button_'.$lang->slug.'_url' => 'nullable',
|
||||
]);
|
||||
|
||||
$categories = 'home19_store_section_'.$lang->slug.'_categories';
|
||||
|
||||
//save repeater values
|
||||
$all_fields = [
|
||||
'home19_store_'.$lang->slug.'_section_title' ,
|
||||
'home19_store_button_'.$lang->slug.'_text',
|
||||
'home19_store_button_'.$lang->slug.'_url',
|
||||
];
|
||||
|
||||
foreach ($all_fields as $field){
|
||||
update_static_option($field,$request->$field);
|
||||
}
|
||||
|
||||
update_static_option('home19_store_section_'.$lang->slug.'_categories',json_encode($request->$categories));
|
||||
}
|
||||
update_static_option('home19_store_section_category_items',$request->home19_store_section_category_items);
|
||||
return back()->with(NexelitHelpers::item_update());
|
||||
}
|
||||
|
||||
public function clothing_area(){
|
||||
$all_products_category = ProductCategory::where(['status' => 'publish','lang' => LanguageHelper::user_lang_slug()])->get();
|
||||
return view(self::BASE_PATH.'clothing-area')->with(['all_languages' => LanguageHelper::all_languages(), 'all_products_category'=> $all_products_category]);
|
||||
}
|
||||
|
||||
public function clothing_area_update(Request $request){
|
||||
|
||||
foreach (LanguageHelper::all_languages() as $lang){
|
||||
$this->validate($request,[
|
||||
'home19_clothing_area_section_'.$lang->slug.'_title' => 'nullable',
|
||||
'home19_clothing_area_section_'.$lang->slug.'_subtitle' => 'nullable',
|
||||
'home19_clothing_area_section_'.$lang->slug.'_button_text' => 'nullable',
|
||||
'home19_clothing_area_section_'.$lang->slug.'_button_url' => 'nullable',
|
||||
]);
|
||||
|
||||
$all_fields = [
|
||||
'home19_clothing_area_section_'.$lang->slug.'_title',
|
||||
'home19_clothing_area_section_'.$lang->slug.'_subtitle',
|
||||
'home19_clothing_area_section_'.$lang->slug.'_button_text',
|
||||
'home19_clothing_area_section_'.$lang->slug.'_button_url'
|
||||
];
|
||||
|
||||
foreach ($all_fields as $field){
|
||||
update_static_option($field,$request->$field);
|
||||
}
|
||||
}
|
||||
|
||||
update_static_option('home19_clothing_area_section_left_image',$request->home19_clothing_area_section_left_image);
|
||||
update_static_option('home19_clothing_area_section_right_image',$request->home19_clothing_area_section_right_image);
|
||||
|
||||
return back()->with(NexelitHelpers::item_update());
|
||||
}
|
||||
|
||||
public function popular_area(){
|
||||
$all_products = Products::where(['status' => 'publish','lang' => LanguageHelper::user_lang_slug()])->get();
|
||||
return view(self::BASE_PATH.'popular-area')->with(['all_languages' => LanguageHelper::all_languages(), 'all_products'=> $all_products]);
|
||||
}
|
||||
|
||||
public function popular_area_update(Request $request){
|
||||
|
||||
foreach (LanguageHelper::all_languages() as $lang){
|
||||
|
||||
$this->validate($request,[
|
||||
'home_page_19_'.$lang->slug.'_popular_area_title' => 'nullable',
|
||||
'home_page_19_'.$lang->slug.'_popular_area_products' => 'nullable',
|
||||
]);
|
||||
|
||||
$products = 'home_page_19_'.$lang->slug.'_popular_area_products';
|
||||
|
||||
$all_fields = [
|
||||
'home_page_19_'.$lang->slug.'_popular_area_title' ,
|
||||
];
|
||||
|
||||
foreach ($all_fields as $field){
|
||||
update_static_option($field,$request->$field);
|
||||
}
|
||||
|
||||
update_static_option($products,json_encode($request->$products));
|
||||
}
|
||||
return back()->with(NexelitHelpers::item_update());
|
||||
}
|
||||
|
||||
public function instagram_area(){
|
||||
$all_products = Products::where(['status' => 'publish','lang' => LanguageHelper::user_lang_slug()])->get();
|
||||
return view(self::BASE_PATH.'instagram-area')->with(['all_languages' => LanguageHelper::all_languages(), 'all_products'=> $all_products]);
|
||||
}
|
||||
|
||||
public function instagram_area_update(Request $request)
|
||||
{
|
||||
|
||||
foreach (LanguageHelper::all_languages() as $lang){
|
||||
|
||||
$this->validate($request,[
|
||||
'home_page_19_'.$lang->slug.'_instagram_area_title' => 'nullable',
|
||||
'home_page_19_instagram_area_item_show' => 'nullable',
|
||||
]);
|
||||
|
||||
$all_fields = [
|
||||
'home_page_19_'.$lang->slug.'_instagram_area_title',
|
||||
];
|
||||
|
||||
foreach ($all_fields as $field){
|
||||
update_static_option($field,$request->$field);
|
||||
}
|
||||
|
||||
}
|
||||
update_static_option('home_page_19_instagram_area_item_show',$request->home_page_19_instagram_area_item_show);
|
||||
|
||||
return back()->with(NexelitHelpers::item_update());
|
||||
}
|
||||
|
||||
|
||||
public function promo_area(){
|
||||
return view(self::BASE_PATH.'promo-area')->with(['all_languages' => LanguageHelper::all_languages()]);
|
||||
}
|
||||
|
||||
public function promo_area_update(Request $request){
|
||||
|
||||
foreach (LanguageHelper::all_languages() as $lang){
|
||||
$this->validate($request,[
|
||||
'home_19_promo_section_'.$lang->slug.'_title' => 'nullable|array',
|
||||
'home_19_promo_section_'.$lang->slug.'_subtitle' => 'nullable|array',
|
||||
'home_19_promo_section_'.$lang->slug.'_title_url' => 'required|array',
|
||||
|
||||
'home19_promo_section_icon' => 'array|required',
|
||||
'home19_promo_section_icon.*' => 'string|required',
|
||||
]);
|
||||
|
||||
//save repeater values
|
||||
$all_fields = [
|
||||
'home_19_promo_section_'.$lang->slug.'_title',
|
||||
'home_19_promo_section_'.$lang->slug.'_subtitle',
|
||||
'home_19_promo_section_'.$lang->slug.'_title_url',
|
||||
'home19_promo_section_icon',
|
||||
];
|
||||
|
||||
foreach ($all_fields as $field){
|
||||
$value = $request->$field ?? [];
|
||||
update_static_option($field,serialize($value));
|
||||
}
|
||||
}
|
||||
return back()->with(NexelitHelpers::item_update());
|
||||
}
|
||||
|
||||
public function product_by_lang(Request $request){
|
||||
|
||||
$categories = Products::where(['lang' => $request->lang,'status' => 'publish'])->get();
|
||||
return response()->json(['categories' => $categories,'selected' => json_decode(get_static_option($request->staticName))]);
|
||||
}
|
||||
|
||||
public function product_category_by_lang(Request $request){
|
||||
|
||||
$categories = ProductCategory::where(['lang' => $request->lang,'status' => 'publish'])->get();
|
||||
return response()->json(['categories' => $categories,'selected' => json_decode(get_static_option($request->staticName))]);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Helpers\LanguageHelper;
|
||||
use App\Helpers\NexelitHelpers;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Traits\EmailTemplateHelperTrait;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class JobApplicantEmailTemplateController extends Controller
|
||||
{
|
||||
use EmailTemplateHelperTrait;
|
||||
const BASE_PATH = 'backend.email-template.job.';
|
||||
|
||||
public function job_application_admin(){
|
||||
return view(self::BASE_PATH.'admin-mail')->with(['all_languages' => LanguageHelper::all_languages()]);
|
||||
}
|
||||
public function job_application_user(){
|
||||
return view(self::BASE_PATH.'user-mail')->with(['all_languages' => LanguageHelper::all_languages()]);
|
||||
}
|
||||
|
||||
public function update_job_application_admin(Request $request){
|
||||
$this->save_data('job_admin_mail_',$request);
|
||||
|
||||
return back()->with(NexelitHelpers::settings_update());
|
||||
}
|
||||
public function update_job_application_user(Request $request){
|
||||
$this->save_data('job_user_mail_',$request);
|
||||
|
||||
return back()->with(NexelitHelpers::settings_update());
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Kyc;
|
||||
|
||||
class KycApprovalController extends Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth:admin');
|
||||
}
|
||||
public function index() {
|
||||
$kycs = Kyc::latest()->paginate(10);
|
||||
return view('backend.pages.kyc.index', compact('kycs'));
|
||||
}
|
||||
|
||||
public function show($id) {
|
||||
$kyc = Kyc::findOrFail($id);
|
||||
return view('backend.pages.kyc.show', compact('kyc'));
|
||||
}
|
||||
|
||||
public function approve($id) {
|
||||
$kyc = Kyc::findOrFail($id);
|
||||
$kyc->update(['status' => 'approved']);
|
||||
return redirect()->route('admin.kyc.index')->with(['msg' => 'KYC disetujui', 'type' => 'success']);
|
||||
}
|
||||
|
||||
public function reject($id) {
|
||||
$kyc = Kyc::findOrFail($id);
|
||||
$kyc->update(['status' => 'rejected']);
|
||||
return redirect()->route('admin.kyc.index')->with(['msg' => 'KYC ditolak', 'type' => 'danger']);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin\Launchpad;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\LaunchpadProject;
|
||||
use App\Models\LaunchpadPresale;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class LaunchpadPresaleController extends Controller
|
||||
{
|
||||
public function create($project_id)
|
||||
{
|
||||
$project = LaunchpadProject::findOrFail($project_id);
|
||||
return view('backend.pages.launchpad.presale_create', compact('project'));
|
||||
}
|
||||
|
||||
public function store(Request $request, $project_id)
|
||||
{
|
||||
$request->validate([
|
||||
'start_time' => 'required|date',
|
||||
'end_time' => 'required|date|after:start_time',
|
||||
'rate_per_token' => 'required|numeric',
|
||||
'soft_cap' => 'required|numeric',
|
||||
'hard_cap' => 'required|numeric',
|
||||
'liquidity_lockup' => 'required'
|
||||
]);
|
||||
|
||||
LaunchpadPresale::create(array_merge($request->all(), ['project_id' => $project_id]));
|
||||
|
||||
return back()->with(['msg' => 'Presale created', 'type' => 'success']);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin\Launchpad;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\LaunchpadProject;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class LaunchpadProjectController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$projects = LaunchpadProject::latest()->paginate(10);
|
||||
return view('backend.pages.launchpad.index', compact('projects'));
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
return view('backend.pages.launchpad.create');
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$data = $request->validate([
|
||||
'name' => 'required', 'symbol' => 'required',
|
||||
'slug' => 'required|unique:launchpad_projects',
|
||||
'contract_address' => 'required',
|
||||
'total_supply' => 'required',
|
||||
'website' => 'nullable', 'telegram' => 'nullable',
|
||||
'twitter' => 'nullable', 'banner_url' => 'nullable',
|
||||
'status' => 'required'
|
||||
]);
|
||||
|
||||
LaunchpadProject::create($data);
|
||||
return redirect()->route('admin.launchpad.index')->with(['msg' => 'Project created', 'type' => 'success']);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin\Launchpad;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\LaunchpadProject;
|
||||
use App\Models\LaunchpadTokenomic;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class LaunchpadTokenomicController extends Controller
|
||||
{
|
||||
public function create($project_id)
|
||||
{
|
||||
$project = LaunchpadProject::findOrFail($project_id);
|
||||
$items = LaunchpadTokenomic::where('project_id', $project_id)->get();
|
||||
return view('backend.pages.launchpad.tokenomic_create', compact('project', 'items'));
|
||||
}
|
||||
|
||||
public function store(Request $request, $project_id)
|
||||
{
|
||||
$request->validate([
|
||||
'label' => 'required',
|
||||
'percentage' => 'required|numeric|min:0|max:100'
|
||||
]);
|
||||
|
||||
LaunchpadTokenomic::create([
|
||||
'project_id' => $project_id,
|
||||
'label' => $request->label,
|
||||
'percentage' => $request->percentage
|
||||
]);
|
||||
|
||||
return back()->with(['msg' => 'Tokenomic added', 'type' => 'success']);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,220 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\BlogCategory;
|
||||
use App\Helpers\LanguageHelper;
|
||||
use App\Helpers\NexelitHelpers;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class NewspaperHomePageManageController extends Controller
|
||||
{
|
||||
const BASE_PATH = 'backend.pages.home.newspaper.';
|
||||
public function __construct() {
|
||||
$this->middleware('auth:admin');
|
||||
}
|
||||
public function header_area(){
|
||||
$all_languages = LanguageHelper::all_languages();
|
||||
return view(self::BASE_PATH.'header-area',compact('all_languages'));
|
||||
}
|
||||
public function breaking_news_area(){
|
||||
$all_languages = LanguageHelper::all_languages();
|
||||
return view(self::BASE_PATH.'breaking-news',compact('all_languages'));
|
||||
}
|
||||
public function advertisement_area(){
|
||||
$all_languages = LanguageHelper::all_languages();
|
||||
return view(self::BASE_PATH.'advertisement-area',compact('all_languages'));
|
||||
}
|
||||
public function popular_area(){
|
||||
$all_languages = LanguageHelper::all_languages();
|
||||
return view(self::BASE_PATH.'popular-news',compact('all_languages'));
|
||||
}
|
||||
public function video_area(){
|
||||
$all_languages = LanguageHelper::all_languages();
|
||||
return view(self::BASE_PATH.'video-area',compact('all_languages'));
|
||||
}
|
||||
public function sports_area(){
|
||||
$all_languages = LanguageHelper::all_languages();
|
||||
return view(self::BASE_PATH.'sports-news',compact('all_languages'));
|
||||
}
|
||||
public function hot_area(){
|
||||
$all_languages = LanguageHelper::all_languages();
|
||||
return view(self::BASE_PATH.'hot-news',compact('all_languages'));
|
||||
}
|
||||
|
||||
public function hot_area_update(Request $request){
|
||||
foreach (LanguageHelper::all_languages() as $lang){
|
||||
$this->validate($request,[
|
||||
'home20_hot_news_section_'.$lang->slug.'_section_title' => 'nullable|string',
|
||||
'home20_hot_news_section_'.$lang->slug.'_categories' => 'nullable|array',
|
||||
]);
|
||||
|
||||
$field_list = [
|
||||
'home20_hot_news_section_'.$lang->slug.'_section_title',
|
||||
];
|
||||
|
||||
foreach ($field_list as $field){
|
||||
update_static_option($field,$request->$field);
|
||||
}
|
||||
|
||||
$field_list = [
|
||||
'home20_hot_news_section_'.$lang->slug.'_categories',
|
||||
];
|
||||
|
||||
foreach ($field_list as $field){
|
||||
update_static_option($field, json_encode($request->$field));
|
||||
}
|
||||
}
|
||||
|
||||
update_static_option('home20_hot_news_section_items',$request->home20_hot_news_section_items);
|
||||
|
||||
return back()->with(NexelitHelpers::item_update());
|
||||
}
|
||||
|
||||
|
||||
public function sports_area_update(Request $request){
|
||||
foreach (LanguageHelper::all_languages() as $lang){
|
||||
$this->validate($request,[
|
||||
'home20_sports_news_section_'.$lang->slug.'_section_title' => 'nullable|string',
|
||||
'home20_sports_news_section_'.$lang->slug.'_categories' => 'nullable|array',
|
||||
]);
|
||||
|
||||
$field_list = [
|
||||
'home20_sports_news_section_'.$lang->slug.'_section_title',
|
||||
];
|
||||
|
||||
foreach ($field_list as $field){
|
||||
update_static_option($field,$request->$field);
|
||||
}
|
||||
|
||||
$field_list = [
|
||||
'home20_sports_news_section_'.$lang->slug.'_categories',
|
||||
];
|
||||
|
||||
foreach ($field_list as $field){
|
||||
update_static_option($field, json_encode($request->$field));
|
||||
}
|
||||
}
|
||||
|
||||
update_static_option('home20_sports_news_section_items',$request->home20_sports_news_section_items);
|
||||
|
||||
return back()->with(NexelitHelpers::item_update());
|
||||
}
|
||||
|
||||
public function blog_category_by_lang(Request $request){
|
||||
$categories = BlogCategory::where(['lang' => $request->lang,'status' => 'publish'])->get();
|
||||
return response()->json(['categories' => $categories,'selected' => json_decode(get_static_option($request->staticName))]);
|
||||
}
|
||||
|
||||
public function video_area_update(Request $request){
|
||||
foreach (LanguageHelper::all_languages() as $lang){
|
||||
$this->validate($request,[
|
||||
'home20_video_news_section_'.$lang->slug.'_section_title' => 'nullable|string',
|
||||
]);
|
||||
|
||||
$field_list = [
|
||||
'home20_video_news_section_'.$lang->slug.'_section_title',
|
||||
];
|
||||
|
||||
foreach ($field_list as $field){
|
||||
update_static_option($field,$request->$field);
|
||||
}
|
||||
}
|
||||
|
||||
update_static_option('home20_video_news_section_items',$request->home20_video_news_section_items);
|
||||
|
||||
return back()->with(NexelitHelpers::item_update());
|
||||
}
|
||||
|
||||
public function advertisement_area_update(Request $request){
|
||||
|
||||
$request->validate([
|
||||
'home_page_newspaper_advertisement_type'=> 'required',
|
||||
'home_page_newspaper_advertisement_size'=> 'required',
|
||||
'home_page_newspaper_advertisement_type_bottom'=> 'required',
|
||||
'home_page_newspaper_advertisement_size_bottom'=> 'required',
|
||||
]);
|
||||
|
||||
update_static_option('home_page_newspaper_advertisement_type',$request->home_page_newspaper_advertisement_type);
|
||||
update_static_option('home_page_newspaper_advertisement_size',$request->home_page_newspaper_advertisement_size);
|
||||
update_static_option('home_page_newspaper_advertisement_type_bottom',$request->home_page_newspaper_advertisement_type_bottom);
|
||||
update_static_option('home_page_newspaper_advertisement_size_bottom',$request->home_page_newspaper_advertisement_size_bottom);
|
||||
|
||||
return back()->with(NexelitHelpers::item_update());
|
||||
}
|
||||
|
||||
public function popular_area_update(Request $request){
|
||||
foreach (LanguageHelper::all_languages() as $lang){
|
||||
$this->validate($request,[
|
||||
'home20_popular_news_section_'.$lang->slug.'_section_title' => 'nullable|string',
|
||||
'home20_popular_news_section_'.$lang->slug.'_categories' => 'nullable|array',
|
||||
]);
|
||||
|
||||
$field_list = [
|
||||
'home20_popular_news_section_'.$lang->slug.'_section_title',
|
||||
];
|
||||
|
||||
foreach ($field_list as $field){
|
||||
update_static_option($field,$request->$field);
|
||||
}
|
||||
|
||||
$field_list = [
|
||||
'home20_popular_news_section_'.$lang->slug.'_categories',
|
||||
];
|
||||
|
||||
foreach ($field_list as $field){
|
||||
update_static_option($field, json_encode($request->$field));
|
||||
}
|
||||
}
|
||||
|
||||
update_static_option('home20_popular_news_section_items',$request->home20_popular_news_section_items);
|
||||
|
||||
return back()->with(NexelitHelpers::item_update());
|
||||
}
|
||||
|
||||
public function breaking_news_area_update(Request $request){
|
||||
|
||||
//todo save langauge wise data
|
||||
foreach (LanguageHelper::all_languages() as $lang){
|
||||
$this->validate($request,[
|
||||
'home_20_breaking_news_section_'.$lang->slug.'_title' => 'nullable|string',
|
||||
]);
|
||||
|
||||
$field_list = [
|
||||
'home_20_breaking_news_section_'.$lang->slug.'_title',
|
||||
];
|
||||
|
||||
foreach ($field_list as $field){
|
||||
update_static_option($field,$request->$field);
|
||||
}
|
||||
}
|
||||
|
||||
return back()->with(NexelitHelpers::item_update());
|
||||
}
|
||||
|
||||
public function header_area_update(Request $request){
|
||||
|
||||
$this->validate($request,[
|
||||
'home20_header_section_items' => 'required|integer'
|
||||
]);
|
||||
|
||||
foreach (LanguageHelper::all_languages() as $lang){
|
||||
$this->validate($request,[
|
||||
'home_20_header_section_'.$lang->slug.'_readmore_text' => 'nullable|string',
|
||||
]);
|
||||
|
||||
$field_list = [
|
||||
'home_20_header_section_'.$lang->slug.'_readmore_text',
|
||||
];
|
||||
|
||||
foreach ($field_list as $field){
|
||||
update_static_option($field,$request->$field);
|
||||
}
|
||||
}
|
||||
|
||||
update_static_option('home20_header_section_items',$request->home20_header_section_items);
|
||||
|
||||
return back()->with(NexelitHelpers::item_update());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Helpers\LanguageHelper;
|
||||
use App\Helpers\NexelitHelpers;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Traits\EmailTemplateHelperTrait;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class PackageOrderEmailTemplateController extends Controller
|
||||
{
|
||||
|
||||
use EmailTemplateHelperTrait;
|
||||
const BASE_PATH = 'backend.email-template.package-order.';
|
||||
|
||||
public function package_order_status_change(){
|
||||
return view(self::BASE_PATH.'status-change')->with(['all_languages' => LanguageHelper::all_languages()]);
|
||||
}
|
||||
public function package_order_admin(){
|
||||
return view(self::BASE_PATH.'admin-mail')->with(['all_languages' => LanguageHelper::all_languages()]);
|
||||
}
|
||||
public function package_order_user(){
|
||||
return view(self::BASE_PATH.'user-mail')->with(['all_languages' => LanguageHelper::all_languages()]);
|
||||
}
|
||||
public function package_order_payment_accept(){
|
||||
return view(self::BASE_PATH.'payment-accept')->with(['all_languages' => LanguageHelper::all_languages()]);
|
||||
}
|
||||
public function package_order_reminder_mail(){
|
||||
return view(self::BASE_PATH.'reminder-mail')->with(['all_languages' => LanguageHelper::all_languages()]);
|
||||
}
|
||||
public function update_package_order_reminder_mail(Request $request){
|
||||
$this->save_data('package_order_reminder_mail_',$request);
|
||||
return back()->with(NexelitHelpers::settings_update());
|
||||
}
|
||||
public function update_package_order_payment_accept(Request $request){
|
||||
$this->save_data('package_order_payment_accept_',$request);
|
||||
return back()->with(NexelitHelpers::settings_update());
|
||||
}
|
||||
public function update_package_order_status_change(Request $request){
|
||||
$this->save_data('package_order_status_change_',$request);
|
||||
return back()->with(NexelitHelpers::settings_update());
|
||||
}
|
||||
public function update_package_order_user(Request $request){
|
||||
$this->save_data('package_order_user_mail_',$request);
|
||||
return back()->with(NexelitHelpers::settings_update());
|
||||
}
|
||||
public function update_package_order_admin(Request $request){
|
||||
$this->save_data('package_order_admin_mail_',$request);
|
||||
return back()->with(NexelitHelpers::settings_update());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,131 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Helpers\NexelitHelpers;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Page;
|
||||
use App\PageBuilder;
|
||||
use App\PageBuilder\PageBuilderSetup;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class PageBuilderController extends Controller
|
||||
{
|
||||
const BASE_PATH = 'backend.page-builder.';
|
||||
|
||||
public function homepage_builder(){
|
||||
return view(self::BASE_PATH.'homepage');
|
||||
}
|
||||
|
||||
public function aboutpage_builder(){
|
||||
return view(self::BASE_PATH.'aboutpage');
|
||||
}
|
||||
public function contactpage_builder(){
|
||||
return view(self::BASE_PATH.'contactpage');
|
||||
}
|
||||
public function dynamicpage_builder($type,$id){
|
||||
if (empty($type) || empty($id)){
|
||||
abort(404);
|
||||
}
|
||||
$page = Page::findOrFail($id);
|
||||
return view(self::BASE_PATH.'dynamicpage',compact('id','type','page'));
|
||||
}
|
||||
|
||||
public function update_aboutpage_builder(Request $request){
|
||||
$this->validate($request,[
|
||||
'about_page_page_builder_status' => 'nullable|string|max:191'
|
||||
]);
|
||||
update_static_option('about_page_page_builder_status',$request->about_page_page_builder_status);
|
||||
return back()->with(NexelitHelpers::settings_update());
|
||||
}
|
||||
public function update_contactpage_builder(Request $request){
|
||||
$this->validate($request,[
|
||||
'contact_page_page_builder_status' => 'nullable|string|max:191'
|
||||
]);
|
||||
update_static_option('contact_page_page_builder_status',$request->contact_page_page_builder_status);
|
||||
return back()->with(NexelitHelpers::settings_update());
|
||||
}
|
||||
public function update_homepage_builder(Request $request){
|
||||
$this->validate($request,[
|
||||
'home_page_page_builder_status' => 'nullable|string|max:191'
|
||||
]);
|
||||
update_static_option('home_page_page_builder_status',$request->home_page_page_builder_status);
|
||||
return back()->with(NexelitHelpers::settings_update());
|
||||
}
|
||||
|
||||
public function get_admin_panel_addon_markup(Request $request){
|
||||
$output = PageBuilderSetup::render_widgets_by_name_for_admin([
|
||||
'name' => $request->addon_class,
|
||||
'namespace' => base64_decode( $request->addon_namespace),
|
||||
'type' => 'new',
|
||||
'page_id' => $request->addon_page_id ?? '',
|
||||
'page_type' => $request->addon_page_type ?? '',
|
||||
'location' => $request->addon_location ?? '',
|
||||
'after' => false,
|
||||
'before' => false,
|
||||
]);
|
||||
return $output;
|
||||
}
|
||||
|
||||
public function store_new_addon_content(Request $request){
|
||||
$this->validate($request,[
|
||||
'addon_name' => 'required',
|
||||
'addon_namespace' => 'required',
|
||||
'addon_order' => 'nullable',
|
||||
'addon_location' => 'required',
|
||||
]);
|
||||
|
||||
unset($request['_token']);
|
||||
$widget_content = (array) $request->all();
|
||||
|
||||
$widget_id = PageBuilder::create([
|
||||
'addon_type' => $request->addon_type,
|
||||
'addon_location' => $request->addon_location,
|
||||
'addon_name' => $request->addon_name,
|
||||
'addon_namespace' => base64_decode( $request->addon_namespace),
|
||||
'addon_page_id' => $request->addon_page_id,
|
||||
'addon_order' => $request->addon_order,
|
||||
'addon_page_type' => $request->addon_page_type,
|
||||
'addon_settings' => serialize($widget_content),
|
||||
])->id;
|
||||
$data['id'] = $widget_id;
|
||||
$data['status'] = 'ok';
|
||||
return response()->json($data);
|
||||
}
|
||||
|
||||
public function delete(Request $request){
|
||||
PageBuilder::findOrFail($request->id)->delete();
|
||||
return response()->json('ok');
|
||||
}
|
||||
|
||||
public function update_addon_order(Request $request){
|
||||
PageBuilder::findOrFail($request->id)->update(['addon_order' => $request->addon_order]);
|
||||
return response()->json('ok');
|
||||
}
|
||||
|
||||
public function update_addon_content(Request $request){
|
||||
$this->validate($request,[
|
||||
'addon_name' => 'required',
|
||||
'addon_namespace' => 'required',
|
||||
'addon_order' => 'nullable',
|
||||
'addon_location' => 'required',
|
||||
]);
|
||||
|
||||
unset($request['_token']);
|
||||
$addon_content = (array) $request->all();
|
||||
|
||||
PageBuilder::findOrFail($request->id)->update([
|
||||
'addon_type' => $request->addon_type,
|
||||
'addon_location' => $request->addon_location,
|
||||
'addon_name' => $request->addon_name,
|
||||
'addon_namespace' => base64_decode($request->addon_namespace),
|
||||
'addon_page_id' => $request->addon_page_id,
|
||||
'addon_order' => $request->addon_order,
|
||||
'addon_page_type' => $request->addon_page_type,
|
||||
'addon_settings' => serialize($addon_content),
|
||||
]);
|
||||
|
||||
return response()->json('ok');
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\PresaleSchedule;
|
||||
|
||||
class PresaleController extends Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth:admin');
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$schedules = PresaleSchedule::orderBy('start_date')->get();
|
||||
return view('backend.pages.token.presale', compact('schedules'));
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
'phase' => 'required|string',
|
||||
'start_date' => 'required|date',
|
||||
'end_date' => 'required|date|after_or_equal:start_date',
|
||||
'price_per_token' => 'required|numeric',
|
||||
'quota' => 'required|integer',
|
||||
]);
|
||||
|
||||
PresaleSchedule::create($request->all());
|
||||
return back()->with(['msg' => 'Jadwal presale ditambahkan', 'type' => 'success']);
|
||||
}
|
||||
|
||||
public function destroy($id)
|
||||
{
|
||||
PresaleSchedule::findOrFail($id)->delete();
|
||||
return back()->with(['msg' => 'Jadwal presale dihapus', 'type' => 'danger']);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Helpers\LanguageHelper;
|
||||
use App\Helpers\NexelitHelpers;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Traits\EmailTemplateHelperTrait;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ProductEmailTemplateController extends Controller
|
||||
{
|
||||
use EmailTemplateHelperTrait;
|
||||
const BASE_PATH = 'backend.email-template.products.';
|
||||
|
||||
public function product_order_status_change_mail(){
|
||||
return view(self::BASE_PATH.'order-status-change')->with(['all_languages' => LanguageHelper::all_languages()]);
|
||||
}
|
||||
public function update_product_order_status_change_mail(Request $request){
|
||||
$this->save_data('product_order_status_change_mail_',$request);
|
||||
return back()->with(NexelitHelpers::settings_update());
|
||||
}
|
||||
|
||||
public function product_order_mail_payment_accept(){
|
||||
return view(self::BASE_PATH.'order-payment-accept')->with(['all_languages' => LanguageHelper::all_languages()]);
|
||||
}
|
||||
public function update_product_order_mail_payment_accept(Request $request){
|
||||
$this->save_data('product_order_payment_accept_mail_',$request);
|
||||
return back()->with(NexelitHelpers::settings_update());
|
||||
}
|
||||
|
||||
public function product_order_mail_reminder_mail(){
|
||||
return view(self::BASE_PATH.'order-reminder-mail')->with(['all_languages' => LanguageHelper::all_languages()]);
|
||||
}
|
||||
public function update_product_order_mail_reminder_mail(Request $request){
|
||||
$this->save_data('product_order_reminder_mail_',$request);
|
||||
return back()->with(NexelitHelpers::settings_update());
|
||||
}
|
||||
|
||||
public function product_order_mail_admin(){
|
||||
return view(self::BASE_PATH.'order-mail-admin')->with(['all_languages' => LanguageHelper::all_languages()]);
|
||||
}
|
||||
public function update_product_order_mail_admin(Request $request){
|
||||
$this->save_data('product_order_admin_mail_',$request);
|
||||
return back()->with(NexelitHelpers::settings_update());
|
||||
}
|
||||
|
||||
public function product_order_mail_user(){
|
||||
return view(self::BASE_PATH.'order-mail-user')->with(['all_languages' => LanguageHelper::all_languages()]);
|
||||
}
|
||||
public function update_product_order_mail_user(Request $request){
|
||||
$this->save_data('product_order_user_mail_',$request);
|
||||
return back()->with(NexelitHelpers::settings_update());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Roadmap;
|
||||
|
||||
class RoadmapController extends Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth:admin');
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$items = Roadmap::orderBy('milestone_date')->get();
|
||||
return view('backend.pages.token.roadmap', compact('items'));
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
'title' => 'required',
|
||||
'milestone_date' => 'required|date'
|
||||
]);
|
||||
|
||||
Roadmap::create($request->only('title', 'description', 'milestone_date'));
|
||||
return back()->with(['msg' => 'Roadmap ditambahkan', 'type' => 'success']);
|
||||
}
|
||||
|
||||
public function destroy($id)
|
||||
{
|
||||
Roadmap::findOrFail($id)->delete();
|
||||
return back()->with(['msg' => 'Roadmap dihapus', 'type' => 'danger']);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use Spatie\Permission\Models\Role;
|
||||
use Spatie\Permission\Models\Permission;
|
||||
|
||||
class RolePermissionController extends Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth:admin');
|
||||
}
|
||||
public function index()
|
||||
{
|
||||
$roles = Role::with('permissions')->get();
|
||||
$permissions = Permission::all();
|
||||
return view('backend.pages.role-permission.index', compact('roles', 'permissions'));
|
||||
}
|
||||
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
$role = Role::findOrFail($id);
|
||||
$role->syncPermissions($request->permissions ?? []);
|
||||
return back()->with(['msg' => 'Permission untuk role diperbarui', 'type' => 'success']);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Helpers\LanguageHelper;
|
||||
use App\Helpers\NexelitHelpers;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\SupportDepartment;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class SupportDepartmentController extends Controller
|
||||
{
|
||||
|
||||
|
||||
public function category(){
|
||||
$all_category = SupportDepartment::all()->groupBy('lang');
|
||||
$all_language = LanguageHelper::all_languages();
|
||||
return view('backend.support-ticket.support-ticket-category.category')->with([
|
||||
'all_category' => $all_category,
|
||||
'all_languages' => $all_language
|
||||
]);
|
||||
}
|
||||
public function new_category(Request $request){
|
||||
$this->validate($request,[
|
||||
'name' => 'required|string|max:191|unique:support_departments',
|
||||
'lang' => 'required|string|max:191',
|
||||
'status' => 'required|string|max:191'
|
||||
]);
|
||||
|
||||
SupportDepartment::create($request->all());
|
||||
|
||||
return redirect()->back()->with(NexelitHelpers::item_new());
|
||||
}
|
||||
|
||||
public function update(Request $request){
|
||||
$this->validate($request,[
|
||||
'name' => 'required|string|max:191|unique:support_departments,id,'.$request->id,
|
||||
'lang' => 'required|string|max:191',
|
||||
'status' => 'required|string|max:191'
|
||||
]);
|
||||
|
||||
SupportDepartment::find($request->id)->update([
|
||||
'name' => $request->name,
|
||||
'status' => $request->status,
|
||||
'lang' => $request->lang,
|
||||
]);
|
||||
|
||||
return redirect()->back()->with(NexelitHelpers::item_update());
|
||||
}
|
||||
|
||||
public function delete(Request $request,$id){
|
||||
SupportDepartment::find($id)->delete();
|
||||
return redirect()->back()->with(NexelitHelpers::item_delete());
|
||||
}
|
||||
public function bulk_action(Request $request){
|
||||
SupportDepartment::whereIn('id',$request->ids)->delete();
|
||||
return response()->json(['status' => 'ok']);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,64 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use Intervention\Image\Facades\Image;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class TokenPageOptionController extends Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth:admin');
|
||||
}
|
||||
|
||||
public function editPerusahaan() {
|
||||
return view('backend.pages.token-page.perusahaan');
|
||||
}
|
||||
|
||||
public function updatePerusahaan(Request $request) {
|
||||
update_static_option('token_page_perusahaan_banner_title', $request->banner_title);
|
||||
update_static_option('token_page_perusahaan_banner_subtitle', $request->banner_subtitle);
|
||||
update_static_option('token_page_perusahaan_banner_image', $request->banner_image);
|
||||
update_static_option('token_page_perusahaan_content_body', $request->content_body);
|
||||
return back()->with(['msg' => 'Halaman Perusahaan diperbarui', 'type' => 'success']);
|
||||
}
|
||||
|
||||
public function editPengembang() {
|
||||
return view('backend.pages.token-page.pengembang');
|
||||
}
|
||||
|
||||
public function updatePengembang(Request $request) {
|
||||
update_static_option('token_page_pengembang_banner_title', $request->banner_title);
|
||||
update_static_option('token_page_pengembang_banner_subtitle', $request->banner_subtitle);
|
||||
update_static_option('token_page_pengembang_banner_image', $request->banner_image);
|
||||
update_static_option('token_page_pengembang_content_body', $request->content_body);
|
||||
return back()->with(['msg' => 'Halaman Pengembang diperbarui', 'type' => 'success']);
|
||||
}
|
||||
|
||||
public function editHukum() {
|
||||
return view('backend.pages.token-page.hukum');
|
||||
}
|
||||
|
||||
public function updateHukum(Request $request) {
|
||||
update_static_option('token_page_hukum-privasi_banner_title', $request->banner_title);
|
||||
update_static_option('token_page_hukum-privasi_banner_subtitle', $request->banner_subtitle);
|
||||
update_static_option('token_page_hukum-privasi_banner_image', $request->banner_image);
|
||||
update_static_option('token_page_hukum-privasi_content_body', $request->content_body);
|
||||
return back()->with(['msg' => 'Halaman Hukum & Privasi diperbarui', 'type' => 'success']);
|
||||
}
|
||||
|
||||
public function editKontak() {
|
||||
return view('backend.pages.token-page.kontak');
|
||||
}
|
||||
|
||||
public function updateKontak(Request $request) {
|
||||
update_static_option('token_page_hubungi-kami_banner_title', $request->banner_title);
|
||||
update_static_option('token_page_hubungi-kami_banner_subtitle', $request->banner_subtitle);
|
||||
update_static_option('token_page_hubungi-kami_banner_image', $request->banner_image);
|
||||
update_static_option('token_page_hubungi-kami_content_body', $request->content_body);
|
||||
return back()->with(['msg' => 'Halaman Hubungi Kami diperbarui', 'type' => 'success']);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Tokenomics;
|
||||
|
||||
class TokenomicsController extends Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth:admin');
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$items = Tokenomics::all();
|
||||
return view('backend.pages.token.tokenomics', compact('items'));
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
'label' => 'required',
|
||||
'allocation_percent' => 'required|numeric',
|
||||
]);
|
||||
|
||||
Tokenomics::create($request->only('label', 'allocation_percent', 'description'));
|
||||
return back()->with(['msg' => 'Tokenomics berhasil ditambahkan', 'type' => 'success']);
|
||||
}
|
||||
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
$item = Tokenomics::findOrFail($id);
|
||||
$item->update($request->only('label', 'allocation_percent', 'description'));
|
||||
return back()->with(['msg' => 'Tokenomics berhasil diperbarui', 'type' => 'success']);
|
||||
}
|
||||
|
||||
public function destroy($id)
|
||||
{
|
||||
Tokenomics::findOrFail($id)->delete();
|
||||
return back()->with(['msg' => 'Tokenomics berhasil dihapus', 'type' => 'danger']);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\User;
|
||||
use Spatie\Permission\Models\Role;
|
||||
use Spatie\Permission\Models\Permission;
|
||||
|
||||
class UserRoleController extends Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth:admin');
|
||||
}
|
||||
public function index()
|
||||
{
|
||||
$users = User::with('roles', 'permissions')->get();
|
||||
$roles = Role::all();
|
||||
$permissions = Permission::all();
|
||||
return view('backend.pages.user.role', compact('users', 'roles', 'permissions'));
|
||||
}
|
||||
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
$user = User::findOrFail($id);
|
||||
$user->syncRoles($request->roles ?? []);
|
||||
$user->syncPermissions($request->permissions ?? []);
|
||||
return back()->with(['msg' => 'Role & permission pengguna diperbarui', 'type' => 'success']);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,82 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Helpers\LanguageHelper;
|
||||
use App\Helpers\NexelitHelpers;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\VideoGallery;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class VideoGalleryController extends Controller
|
||||
{
|
||||
const BASE_PATH = 'backend.video-gallery.';
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth:admin');
|
||||
}
|
||||
|
||||
public function index(){
|
||||
$all_gallery = VideoGallery::all();
|
||||
return view(self::BASE_PATH.'video-gallery',compact('all_gallery'));
|
||||
}
|
||||
|
||||
public function store(Request $request){
|
||||
$this->validate($request,[
|
||||
'title' => 'nullable|string',
|
||||
'embed_code' => 'required|string',
|
||||
'status' => 'required|string',
|
||||
]);
|
||||
VideoGallery::create([
|
||||
'title' => $request->title,
|
||||
'embed_code' => $request->embed_code,
|
||||
'status' => $request->status
|
||||
]);
|
||||
return redirect()->back()->with(NexelitHelpers::item_new());
|
||||
}
|
||||
public function update(Request $request){
|
||||
$this->validate($request,[
|
||||
'title' => 'nullable|string',
|
||||
'embed_code' => 'required|string',
|
||||
'status' => 'required|string',
|
||||
]);
|
||||
VideoGallery::find($request->id)->update([
|
||||
'title' => $request->title,
|
||||
'embed_code' => $request->embed_code,
|
||||
'status' => $request->status
|
||||
]);
|
||||
return redirect()->back()->with(NexelitHelpers::item_update());
|
||||
}
|
||||
public function delete(Request $request,$id){
|
||||
VideoGallery::find($id)->delete();
|
||||
return redirect()->back()->with(NexelitHelpers::item_delete());
|
||||
}
|
||||
|
||||
public function bulk_action(Request $request){
|
||||
VideoGallery::whereIn('id',$request->ids)->delete();
|
||||
return response()->json(['status' => 'ok']);
|
||||
}
|
||||
|
||||
public function page_settings(){
|
||||
return view(self::BASE_PATH.'video-gallery-page-settings')->with(['all_languages' => LanguageHelper::all_languages()]);
|
||||
}
|
||||
|
||||
public function update_page_settings(Request $request){
|
||||
$this->validate($request,[
|
||||
'site_video_gallery_post_items' => 'required',
|
||||
'site_video_gallery_order' => 'required',
|
||||
'site_video_gallery_order_by' => 'required',
|
||||
]);
|
||||
$all_fields = [
|
||||
'site_video_gallery_post_items',
|
||||
'site_video_gallery_order',
|
||||
'site_video_gallery_order_by'
|
||||
];
|
||||
|
||||
foreach ($all_fields as $field){
|
||||
update_static_option($field,$request->$field);
|
||||
}
|
||||
|
||||
return redirect()->back()->with(['msg' => __('Settings Updated...'),'type' => 'success']);
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue