for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace Rinvex\Forms\Traits;
use Illuminate\Database\Eloquent\Relations\MorphMany;
trait HasForms
{
/**
* Register a deleted model event with the dispatcher.
*
* @param \Closure|string $callback
* @return void
*/
abstract public static function deleted($callback);
* Define a polymorphic one-to-many relationship.
* @param string $related
* @param string $name
* @param string $type
$type
string|null
This check looks for @param annotations where the type inferred by our type inference engine differs from the declared type.
@param
It makes a suggestion as to what type it considers more descriptive.
Most often this is a case of a parameter that can be null in addition to its declared types.
* @param string $id
$id
* @param string $localKey
$localKey
* @return \Illuminate\Database\Eloquent\Relations\MorphMany
abstract public function morphMany($related, $name, $type = null, $id = null, $localKey = null);
* Boot the HasForms trait for the model.
public static function bootHasForms()
static::deleted(function (self $model) {
$model->forms()->delete();
});
}
* Get all attached forms to the model.
public function forms(): MorphMany
return $this->morphMany(config('rinvex.forms.models.form'), 'entity');
This check looks for
@param
annotations where the type inferred by our type inference engine differs from the declared type.It makes a suggestion as to what type it considers more descriptive.
Most often this is a case of a parameter that can be null in addition to its declared types.