<commit_before><?php

namespace DoeSangue\Http\Controllers;

use DoeSangue\Models\Donor;
use Illuminate\Http\Request;

class DonorController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        $donors = Donor::orderBy('id', 'desc')->get();

        return view('donors.index', compact('donors'));
    }

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

    /**
     * Store a newly created resource in storage.
     *
     * @param \Illuminate\Http\Request $request
     *
     * @return \Illuminate\Http\Response
     */
    public function store(Request $request)
    {
        $this->validate(
            $request,
            [
            'user_id' => 'required',
            'blood_type_id' => 'required',
            ]
        );

        $donor = new Donor();
        $donor->user_id => $request['user_id'];
        $donor->blood_type_id => $request['blood_type_id'];
        $donor->save();

        return redirect()->route('user.profile');
    }

    /**
     * Display the specified resource.<commit_msg>Corrigindo erro de sintaxe no controller DonorController<commit_after><?php

namespace DoeSangue\Http\Controllers;

use DoeSangue\Models\Donor;
use Illuminate\Http\Request;

class DonorController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        $donors = Donor::orderBy('id', 'desc')->get();

        return view('donors.index', compact('donors'));
    }

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

    /**
     * Store a newly created resource in storage.
     *
     * @param \Illuminate\Http\Request $request
     *
     * @return \Illuminate\Http\Response
     */
    public function store(Request $request)
    {
        $this->validate(
            $request,
            [
            'user_id' => 'required',
            'blood_type_id' => 'required',
            ]
        );

        $donor = new Donor();
        $donor->user_id = $request['user_id'];
        $donor->blood_type_id = $request['blood_type_id'];
        $donor->save();

        return redirect()->route('user.profile');
    }

    /**
     * Display the specified resource.
{'fraction_non_alphanumeric': 0.13697575990765679, 'fraction_numerical': 0.0, 'mean_word_length': 2.0197444831591174, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 21, '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': '4319302', 'n_tokens_mistral': 774, 'n_tokens_neox': 775, 'n_words': 163}