<?php

namespace App\Http\Controllers\Api\mini;

use App\Models\RentType;
use Illuminate\Http\Request;

class RentTypeController extends BaseController
{
    protected $model;

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

    public function get(Request $request)
    {
        if($request->input('type') == 'drop_menu') {
            $items = $this->model->select('name as text', 'id as value')->get();
            $items = $items->prepend(collect(['text' => '租赁方式', 'value' => '']));
            return $this->success(['data' => $items]);
        }
        $items = $this->model->get();
        return $this->success(['data' => $items]);
    }
}
