mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 09:34:04 +00:00
This PR adds Postgres RLS (trait manager + table manager approach) and permission controlled managers for PostgreSQL. --------- Co-authored-by: lukinovec <lukinovec@gmail.com> Co-authored-by: PHP CS Fixer <phpcsfixer@example.com>
25 lines
560 B
PHP
25 lines
560 B
PHP
<?php
|
|
|
|
namespace Stancl\Tenancy\Tests\RLS\Etc;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Stancl\Tenancy\Database\Concerns\RLSModel;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
use Stancl\Tenancy\Database\Concerns\BelongsToTenant;
|
|
|
|
/** Used for testing TraitRLSManager */
|
|
class Post extends Model implements RLSModel
|
|
{
|
|
use BelongsToTenant;
|
|
|
|
public $table = 'posts';
|
|
|
|
public $timestamps = false;
|
|
|
|
protected $guarded = [];
|
|
|
|
public function comments(): HasMany
|
|
{
|
|
return $this->hasMany(Comment::class, 'post_id');
|
|
}
|
|
}
|