Я создал пакет laravel и потребовал свой пакет в другом проекте. Я использую черту пакета в модели проекта. Но я получаю эту ошибку => Черта не найдена - PullRequest
0 голосов
/ 05 ноября 2019

Я создал пакет laravel и потребовал свой пакет в другом проекте. Я использую черту пакета в модели проекта.

Но я получаю эту ошибку =>

Symfony \ Component \ Debug\ Exception \ FatalErrorException: черта 'Encryption \ Src \ Encryptable' не найдена

Я загрузил пакет GitHub, вы можете увидеть эту ссылку =>

https://github.com/kablanfatih/encryption

{
    "name": "kablanfatih/encryption",
    "description": "A package for automatically encrypting and decrypting Eloquent attributes in Laravel , based on configuration settings.",
    "type": "library",
    "license": "MIT",
    "authors": [
        {
            "name": "kablanfatih",
            "email": "kablanfatih34@gmail.com"
        }
    ],
    "minimum-stability": "dev",
    "require": {},
    "autoload": {
        "psr-4": {
            "kablanfatih\\encryption\\": "../encryption"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "kablanfatih\\encryption\\": "../encryption/",
            "Tests\\": "tests"
        }
    },
    "extra": {
        "laravel": {
            "providers": [
                "Barryvdh\\Debugbar\\ServiceProvider"
            ],
            "aliases": {
                "Debugbar": "Barryvdh\\Debugbar\\Facade"
            }
        }
    },
    "require-dev": {
        "barryvdh/laravel-debugbar": "^3.2@dev"
    }
}

<?php

namespace App\Models;

use Encryption\Src\Encryptable;
use Illuminate\Database\Eloquent\Model;

class Question extends Model
{
    use Encryptable;
    /**
     * The table associated with the model.
     *
     * @var string
     */
    protected $table = 'questions';

    /**
     * The attributes that are mass assignable.
     * @var array
     */
    protected $fillable = [
        'question', 'incorrect1', 'incorrect2', 'incorrect3', 'incorrect4', 'correct'
    ];

    /**
     * The attributes that are encrypted.
     *
     * @var array
     */
    protected $encrypted = [
        'question'
    ];
}

1 Ответ

1 голос
/ 05 ноября 2019

Ваше пространство имен неверно. Вам следует заменить "kablanfatih\\encryption\\" в composer.json на Encryption\\

...