feat:improved background importing

This commit is contained in:
hackerESQ
2024-10-24 14:48:24 -05:00
parent 7543c0a865
commit 3c368310ad
15 changed files with 459 additions and 139 deletions
@@ -0,0 +1,27 @@
<?php
namespace App\Rules;
use App\Models\Portfolio;
use Illuminate\Contracts\Validation\ValidationRule;
class PortfolioAccessValidationRule implements ValidationRule
{
public function __construct(
public ?string $user_id
) { }
/**
* Validate the attribute.
*
* @param string $attribute
* @param mixed $value
* @param \Closure $fail
* @return void
*/
public function validate(string $attribute, mixed $value, \Closure $fail): void
{
if (!Portfolio::fullAccess($this->user_id)->where('id', $value)->count()) {
$fail(__('You do not have access to that portfolio.'));
}
}
}