<commit_before><?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

use App\Http\Requests;
use App\Http\Controllers\Controller;

use Auth;
use App\Client;
use App\Quote;
use Input;

class QuoteController extends Controller
{
    /**
     * 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($client_id, Request $request)
    {
        $input = $request->input('form_data');
        $quote = new Quote;
        $client = Client::findOrFail($client_id);

        $quote_count = $client->quotes()->count();

        $quote->client_specific_id = $quote_count + 1;
        $quote->client_id = $client_id;
        $quote->user_id = Auth::user()->id;
        $quote->issue_date = $input['issue_date'];
        $quote->amount = $input['amount'];
        $quote->is_accepted = 0;

        $quote->save();

        return $quote;
    }

    /**
     * Display the specified resource.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function show($id)
    {
        $quote = Quote::findOrFail($id);
        $quote->readable_specific_id = $quote->client_specific_id;
        if ($quote->client_specific_id < 10) {
            $quote->readable_specific_id = sprintf("%02d", $quote->client_specific_id);
        }

        $client = $quote->client;
        $client->client_id = $client->id + 1000;

        return view('app.quote', [
            'client'  => $client,
            'quote' => $quote
        ]);
    }

    /**<commit_msg>redirect to quote details page after create<commit_after><?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

use App\Http\Requests;
use App\Http\Controllers\Controller;

use Auth;
use App\Client;
use App\Quote;
use Input;

class QuoteController extends Controller
{
    /**
     * 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($client_id, Request $request)
    {
        $quote = new Quote;
        $client = Client::findOrFail($client_id);

        $quote_count = $client->quotes()->count();

        $quote->client_specific_id = $quote_count + 1;
        $quote->client_id = $client_id;
        $quote->user_id = Auth::user()->id;
        $quote->issue_date = $request->issue_date;
        $quote->amount = $request->amount;
        $quote->is_accepted = 0;

        $quote->save();

        return redirect()->action('QuoteController@show', [$quote->id]);
    }

    /**
     * Display the specified resource.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function show($id)
    {
        $quote = Quote::findOrFail($id);
        $quote->readable_specific_id = $quote->client_specific_id;
        if ($quote->client_specific_id < 10) {
            $quote->readable_specific_id = sprintf("%02d", $quote->client_specific_id);
        }

        $client = $quote->client;
        $client->client_id = $client->id + 1000;

        return view('app.quote', [
            'client'  => $client,
            'quote' => $quote
        ]);
    }

    /**
{'fraction_non_alphanumeric': 0.1417201540436457, 'fraction_numerical': 0.005134788189987163, 'mean_word_length': 2.092063492063492, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 48, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6802032', 'n_tokens_mistral': 1208, 'n_tokens_neox': 1195, 'n_words': 245}