<?php

namespace App\Http\Controllers\Api\mini;

use App\Models\Part;
use App\Models\Spec;
use App\Models\UseRecord;
use Illuminate\Http\Request;

class PartController extends BaseController
{
    protected $model;

    public function __construct()
    {
        $this->model = new Part();
    }

    public function get(Request $request)
    {
        $items = $this->model->where('repair_device_id', $request->input('id'))->get();
        foreach($items as $item) {
            $item->date = substr($item->created_at, 0, 10);
        }
        return $this->success(['data' => $items]);
    }
}
