Initial commit: Pireon Admin — headless admin panel and public API
Laravel 13 + Filament 5 admin panel and REST API for a non-profit developer collective, backed by the Pireon OAuth identity server. The public site is a separate, server-rendered application consuming /api/public/v1. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
33
app/Policies/MediaPolicy.php
Normal file
33
app/Policies/MediaPolicy.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Policies;
|
||||
|
||||
use App\Models\User;
|
||||
|
||||
class MediaPolicy extends ResourcePolicy
|
||||
{
|
||||
protected function resource(): string
|
||||
{
|
||||
return 'media';
|
||||
}
|
||||
|
||||
/**
|
||||
* Files arrive by being uploaded on a record, not by being created here.
|
||||
*/
|
||||
public function create(User $user): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* A file something still points at cannot be deleted from here: doing so
|
||||
* would leave a broken image on the public site, which is precisely what
|
||||
* the health check exists to complain about.
|
||||
*/
|
||||
public function delete(User $user, $model): bool
|
||||
{
|
||||
return parent::delete($user, $model) && ! $model->isReferenced();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user