added comment to db column; added @property-read to Category and CategoryTranslation model
This commit is contained in:
parent
78a3c91c84
commit
0eb9cfc86d
|
|
@ -8,6 +8,13 @@ use Illuminate\Support\Facades\Storage;
|
|||
use Webkul\Category\Contracts\Category as CategoryContract;
|
||||
use Webkul\Attribute\Models\AttributeProxy;
|
||||
|
||||
/**
|
||||
* Class Category
|
||||
*
|
||||
* @package Webkul\Category\Models
|
||||
*
|
||||
* @property-read string $url_path maintained by database triggers
|
||||
*/
|
||||
class Category extends TranslatableModel implements CategoryContract
|
||||
{
|
||||
use NodeTrait;
|
||||
|
|
|
|||
|
|
@ -5,6 +5,13 @@ namespace Webkul\Category\Models;
|
|||
use Illuminate\Database\Eloquent\Model;
|
||||
use Webkul\Category\Contracts\CategoryTranslation as CategoryTranslationContract;
|
||||
|
||||
/**
|
||||
* Class CategoryTranslation
|
||||
*
|
||||
* @package Webkul\Category\Models
|
||||
*
|
||||
* @property-read string $url_path maintained by database triggers
|
||||
*/
|
||||
class CategoryTranslation extends Model implements CategoryTranslationContract
|
||||
{
|
||||
public $timestamps = false;
|
||||
|
|
|
|||
|
|
@ -14,7 +14,8 @@ class AddColumnUrlPathToCategoryTranslations extends Migration
|
|||
public function up()
|
||||
{
|
||||
Schema::table('category_translations', function (Blueprint $table) {
|
||||
$table->string('url_path');
|
||||
$table->string('url_path')
|
||||
->comment('maintained by database triggers');
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ SQL;
|
|||
SET NEW.url_path = urlPath;
|
||||
|
||||
END IF;
|
||||
SQL;
|
||||
SQL;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ class AddUrlPathToExistingCategoryTranslations extends Migration
|
|||
{
|
||||
$sqlStoredFunction = <<< SQL
|
||||
SELECT get_url_path_of_category(:category_id, :locale_code) AS url_path;
|
||||
SQL;
|
||||
SQL;
|
||||
|
||||
|
||||
$categoryTranslationsTableName = app(CategoryTranslation::class)->getTable();
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ class AddTriggerToCategories extends Migration
|
|||
CLOSE curs;
|
||||
|
||||
END IF;
|
||||
SQL;
|
||||
SQL;
|
||||
|
||||
$insertTrigger = <<< SQL
|
||||
CREATE TRIGGER %s
|
||||
|
|
@ -58,7 +58,7 @@ class AddTriggerToCategories extends Migration
|
|||
BEGIN
|
||||
$triggerBody
|
||||
END;
|
||||
SQL;
|
||||
SQL;
|
||||
|
||||
$updateTrigger = <<< SQL
|
||||
CREATE TRIGGER %s
|
||||
|
|
@ -67,7 +67,7 @@ class AddTriggerToCategories extends Migration
|
|||
BEGIN
|
||||
$triggerBody
|
||||
END;
|
||||
SQL;
|
||||
SQL;
|
||||
|
||||
DB::unprepared(sprintf('DROP TRIGGER IF EXISTS %s;', self::TRIGGER_NAME_INSERT));
|
||||
DB::unprepared(sprintf($insertTrigger, self::TRIGGER_NAME_INSERT));
|
||||
|
|
|
|||
Loading…
Reference in New Issue