HEX
Server: Apache/2.4.41 (Ubuntu)
System: Linux ip-172-31-42-149 5.15.0-1084-aws #91~20.04.1-Ubuntu SMP Fri May 2 07:00:04 UTC 2025 aarch64
User: ubuntu (1000)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/vhost/disk-apps/demo-telemedicina.teky.com.co/app/Http/Controllers/AttentionController.php
<?php

namespace Telemedicina\Http\Controllers;

use Illuminate\Http\Request;
use Telemedicina\AttentionType;
Use Session;
Use Redirect;

class AttentionController extends Controller
{
    /**
    * Display a listing of the resource.
    *
    * @return \Illuminate\Http\Response
    */
    public function index()
    {
        $obj = AttentionType::orderBy('name')->paginate(15);
        return view('types_care.main')->with('types_care', $obj);
    }

    /**
    * Show the form for creating a new resource.
    *
    * @return \Illuminate\Http\Response
    */
    public function create()
    {
        //
    }

    /**
    * Store a newly created resource in storage.
    *
    * @param  \Illuminate\Http\Request  $request
    * @return \Illuminate\Http\Response
    */
    public function store(Request $request)
    {
            $obj = new AttentionType;
            $obj->name = $request->name;

            $obj->save();


            Session::flash('data', array('type' => 'success', 'message' => __('messages.attention_type.ok_create')));

            return redirect()->back();
        }

        /**
        * Display the specified resource.
        *
        * @param  int  $id
        * @return \Illuminate\Http\Response
        */
        public function show($id)
        {
            //
        }

        /**
        * Show the form for editing the specified resource.
        *
        * @param  int  $id
        * @return \Illuminate\Http\Response
        */
        public function edit($id)
        {
            $obj = AttentionType::find($id);
            return view('types_care.edit', compact('obj'));
        }

        /**
        * Update the specified resource in storage.
        *
        * @param  \Illuminate\Http\Request  $request
        * @param  int  $id
        * @return \Illuminate\Http\Response
        */
        public function update(Request $request, $id)
        {
                $obj = AttentionType::find($id);
                $obj->name = $request->name;

                $obj->save();

                Session::flash('data', array('type' => 'success', 'message' => __('messages.attention_type.ok_update')));
                return Redirect::to('types_care');
            }

            /**
            * Remove the specified resource from storage.
            *
            * @param  int  $id
            * @return \Illuminate\Http\Response
            */
            public function destroy($id)
            {
                //
            }

            public function active(Request $request){

                $id= $request['id'];
                $estado=  $request['estado'];
                $zhc = AttentionType::where('id', '=',$id)->first();
                $zhc->active = $estado;
                $zhc->update();

                $res[] = array('respuesta' => true);
                $dres = json_encode($res);
                return json_decode($dres, true);

            }
        }