<?php
namespace App\Http\Controllers\API;


use Illuminate\Http\Request;
use App\Http\Controllers\API\BaseController as BaseController;
use App\Suggestiontrackings;
use Validator;
use DB;
use Datatables;
use App\Http\Controllers\Helpers;

class SuggestiontrackingsController extends BaseController
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        //
    }

    /**
     * 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)
    {
        //dd($request->all());
        DB::table('suggestion_trackings')->insert([
        'suggestions_id' => $request['suggestion_id'],
        'keywords' => $request['query'],
        'ip_address' => $request->ip(),
        'created_at' => date('Y-m-d H:i:s'),
        'updated_at' => date('Y-m-d H:i:s')
        ]);

        $last_user_id = DB::getPdo()->lastInsertId();
        //Suggestiontrackings::create($request->all());
        return $this->sendResponse($request['title'], $request['slug']);
    }

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

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

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

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