<?php

namespace App\Http\Controllers\Api\mini;

use App\Models\Project;
use App\Models\ProjectRole;
use App\Models\ProjectUser;
use App\Models\WorkPoint;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Database\Eloquent\Builder;

class WorkPointController extends BaseController
{
    protected $model;

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

    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]);
    }
}
