<commit_before><?php

namespace App\Http\Controllers\Api\v1\Modules;

use App\Http\Controllers\Controller;
use App\Http\Requests\Legacy\DetailsRequest;
use App\Models\Details;
use Illuminate\Http\Request;

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

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

    /**
     * Store a newly created resource in storage.
     *
     * @param DetailsRequest $request
     * @return \Illuminate\Http\Response
     */
    public function store(DetailsRequest $request)
    {
        $detail = Details::create(
            array_merge(
                $request->only(
                    [
                        'DETAIL_INHALT',
                        'DETAIL_BEMERKUNG',
                        'DETAIL_NAME',
                        'DETAIL_ZUORDNUNG_TABELLE',
                        'DETAIL_ZUORDNUNG_ID'
                    ]
                ),
                [
                    'DETAIL_AKTUELL' => '1',
                    'DETAIL_ID' => Details::max('DETAIL_ID') + 1
                ]
            )
        );
        return response()->json($detail);
    }

    /**
     * Display the specified resource.
     *
     * @param  \App\Models\Details $details
     * @return \Illuminate\Http\Response
     */
    public function show(Details $details)
    {
        return response();
    }

    /**
     * Show the form for editing the specified resource.
     *
     * @param  \App\Models\Details $details
     * @return \Illuminate\Http\Response
     */
    public function edit(Details $details)
    {
        return response();
    }

    /**
     * Update the specified resource in storage.
     *
     * @param DetailsRequest|Request $request
     * @param  \App\Models\Details $detail
     * @return \Illuminate\Http\Response
     */
    public function update(DetailsRequest $request, Details $detail)
    {
        $detail->update($request->only(['DETAIL_INHALT', 'DETAIL_BEMERKUNG']));
        return response();
    }

    /**
     * Remove the specified resource from storage.
     *
     * @param DetailsRequest $request
     * @param  \App\Models\Details $detail
     * @return \Illuminate\Http\Response
     */
    public function destroy(DetailsRequest $request, Details $detail)
    {
        $detail->update(['DETAIL_AKTUELL' => '0']);
        return response();
    }
}<commit_msg>fix: updated DetailController to allow exception-free alteration of details<commit_after><?php

namespace App\Http\Controllers\Api\v1\Modules;

use App\Http\Controllers\Controller;
use App\Http\Requests\Legacy\DetailsRequest;
use App\Models\Details;
use Illuminate\Http\Request;

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

    /**
     * Store a newly created resource in storage.
     *
     * @param DetailsRequest $request
     * @return \Illuminate\Http\Response
     */
    public function store(DetailsRequest $request)
    {
        $detail = Details::create(
            array_merge(
                $request->only(
                    [
                        'DETAIL_INHALT',
                        'DETAIL_BEMERKUNG',
                        'DETAIL_NAME',
                        'DETAIL_ZUORDNUNG_TABELLE',
                        'DETAIL_ZUORDNUNG_ID'
                    ]
                ),
                [
                    'DETAIL_AKTUELL' => '1',
                    'DETAIL_ID' => Details::max('DETAIL_ID') + 1
                ]
            )
        );
        return response()->json($detail);
    }

    /**
     * Display the specified resource.
     *
     * @param  \App\Models\Details $details
     * @return \Illuminate\Http\Response
     */
    public function show(Details $details)
    {
        return response();
    }

    /**
     * Update the specified resource in storage.
     *
     * @param DetailsRequest|Request $request
     * @param  \App\Models\Details $detail
     * @return \Illuminate\Http\Response
     */
    public function update(DetailsRequest $request, Details $detail)
    {
        $detail->update($request->only(['DETAIL_INHALT', 'DETAIL_BEMERKUNG']));
        return response()->json($detail);
    }

    /**
     * Remove the specified resource from storage.
     *
     * @param DetailsRequest $request
     * @param  \App\Models\Details $detail
     * @return \Illuminate\Http\Response
     */
    public function destroy(DetailsRequest $request, Details $detail)
    {
        $detail->update(['DETAIL_AKTUELL' => '0']);
        return response()->json(['status' => 'ok']);
    }
}
{'fraction_non_alphanumeric': 0.11454983922829581, 'fraction_numerical': 0.001607717041800643, 'mean_word_length': 1.7527654867256637, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 22, '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': '3868321', 'n_tokens_mistral': 1417, 'n_tokens_neox': 1382, 'n_words': 289}