repo stringlengths 7 63 | file_url stringlengths 81 284 | file_path stringlengths 5 200 | content stringlengths 0 32.8k | language stringclasses 1 value | license stringclasses 7 values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:02:33 2026-01-05 05:24:06 | truncated bool 2 classes |
|---|---|---|---|---|---|---|---|---|
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/DataTransfer/src/Resources/lang/ar/ar.php | packages/Webkul/DataTransfer/src/Resources/lang/ar/ar.php | <?php
return [
'importers' => [
'persons' => [
'title' => 'الأشخاص',
'validation' => [
'errors' => [
'duplicate-email' => 'البريد الإلكتروني: \'%s\' تم العثور عليه أكثر من مرة في ملف الاستيراد.',
'duplicate-phone' => 'الهاتف: \'%s\' تم العثور عليه أكثر من مرة في ملف الاستيراد.',
'email-not-found' => 'البريد الإلكتروني: \'%s\' لم يتم العثور عليه في النظام.',
],
],
],
'products' => [
'title' => 'المنتجات',
'validation' => [
'errors' => [
'sku-not-found' => 'المنتج ذو الكود المحدد لم يتم العثور عليه.',
],
],
],
'leads' => [
'title' => 'العملاء المحتملون',
'validation' => [
'errors' => [
'id-not-found' => 'المعرف: \'%s\' غير موجود في النظام.',
],
],
],
],
'validation' => [
'errors' => [
'column-empty-headers' => 'الأعمدة رقم "%s" تحتوي على رؤوس فارغة.',
'column-name-invalid' => 'أسماء الأعمدة غير صالحة: "%s".',
'column-not-found' => 'الأعمدة المطلوبة غير موجودة: %s.',
'column-numbers' => 'عدد الأعمدة لا يتوافق مع عدد الصفوف في الرأس.',
'invalid-attribute' => 'الرأس يحتوي على سمة غير صالحة: "%s".',
'system' => 'حدث خطأ غير متوقع في النظام.',
'wrong-quotes' => 'تم استخدام علامات الاقتباس الملتوية بدلاً من الاقتباسات المستقيمة.',
],
],
];
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/DataTransfer/src/Resources/lang/fa/app.php | packages/Webkul/DataTransfer/src/Resources/lang/fa/app.php | <?php
return [
'importers' => [
'persons' => [
'title' => 'افراد',
'validation' => [
'errors' => [
'duplicate-email' => 'ایمیل: \'%s\' بیش از یک بار در فایل واردات یافت شد.',
'duplicate-phone' => 'تلفن: \'%s\' بیش از یک بار در فایل واردات یافت شد.',
'email-not-found' => 'ایمیل: \'%s\' در سیستم یافت نشد.',
],
],
],
'products' => [
'title' => 'محصولات',
'validation' => [
'errors' => [
'sku-not-found' => 'محصول با کد SKU مشخص شده یافت نشد.',
],
],
],
'leads' => [
'title' => 'سرنخها',
'validation' => [
'errors' => [
'id-not-found' => 'شناسه: \'%s\' در سیستم یافت نشد.',
],
],
],
],
'validation' => [
'errors' => [
'column-empty-headers' => 'ستونهای شماره "%s" دارای سرصفحههای خالی هستند.',
'column-name-invalid' => 'نامهای ستون نامعتبر: "%s".',
'column-not-found' => 'ستونهای مورد نیاز یافت نشد: %s.',
'column-numbers' => 'تعداد ستونها با تعداد سطرهای سرصفحه مطابقت ندارد.',
'invalid-attribute' => 'سرصفحه شامل ویژگیهای نامعتبر است: "%s".',
'system' => 'خطای غیرمنتظرهای در سیستم رخ داد.',
'wrong-quotes' => 'به جای گیومههای مستقیم از گیومههای خمیده استفاده شده است.',
],
],
];
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/DataTransfer/src/Resources/lang/es/app.php | packages/Webkul/DataTransfer/src/Resources/lang/es/app.php | <?php
return [
'importers' => [
'persons' => [
'title' => 'Personas',
'validation' => [
'errors' => [
'duplicate-email' => 'Correo electrónico: \'%s\' se encontró más de una vez en el archivo de importación.',
'duplicate-phone' => 'Teléfono: \'%s\' se encontró más de una vez en el archivo de importación.',
'email-not-found' => 'Correo electrónico: \'%s\' no se encontró en el sistema.',
],
],
],
'products' => [
'title' => 'Productos',
'validation' => [
'errors' => [
'sku-not-found' => 'Producto con el SKU especificado no encontrado.',
],
],
],
'leads' => [
'title' => 'Clientes Potenciales',
'validation' => [
'errors' => [
'id-not-found' => 'ID: \'%s\' no se encuentra en el sistema.',
],
],
],
],
'validation' => [
'errors' => [
'column-empty-headers' => 'Las columnas número "%s" tienen encabezados vacíos.',
'column-name-invalid' => 'Nombres de columnas no válidos: "%s".',
'column-not-found' => 'No se encontraron las columnas requeridas: %s.',
'column-numbers' => 'El número de columnas no corresponde al número de filas en el encabezado.',
'invalid-attribute' => 'El encabezado contiene atributos no válidos: "%s".',
'system' => 'Ocurrió un error inesperado en el sistema.',
'wrong-quotes' => 'Se usaron comillas curvas en lugar de comillas rectas.',
],
],
];
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/DataTransfer/src/Models/ImportProxy.php | packages/Webkul/DataTransfer/src/Models/ImportProxy.php | <?php
namespace Webkul\DataTransfer\Models;
use Konekt\Concord\Proxies\ModelProxy;
class ImportProxy extends ModelProxy {}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/DataTransfer/src/Models/ImportBatchProxy.php | packages/Webkul/DataTransfer/src/Models/ImportBatchProxy.php | <?php
namespace Webkul\DataTransfer\Models;
use Konekt\Concord\Proxies\ModelProxy;
class ImportBatchProxy extends ModelProxy {}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/DataTransfer/src/Models/ImportBatch.php | packages/Webkul/DataTransfer/src/Models/ImportBatch.php | <?php
namespace Webkul\DataTransfer\Models;
use Illuminate\Database\Eloquent\Model;
use Webkul\DataTransfer\Contracts\ImportBatch as ImportBatchContract;
class ImportBatch extends Model implements ImportBatchContract
{
/**
* Indicates if the model should be timestamped.
*
* @var bool
*/
public $timestamps = false;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'state',
'data',
'summary',
'import_id',
];
/**
* The attributes that should be cast.
*
* @var array
*/
protected $casts = [
'summary' => 'array',
'data' => 'array',
];
/**
* Get the import that owns the import batch.
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function import()
{
return $this->belongsTo(ImportProxy::modelClass());
}
}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/DataTransfer/src/Models/Import.php | packages/Webkul/DataTransfer/src/Models/Import.php | <?php
namespace Webkul\DataTransfer\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Webkul\DataTransfer\Contracts\Import as ImportContract;
class Import extends Model implements ImportContract
{
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'state',
'process_in_queue',
'type',
'action',
'validation_strategy',
'validation_strategy',
'allowed_errors',
'processed_rows_count',
'invalid_rows_count',
'errors_count',
'errors',
'field_separator',
'file_path',
'error_file_path',
'summary',
'started_at',
'completed_at',
];
/**
* The attributes that should be cast.
*
* @var array
*/
protected $casts = [
'summary' => 'array',
'errors' => 'array',
'started_at' => 'datetime',
'completed_at' => 'datetime',
];
/**
* Get the options.
*/
public function batches(): HasMany
{
return $this->hasMany(ImportBatchProxy::modelClass());
}
/**
* Get the file name.
*/
public function getFileNameAttribute(): string
{
return preg_replace('/^.*?\/\d+-/', '', $this->file_path);
}
}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/DataTransfer/src/Repositories/ImportRepository.php | packages/Webkul/DataTransfer/src/Repositories/ImportRepository.php | <?php
namespace Webkul\DataTransfer\Repositories;
use Webkul\Core\Eloquent\Repository;
use Webkul\DataTransfer\Contracts\Import;
class ImportRepository extends Repository
{
/**
* Specify model class name.
*/
public function model(): string
{
return Import::class;
}
}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/DataTransfer/src/Repositories/ImportBatchRepository.php | packages/Webkul/DataTransfer/src/Repositories/ImportBatchRepository.php | <?php
namespace Webkul\DataTransfer\Repositories;
use Webkul\Core\Eloquent\Repository;
use Webkul\DataTransfer\Contracts\ImportBatch;
class ImportBatchRepository extends Repository
{
/**
* Specify model class name.
*/
public function model(): string
{
return ImportBatch::class;
}
}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/DataTransfer/src/Providers/DataTransferServiceProvider.php | packages/Webkul/DataTransfer/src/Providers/DataTransferServiceProvider.php | <?php
namespace Webkul\DataTransfer\Providers;
use Illuminate\Support\ServiceProvider;
class DataTransferServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*/
public function boot(): void
{
$this->loadTranslationsFrom(__DIR__.'/../Resources/lang', 'data_transfer');
$this->loadMigrationsFrom(__DIR__.'/../Database/Migrations');
}
/**
* Register any application services.
*/
public function register(): void
{
$this->mergeConfigFrom(dirname(__DIR__).'/Config/importers.php', 'importers');
}
}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/DataTransfer/src/Providers/ModuleServiceProvider.php | packages/Webkul/DataTransfer/src/Providers/ModuleServiceProvider.php | <?php
namespace Webkul\DataTransfer\Providers;
use Webkul\Core\Providers\BaseModuleServiceProvider;
class ModuleServiceProvider extends BaseModuleServiceProvider
{
/**
* Define models to map with repository interfaces.
*
* @var array
*/
protected $models = [
\Webkul\DataTransfer\Models\Import::class,
\Webkul\DataTransfer\Models\ImportBatch::class,
];
}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Warehouse/src/Contracts/Location.php | packages/Webkul/Warehouse/src/Contracts/Location.php | <?php
namespace Webkul\Warehouse\Contracts;
interface Location {}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Warehouse/src/Contracts/Warehouse.php | packages/Webkul/Warehouse/src/Contracts/Warehouse.php | <?php
namespace Webkul\Warehouse\Contracts;
interface Warehouse {}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Warehouse/src/Database/Migrations/2024_08_10_100340_create_warehouse_tags_table.php | packages/Webkul/Warehouse/src/Database/Migrations/2024_08_10_100340_create_warehouse_tags_table.php | <?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('warehouse_tags', function (Blueprint $table) {
$table->integer('tag_id')->unsigned();
$table->foreign('tag_id')->references('id')->on('tags')->onDelete('cascade');
$table->integer('warehouse_id')->unsigned();
$table->foreign('warehouse_id')->references('id')->on('warehouses')->onDelete('cascade');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('warehouse_tags');
}
};
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Warehouse/src/Database/Migrations/2024_06_21_160735_create_warehouse_locations_table.php | packages/Webkul/Warehouse/src/Database/Migrations/2024_06_21_160735_create_warehouse_locations_table.php | <?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('warehouse_locations', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->integer('warehouse_id')->unsigned();
$table->foreign('warehouse_id')->references('id')->on('warehouses')->onDelete('cascade');
$table->unique(['warehouse_id', 'name']);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('warehouse_locations');
}
};
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Warehouse/src/Database/Migrations/2024_08_10_100329_create_warehouse_activities_table.php | packages/Webkul/Warehouse/src/Database/Migrations/2024_08_10_100329_create_warehouse_activities_table.php | <?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('warehouse_activities', function (Blueprint $table) {
$table->integer('activity_id')->unsigned();
$table->foreign('activity_id')->references('id')->on('activities')->onDelete('cascade');
$table->integer('warehouse_id')->unsigned();
$table->foreign('warehouse_id')->references('id')->on('warehouses')->onDelete('cascade');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('warehouse_activities');
}
};
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Warehouse/src/Database/Migrations/2024_06_21_160707_create_warehouses_table.php | packages/Webkul/Warehouse/src/Database/Migrations/2024_06_21_160707_create_warehouses_table.php | <?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('warehouses', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->text('description')->nullable();
$table->string('contact_name');
$table->json('contact_emails');
$table->json('contact_numbers');
$table->json('contact_address');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('warehouses');
}
};
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Warehouse/src/Models/LocationProxy.php | packages/Webkul/Warehouse/src/Models/LocationProxy.php | <?php
namespace Webkul\Warehouse\Models;
use Konekt\Concord\Proxies\ModelProxy;
class LocationProxy extends ModelProxy {}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Warehouse/src/Models/Location.php | packages/Webkul/Warehouse/src/Models/Location.php | <?php
namespace Webkul\Warehouse\Models;
use Illuminate\Database\Eloquent\Model;
use Webkul\Warehouse\Contracts\Location as LocationContract;
class Location extends Model implements LocationContract
{
/**
* The table associated with the model.
*/
protected $table = 'warehouse_locations';
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'name',
'warehouse_id',
];
/**
* Get the warehouse that owns the location.
*/
public function warehouse()
{
return $this->belongsTo(WarehouseProxy::modelClass());
}
}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Warehouse/src/Models/Warehouse.php | packages/Webkul/Warehouse/src/Models/Warehouse.php | <?php
namespace Webkul\Warehouse\Models;
use Illuminate\Database\Eloquent\Model;
use Webkul\Activity\Models\ActivityProxy;
use Webkul\Activity\Traits\LogsActivity;
use Webkul\Attribute\Traits\CustomAttribute;
use Webkul\Tag\Models\TagProxy;
use Webkul\Warehouse\Contracts\Warehouse as WarehouseContract;
class Warehouse extends Model implements WarehouseContract
{
use CustomAttribute, LogsActivity;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'name',
'description',
'contact_name',
'contact_emails',
'contact_numbers',
'contact_address',
];
/**
* The attributes that are castable.
*
* @var array
*/
protected $casts = [
'contact_emails' => 'array',
'contact_numbers' => 'array',
'contact_address' => 'array',
];
/**
* Get the locations for the warehouse.
*/
public function locations()
{
return $this->hasMany(LocationProxy::modelClass());
}
/**
* The tags that belong to the lead.
*/
public function tags()
{
return $this->belongsToMany(TagProxy::modelClass(), 'warehouse_tags');
}
/**
* Get the activities.
*/
public function activities()
{
return $this->belongsToMany(ActivityProxy::modelClass(), 'warehouse_activities');
}
}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Warehouse/src/Models/WarehouseProxy.php | packages/Webkul/Warehouse/src/Models/WarehouseProxy.php | <?php
namespace Webkul\Warehouse\Models;
use Konekt\Concord\Proxies\ModelProxy;
class WarehouseProxy extends ModelProxy {}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Warehouse/src/Repositories/LocationRepository.php | packages/Webkul/Warehouse/src/Repositories/LocationRepository.php | <?php
namespace Webkul\Warehouse\Repositories;
use Webkul\Core\Eloquent\Repository;
class LocationRepository extends Repository
{
/**
* Searchable fields
*/
protected $fieldSearchable = [
'name',
'warehouse_id',
];
/**
* Specify Model class name
*
* @return mixed
*/
public function model()
{
return 'Webkul\Warehouse\Contracts\Location';
}
}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Warehouse/src/Repositories/WarehouseRepository.php | packages/Webkul/Warehouse/src/Repositories/WarehouseRepository.php | <?php
namespace Webkul\Warehouse\Repositories;
use Illuminate\Container\Container;
use Webkul\Attribute\Repositories\AttributeRepository;
use Webkul\Attribute\Repositories\AttributeValueRepository;
use Webkul\Core\Eloquent\Repository;
use Webkul\Warehouse\Contracts\Warehouse;
class WarehouseRepository extends Repository
{
/**
* Searchable fields.
*/
protected $fieldSearchable = [
'name',
'contact_name',
'contact_emails',
'contact_numbers',
'contact_address',
];
/**
* Create a new repository instance.
*
* @return void
*/
public function __construct(
protected AttributeRepository $attributeRepository,
protected AttributeValueRepository $attributeValueRepository,
Container $container
) {
parent::__construct($container);
}
/**
* Specify model class name.
*
* @return mixed
*/
public function model()
{
return Warehouse::class;
}
/**
* Create.
*
* @return \Webkul\Warehouse\Contracts\Warehouse
*/
public function create(array $data)
{
$warehouse = parent::create($data);
$this->attributeValueRepository->save(array_merge($data, [
'entity_id' => $warehouse->id,
]));
return $warehouse;
}
/**
* Update.
*
* @param int $id
* @param array $attribute
* @return \Webkul\Warehouse\Contracts\Warehouse
*/
public function update(array $data, $id, $attributes = [])
{
$warehouse = parent::update($data, $id);
/**
* If attributes are provided then only save the provided attributes and return.
*/
if (! empty($attributes)) {
$conditions = ['entity_type' => $data['entity_type']];
if (isset($data['quick_add'])) {
$conditions['quick_add'] = 1;
}
$attributes = $this->attributeRepository->where($conditions)
->whereIn('code', $attributes)
->get();
$this->attributeValueRepository->save(array_merge($data, [
'entity_id' => $warehouse->id,
]), $attributes);
return $warehouse;
}
$this->attributeValueRepository->save(array_merge($data, [
'entity_id' => $warehouse->id,
]));
return $warehouse;
}
}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Warehouse/src/Providers/ModuleServiceProvider.php | packages/Webkul/Warehouse/src/Providers/ModuleServiceProvider.php | <?php
namespace Webkul\Warehouse\Providers;
use Webkul\Core\Providers\BaseModuleServiceProvider;
class ModuleServiceProvider extends BaseModuleServiceProvider
{
protected $models = [
\Webkul\Warehouse\Models\Location::class,
\Webkul\Warehouse\Models\Warehouse::class,
];
}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Warehouse/src/Providers/WarehouseServiceProvider.php | packages/Webkul/Warehouse/src/Providers/WarehouseServiceProvider.php | <?php
namespace Webkul\Warehouse\Providers;
use Illuminate\Routing\Router;
use Illuminate\Support\ServiceProvider;
class WarehouseServiceProvider extends ServiceProvider
{
/**
* Bootstrap services.
*
* @return void
*/
public function boot(Router $router)
{
$this->loadMigrationsFrom(__DIR__.'/../Database/Migrations');
}
/**
* Register services.
*
* @return void
*/
public function register() {}
}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Quote/src/Contracts/Quote.php | packages/Webkul/Quote/src/Contracts/Quote.php | <?php
namespace Webkul\Quote\Contracts;
interface Quote {}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Quote/src/Contracts/QuoteItem.php | packages/Webkul/Quote/src/Contracts/QuoteItem.php | <?php
namespace Webkul\Quote\Contracts;
interface QuoteItem {}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Quote/src/Database/Migrations/2021_07_01_231317_create_quote_items_table.php | packages/Webkul/Quote/src/Database/Migrations/2021_07_01_231317_create_quote_items_table.php | <?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('quote_items', function (Blueprint $table) {
$table->increments('id');
$table->string('sku')->nullable();
$table->string('name')->nullable();
$table->integer('quantity')->default(0)->nullable();
$table->decimal('price', 12, 4)->default(0);
$table->string('coupon_code')->nullable();
$table->decimal('discount_percent', 12, 4)->default(0)->nullable();
$table->decimal('discount_amount', 12, 4)->default(0)->nullable();
$table->decimal('tax_percent', 12, 4)->default(0)->nullable();
$table->decimal('tax_amount', 12, 4)->default(0)->nullable();
$table->decimal('total', 12, 4)->default(0);
$table->integer('product_id')->unsigned();
$table->integer('quote_id')->unsigned();
$table->foreign('quote_id')->references('id')->on('quotes')->onDelete('cascade');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('quote_items');
}
};
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Quote/src/Database/Migrations/2021_07_01_230345_create_quotes_table.php | packages/Webkul/Quote/src/Database/Migrations/2021_07_01_230345_create_quotes_table.php | <?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('quotes', function (Blueprint $table) {
$table->increments('id');
$table->string('subject');
$table->string('description')->nullable();
$table->json('billing_address')->nullable();
$table->json('shipping_address')->nullable();
$table->decimal('discount_percent', 12, 4)->default(0)->nullable();
$table->decimal('discount_amount', 12, 4)->nullable();
$table->decimal('tax_amount', 12, 4)->nullable();
$table->decimal('adjustment_amount', 12, 4)->nullable();
$table->decimal('sub_total', 12, 4)->nullable();
$table->decimal('grand_total', 12, 4)->nullable();
$table->datetime('expired_at')->nullable();
$table->integer('person_id')->unsigned();
$table->foreign('person_id')->references('id')->on('persons')->onDelete('cascade');
$table->integer('user_id')->unsigned();
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('quotes');
}
};
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Quote/src/Models/QuoteProxy.php | packages/Webkul/Quote/src/Models/QuoteProxy.php | <?php
namespace Webkul\Quote\Models;
use Konekt\Concord\Proxies\ModelProxy;
class QuoteProxy extends ModelProxy {}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Quote/src/Models/QuoteItemProxy.php | packages/Webkul/Quote/src/Models/QuoteItemProxy.php | <?php
namespace Webkul\Quote\Models;
use Konekt\Concord\Proxies\ModelProxy;
class QuoteItemProxy extends ModelProxy {}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Quote/src/Models/Quote.php | packages/Webkul/Quote/src/Models/Quote.php | <?php
namespace Webkul\Quote\Models;
use Illuminate\Database\Eloquent\Model;
use Webkul\Attribute\Traits\CustomAttribute;
use Webkul\Contact\Models\PersonProxy;
use Webkul\Lead\Models\LeadProxy;
use Webkul\Quote\Contracts\Quote as QuoteContract;
use Webkul\User\Models\UserProxy;
class Quote extends Model implements QuoteContract
{
use CustomAttribute;
protected $table = 'quotes';
protected $casts = [
'billing_address' => 'array',
'shipping_address' => 'array',
'expired_at' => 'datetime',
];
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'subject',
'description',
'billing_address',
'shipping_address',
'discount_percent',
'discount_amount',
'tax_amount',
'adjustment_amount',
'sub_total',
'grand_total',
'expired_at',
'user_id',
'person_id',
];
/**
* Get the quote items record associated with the quote.
*/
public function items()
{
return $this->hasMany(QuoteItemProxy::modelClass());
}
/**
* Get the user that owns the quote.
*/
public function user()
{
return $this->belongsTo(UserProxy::modelClass());
}
/**
* Get the person that owns the quote.
*/
public function person()
{
return $this->belongsTo(PersonProxy::modelClass());
}
/**
* The leads that belong to the quote.
*/
public function leads()
{
return $this->belongsToMany(LeadProxy::modelClass(), 'lead_quotes');
}
}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Quote/src/Models/QuoteItem.php | packages/Webkul/Quote/src/Models/QuoteItem.php | <?php
namespace Webkul\Quote\Models;
use Illuminate\Database\Eloquent\Model;
use Webkul\Quote\Contracts\QuoteItem as QuoteItemContract;
class QuoteItem extends Model implements QuoteItemContract
{
protected $table = 'quote_items';
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'sku',
'name',
'quantity',
'price',
'coupon_code',
'discount_percent',
'discount_amount',
'tax_percent',
'tax_amount',
'total',
'product_id',
'quote_id',
];
/**
* Get the quote record associated with the quote item.
*/
public function quote()
{
return $this->belongsTo(QuoteProxy::modelClass());
}
}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Quote/src/Repositories/QuoteRepository.php | packages/Webkul/Quote/src/Repositories/QuoteRepository.php | <?php
namespace Webkul\Quote\Repositories;
use Illuminate\Container\Container;
use Illuminate\Support\Str;
use Webkul\Attribute\Repositories\AttributeRepository;
use Webkul\Attribute\Repositories\AttributeValueRepository;
use Webkul\Core\Eloquent\Repository;
use Webkul\Quote\Contracts\Quote;
class QuoteRepository extends Repository
{
/**
* Searchable fields.
*/
protected $fieldSearchable = [
'subject',
'description',
'person_id',
'person.name',
'user_id',
'user.name',
];
/**
* Create a new repository instance.
*
* @return void
*/
public function __construct(
protected AttributeRepository $attributeRepository,
protected AttributeValueRepository $attributeValueRepository,
protected QuoteItemRepository $quoteItemRepository,
Container $container
) {
parent::__construct($container);
}
/**
* Specify model class name.
*
* @return mixed
*/
public function model()
{
return Quote::class;
}
/**
* Create.
*
* @return \Webkul\Quote\Contracts\Quote
*/
public function create(array $data)
{
$quote = parent::create($data);
$this->attributeValueRepository->save(array_merge($data, [
'entity_id' => $quote->id,
]));
foreach ($data['items'] as $itemData) {
$this->quoteItemRepository->create(array_merge($itemData, [
'quote_id' => $quote->id,
]));
}
return $quote;
}
/**
* Update.
*
* @param int $id
* @param array $attribute
* @return \Webkul\Quote\Contracts\Quote
*/
public function update(array $data, $id, $attributes = [])
{
$quote = $this->find($id);
parent::update($data, $id);
/**
* If attributes are provided then only save the provided attributes and return.
*/
if (! empty($attributes)) {
$conditions = ['entity_type' => $data['entity_type']];
if (isset($data['quick_add'])) {
$conditions['quick_add'] = 1;
}
$attributes = $this->attributeRepository->where($conditions)
->whereIn('code', $attributes)
->get();
$this->attributeValueRepository->save(array_merge($data, [
'entity_id' => $quote->id,
]), $attributes);
return $quote;
}
$this->attributeValueRepository->save(array_merge($data, [
'entity_id' => $quote->id,
]));
$previousItemIds = $quote->items->pluck('id');
if (isset($data['items'])) {
foreach ($data['items'] as $itemId => $itemData) {
if (Str::contains($itemId, 'item_')) {
$this->quoteItemRepository->create(array_merge($itemData, [
'quote_id' => $id,
]));
} else {
if (is_numeric($index = $previousItemIds->search($itemId))) {
$previousItemIds->forget($index);
}
$this->quoteItemRepository->update($itemData, $itemId);
}
}
}
foreach ($previousItemIds as $itemId) {
$this->quoteItemRepository->delete($itemId);
}
return $quote;
}
/**
* Retrieves customers count based on date.
*
* @return number
*/
public function getQuotesCount($startDate, $endDate)
{
return $this
->whereBetween('created_at', [$startDate, $endDate])
->get()
->count();
}
}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Quote/src/Repositories/QuoteItemRepository.php | packages/Webkul/Quote/src/Repositories/QuoteItemRepository.php | <?php
namespace Webkul\Quote\Repositories;
use Illuminate\Container\Container;
use Webkul\Core\Eloquent\Repository;
use Webkul\Product\Repositories\ProductRepository;
class QuoteItemRepository extends Repository
{
/**
* Create a new repository instance.
*
* @return void
*/
public function __construct(
protected ProductRepository $productRepository,
Container $container
) {
parent::__construct($container);
}
/**
* Specify Model class name
*
* @return mixed
*/
public function model()
{
return 'Webkul\Quote\Contracts\QuoteItem';
}
/**
* @return mixed
*/
public function create(array $data)
{
if (empty($data['product_id'])) {
return null;
}
$product = $this->productRepository->findOrFail($data['product_id']);
$quoteItem = parent::create(array_merge($data, [
'sku' => $product->sku,
'name' => $product->name,
]));
return $quoteItem;
}
/**
* @param int $id
* @param string $attribute
* @return \Webkul\Quote\Contracts\QuoteItem
*/
public function update(array $data, $id, $attribute = 'id')
{
$product = $this->productRepository->findOrFail($data['product_id']);
$quoteItem = parent::update(array_merge($data, [
'sku' => $product->sku,
'name' => $product->name,
]), $id);
return $quoteItem;
}
}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Quote/src/Providers/QuoteServiceProvider.php | packages/Webkul/Quote/src/Providers/QuoteServiceProvider.php | <?php
namespace Webkul\Quote\Providers;
use Illuminate\Routing\Router;
use Illuminate\Support\ServiceProvider;
class QuoteServiceProvider extends ServiceProvider
{
/**
* Bootstrap services.
*
* @return void
*/
public function boot(Router $router)
{
$this->loadMigrationsFrom(__DIR__.'/../Database/Migrations');
}
/**
* Register services.
*
* @return void
*/
public function register() {}
}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Quote/src/Providers/ModuleServiceProvider.php | packages/Webkul/Quote/src/Providers/ModuleServiceProvider.php | <?php
namespace Webkul\Quote\Providers;
use Webkul\Core\Providers\BaseModuleServiceProvider;
class ModuleServiceProvider extends BaseModuleServiceProvider
{
protected $models = [
\Webkul\Quote\Models\Quote::class,
\Webkul\Quote\Models\QuoteItem::class,
];
}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Attribute/src/Traits/CustomAttribute.php | packages/Webkul/Attribute/src/Traits/CustomAttribute.php | <?php
namespace Webkul\Attribute\Traits;
use Webkul\Attribute\Models\AttributeValueProxy;
use Webkul\Attribute\Repositories\AttributeRepository;
trait CustomAttribute
{
/**
* @var array
*/
public static $attributeTypeFields = [
'text' => 'text_value',
'textarea' => 'text_value',
'price' => 'float_value',
'boolean' => 'boolean_value',
'select' => 'integer_value',
'multiselect' => 'text_value',
'checkbox' => 'text_value',
'email' => 'json_value',
'address' => 'json_value',
'phone' => 'json_value',
'lookup' => 'integer_value',
'datetime' => 'datetime_value',
'date' => 'date_value',
'file' => 'text_value',
'image' => 'text_value',
];
/**
* Get the attribute values that owns the entity.
*/
public function attribute_values()
{
return $this->morphMany(AttributeValueProxy::modelClass(), 'entity');
}
/**
* Get an attribute from the model.
*
* @param string $key
* @return mixed
*/
public function getAttribute($key)
{
if (! method_exists(static::class, $key) && ! isset($this->attributes[$key])) {
if (isset($this->id)) {
$this->attributes[$key] = '';
$attribute = app(AttributeRepository::class)->getAttributeByCode($key);
$this->attributes[$key] = $this->getCustomAttributeValue($attribute);
return $this->getAttributeValue($key);
}
}
return parent::getAttribute($key);
}
/**
* @return array
*/
public function attributesToArray()
{
$attributes = parent::attributesToArray();
$hiddenAttributes = $this->getHidden();
if (isset($this->id)) {
$customAttributes = $this->getCustomAttributes();
foreach ($customAttributes as $attribute) {
if (in_array($attribute->code, $hiddenAttributes) && isset($this->attributes[$attribute->code])) {
continue;
}
$attributes[$attribute->code] = $this->getCustomAttributeValue($attribute);
}
}
return $attributes;
}
/**
* Check in loaded family attributes.
*
* @return object
*/
public function getCustomAttributes()
{
static $attributes;
if ($attributes) {
return $attributes;
}
return $attributes = app(AttributeRepository::class)->where('entity_type', $this->getTable())->get();
}
/**
* Get an product attribute value.
*
* @return mixed
*/
public function getCustomAttributeValue($attribute)
{
if (! $attribute) {
return;
}
$attributeValue = $this->attribute_values->where('attribute_id', $attribute->id)->first();
return $attributeValue[self::$attributeTypeFields[$attribute->type]] ?? null;
}
/**
* Create a new instance of the given model.
*
* @param array $attributes
* @return Collection
*/
public function getLookUpAttributes($attributes)
{
$attributes = app(AttributeRepository::class)->scopeQuery(function ($query) use ($attributes) {
return $query->distinct()
->where('type', 'lookup')
->where('entity_type', request('entity_type'))
->whereIn('code', array_keys($attributes, '', false));
})->get();
return $attributes;
}
/**
* Create a new instance of the given model.
*
* @param array $attributes
* @param bool $exists
* @return static
*/
public function newInstance($attributes = [], $exists = false)
{
// $attributes = $this->getLookUpAttributes($attributes);
// Play with data here
return parent::newInstance($attributes, $exists);
}
/**
* Fill the model with an array of attributes.
*
* @return $this
*
* @throws \Illuminate\Database\Eloquent\MassAssignmentException
*/
public function fill(array $attributes)
{
// Play with data here
return parent::fill($attributes);
}
// Delete model's attribute values
public static function boot()
{
parent::boot();
static::deleting(function ($entity) {
$entity->attribute_values()->delete();
});
}
}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Attribute/src/Contracts/Attribute.php | packages/Webkul/Attribute/src/Contracts/Attribute.php | <?php
namespace Webkul\Attribute\Contracts;
interface Attribute {}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Attribute/src/Contracts/AttributeValue.php | packages/Webkul/Attribute/src/Contracts/AttributeValue.php | <?php
namespace Webkul\Attribute\Contracts;
interface AttributeValue {}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Attribute/src/Contracts/AttributeOption.php | packages/Webkul/Attribute/src/Contracts/AttributeOption.php | <?php
namespace Webkul\Attribute\Contracts;
interface AttributeOption {}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Attribute/src/Database/Migrations/2021_04_02_080709_create_attributes_table.php | packages/Webkul/Attribute/src/Database/Migrations/2021_04_02_080709_create_attributes_table.php | <?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('attributes', function (Blueprint $table) {
$table->increments('id');
$table->string('code');
$table->string('name');
$table->string('type');
$table->string('lookup_type')->nullable();
$table->string('entity_type');
$table->integer('sort_order')->nullable();
$table->string('validation')->nullable();
$table->boolean('is_required')->default(0);
$table->boolean('is_unique')->default(0);
$table->boolean('quick_add')->default(0);
$table->boolean('is_user_defined')->default(1);
$table->unique(['code', 'entity_type']);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('attributes');
}
};
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Attribute/src/Database/Migrations/2021_04_06_122751_create_attribute_values_table.php | packages/Webkul/Attribute/src/Database/Migrations/2021_04_06_122751_create_attribute_values_table.php | <?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('attribute_values', function (Blueprint $table) {
$table->increments('id');
$table->string('entity_type')->default('leads');
$table->text('text_value')->nullable();
$table->boolean('boolean_value')->nullable();
$table->integer('integer_value')->nullable();
$table->double('float_value')->nullable();
$table->datetime('datetime_value')->nullable();
$table->date('date_value')->nullable();
$table->json('json_value')->nullable();
$table->integer('entity_id')->unsigned();
$table->integer('attribute_id')->unsigned();
$table->foreign('attribute_id')->references('id')->on('attributes')->onDelete('cascade');
$table->unique(['entity_type', 'entity_id', 'attribute_id'], 'entity_type_attribute_value_index_unique');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('attribute_values');
}
};
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Attribute/src/Database/Migrations/2025_07_02_191710_alter_attribute_values_table.php | packages/Webkul/Attribute/src/Database/Migrations/2025_07_02_191710_alter_attribute_values_table.php | <?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('attribute_values', function (Blueprint $table) {
$table->string('unique_id')->nullable();
});
$tablePrefix = DB::getTablePrefix();
DB::statement('UPDATE '.$tablePrefix."attribute_values SET unique_id = CONCAT(entity_id, '|', attribute_id)");
Schema::table('attribute_values', function (Blueprint $table) {
$table->unique('unique_id');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('attribute_values', function (Blueprint $table) {
$table->dropUnique(['unique_id']);
$table->dropColumn('unique_id');
});
}
};
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Attribute/src/Database/Migrations/2021_04_02_080837_create_attribute_options_table.php | packages/Webkul/Attribute/src/Database/Migrations/2021_04_02_080837_create_attribute_options_table.php | <?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('attribute_options', function (Blueprint $table) {
$table->increments('id');
$table->string('name')->nullable();
$table->integer('sort_order')->nullable();
$table->integer('attribute_id')->unsigned();
$table->foreign('attribute_id')->references('id')->on('attributes')->onDelete('cascade');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('attribute_options');
}
};
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Attribute/src/Config/attribute_lookups.php | packages/Webkul/Attribute/src/Config/attribute_lookups.php | <?php
return [
];
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Attribute/src/Models/Attribute.php | packages/Webkul/Attribute/src/Models/Attribute.php | <?php
namespace Webkul\Attribute\Models;
use Illuminate\Database\Eloquent\Model;
use Webkul\Attribute\Contracts\Attribute as AttributeContract;
class Attribute extends Model implements AttributeContract
{
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'code',
'name',
'type',
'entity_type',
'lookup_type',
'is_required',
'is_unique',
'quick_add',
'validation',
'is_user_defined',
];
/**
* Get the options.
*/
public function options()
{
return $this->hasMany(AttributeOptionProxy::modelClass());
}
}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Attribute/src/Models/AttributeValue.php | packages/Webkul/Attribute/src/Models/AttributeValue.php | <?php
namespace Webkul\Attribute\Models;
use Illuminate\Database\Eloquent\Model;
use Webkul\Activity\Traits\LogsActivity;
use Webkul\Attribute\Contracts\AttributeValue as AttributeValueContract;
class AttributeValue extends Model implements AttributeValueContract
{
use LogsActivity;
/**
* Disable the default timestamps.
*
* @var bool
*/
public $timestamps = false;
/**
* Cast the attributes to their respective types.
*
* @var array
*/
protected $casts = [
'json_value' => 'array',
];
/**
* The attributes that are fillable for the model.
*
* @var array
*/
protected $fillable = [
'attribute_id',
'text_value',
'boolean_value',
'integer_value',
'float_value',
'datetime_value',
'date_value',
'json_value',
'entity_id',
'entity_type',
];
/**
* The attributes that are used for logging activity.
*
* @var array
*/
public static $attributeTypeFields = [
'text' => 'text_value',
'textarea' => 'text_value',
'price' => 'float_value',
'boolean' => 'boolean_value',
'select' => 'integer_value',
'multiselect' => 'text_value',
'checkbox' => 'text_value',
'email' => 'json_value',
'address' => 'json_value',
'phone' => 'json_value',
'lookup' => 'integer_value',
'datetime' => 'datetime_value',
'date' => 'date_value',
'file' => 'text_value',
'image' => 'text_value',
];
/**
* Get the attribute that owns the attribute value.
*/
public function attribute()
{
return $this->belongsTo(AttributeProxy::modelClass());
}
/**
* Get the parent entity model (leads, products, persons or organizations).
*/
public function entity()
{
return $this->morphTo();
}
}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Attribute/src/Models/AttributeOption.php | packages/Webkul/Attribute/src/Models/AttributeOption.php | <?php
namespace Webkul\Attribute\Models;
use Illuminate\Database\Eloquent\Model;
use Webkul\Attribute\Contracts\AttributeOption as AttributeOptionContract;
class AttributeOption extends Model implements AttributeOptionContract
{
public $timestamps = false;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'name',
'sort_order',
'attribute_id',
];
/**
* Get the attribute that owns the attribute option.
*/
public function attribute()
{
return $this->belongsTo(AttributeProxy::modelClass());
}
}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Attribute/src/Models/AttributeOptionProxy.php | packages/Webkul/Attribute/src/Models/AttributeOptionProxy.php | <?php
namespace Webkul\Attribute\Models;
use Konekt\Concord\Proxies\ModelProxy;
class AttributeOptionProxy extends ModelProxy {}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Attribute/src/Models/AttributeProxy.php | packages/Webkul/Attribute/src/Models/AttributeProxy.php | <?php
namespace Webkul\Attribute\Models;
use Konekt\Concord\Proxies\ModelProxy;
class AttributeProxy extends ModelProxy {}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Attribute/src/Models/AttributeValueProxy.php | packages/Webkul/Attribute/src/Models/AttributeValueProxy.php | <?php
namespace Webkul\Attribute\Models;
use Konekt\Concord\Proxies\ModelProxy;
class AttributeValueProxy extends ModelProxy {}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Attribute/src/Repositories/AttributeRepository.php | packages/Webkul/Attribute/src/Repositories/AttributeRepository.php | <?php
namespace Webkul\Attribute\Repositories;
use Illuminate\Container\Container;
use Illuminate\Support\Str;
use Webkul\Core\Eloquent\Repository;
class AttributeRepository extends Repository
{
/**
* Create a new repository instance.
*
* @return void
*/
public function __construct(
protected AttributeOptionRepository $attributeOptionRepository,
Container $container
) {
parent::__construct($container);
}
/**
* Specify Model class name
*
* @return mixed
*/
public function model()
{
return 'Webkul\Attribute\Contracts\Attribute';
}
/**
* @return \Webkul\Attribute\Contracts\Attribute
*/
public function create(array $data)
{
$options = isset($data['options']) ? $data['options'] : [];
$attribute = $this->model->create($data);
if (in_array($attribute->type, ['select', 'multiselect', 'checkbox']) && count($options)) {
$sortOrder = 1;
foreach ($options as $optionInputs) {
$this->attributeOptionRepository->create(array_merge([
'attribute_id' => $attribute->id,
'sort_order' => $sortOrder++,
], $optionInputs));
}
}
return $attribute;
}
/**
* @param int $id
* @param string $attribute
* @return \Webkul\Attribute\Contracts\Attribute
*/
public function update(array $data, $id, $attribute = 'id')
{
$attribute = $this->find($id);
$attribute->update($data);
if (! in_array($attribute->type, ['select', 'multiselect', 'checkbox'])) {
return $attribute;
}
if (! isset($data['options'])) {
return $attribute;
}
foreach ($data['options'] as $optionId => $optionInputs) {
$isNew = $optionInputs['isNew'] == 'true';
if ($isNew) {
$this->attributeOptionRepository->create(array_merge([
'attribute_id' => $attribute->id,
], $optionInputs));
} else {
$isDelete = $optionInputs['isDelete'] == 'true';
if ($isDelete) {
$this->attributeOptionRepository->delete($optionId);
} else {
$this->attributeOptionRepository->update($optionInputs, $optionId);
}
}
}
return $attribute;
}
/**
* @param string $code
* @return \Webkul\Attribute\Contracts\Attribute
*/
public function getAttributeByCode($code)
{
static $attributes = [];
if (array_key_exists($code, $attributes)) {
return $attributes[$code];
}
return $attributes[$code] = $this->findOneByField('code', $code);
}
/**
* @param int $lookup
* @param string $query
* @param array $columns
* @return array
*/
public function getLookUpOptions($lookup, $query = '', $columns = [])
{
$lookup = config('attribute_lookups.'.$lookup);
if (! count($columns)) {
$columns = [($lookup['value_column'] ?? 'id').' as id', ($lookup['label_column'] ?? 'name').' as name'];
}
if (Str::contains($lookup['repository'], 'UserRepository')) {
$userRepository = app($lookup['repository'])->where('status', 1);
$currentUser = auth()->guard('user')->user();
if ($currentUser?->view_permission === 'group') {
$query = urldecode($query);
$userIds = bouncer()->getAuthorizedUserIds();
return $userRepository
->when(! empty($userIds), fn ($queryBuilder) => $queryBuilder->whereIn('users.id', $userIds))
->when(! empty($query), fn ($queryBuilder) => $queryBuilder->where('users.name', 'like', "%{$query}%"))
->get();
} elseif ($currentUser?->view_permission === 'individual') {
return $userRepository->where('users.id', $currentUser->id)->get();
}
return $userRepository->where('users.name', 'like', '%'.urldecode($query).'%')->get();
}
return app($lookup['repository'])->findWhere([
[$lookup['label_column'] ?? 'name', 'like', '%'.urldecode($query).'%'],
], $columns);
}
/**
* @param string $lookup
* @param int|array $entityId
* @param array $columns
* @return mixed
*/
public function getLookUpEntity($lookup, $entityId = null, $columns = [])
{
if (! $entityId) {
return;
}
$lookup = config('attribute_lookups.'.$lookup);
if (! count($columns)) {
$columns = [($lookup['value_column'] ?? 'id').' as id', ($lookup['label_column'] ?? 'name').' as name'];
}
if (is_array($entityId)) {
return app($lookup['repository'])->findWhereIn(
'id',
$entityId,
$columns
);
} else {
return app($lookup['repository'])->find($entityId, $columns);
}
}
}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Attribute/src/Repositories/AttributeValueRepository.php | packages/Webkul/Attribute/src/Repositories/AttributeValueRepository.php | <?php
namespace Webkul\Attribute\Repositories;
use Carbon\Carbon;
use Illuminate\Container\Container;
use Illuminate\Http\UploadedFile;
use Illuminate\Support\Facades\Storage;
use Webkul\Attribute\Contracts\AttributeValue;
use Webkul\Core\Eloquent\Repository;
class AttributeValueRepository extends Repository
{
/**
* Create a new repository instance.
*
* @return void
*/
public function __construct(
protected AttributeRepository $attributeRepository,
Container $container
) {
parent::__construct($container);
}
/**
* Specify model class name.
*
* @return mixed
*/
public function model()
{
return AttributeValue::class;
}
/**
* Save attribute value.
*/
public function save(array $data, $attributes = []): void
{
if (empty($attributes)) {
$conditions = ['entity_type' => $data['entity_type']];
if (isset($data['quick_add'])) {
$conditions['quick_add'] = 1;
}
$attributes = $this->attributeRepository->where($conditions)->get();
}
foreach ($attributes as $attribute) {
$typeColumn = $this->model::$attributeTypeFields[$attribute->type];
if ($attribute->type === 'boolean') {
$data[$attribute->code] = isset($data[$attribute->code]) && $data[$attribute->code] ? 1 : 0;
}
if (! array_key_exists($attribute->code, $data)) {
continue;
}
if ($attribute->type === 'price'
&& isset($data[$attribute->code])
&& $data[$attribute->code] === ''
) {
$data[$attribute->code] = null;
}
if ($attribute->type === 'date' && $data[$attribute->code] === '') {
$data[$attribute->code] = null;
}
if ($attribute->type === 'multiselect' || $attribute->type === 'checkbox') {
$data[$attribute->code] = implode(',', $data[$attribute->code]);
}
if ($attribute->type === 'email' || $attribute->type === 'phone') {
$data[$attribute->code] = $this->sanitizeEmailAndPhone($data[$attribute->code]);
}
if ($attribute->type === 'image' || $attribute->type === 'file') {
$data[$attribute->code] = $data[$attribute->code] instanceof UploadedFile
? $data[$attribute->code]->store($data['entity_type'].'/'.$data['entity_id'])
: null;
}
$attributeValue = $this->findOneWhere([
'entity_type' => $data['entity_type'],
'entity_id' => $data['entity_id'],
'attribute_id' => $attribute->id,
]);
if (! $attributeValue) {
$this->create([
'entity_type' => $data['entity_type'],
'entity_id' => $data['entity_id'],
'attribute_id' => $attribute->id,
$typeColumn => $data[$attribute->code],
]);
} else {
$this->update([
$typeColumn => $data[$attribute->code],
], $attributeValue->id);
if ($attribute->type == 'image' || $attribute->type == 'file') {
if ($attributeValue->text_value) {
Storage::delete($attributeValue->text_value);
}
}
}
}
}
/**
* Is value unique.
*
* @param int $entityId
* @param string $entityType
* @param \Webkul\Attribute\Contracts\Attribute $attribute
* @param string $value
* @return bool
*/
public function isValueUnique($entityId, $entityType, $attribute, $value)
{
$query = $this->resetScope()->model
->where('attribute_id', $attribute->id)
->where('entity_type', $entityType)
->where('entity_id', '!=', $entityId);
/**
* If the attribute type is email or phone, check the JSON value.
*/
if (in_array($attribute->type, ['email', 'phone'])) {
$query->whereJsonContains($this->model::$attributeTypeFields[$attribute->type], [['value' => $value]]);
} else {
$query->where($this->model::$attributeTypeFields[$attribute->type], $value);
}
return $query->get()->count() ? false : true;
}
/**
* Removed null values from email and phone fields.
*
* @param array $data
* @return array
*/
public function sanitizeEmailAndPhone($data)
{
foreach ($data as $key => $row) {
if (is_null($row['value'])) {
unset($data[$key]);
}
}
return $data;
}
/**
* Replace placeholders with values
*/
public function getAttributeLabel(mixed $value, mixed $attribute)
{
switch ($attribute?->type) {
case 'price':
$label = core()->formatBasePrice($value);
break;
case 'boolean':
$label = $value ? 'Yes' : 'No';
break;
case 'select':
case 'radio':
case 'lookup':
if ($attribute->lookup_type) {
$option = $this->attributeRepository->getLookUpEntity($attribute->lookup_type, $value);
} else {
$option = $attribute->options->where('id', $value)->first();
}
$label = $option?->name;
break;
case 'multiselect':
case 'checkbox':
if ($attribute->lookup_type) {
$options = $this->attributeRepository->getLookUpEntity($attribute->lookup_type, explode(',', $value));
} else {
$options = $attribute->options->whereIn('id', explode(',', $value));
}
$optionsLabels = [];
foreach ($options as $key => $option) {
$optionsLabels[] = $option->name;
}
$label = implode(', ', $optionsLabels);
break;
case 'email':
case 'phone':
if (! is_array($value)) {
break;
}
$optionsLabels = [];
foreach ($value as $item) {
$optionsLabels[] = $item['value'].' ('.$item['label'].')';
}
$label = implode(', ', $optionsLabels);
break;
case 'address':
if (
! $value
|| ! count(array_filter($value))
) {
break;
}
$label = $value['address'].'<br>'
.$value['postcode'].' '.$value['city'].'<br>'
.core()->state_name($value['state']).'<br>'
.core()->country_name($value['country']).'<br>';
break;
case 'date':
if ($value) {
$label = Carbon::parse($value)->format('D M d, Y');
} else {
$label = null;
}
break;
case 'datetime':
if ($value) {
$label = Carbon::parse($value)->format('D M d, Y H:i A');
} else {
$label = null;
}
break;
default:
if ($value instanceof Carbon) {
$label = $value->format('D M d, Y H:i A');
} else {
$label = $value;
}
break;
}
return $label ?? null;
}
}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Attribute/src/Repositories/AttributeOptionRepository.php | packages/Webkul/Attribute/src/Repositories/AttributeOptionRepository.php | <?php
namespace Webkul\Attribute\Repositories;
use Webkul\Core\Eloquent\Repository;
class AttributeOptionRepository extends Repository
{
/**
* Specify Model class name
*
* @return mixed
*/
public function model()
{
return 'Webkul\Attribute\Contracts\AttributeOption';
}
}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Attribute/src/Providers/ModuleServiceProvider.php | packages/Webkul/Attribute/src/Providers/ModuleServiceProvider.php | <?php
namespace Webkul\Attribute\Providers;
use Webkul\Core\Providers\BaseModuleServiceProvider;
class ModuleServiceProvider extends BaseModuleServiceProvider
{
protected $models = [
\Webkul\Attribute\Models\Attribute::class,
\Webkul\Attribute\Models\AttributeOption::class,
\Webkul\Attribute\Models\AttributeValue::class,
];
}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Attribute/src/Providers/AttributeServiceProvider.php | packages/Webkul/Attribute/src/Providers/AttributeServiceProvider.php | <?php
namespace Webkul\Attribute\Providers;
use Illuminate\Routing\Router;
use Illuminate\Support\ServiceProvider;
class AttributeServiceProvider extends ServiceProvider
{
/**
* Bootstrap services.
*
* @return void
*/
public function boot(Router $router)
{
$this->loadMigrationsFrom(__DIR__.'/../Database/Migrations');
}
/**
* Register services.
*
* @return void
*/
public function register()
{
$this->registerConfig();
}
/**
* Register package config.
*
* @return void
*/
protected function registerConfig()
{
$this->mergeConfigFrom(
dirname(__DIR__).'/Config/attribute_lookups.php', 'attribute_lookups'
);
}
}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Core/src/Vite.php | packages/Webkul/Core/src/Vite.php | <?php
namespace Webkul\Core;
use Illuminate\Support\Facades\Vite as BaseVite;
use Webkul\Core\Exceptions\ViterNotFound;
class Vite
{
/**
* Return the asset URL.
*
* @return string
*/
public function asset(string $filename, string $namespace = 'admin')
{
$viters = config('krayin-vite.viters');
if (empty($viters[$namespace])) {
throw new ViterNotFound($namespace);
}
$url = trim($filename, '/');
$viteUrl = trim($viters[$namespace]['package_assets_directory'], '/').'/'.$url;
return BaseVite::useHotFile($viters[$namespace]['hot_file'])
->useBuildDirectory($viters[$namespace]['build_directory'])
->asset($viteUrl);
}
/**
* Set krayin vite.
*
* @return mixed
*/
public function set(mixed $entryPoints, string $namespace = 'admin')
{
$viters = config('krayin-vite.viters');
if (empty($viters[$namespace])) {
throw new ViterNotFound($namespace);
}
return BaseVite::useHotFile($viters[$namespace]['hot_file'])
->useBuildDirectory($viters[$namespace]['build_directory'])
->withEntryPoints($entryPoints);
}
}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Core/src/Menu.php | packages/Webkul/Core/src/Menu.php | <?php
namespace Webkul\Core;
use Illuminate\Support\Arr;
use Illuminate\Support\Collection;
use Webkul\Core\Menu\MenuItem;
class Menu
{
/**
* Menu items.
*/
private array $items = [];
/**
* Config menu.
*/
private array $configMenu = [];
/**
* Contains current item key.
*/
private string $currentKey = '';
/**
* Menu area for admin.
*/
const ADMIN = 'admin';
/**
* Menu area for customer.
*/
const CUSTOMER = 'customer';
/**
* Add a new menu item.
*/
public function addItem(MenuItem $menuItem): void
{
$this->items[] = $menuItem;
}
/**
* Get all menu items.
*/
public function getItems(?string $area = null, string $key = ''): Collection
{
if (! $area) {
throw new \Exception('Area must be provided to get menu items.');
}
static $items;
if ($items) {
return $items;
}
$configMenu = collect(config("menu.$area"))->map(function ($item) {
return Arr::except([
...$item,
'url' => route($item['route'], $item['params'] ?? []),
], ['params']);
});
switch ($area) {
case self::ADMIN:
$this->configMenu = $configMenu
->filter(fn ($item) => bouncer()->hasPermission($item['key']))
->toArray();
break;
default:
$this->configMenu = $configMenu->toArray();
break;
}
if (! $this->items) {
$this->prepareMenuItems();
}
$items = collect($this->items)->sortBy(fn ($item) => $item->getPosition());
return $items;
}
/**
* Get admin menu by key or keys.
*/
public function getAdminMenuByKey(array|string $keys): mixed
{
$items = $this->getItems('admin');
$keysArray = (array) $keys;
$filteredItems = $items->filter(fn ($item) => in_array($item->getKey(), $keysArray));
return is_array($keys) ? $filteredItems : $filteredItems->first();
}
/**
* Prepare menu items.
*/
private function prepareMenuItems(): void
{
$menuWithDotNotation = [];
foreach ($this->configMenu as $item) {
if (strpos(request()->url(), route($item['route'])) !== false) {
$this->currentKey = $item['key'];
}
$menuWithDotNotation[$item['key']] = $item;
}
$menu = Arr::undot(Arr::dot($menuWithDotNotation));
foreach ($menu as $menuItemKey => $menuItem) {
$this->addItem(new MenuItem(
key: $menuItemKey,
name: trans($menuItem['name']),
route: $menuItem['route'],
url: $menuItem['url'],
sort: $menuItem['sort'],
icon: $menuItem['icon-class'],
info: trans($menuItem['info'] ?? ''),
children: $this->processSubMenuItems($menuItem),
));
}
}
/**
* Process sub menu items.
*/
private function processSubMenuItems($menuItem): Collection
{
return collect($menuItem)
->sortBy('sort')
->filter(fn ($value) => is_array($value))
->map(function ($subMenuItem) {
$subSubMenuItems = $this->processSubMenuItems($subMenuItem);
return new MenuItem(
key: $subMenuItem['key'],
name: trans($subMenuItem['name']),
route: $subMenuItem['route'],
url: $subMenuItem['url'],
sort: $subMenuItem['sort'],
icon: $subMenuItem['icon-class'],
info: trans($subMenuItem['info'] ?? ''),
children: $subSubMenuItems,
);
});
}
/**
* Get current active menu.
*/
public function getCurrentActiveMenu(?string $area = null): ?MenuItem
{
$currentKey = implode('.', array_slice(explode('.', $this->currentKey), 0, 2));
return $this->findMatchingItem($this->getItems($area), $currentKey);
}
/**
* Finding the matching item.
*/
private function findMatchingItem($items, $currentKey): ?MenuItem
{
foreach ($items as $item) {
if ($item->key == $currentKey) {
return $item;
}
if ($item->haveChildren()) {
$matchingChild = $this->findMatchingItem($item->getChildren(), $currentKey);
if ($matchingChild) {
return $matchingChild;
}
}
}
return null;
}
}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Core/src/Core.php | packages/Webkul/Core/src/Core.php | <?php
namespace Webkul\Core;
use Carbon\Carbon;
use Webkul\Core\Repositories\CoreConfigRepository;
use Webkul\Core\Repositories\CountryRepository;
use Webkul\Core\Repositories\CountryStateRepository;
class Core
{
/**
* The Krayin version.
*
* @var string
*/
const KRAYIN_VERSION = '2.1.6';
/**
* Create a new instance.
*
* @return void
*/
public function __construct(
protected CountryRepository $countryRepository,
protected CoreConfigRepository $coreConfigRepository,
protected CountryStateRepository $countryStateRepository
) {}
/**
* Get the version number of the Krayin.
*
* @return string
*/
public function version()
{
return static::KRAYIN_VERSION;
}
/**
* Retrieve all timezones.
*/
public function timezones(): array
{
$timezones = [];
foreach (timezone_identifiers_list() as $timezone) {
$timezones[$timezone] = $timezone;
}
return $timezones;
}
/**
* Retrieve all locales.
*/
public function locales(): array
{
$options = [];
foreach (config('app.available_locales') as $key => $title) {
$options[] = [
'title' => $title,
'value' => $key,
];
}
return $options;
}
/**
* Retrieve all countries.
*
* @return \Illuminate\Support\Collection
*/
public function countries()
{
return $this->countryRepository->all();
}
/**
* Returns country name by code.
*/
public function country_name(string $code): string
{
$country = $this->countryRepository->findOneByField('code', $code);
return $country ? $country->name : '';
}
/**
* Returns state name by code.
*/
public function state_name(string $code): string
{
$state = $this->countryStateRepository->findOneByField('code', $code);
return $state ? $state->name : $code;
}
/**
* Retrieve all country states.
*
* @return \Illuminate\Support\Collection
*/
public function states(string $countryCode)
{
return $this->countryStateRepository->findByField('country_code', $countryCode);
}
/**
* Retrieve all grouped states by country code.
*
* @return \Illuminate\Support\Collection
*/
public function groupedStatesByCountries()
{
$collection = [];
foreach ($this->countryStateRepository->all() as $state) {
$collection[$state->country_code][] = $state->toArray();
}
return $collection;
}
/**
* Retrieve all grouped states by country code.
*
* @return \Illuminate\Support\Collection
*/
public function findStateByCountryCode($countryCode = null, $stateCode = null)
{
$collection = [];
$collection = $this->countryStateRepository->findByField([
'country_code' => $countryCode,
'code' => $stateCode,
]);
if (count($collection)) {
return $collection->first();
} else {
return false;
}
}
/**
* Create singleton object through single facade.
*
* @param string $className
* @return mixed
*/
public function getSingletonInstance($className)
{
static $instances = [];
if (array_key_exists($className, $instances)) {
return $instances[$className];
}
return $instances[$className] = app($className);
}
/**
* Format date
*
* @return string
*/
public function formatDate($date, $format = 'd M Y h:iA')
{
return Carbon::parse($date)->format($format);
}
/**
* Week range.
*
* @param string $date
* @param int $day
* @return string
*/
public function xWeekRange($date, $day)
{
$ts = strtotime($date);
if (! $day) {
$start = (date('D', $ts) == 'Sun') ? $ts : strtotime('last sunday', $ts);
return date('Y-m-d', $start);
} else {
$end = (date('D', $ts) == 'Sat') ? $ts : strtotime('next saturday', $ts);
return date('Y-m-d', $end);
}
}
/**
* Return currency symbol from currency code.
*
* @param float $price
* @return string
*/
public function currencySymbol($code)
{
$formatter = new \NumberFormatter(app()->getLocale().'@currency='.$code, \NumberFormatter::CURRENCY);
return $formatter->getSymbol(\NumberFormatter::CURRENCY_SYMBOL);
}
/**
* Format price with base currency symbol. This method also give ability to encode
* the base currency symbol and its optional.
*
* @param float $price
* @return string
*/
public function formatBasePrice($price)
{
if (is_null($price)) {
$price = 0;
}
$formatter = new \NumberFormatter(app()->getLocale(), \NumberFormatter::CURRENCY);
return $formatter->formatCurrency($price, config('app.currency'));
}
/**
* Get the config field.
*/
public function getConfigField(string $fieldName): ?array
{
return system_config()->getConfigField($fieldName);
}
/**
* Retrieve information for configuration.
*/
public function getConfigData(string $field): mixed
{
return system_config()->getConfigData($field);
}
}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Core/src/ViewRenderEventManager.php | packages/Webkul/Core/src/ViewRenderEventManager.php | <?php
namespace Webkul\Core;
use Illuminate\Support\Facades\Event;
class ViewRenderEventManager
{
/**
* Contains all templates
*
* @var array
*/
protected $templates = [];
/**
* Parameters passed with event
*
* @var array
*/
protected $params;
/**
* Fires event for rendering template
*
* @param string $eventName
* @param array|null $params
* @return string
*/
public function handleRenderEvent($eventName, $params = null)
{
$this->params = $params ?? [];
Event::dispatch($eventName, $this);
return $this->templates;
}
/**
* get params
*
* @return array
*/
public function getParams()
{
return $this->params;
}
/**
* get param
*
* @return mixed
*/
public function getParam($name)
{
return optional($this->params)[$name];
}
/**
* Add templates for render
*
* @param string $template
* @return void
*/
public function addTemplate($template)
{
array_push($this->templates, $template);
}
/**
* Renders templates
*
* @return string
*/
public function render()
{
$string = '';
foreach ($this->templates as $template) {
if (view()->exists($template)) {
$string .= view($template, $this->params)->render();
} elseif (is_string($template)) {
$string .= $template;
}
}
return $string;
}
}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Core/src/Acl.php | packages/Webkul/Core/src/Acl.php | <?php
namespace Webkul\Core;
use Illuminate\Support\Arr;
use Illuminate\Support\Collection;
use Webkul\Core\Acl\AclItem;
class Acl
{
/**
* acl items.
*/
protected array $items = [];
/**
* Add a new acl item.
*/
public function addItem(AclItem $aclItem): void
{
$this->items[] = $aclItem;
}
/**
* Get all acl items.
*/
public function getItems(): Collection
{
if (! $this->items) {
$this->prepareAclItems();
}
return collect($this->items)
->sortBy('sort')
->values();
}
/**
* Acl Config.
*/
private function getAclConfig(): array
{
static $aclConfig;
if ($aclConfig) {
return $aclConfig;
}
$aclConfig = config('acl');
return $aclConfig;
}
/**
* Get all roles.
*/
public function getRoles(): Collection
{
static $roles;
if ($roles) {
return $roles;
}
$roles = collect($this->getAclConfig())
->mapWithKeys(function ($role) {
if (is_array($role['route'])) {
return collect($role['route'])->mapWithKeys(function ($route) use ($role) {
return [$route => $role['key']];
});
} else {
return [$role['route'] => $role['key']];
}
});
return $roles;
}
/**
* Prepare acl items.
*/
private function prepareAclItems(): void
{
$aclWithDotNotation = [];
foreach ($this->getAclConfig() as $item) {
$aclWithDotNotation[$item['key']] = $item;
}
$acl = Arr::undot(Arr::dot($aclWithDotNotation));
foreach ($acl as $aclItemKey => $aclItem) {
$subAclItems = $this->processSubAclItems($aclItem);
$this->addItem(new AclItem(
key: $aclItemKey,
name: trans($aclItem['name']),
route: $aclItem['route'],
sort: $aclItem['sort'],
children: $subAclItems,
));
}
}
/**
* Process sub acl items.
*/
private function processSubAclItems($aclItem): Collection
{
return collect($aclItem)
->sortBy('sort')
->filter(fn ($value, $key) => is_array($value) && $key !== 'route')
->map(function ($subAclItem) {
$subSubAclItems = $this->processSubAclItems($subAclItem);
return new AclItem(
key: $subAclItem['key'],
name: trans($subAclItem['name']),
route: $subAclItem['route'],
sort: $subAclItem['sort'],
children: $subSubAclItems,
);
});
}
}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Core/src/SystemConfig.php | packages/Webkul/Core/src/SystemConfig.php | <?php
namespace Webkul\Core;
use Illuminate\Support\Arr;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Config;
use Webkul\Core\Repositories\CoreConfigRepository;
use Webkul\Core\SystemConfig\Item;
class SystemConfig
{
/**
* Items array.
*/
public array $items = [];
/**
* Create a new class instance.
*
* @return void
*/
public function __construct(protected CoreConfigRepository $coreConfigRepository) {}
/**
* Add Item.
*/
public function addItem(Item $item): void
{
$this->items[] = $item;
}
/**
* Get all configuration items.
*/
public function getItems(): Collection
{
if (! $this->items) {
$this->prepareConfigurationItems();
}
return collect($this->items)
->sortBy('sort');
}
/**
* Retrieve Core Config
*/
private function retrieveCoreConfig(): array
{
static $items;
if ($items) {
return $items;
}
return $items = config('core_config');
}
/**
* Prepare configuration items.
*/
public function prepareConfigurationItems()
{
$configWithDotNotation = [];
foreach ($this->retrieveCoreConfig() as $item) {
$configWithDotNotation[$item['key']] = $item;
}
$configs = Arr::undot(Arr::dot($configWithDotNotation));
foreach ($configs as $configItem) {
$subConfigItems = $this->processSubConfigItems($configItem);
$this->addItem(new Item(
children: $subConfigItems,
fields: $configItem['fields'] ?? null,
icon: $configItem['icon'] ?? null,
key: $configItem['key'],
name: trans($configItem['name']),
route: $configItem['route'] ?? null,
info: trans($configItem['info']) ?? null,
sort: $configItem['sort'],
));
}
}
/**
* Process sub config items.
*/
private function processSubConfigItems($configItem): Collection
{
return collect($configItem)
->sortBy('sort')
->filter(fn ($value) => is_array($value) && isset($value['name']))
->map(function ($subConfigItem) {
$configItemChildren = $this->processSubConfigItems($subConfigItem);
return new Item(
children: $configItemChildren,
fields: $subConfigItem['fields'] ?? null,
icon: $subConfigItem['icon'] ?? null,
key: $subConfigItem['key'],
name: trans($subConfigItem['name']),
info: trans($subConfigItem['info']) ?? null,
route: $subConfigItem['route'] ?? null,
sort: $subConfigItem['sort'] ?? null,
);
});
}
/**
* Get active configuration item.
*/
public function getActiveConfigurationItem(): ?Item
{
if (! $slug = request()->route('slug')) {
return null;
}
$activeItem = $this->getItems()->where('key', $slug)->first() ?? null;
if (! $activeItem) {
return null;
}
if ($slug2 = request()->route('slug2')) {
$activeItem = $activeItem->getChildren()[$slug2];
}
return $activeItem;
}
/**
* Get config field.
*/
public function getConfigField(string $fieldName): ?array
{
foreach ($this->retrieveCoreConfig() as $coreData) {
if (! isset($coreData['fields'])) {
continue;
}
foreach ($coreData['fields'] as $field) {
$name = $coreData['key'].'.'.$field['name'];
if ($name == $fieldName) {
return $field;
}
}
}
return null;
}
/**
* Get default config.
*/
private function getDefaultConfig(string $field): mixed
{
$configFieldInfo = $this->getConfigField($field);
$fields = explode('.', $field);
array_shift($fields);
$field = implode('.', $fields);
return Config::get($field, $configFieldInfo['default'] ?? null);
}
/**
* Retrieve information for configuration
*/
public function getConfigData(string $field): mixed
{
$coreConfigValue = $this->coreConfigRepository->findOneWhere([
'code' => $field,
]);
if (! $coreConfigValue) {
return $this->getDefaultConfig($field);
}
return $coreConfigValue->value;
}
}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Core/src/Exceptions/ViterNotFound.php | packages/Webkul/Core/src/Exceptions/ViterNotFound.php | <?php
namespace Webkul\Core\Exceptions;
class ViterNotFound extends \Exception
{
/**
* Create an instance.
*
* @param string $theme
* @return void
*/
public function __construct($namespace)
{
parent::__construct("Viter with `$namespace` namespace not found. Please add `$namespace` namespace in the `config/krayin-vite.php` file.", 1);
}
}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Core/src/SystemConfig/Item.php | packages/Webkul/Core/src/SystemConfig/Item.php | <?php
namespace Webkul\Core\SystemConfig;
use Illuminate\Support\Collection;
class Item
{
/**
* Create a new Item instance.
*/
public function __construct(
public Collection $children,
public ?array $fields,
public ?string $icon,
public ?string $info,
public string $key,
public string $name,
public ?string $route = null,
public ?int $sort = null
) {}
/**
* Get name of config item.
*/
public function getName(): string
{
return $this->name ?? '';
}
/**
* Format options.
*/
private function formatOptions($options)
{
return is_array($options) ? $options : (is_string($options) ? $options : []);
}
/**
* Get fields of config item.
*/
public function getFields(): Collection
{
return collect($this->fields)->map(function ($field) {
return new ItemField(
item_key: $this->key,
name: $field['name'],
title: $field['title'],
info: $field['info'] ?? null,
type: $field['type'],
depends: $field['depends'] ?? null,
path: $field['path'] ?? null,
validation: $field['validation'] ?? null,
default: $field['default'] ?? null,
channel_based: $field['channel_based'] ?? null,
locale_based: $field['locale_based'] ?? null,
options: $this->formatOptions($field['options'] ?? null),
tinymce: $field['tinymce'] ?? false,
is_visible: true,
);
});
}
/**
* Get name of config item.
*/
public function getInfo(): ?string
{
return $this->info;
}
/**
* Get current route.
*/
public function getRoute(): string
{
return $this->route;
}
/**
* Get the url of the config item.
*/
public function getUrl(): string
{
return route($this->getRoute());
}
/**
* Get the key of the config item.
*/
public function getKey(): string
{
return $this->key;
}
/**
* Get Icon.
*/
public function getIcon(): ?string
{
return $this->icon;
}
/**
* Check weather config item have children or not.
*/
public function haveChildren(): bool
{
return $this->children->isNotEmpty();
}
/**
* Get children of config item.
*/
public function getChildren(): Collection
{
if (! $this->haveChildren()) {
return collect();
}
return $this->children;
}
}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Core/src/SystemConfig/ItemField.php | packages/Webkul/Core/src/SystemConfig/ItemField.php | <?php
namespace Webkul\Core\SystemConfig;
use Illuminate\Support\Str;
class ItemField
{
/**
* Laravel to Vee Validation mappings.
*
* @var array
*/
protected $veeValidateMappings = [
'min'=> 'min_value',
];
/**
* Create a new ItemField instance.
*/
public function __construct(
public string $item_key,
public string $name,
public string $title,
public ?string $info,
public string $type,
public ?string $path,
public ?string $validation,
public ?string $depends,
public ?string $default,
public ?bool $channel_based,
public ?bool $locale_based,
public array|string $options,
public bool $is_visible = true,
public bool $tinymce = false,
) {
$this->options = $this->getOptions();
}
/**
* Get name of config item.
*/
public function getName(): ?string
{
return $this->name;
}
/**
* Get info of config item.
*/
public function getInfo(): ?string
{
return $this->info ?? '';
}
/**
* Get title of config item.
*/
public function getTitle(): ?string
{
return $this->title ?? '';
}
/**
* Determine if the field should use TinyMCE.
*/
public function getTinymce(): bool
{
return $this->tinymce;
}
/**
* Get type of config item.
*/
public function getType(): string
{
return $this->type;
}
/**
* Get path of config item.
*/
public function getPath(): ?string
{
return $this->path;
}
/**
* Get item key of config item.
*/
public function getItemKey(): string
{
return $this->item_key;
}
/**
* Get validation of config item.
*/
public function getValidations(): ?string
{
if (empty($this->validation)) {
return '';
}
foreach ($this->veeValidateMappings as $laravelRule => $veeValidateRule) {
$this->validation = str_replace($laravelRule, $veeValidateRule, $this->validation);
}
return $this->validation;
}
/**
* Get depends of config item.
*/
public function getDepends(): ?string
{
return $this->depends;
}
/**
* Get default value of config item.
*/
public function getDefault(): ?string
{
return $this->default;
}
/**
* Get channel based of config item.
*/
public function getChannelBased(): ?bool
{
return $this->channel_based;
}
/**
* Get locale based of config item.
*/
public function getLocaleBased(): ?bool
{
return $this->locale_based;
}
/**
* Get name field for forms in configuration page.
*/
public function getNameKey(): string
{
return $this->item_key.'.'.$this->name;
}
/**
* Check if the field is required.
*/
public function isRequired(): string
{
return Str::contains($this->getValidations(), 'required') ? 'required' : '';
}
/**
* Get options of config item.
*/
public function getOptions(): array
{
if (is_array($this->options)) {
return collect($this->options)->map(fn ($option) => [
'title' => trans($option['title']),
'value' => $option['value'],
])->toArray();
}
return collect($this->getFieldOptions($this->options))->map(fn ($option) => [
'title' => trans($option['title']),
'value' => $option['value'],
])->toArray();
}
/**
* Convert the field to an array.
*/
public function toArray()
{
return [
'name' => $this->getName(),
'title' => $this->getTitle(),
'info' => $this->getInfo(),
'type' => $this->getType(),
'path' => $this->getPath(),
'depends' => $this->getDepends(),
'validation' => $this->getValidations(),
'default' => $this->getDefault(),
'channel_based' => $this->getChannelBased(),
'locale_based' => $this->getLocaleBased(),
'options' => $this->getOptions(),
'item_key' => $this->getItemKey(),
'tinymce' => $this->getTinymce(),
];
}
/**
* Get name field for forms in configuration page.
*
* @param string $key
* @return string
*/
public function getNameField($key = null)
{
if (! $key) {
$key = $this->item_key.'.'.$this->name;
}
$nameField = '';
foreach (explode('.', $key) as $key => $field) {
$nameField .= $key === 0 ? $field : '['.$field.']';
}
return $nameField;
}
/**
* Get depend the field name.
*/
public function getDependFieldName(): string
{
if (empty($depends = $this->getDepends())) {
return '';
}
$dependNameKey = $this->getItemKey().'.'.collect(explode(':', $depends))->first();
return $this->getNameField($dependNameKey);
}
/**
* Returns the select options for the field.
*/
protected function getFieldOptions(string $options): array
{
[$class, $method] = Str::parseCallback($options);
return app($class)->$method();
}
}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Core/src/Helpers/Helper.php | packages/Webkul/Core/src/Helpers/Helper.php | <?php
namespace Webkul\Core\Helpers;
class Helper
{
/**
* @param string $packageName
* @return array
*/
public function jsonTranslations($packageName)
{
$currentLocale = app()->getLocale();
$path = __DIR__."/../../../$packageName/src/Resources/lang/$currentLocale/app.php";
if (is_string($path) && is_readable($path)) {
return include $path;
} else {
$currentLocale = 'en';
$path = __DIR__."/../../../$packageName/src/Resources/lang/$currentLocale/app.php";
return include $path;
}
}
}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Core/src/Http/helpers.php | packages/Webkul/Core/src/Http/helpers.php | <?php
use Webkul\Core\Acl;
use Webkul\Core\Core;
use Webkul\Core\Menu;
use Webkul\Core\SystemConfig;
use Webkul\Core\ViewRenderEventManager;
use Webkul\Core\Vite;
if (! function_exists('core')) {
/**
* Core helper.
*/
function core(): Core
{
return app('core');
}
}
if (! function_exists('menu')) {
/**
* Menu helper.
*/
function menu(): Menu
{
return app('menu');
}
}
if (! function_exists('acl')) {
/**
* Acl helper.
*/
function acl(): Acl
{
return app('acl');
}
}
if (! function_exists('system_config')) {
/**
* System Config helper.
*/
function system_config(): SystemConfig
{
return app('system_config');
}
}
if (! function_exists('view_render_event')) {
/**
* View render event helper.
*/
function view_render_event($eventName, $params = null)
{
app()->singleton(ViewRenderEventManager::class);
$viewEventManager = app()->make(ViewRenderEventManager::class);
$viewEventManager->handleRenderEvent($eventName, $params);
return $viewEventManager->render();
}
}
if (! function_exists('vite')) {
/**
* Vite helper.
*/
function vite(): Vite
{
return app(Vite::class);
}
}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Core/src/Http/Controllers/CoreController.php | packages/Webkul/Core/src/Http/Controllers/CoreController.php | <?php
namespace Webkul\Core\Http\Controllers;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Routing\Controller as BaseController;
class CoreController extends BaseController
{
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
protected $_config;
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->_config = request('_config');
}
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
return view($this->_config['view'], $this->_config);
}
}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Core/src/Traits/Sanitizer.php | packages/Webkul/Core/src/Traits/Sanitizer.php | <?php
namespace Webkul\Core\Traits;
use enshrined\svgSanitize\data\AllowedAttributes;
use enshrined\svgSanitize\data\AllowedTags;
use enshrined\svgSanitize\Sanitizer as MainSanitizer;
use Exception;
use Illuminate\Http\UploadedFile;
use Illuminate\Support\Facades\Storage;
/**
* Trait for sanitizing SVG uploads to prevent security vulnerabilities.
*/
trait Sanitizer
{
/**
* Sanitize an SVG file to remove potentially malicious content.
*/
public function sanitizeSvg(string $path, UploadedFile $file): void
{
if (! $this->isSvgFile($file)) {
return;
}
try {
$svgContent = Storage::get($path);
if (! $svgContent) {
return;
}
$sanitizer = new MainSanitizer;
$sanitizer->setAllowedAttrs(new AllowedAttributes);
$sanitizer->setAllowedTags(new AllowedTags);
$sanitizer->minify(true);
$sanitizer->removeRemoteReferences(true);
$sanitizer->removeXMLTag(true);
$sanitizer->setXMLOptions(LIBXML_NONET | LIBXML_NOBLANKS);
$sanitizedContent = $sanitizer->sanitize($svgContent);
if ($sanitizedContent === false) {
$patterns = [
'/<script\b[^>]*>(.*?)<\/script>/is',
'/\bon\w+\s*=\s*["\'][^"\']*["\']/i',
'/javascript\s*:/i',
'/data\s*:[^,]*base64/i',
];
$sanitizedContent = $svgContent;
foreach ($patterns as $pattern) {
$sanitizedContent = preg_replace($pattern, '', $sanitizedContent);
}
Storage::put($path, $sanitizedContent);
return;
}
$sanitizedContent = preg_replace('/(<script.*?>.*?<\/script>)|(\son\w+\s*=\s*["\'][^"\']*["\'])/is', '', $sanitizedContent);
Storage::put($path, $sanitizedContent);
} catch (Exception $e) {
report($e->getMessage());
Storage::delete($path);
}
}
/**
* Check if the uploaded file is an SVG based on both extension and mime type.
*/
public function isSvgFile(UploadedFile $file): bool
{
return str_contains(strtolower($file->getClientOriginalExtension()), 'svg');
}
}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Core/src/Traits/PDFHandler.php | packages/Webkul/Core/src/Traits/PDFHandler.php | <?php
namespace Webkul\Core\Traits;
use Barryvdh\DomPDF\Facade\Pdf;
use Illuminate\Support\Str;
use Mpdf\Mpdf;
trait PDFHandler
{
/**
* Download PDF.
*
* @return \Illuminate\Http\Response
*/
protected function downloadPDF(string $html, ?string $fileName = null)
{
if (is_null($fileName)) {
$fileName = Str::random(32);
}
$html = mb_convert_encoding($html, 'HTML-ENTITIES', 'UTF-8');
if (in_array($direction = app()->getLocale(), ['ar', 'he'])) {
$mPDF = new Mpdf([
'margin_left' => 0,
'margin_right' => 0,
'margin_top' => 0,
'margin_bottom'=> 0,
]);
$mPDF->SetDirectionality($direction);
$mPDF->SetDisplayMode('fullpage');
$mPDF->WriteHTML($this->adjustArabicAndPersianContent($html));
return response()->streamDownload(fn () => print ($mPDF->Output('', 'S')), $fileName.'.pdf');
}
return PDF::loadHTML($this->adjustArabicAndPersianContent($html))
->setPaper('A4', 'portrait')
->set_option('defaultFont', 'Courier')
->download($fileName.'.pdf');
}
/**
* Adjust arabic and persian content.
*
* @return string
*/
protected function adjustArabicAndPersianContent(string $html)
{
$arabic = new \ArPHP\I18N\Arabic;
$p = $arabic->arIdentify($html);
for ($i = count($p) - 1; $i >= 0; $i -= 2) {
$utf8ar = $arabic->utf8Glyphs(substr($html, $p[$i - 1], $p[$i] - $p[$i - 1]));
$html = substr_replace($html, $utf8ar, $p[$i - 1], $p[$i] - $p[$i - 1]);
}
return $html;
}
}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Core/src/Acl/AclItem.php | packages/Webkul/Core/src/Acl/AclItem.php | <?php
namespace Webkul\Core\Acl;
use Illuminate\Support\Collection;
class AclItem
{
/**
* Create a new AclItem instance.
*/
public function __construct(
public string $key,
public string $name,
public array|string $route,
public int $sort,
public Collection $children,
) {}
}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Core/src/Contracts/CountryState.php | packages/Webkul/Core/src/Contracts/CountryState.php | <?php
namespace Webkul\Core\Contracts;
interface CountryState {}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Core/src/Contracts/Country.php | packages/Webkul/Core/src/Contracts/Country.php | <?php
namespace Webkul\Core\Contracts;
interface Country {}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Core/src/Contracts/CoreConfig.php | packages/Webkul/Core/src/Contracts/CoreConfig.php | <?php
namespace Webkul\Core\Contracts;
interface CoreConfig {}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Core/src/Contracts/Validations/Decimal.php | packages/Webkul/Core/src/Contracts/Validations/Decimal.php | <?php
namespace Webkul\Core\Contracts\Validations;
use Closure;
use Illuminate\Contracts\Validation\ValidationRule;
class Decimal implements ValidationRule
{
/**
* Run the validation rule.
*
* @param \Closure(string): \Illuminate\Translation\PotentiallyTranslatedString $fail
*/
public function validate(string $attribute, mixed $value, Closure $fail): void
{
if (! preg_match('/^\d*(\.\d{1,4})?$/', $value)) {
$fail(trans('admin::app.validations.message.decimal', ['attribute' => $attribute]));
}
}
}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Core/src/Contracts/Validations/Code.php | packages/Webkul/Core/src/Contracts/Validations/Code.php | <?php
namespace Webkul\Core\Contracts\Validations;
use Illuminate\Contracts\Validation\Rule;
class Code implements Rule
{
/**
* Determine if the validation rule passes.
*
* @param string $attribute
* @param mixed $value
* @return bool
*/
public function passes($attribute, $value)
{
return preg_match('/^[a-zA-Z]+[a-zA-Z0-9_]+$/', $value);
}
/**
* Get the validation error message.
*
* @return string
*/
public function message()
{
return trans('core::app.validations.code');
}
}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Core/src/Database/Migrations/2025_01_29_133500_update_text_column_type_in_core_config_table.php | packages/Webkul/Core/src/Database/Migrations/2025_01_29_133500_update_text_column_type_in_core_config_table.php | <?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('core_config', function (Blueprint $table) {
$table->text('value')->change();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('core_config', function (Blueprint $table) {
$table->string('value')->change();
});
}
};
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Core/src/Database/Migrations/2021_04_12_173232_create_countries_table.php | packages/Webkul/Core/src/Database/Migrations/2021_04_12_173232_create_countries_table.php | <?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('countries', function (Blueprint $table) {
$table->increments('id');
$table->string('code');
$table->string('name');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('countries');
}
};
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Core/src/Database/Migrations/2021_04_12_173344_create_country_states_table.php | packages/Webkul/Core/src/Database/Migrations/2021_04_12_173344_create_country_states_table.php | <?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('country_states', function (Blueprint $table) {
$table->increments('id');
$table->string('country_code');
$table->string('code');
$table->string('name');
$table->integer('country_id')->unsigned();
$table->foreign('country_id')->references('id')->on('countries')->onDelete('cascade');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('country_states');
}
};
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Core/src/Database/Migrations/2021_03_12_060658_create_core_config_table.php | packages/Webkul/Core/src/Database/Migrations/2021_03_12_060658_create_core_config_table.php | <?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('core_config', function (Blueprint $table) {
$table->increments('id');
$table->string('code');
$table->string('value');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('core_config');
}
};
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Core/src/Facades/Menu.php | packages/Webkul/Core/src/Facades/Menu.php | <?php
namespace Webkul\Core\Facades;
use Illuminate\Support\Facades\Facade;
class Menu extends Facade
{
/**
* Get the registered name of the component.
*
* @return string
*/
protected static function getFacadeAccessor()
{
return 'menu';
}
}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Core/src/Facades/Core.php | packages/Webkul/Core/src/Facades/Core.php | <?php
namespace Webkul\Core\Facades;
use Illuminate\Support\Facades\Facade;
class Core extends Facade
{
/**
* Get the registered name of the component.
*
* @return string
*/
protected static function getFacadeAccessor()
{
return 'core';
}
}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Core/src/Facades/Acl.php | packages/Webkul/Core/src/Facades/Acl.php | <?php
namespace Webkul\Core\Facades;
use Illuminate\Support\Facades\Facade;
class Acl extends Facade
{
/**
* Get the registered name of the component.
*
* @return string
*/
protected static function getFacadeAccessor()
{
return 'acl';
}
}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Core/src/Facades/SystemConfig.php | packages/Webkul/Core/src/Facades/SystemConfig.php | <?php
namespace Webkul\Core\Facades;
use Illuminate\Support\Facades\Facade;
class SystemConfig extends Facade
{
/**
* Get the registered name of the component.
*
* @return string
*/
protected static function getFacadeAccessor()
{
return 'system_config';
}
}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Core/src/Console/Commands/Version.php | packages/Webkul/Core/src/Console/Commands/Version.php | <?php
namespace Webkul\Core\Console\Commands;
use Illuminate\Console\Command;
class Version extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'krayin-crm:version';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Displays current version of Krayin CRM installed';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$this->comment('v'.core()->version());
}
}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Core/src/Config/concord.php | packages/Webkul/Core/src/Config/concord.php | <?php
return [
'modules' => [
\Webkul\Activity\Providers\ModuleServiceProvider::class,
\Webkul\Admin\Providers\ModuleServiceProvider::class,
\Webkul\Attribute\Providers\ModuleServiceProvider::class,
\Webkul\Automation\Providers\ModuleServiceProvider::class,
\Webkul\Contact\Providers\ModuleServiceProvider::class,
\Webkul\Core\Providers\ModuleServiceProvider::class,
\Webkul\DataGrid\Providers\ModuleServiceProvider::class,
\Webkul\EmailTemplate\Providers\ModuleServiceProvider::class,
\Webkul\Email\Providers\ModuleServiceProvider::class,
\Webkul\Lead\Providers\ModuleServiceProvider::class,
\Webkul\Product\Providers\ModuleServiceProvider::class,
\Webkul\Quote\Providers\ModuleServiceProvider::class,
\Webkul\Tag\Providers\ModuleServiceProvider::class,
\Webkul\User\Providers\ModuleServiceProvider::class,
\Webkul\Warehouse\Providers\ModuleServiceProvider::class,
\Webkul\WebForm\Providers\ModuleServiceProvider::class,
\Webkul\DataTransfer\Providers\ModuleServiceProvider::class,
],
'register_route_models' => true,
];
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Core/src/Config/cors.php | packages/Webkul/Core/src/Config/cors.php | <?php
return [
/*
|--------------------------------------------------------------------------
| Laravel CORS Options
|--------------------------------------------------------------------------
|
| The allowed_methods and allowed_headers options are case-insensitive.
|
| You don't need to provide both allowed_origins and allowed_origins_patterns.
| If one of the strings passed matches, it is considered a valid origin.
|
| If ['*'] is provided to allowed_methods, allowed_origins or allowed_headers
| all methods / origins / headers are allowed.
|
*/
/*
* You can enable CORS for 1 or multiple paths.
* Example: ['api/*']
*/
'paths' => [
'admin/web-forms/forms/*',
],
/*
* Matches the request method. `['*']` allows all methods.
*/
'allowed_methods' => ['*'],
/*
* Matches the request origin. `['*']` allows all origins. Wildcards can be used, eg `*.mydomain.com`
*/
'allowed_origins' => ['*'],
/*
* Patterns that can be used with `preg_match` to match the origin.
*/
'allowed_origins_patterns' => [],
/*
* Sets the Access-Control-Allow-Headers response header. `['*']` allows all headers.
*/
'allowed_headers' => ['*'],
/*
* Sets the Access-Control-Expose-Headers response header with these headers.
*/
'exposed_headers' => [],
/*
* Sets the Access-Control-Max-Age response header when > 0.
*/
'max_age' => 0,
/*
* Sets the Access-Control-Allow-Credentials header.
*/
'supports_credentials' => false,
];
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Core/src/Config/sanctum.php | packages/Webkul/Core/src/Config/sanctum.php | <?php
return [
/*
|--------------------------------------------------------------------------
| Stateful Domains
|--------------------------------------------------------------------------
|
| Requests from the following domains / hosts will receive stateful API
| authentication cookies. Typically, these should include your local
| and production domains which access your API via a frontend SPA.
|
*/
'stateful' => explode(',', env('SANCTUM_STATEFUL_DOMAINS', sprintf(
'%s%s',
'localhost,localhost:3000,127.0.0.1,127.0.0.1:8000,::1',
env('APP_URL') ? ','.parse_url(env('APP_URL'), PHP_URL_HOST) : ''
))),
/*
|--------------------------------------------------------------------------
| Sanctum Guards
|--------------------------------------------------------------------------
|
| This array contains the authentication guards that will be checked when
| Sanctum is trying to authenticate a request. If none of these guards
| are able to authenticate the request, Sanctum will use the bearer
| token that's present on an incoming request for authentication.
|
*/
'guard' => ['user'],
/*
|--------------------------------------------------------------------------
| Expiration Minutes
|--------------------------------------------------------------------------
|
| This value controls the number of minutes until an issued token will be
| considered expired. If this value is null, personal access tokens do
| not expire. This won't tweak the lifetime of first-party sessions.
|
*/
'expiration' => null,
/*
|--------------------------------------------------------------------------
| Sanctum Middleware
|--------------------------------------------------------------------------
|
| When authenticating your first-party SPA with Sanctum you may need to
| customize some of the middleware Sanctum uses while processing the
| request. You may change the middleware listed below as required.
|
*/
'middleware' => [
'verify_csrf_token' => App\Http\Middleware\VerifyCsrfToken::class,
'encrypt_cookies' => App\Http\Middleware\EncryptCookies::class,
],
];
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Core/src/Menu/MenuItem.php | packages/Webkul/Core/src/Menu/MenuItem.php | <?php
namespace Webkul\Core\Menu;
use Illuminate\Support\Collection;
class MenuItem
{
/**
* Create a new MenuItem instance.
*
* @return void
*/
public function __construct(
private string $key,
private string $name,
private string $route,
private string $url,
private int $sort,
private string $icon,
private string $info,
private Collection $children,
) {}
/**
* Set name of menu item.
*/
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
/**
* Get name of menu item.
*/
public function getName(): string
{
return $this->name;
}
/**
* Set position of menu item.
*/
public function setPosition(int $sort): self
{
$this->sort = $sort;
return $this;
}
/**
* Get position of menu item.
*/
public function getPosition()
{
return $this->sort;
}
/**
* Set icon of menu item.
*/
public function setIcon(string $icon): self
{
$this->icon = $icon;
return $this;
}
/**
* Get the icon of menu item.
*/
public function getIcon(): string
{
return $this->icon;
}
/**
* Set info of menu item.
*/
public function setInfo(string $info): self
{
$this->info = $info;
return $this;
}
/**
* Get info of menu item.
*/
public function getInfo(): string
{
return $this->info;
}
/**
* Set route of menu item.
*/
public function setRoute(string $route): self
{
$this->route = $route;
return $this;
}
/**
* Get current route.
*/
public function getRoute(): string
{
return $this->route;
}
/**
* Set url of menu item.
*/
public function setUrl(string $url): self
{
$this->url = $url;
return $this;
}
/**
* Get the url of the menu item.
*/
public function getUrl(): string
{
return $this->url;
}
/**
* Set the key of the menu item.
*/
public function setKey(string $key): self
{
$this->key = $key;
return $this;
}
/**
* Get the key of the menu item.
*/
public function getKey(): string
{
return $this->key;
}
/**
* Set children of menu item.
*/
public function setChildren(Collection $children): self
{
$this->children = $children;
return $this;
}
/**
* Check weather menu item have children or not.
*/
public function haveChildren(): bool
{
return $this->children->isNotEmpty();
}
/**
* Get children of menu item.
*/
public function getChildren(): Collection
{
if (! $this->haveChildren()) {
return collect();
}
return $this->children;
}
/**
* Check weather menu item is active or not.
*/
public function isActive(): bool
{
if (request()->fullUrlIs($this->getUrl().'*')) {
return true;
}
if ($this->haveChildren()) {
foreach ($this->getChildren() as $child) {
if ($child->isActive()) {
return true;
}
}
}
return false;
}
}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Core/src/Resources/lang/pt_BR/app.php | packages/Webkul/Core/src/Resources/lang/pt_BR/app.php | <?php
return [
'validations' => [
'code' => 'O campo deve ser um código válido.',
'decimal' => 'O campo deve ser um número decimal.',
],
];
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Core/src/Resources/lang/tr/app.php | packages/Webkul/Core/src/Resources/lang/tr/app.php | <?php
return [
'validations' => [
'code' => 'Alan geçerli bir kod olmalıdır.',
'decimal' => 'Alan ondalık bir sayı olmalıdır.',
],
];
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Core/src/Resources/lang/en/app.php | packages/Webkul/Core/src/Resources/lang/en/app.php | <?php
return [
'validations' => [
'code' => 'The field must be a valid code.',
'decimal' => 'The field must be a decimal number.',
],
];
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Core/src/Resources/lang/ar/app.php | packages/Webkul/Core/src/Resources/lang/ar/app.php | <?php
return [
'validations' => [
'code' => 'يجب أن يكون الحقل رمزًا صالحًا.',
'decimal' => 'يجب أن يكون الحقل رقمًا عشريًا.',
],
];
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Core/src/Resources/lang/vi/app.php | packages/Webkul/Core/src/Resources/lang/vi/app.php | <?php
return [
'validations' => [
'code' => 'Trường phải là một mã hợp lệ.',
'decimal' => 'Trường phải là một số thập phân.',
],
];
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Core/src/Resources/lang/fa/app.php | packages/Webkul/Core/src/Resources/lang/fa/app.php | <?php
return [
'validations' => [
'code' => 'این فیلد باید یک کد معتبر باشد.',
'decimal' => 'این فیلد باید یک عدد اعشاری باشد.',
],
];
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Core/src/Resources/lang/es/app.php | packages/Webkul/Core/src/Resources/lang/es/app.php | <?php
return [
'validations' => [
'code' => 'El campo debe ser un código válido.',
'decimal' => 'El campo debe ser un número decimal.',
],
];
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Core/src/Models/CountryState.php | packages/Webkul/Core/src/Models/CountryState.php | <?php
namespace Webkul\Core\Models;
use Illuminate\Database\Eloquent\Model;
use Webkul\Core\Contracts\CountryState as CountryStateContract;
class CountryState extends Model implements CountryStateContract
{
public $timestamps = false;
}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Core/src/Models/CountryStateProxy.php | packages/Webkul/Core/src/Models/CountryStateProxy.php | <?php
namespace Webkul\Core\Models;
use Konekt\Concord\Proxies\ModelProxy;
class CountryStateProxy extends ModelProxy {}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Core/src/Models/CoreConfigProxy.php | packages/Webkul/Core/src/Models/CoreConfigProxy.php | <?php
namespace Webkul\Core\Models;
use Konekt\Concord\Proxies\ModelProxy;
class CoreConfigProxy extends ModelProxy {}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.