<?php

declare(strict_types=1);

namespace App\Policies;

use App\Models\ServiceOrder;
use App\Models\User;

class ServiceOrderPolicy
{
    /**
     * The order page hands out download links to finished masters. Without
     * this, altering the reference in the URL would give someone else's
     * music away.
     */
    public function view(User $user, ServiceOrder $order): bool
    {
        return $order->user_id === $user->id || $user->isAdmin();
    }
}
