Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add model description #2656

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions src/Attachment/Models/Attachment.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Support\Carbon;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Str;
use Orchid\Attachment\MimeTypes;
Expand All @@ -21,6 +23,29 @@

/**
* Class Attachment.
*
* @property int $id;
* @property string $name
* @property string $original_name
* @property string $mime
* @property ?string $extension
* @property int $size
* @property int $sort
* @property int $path
* @property ?string $description
* @property ?string $alt
* @property ?string $hash
* @property string $disk
* @property ?int $user_id
* @property ?string $group
* @property ?Carbon $created_at
* @property ?Carbon $updated_at
* @property ?User $user
* @property null|Attachmentable[]|Collection<Attachmentable> $relationships
* @property-read ?string $url
* @property-read ?string $relative_url
* @property-read ?string $title
*
*/
class Attachment extends Model
{
Expand Down
5 changes: 5 additions & 0 deletions src/Attachment/Models/Attachmentable.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@

/**
* This class represents the relation between attachments and any model that can have them.
*
* @property string $attachmentable_type
* @property int $attachmentable_id
* @property int $attachment_id
*
*/
class Attachmentable extends Model
{
Expand Down
8 changes: 8 additions & 0 deletions src/Platform/Models/Role.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Collection;
use Orchid\Access\RoleAccess;
use Orchid\Access\RoleInterface;
use Orchid\Filters\Filterable;
Expand All @@ -14,6 +15,13 @@
use Orchid\Metrics\Chartable;
use Orchid\Screen\AsSource;

/**
* @property int $id
* @property string $name
* @property string $slug
* @property ?array<string, int> $permissions
* @property null|User[]|Collection<User> $users
*/
class Role extends Model implements RoleInterface
{
use RoleAccess, Filterable, AsSource, Chartable, HasFactory;
Expand Down
19 changes: 19 additions & 0 deletions src/Platform/Models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@
namespace Orchid\Platform\Models;

use App\Orchid\Presenters\UserPresenter;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Illuminate\Support\Carbon;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Hash;
use Orchid\Access\UserAccess;
use Orchid\Access\UserInterface;
Expand All @@ -19,6 +22,22 @@
use Orchid\Screen\AsSource;
use Orchid\Support\Facades\Dashboard;

/**
*
* @property int $id
* @property string $name
* @property string $email
* @property ?Carbon $email_verified_at
* @property string $password
* @property ?string $remember_token
* @property ?Carbon $created_at
* @property ?Carbon $updated_at
* @property ?array<string, int> $permissions
* @property null|Role[]|Collection<Role> $roles
* @method Builder byAccess(string $permitWithoutWildcard)
* @method Builder byAnyAccess(iterable|string $permitWithoutWildcard)
*
*/
class User extends Authenticatable implements UserInterface
{
use Notifiable, UserAccess, AsSource, Filterable, Chartable, HasFactory;
Expand Down