Anons79 Mini Shell

Directory : /home/aplikasiposinfo/www/pemuda.aplikasipos.info/app/Http/Controllers/
Upload File :
Current File : /home/aplikasiposinfo/www/pemuda.aplikasipos.info/app/Http/Controllers/KalenderController.php

<?php

namespace App\Http\Controllers;

use App\Models\KalenderAgenda;
use Illuminate\Http\Request;

class KalenderController extends Controller
{
    /**
     * Display a listing of the resource.
     */
    public function index(Request $request)
    {
        $data['title'] = "Kalender Agenda";
        if($request->get('kalender')) {
            $tampil = KalenderAgenda::orderBy('id', 'DESC')->get();

            $dataArr = array();
            foreach($tampil as $a) {
                $dataArr[] = array(
                    'id' => $a->id,
                    'title' => $a->title,
                    'start' => $a->start_event,
                    'end' => $a->end_event,
                );
            }

            return json_encode($dataArr);
        } else {
            return view('kalender.index', $data);
        }
    }

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

    /**
     * Store a newly created resource in storage.
     */
    public function store(Request $request)
    {
        $data = new KalenderAgenda;
        $data->title = $request->title;
        $data->start_event = $request->start;
        $data->end_event = $request->end;
        $data->save();
    }

    /**
     * Display the specified resource.
     */
    public function show(string $id)
    {
        //
    }

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

    /**
     * Update the specified resource in storage.
     */
    public function update(Request $request, string $id)
    {
        $data = KalenderAgenda::find($id);
        $data->title = $request->title;
        $data->start_event = $request->start;
        $data->end_event = $request->end;
        $data->save();
    }

    /**
     * Remove the specified resource from storage.
     */
    public function destroy(string $id)
    {
        $agenda = KalenderAgenda::find($id);
        $agenda->delete();
    }
}

Anons79 File Manager Version 1.0, Coded By Anons79
Email: [email protected]