IDE Helper added
This commit is contained in:
parent
7fd04ce100
commit
3f1bca4168
15 changed files with 21231 additions and 22 deletions
|
@ -8,6 +8,34 @@ use Illuminate\Database\Eloquent\Model;
|
|||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
/**
|
||||
* App\Models\Media
|
||||
*
|
||||
* @property int $id
|
||||
* @property string|null $token
|
||||
* @property string $path
|
||||
* @property string $type
|
||||
* @property int|null $note_id
|
||||
* @property \Illuminate\Support\Carbon|null $created_at
|
||||
* @property \Illuminate\Support\Carbon|null $updated_at
|
||||
* @property string|null $image_widths
|
||||
* @property-read string $mediumurl
|
||||
* @property-read string $smallurl
|
||||
* @property-read string $url
|
||||
* @property-read \App\Models\Note|null $note
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Media newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Media newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Media query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Media whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Media whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Media whereImageWidths($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Media whereNoteId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Media wherePath($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Media whereToken($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Media whereType($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Media whereUpdatedAt($value)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class Media extends Model
|
||||
{
|
||||
/**
|
||||
|
@ -27,7 +55,7 @@ class Media extends Model
|
|||
/**
|
||||
* Get the note that owns this media.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function note(): BelongsTo
|
||||
{
|
||||
|
@ -77,7 +105,7 @@ class Media extends Model
|
|||
/**
|
||||
* Give the real part of a filename, i.e. strip the file extension.
|
||||
*
|
||||
* @param string $path
|
||||
* @param string $path
|
||||
* @return string
|
||||
*/
|
||||
public function getBasename(string $path): string
|
||||
|
@ -86,17 +114,16 @@ class Media extends Model
|
|||
// foo.bar.png => ['foo', 'bar', 'png'] => ['foo', 'bar'] => foo.bar
|
||||
$filenameParts = explode('.', $path);
|
||||
array_pop($filenameParts);
|
||||
$basename = ltrim(array_reduce($filenameParts, function ($carry, $item) {
|
||||
|
||||
return ltrim(array_reduce($filenameParts, function ($carry, $item) {
|
||||
return $carry . '.' . $item;
|
||||
}, ''), '.');
|
||||
|
||||
return $basename;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the extension from a given filename.
|
||||
*
|
||||
* @param string $path
|
||||
* @param string $path
|
||||
* @return string
|
||||
*/
|
||||
public function getExtension(string $path): string
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue