updating Laravel model to add events and variables in class name for docblock
This commit is contained in:
parent
bbac3cc205
commit
e155e96ff4
@ -1,25 +1,30 @@
|
|||||||
<snippet>
|
<snippet>
|
||||||
<content><![CDATA[
|
<content><![CDATA[
|
||||||
use App\Models\Traits\HasUidTrait;
|
use App\Events\${1:Model}Created;
|
||||||
|
use App\Events\${1:Model}Creating;
|
||||||
|
use App\Events\${1:Model}Deleted;
|
||||||
|
use App\Events\${1:Model}Deleting;
|
||||||
|
use App\Events\${1:Model}Deleting;
|
||||||
|
use App\Events\${1:Model}Replicating;
|
||||||
|
use App\Events\${1:Model}Restored;
|
||||||
|
use App\Events\${1:Model}Restoring;
|
||||||
|
use App\Events\${1:Model}Retrieved;
|
||||||
|
use App\Events\${1:Model}Saved;
|
||||||
|
use App\Events\${1:Model}Saving;
|
||||||
|
use App\Events\${1:Model}Updated;
|
||||||
|
use App\Events\${1:Model}Updating;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||||
use Illuminate\Database\Eloquent\Prunable;
|
use Illuminate\Database\Eloquent\Prunable;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
use Laravel\Scout\Searchable;
|
use Laravel\Scout\Searchable;
|
||||||
|
|
||||||
use HasUidTrait;
|
|
||||||
use Prunable;
|
use Prunable;
|
||||||
use Searchable;
|
use Searchable;
|
||||||
|
|
||||||
/** @var string */
|
/** @var string */
|
||||||
protected \$table = '';
|
protected \$table = '';
|
||||||
|
|
||||||
/** @var string */
|
|
||||||
protected \$keyType = 'string';
|
|
||||||
|
|
||||||
/** @var bool */
|
|
||||||
public \$incrementing = false;
|
|
||||||
|
|
||||||
/** @var array<int,string> */
|
/** @var array<int,string> */
|
||||||
protected \$fillable = [];
|
protected \$fillable = [];
|
||||||
|
|
||||||
@ -42,7 +47,21 @@ protected \$with = [];
|
|||||||
protected \$touches = [];
|
protected \$touches = [];
|
||||||
|
|
||||||
/** @var array<int,string> */
|
/** @var array<int,string> */
|
||||||
protected \$dispatchesEvents = [];
|
protected \$dispatchesEvents = [
|
||||||
|
//'retrieved' => ${1:Model}Retrieved::class,
|
||||||
|
//'creating' => ${1:Model}Creating::class,
|
||||||
|
//'created' => ${1:Model}Created::class,
|
||||||
|
//'updating' => ${1:Model}Updating::class,
|
||||||
|
//'updated' => ${1:Model}Updated::class,
|
||||||
|
//'deleting' => ${1:Model}Deleting::class,
|
||||||
|
//'deleted' => ${1:Model}Deleted::class,
|
||||||
|
//'deleting' => ${1:Model}Deleting::class,
|
||||||
|
//'saving' => ${1:Model}Saving::class,
|
||||||
|
//'saved' => ${1:Model}Saved::class,
|
||||||
|
//'restoring' => ${1:Model}Restoring::class,
|
||||||
|
//'restored' => ${1:Model}Restored::class,
|
||||||
|
//'replicating' => ${1:Model}Replicating::class,
|
||||||
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
@ -63,20 +82,20 @@ protected \$dispatchesEvents = [];
|
|||||||
/**
|
/**
|
||||||
* Get the prunable model query.
|
* Get the prunable model query.
|
||||||
*
|
*
|
||||||
* @package App\Models\Class
|
* @package App\Models\${1:Model}
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Database\Eloquent\Builder
|
* @return \Illuminate\Database\Eloquent\Builder
|
||||||
*/
|
*/
|
||||||
public function prunable(): Builder
|
public function prunable(): Builder
|
||||||
{
|
{
|
||||||
return static::where('deleted_at', '<=', now()->subMonth());
|
// return static::where('deleted_at', '<=', now()->subMonth());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prepare the model for pruning.
|
* Prepare the model for pruning.
|
||||||
*
|
*
|
||||||
* @package App\Models\Class
|
* @package App\Models\${1:Model}
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
@ -89,7 +108,7 @@ protected function pruning(): void
|
|||||||
/**
|
/**
|
||||||
* Get the value used to index the model.
|
* Get the value used to index the model.
|
||||||
*
|
*
|
||||||
* @package App\Models\Class
|
* @package App\Models\${1:Model}
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*
|
*
|
||||||
* @return mixed
|
* @return mixed
|
||||||
@ -102,7 +121,7 @@ public function getScoutKey()
|
|||||||
/**
|
/**
|
||||||
* Get the key name used to index the model.
|
* Get the key name used to index the model.
|
||||||
*
|
*
|
||||||
* @package App\Models\Class
|
* @package App\Models\${1:Model}
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
@ -115,20 +134,20 @@ public function getScoutKeyName(): string
|
|||||||
/**
|
/**
|
||||||
* Get the name of the index associated with the model.
|
* Get the name of the index associated with the model.
|
||||||
*
|
*
|
||||||
* @package App\Models\Class
|
* @package App\Models\${1:Model}
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function searchableAs(): string
|
public function searchableAs(): string
|
||||||
{
|
{
|
||||||
return 'models_index';
|
return 'prefix_models_index';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the indexable data array for the model.
|
* Get the indexable data array for the model.
|
||||||
*
|
*
|
||||||
* @package App\Models\Class
|
* @package App\Models\${1:Model}
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
@ -152,7 +171,7 @@ public function toSearchableArray(): array
|
|||||||
/**
|
/**
|
||||||
* An accessor.
|
* An accessor.
|
||||||
*
|
*
|
||||||
* @package App\Models\Class
|
* @package App\Models\${1:Model}
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Database\Eloquent\Casts\Attribute
|
* @return \Illuminate\Database\Eloquent\Casts\Attribute
|
||||||
@ -193,7 +212,7 @@ protected function attrName(): Attribute
|
|||||||
/**
|
/**
|
||||||
* Something relationship.
|
* Something relationship.
|
||||||
*
|
*
|
||||||
* @package App\Models\Class
|
* @package App\Models\${1:Model}
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||||
|
Loading…
x
Reference in New Issue
Block a user