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 |
|---|---|---|---|---|---|---|---|---|
SpartnerNL/Laravel-Excel | https://github.com/SpartnerNL/Laravel-Excel/blob/b31b6f4eabd8b5ff3f873e808abd183d3f5cb244/tests/Data/Stubs/FromNonEloquentQueryExport.php | tests/Data/Stubs/FromNonEloquentQueryExport.php | <?php
namespace Maatwebsite\Excel\Tests\Data\Stubs;
use Illuminate\Database\Eloquent\Builder as EloquentBuilder;
use Illuminate\Database\Eloquent\Relations\Relation;
use Illuminate\Database\Query\Builder;
use Illuminate\Support\Facades\DB;
use Maatwebsite\Excel\Concerns\Exportable;
use Maatwebsite\Excel\Concerns\FromQuery;
use Maatwebsite\Excel\Concerns\WithCustomChunkSize;
class FromNonEloquentQueryExport implements FromQuery, WithCustomChunkSize
{
use Exportable;
/**
* @return Builder|EloquentBuilder|Relation
*/
public function query()
{
return DB::table('users')->select('name')->orderBy('id');
}
/**
* @return int
*/
public function chunkSize(): int
{
return 10;
}
}
| php | MIT | b31b6f4eabd8b5ff3f873e808abd183d3f5cb244 | 2026-01-04T15:03:06.866936Z | false |
SpartnerNL/Laravel-Excel | https://github.com/SpartnerNL/Laravel-Excel/blob/b31b6f4eabd8b5ff3f873e808abd183d3f5cb244/tests/Data/Stubs/CustomConcern.php | tests/Data/Stubs/CustomConcern.php | <?php
namespace Maatwebsite\Excel\Tests\Data\Stubs;
interface CustomConcern
{
public function custom();
}
| php | MIT | b31b6f4eabd8b5ff3f873e808abd183d3f5cb244 | 2026-01-04T15:03:06.866936Z | false |
SpartnerNL/Laravel-Excel | https://github.com/SpartnerNL/Laravel-Excel/blob/b31b6f4eabd8b5ff3f873e808abd183d3f5cb244/tests/Data/Stubs/ImportWithRegistersEventListeners.php | tests/Data/Stubs/ImportWithRegistersEventListeners.php | <?php
namespace Maatwebsite\Excel\Tests\Data\Stubs;
use Maatwebsite\Excel\Concerns\Importable;
use Maatwebsite\Excel\Concerns\RegistersEventListeners;
use Maatwebsite\Excel\Concerns\WithEvents;
class ImportWithRegistersEventListeners implements WithEvents
{
use Importable, RegistersEventListeners;
/**
* @var callable
*/
public static $beforeImport;
/**
* @var callable
*/
public static $beforeSheet;
/**
* @var callable
*/
public static $afterSheet;
public static function beforeImport()
{
(static::$beforeImport)(...func_get_args());
}
public static function beforeSheet()
{
(static::$beforeSheet)(...func_get_args());
}
public static function afterSheet()
{
(static::$afterSheet)(...func_get_args());
}
}
| php | MIT | b31b6f4eabd8b5ff3f873e808abd183d3f5cb244 | 2026-01-04T15:03:06.866936Z | false |
SpartnerNL/Laravel-Excel | https://github.com/SpartnerNL/Laravel-Excel/blob/b31b6f4eabd8b5ff3f873e808abd183d3f5cb244/tests/Data/Stubs/FromUsersQueryExportWithMapping.php | tests/Data/Stubs/FromUsersQueryExportWithMapping.php | <?php
namespace Maatwebsite\Excel\Tests\Data\Stubs;
use Illuminate\Database\Eloquent\Builder as EloquentBuilder;
use Illuminate\Database\Eloquent\Relations\Relation;
use Illuminate\Database\Query\Builder;
use Maatwebsite\Excel\Concerns\Exportable;
use Maatwebsite\Excel\Concerns\FromQuery;
use Maatwebsite\Excel\Concerns\WithEvents;
use Maatwebsite\Excel\Concerns\WithMapping;
use Maatwebsite\Excel\Events\BeforeSheet;
use Maatwebsite\Excel\Tests\Data\Stubs\Database\User;
class FromUsersQueryExportWithMapping implements FromQuery, WithMapping, WithEvents
{
use Exportable;
/**
* @return Builder|EloquentBuilder|Relation
*/
public function query()
{
return User::query();
}
/**
* @return array
*/
public function registerEvents(): array
{
return [
BeforeSheet::class => function (BeforeSheet $event) {
$event->sheet->chunkSize(10);
},
];
}
/**
* @param User $row
* @return array
*/
public function map($row): array
{
return [
'name' => $row->name,
];
}
}
| php | MIT | b31b6f4eabd8b5ff3f873e808abd183d3f5cb244 | 2026-01-04T15:03:06.866936Z | false |
SpartnerNL/Laravel-Excel | https://github.com/SpartnerNL/Laravel-Excel/blob/b31b6f4eabd8b5ff3f873e808abd183d3f5cb244/tests/Data/Stubs/ExportWithRegistersEventListeners.php | tests/Data/Stubs/ExportWithRegistersEventListeners.php | <?php
namespace Maatwebsite\Excel\Tests\Data\Stubs;
use Maatwebsite\Excel\Concerns\Exportable;
use Maatwebsite\Excel\Concerns\RegistersEventListeners;
use Maatwebsite\Excel\Concerns\WithEvents;
class ExportWithRegistersEventListeners implements WithEvents
{
use Exportable, RegistersEventListeners;
/**
* @var callable
*/
public static $beforeExport;
/**
* @var callable
*/
public static $beforeWriting;
/**
* @var callable
*/
public static $beforeSheet;
/**
* @var callable
*/
public static $afterSheet;
public static function beforeExport()
{
(static::$beforeExport)(...func_get_args());
}
public static function beforeWriting()
{
(static::$beforeWriting)(...func_get_args());
}
public static function beforeSheet()
{
(static::$beforeSheet)(...func_get_args());
}
public static function afterSheet()
{
(static::$afterSheet)(...func_get_args());
}
}
| php | MIT | b31b6f4eabd8b5ff3f873e808abd183d3f5cb244 | 2026-01-04T15:03:06.866936Z | false |
SpartnerNL/Laravel-Excel | https://github.com/SpartnerNL/Laravel-Excel/blob/b31b6f4eabd8b5ff3f873e808abd183d3f5cb244/tests/Data/Stubs/EloquentCollectionWithMappingExport.php | tests/Data/Stubs/EloquentCollectionWithMappingExport.php | <?php
namespace Maatwebsite\Excel\Tests\Data\Stubs;
use Illuminate\Database\Eloquent\Collection;
use Maatwebsite\Excel\Concerns\Exportable;
use Maatwebsite\Excel\Concerns\FromCollection;
use Maatwebsite\Excel\Concerns\WithMapping;
use Maatwebsite\Excel\Tests\Data\Stubs\Database\User;
class EloquentCollectionWithMappingExport implements FromCollection, WithMapping
{
use Exportable;
/**
* @return Collection
*/
public function collection()
{
return collect([
new User([
'firstname' => 'Patrick',
'lastname' => 'Brouwers',
]),
]);
}
/**
* @param User $user
* @return array
*/
public function map($user): array
{
return [
$user->firstname,
$user->lastname,
];
}
}
| php | MIT | b31b6f4eabd8b5ff3f873e808abd183d3f5cb244 | 2026-01-04T15:03:06.866936Z | false |
SpartnerNL/Laravel-Excel | https://github.com/SpartnerNL/Laravel-Excel/blob/b31b6f4eabd8b5ff3f873e808abd183d3f5cb244/tests/Data/Stubs/EmptyExport.php | tests/Data/Stubs/EmptyExport.php | <?php
namespace Maatwebsite\Excel\Tests\Data\Stubs;
use Maatwebsite\Excel\Concerns\Exportable;
class EmptyExport
{
use Exportable;
}
| php | MIT | b31b6f4eabd8b5ff3f873e808abd183d3f5cb244 | 2026-01-04T15:03:06.866936Z | false |
SpartnerNL/Laravel-Excel | https://github.com/SpartnerNL/Laravel-Excel/blob/b31b6f4eabd8b5ff3f873e808abd183d3f5cb244/tests/Data/Stubs/QueuedImportWithMiddleware.php | tests/Data/Stubs/QueuedImportWithMiddleware.php | <?php
namespace Maatwebsite\Excel\Tests\Data\Stubs;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Database\Eloquent\Model;
use Maatwebsite\Excel\Concerns\Importable;
use Maatwebsite\Excel\Concerns\ToModel;
use Maatwebsite\Excel\Concerns\WithChunkReading;
use Maatwebsite\Excel\Tests\Data\Stubs\Database\Group;
class QueuedImportWithMiddleware implements ShouldQueue, ToModel, WithChunkReading
{
use Importable;
/**
* @param array $row
* @return Model|null
*/
public function model(array $row)
{
return new Group([
'name' => $row[0],
]);
}
public function middleware()
{
return [function () {
throw new \Exception('Job reached middleware method');
}];
}
/**
* @return int
*/
public function chunkSize(): int
{
return 100;
}
}
| php | MIT | b31b6f4eabd8b5ff3f873e808abd183d3f5cb244 | 2026-01-04T15:03:06.866936Z | false |
SpartnerNL/Laravel-Excel | https://github.com/SpartnerNL/Laravel-Excel/blob/b31b6f4eabd8b5ff3f873e808abd183d3f5cb244/tests/Data/Stubs/Database/User.php | tests/Data/Stubs/Database/User.php | <?php
namespace Maatwebsite\Excel\Tests\Data\Stubs\Database;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Laravel\Scout\Engines\DatabaseEngine;
use Laravel\Scout\Engines\Engine;
use Laravel\Scout\Engines\NullEngine;
use Laravel\Scout\Searchable;
use Maatwebsite\Excel\Tests\Concerns\FromQueryTest;
use Maatwebsite\Excel\Tests\QueuedQueryExportTest;
class User extends Model
{
use Searchable;
/**
* @var array
*/
protected $guarded = [];
/**
* @var array
*/
protected $casts = [
'options' => 'array',
];
/**
* @var array
*/
protected $hidden = ['password', 'email_verified_at', 'options', 'group_id'];
public function groups(): BelongsToMany
{
return $this->belongsToMany(Group::class);
}
public function group(): BelongsTo
{
return $this->belongsTo(Group::class);
}
/**
* Laravel Scout under <=8 provides only
* — NullEngine, that is searches nothing and not applicable for tests and
* — AlgoliaEngine, that is 3-d party dependent and not applicable for tests too.
*
* The only test-ready engine is DatabaseEngine that comes with Scout >8
*
* Then running tests we will examine engine and skip test until DatabaseEngine is provided.
*
* @see QueuedQueryExportTest::can_queue_scout_export()
* @see FromQueryTest::can_export_from_scout()
*/
public function searchableUsing(): Engine
{
return class_exists('\Laravel\Scout\Engines\DatabaseEngine') ? new DatabaseEngine() : new NullEngine();
}
}
| php | MIT | b31b6f4eabd8b5ff3f873e808abd183d3f5cb244 | 2026-01-04T15:03:06.866936Z | false |
SpartnerNL/Laravel-Excel | https://github.com/SpartnerNL/Laravel-Excel/blob/b31b6f4eabd8b5ff3f873e808abd183d3f5cb244/tests/Data/Stubs/Database/Group.php | tests/Data/Stubs/Database/Group.php | <?php
namespace Maatwebsite\Excel\Tests\Data\Stubs\Database;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
class Group extends Model
{
public $timestamps = false;
protected $guarded = [];
/**
* @return BelongsToMany
*/
public function users(): BelongsToMany
{
return $this->belongsToMany(User::class);
}
}
| php | MIT | b31b6f4eabd8b5ff3f873e808abd183d3f5cb244 | 2026-01-04T15:03:06.866936Z | false |
SpartnerNL/Laravel-Excel | https://github.com/SpartnerNL/Laravel-Excel/blob/b31b6f4eabd8b5ff3f873e808abd183d3f5cb244/tests/Data/Stubs/Database/Migrations/0000_00_00_000000_create_groups_table.php | tests/Data/Stubs/Database/Migrations/0000_00_00_000000_create_groups_table.php | <?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateGroupsTable extends Migration
{
/**
* Run the migrations.
*/
public function up()
{
Schema::create('groups', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down()
{
Schema::dropIfExists('groups');
}
}
| php | MIT | b31b6f4eabd8b5ff3f873e808abd183d3f5cb244 | 2026-01-04T15:03:06.866936Z | false |
SpartnerNL/Laravel-Excel | https://github.com/SpartnerNL/Laravel-Excel/blob/b31b6f4eabd8b5ff3f873e808abd183d3f5cb244/tests/Data/Stubs/Database/Migrations/0000_00_00_000002_add_options_to_users.php | tests/Data/Stubs/Database/Migrations/0000_00_00_000002_add_options_to_users.php | <?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddOptionsToUsers extends Migration
{
/**
* Run the migrations.
*/
public function up()
{
Schema::table('users', function (Blueprint $table) {
$table->text('options')->nullable();
});
}
/**
* Reverse the migrations.
*/
public function down()
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn('options');
});
}
}
| php | MIT | b31b6f4eabd8b5ff3f873e808abd183d3f5cb244 | 2026-01-04T15:03:06.866936Z | false |
SpartnerNL/Laravel-Excel | https://github.com/SpartnerNL/Laravel-Excel/blob/b31b6f4eabd8b5ff3f873e808abd183d3f5cb244/tests/Data/Stubs/Database/Migrations/0000_00_00_000002_add_group_id_to_users_table.php | tests/Data/Stubs/Database/Migrations/0000_00_00_000002_add_group_id_to_users_table.php | <?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddGroupIdToUsersTable extends Migration
{
/**
* Run the migrations.
*/
public function up()
{
Schema::table('users', function (Blueprint $table) {
$table->unsignedInteger('group_id')->index()->nullable();
});
}
/**
* Reverse the migrations.
*/
public function down()
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn('group_id');
});
}
}
| php | MIT | b31b6f4eabd8b5ff3f873e808abd183d3f5cb244 | 2026-01-04T15:03:06.866936Z | false |
SpartnerNL/Laravel-Excel | https://github.com/SpartnerNL/Laravel-Excel/blob/b31b6f4eabd8b5ff3f873e808abd183d3f5cb244/tests/Data/Stubs/Database/Migrations/0000_00_00_000001_create_group_user_table.php | tests/Data/Stubs/Database/Migrations/0000_00_00_000001_create_group_user_table.php | <?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateGroupUserTable extends Migration
{
/**
* Run the migrations.
*/
public function up()
{
Schema::create('group_user', function (Blueprint $table) {
$table->increments('id');
$table->unsignedInteger('group_id')->index();
$table->unsignedInteger('user_id')->index();
});
}
/**
* Reverse the migrations.
*/
public function down()
{
Schema::dropIfExists('group_user');
}
}
| php | MIT | b31b6f4eabd8b5ff3f873e808abd183d3f5cb244 | 2026-01-04T15:03:06.866936Z | false |
SpartnerNL/Laravel-Excel | https://github.com/SpartnerNL/Laravel-Excel/blob/b31b6f4eabd8b5ff3f873e808abd183d3f5cb244/tests/Data/Stubs/Database/Factories/UserFactory.php | tests/Data/Stubs/Database/Factories/UserFactory.php | <?php
use Faker\Generator as Faker;
use Illuminate\Support\Str;
use Maatwebsite\Excel\Tests\Data\Stubs\Database\User;
/*
|--------------------------------------------------------------------------
| Model Factories
|--------------------------------------------------------------------------
|
| This directory should contain each of the model factory definitions for
| your application. Factories provide a convenient way to generate new
| model instances for testing / seeding your application's database.
|
*/
$factory->define(User::class, function (Faker $faker) {
return [
'name' => $faker->name,
'email' => $faker->unique()->safeEmail,
'password' => '$2y$10$TKh8H1.PfQx37YgCzwiKb.KjNyWgaHb9cbcoQgdIVFlYg7B77UdFm', // secret
'remember_token' => Str::random(10),
];
});
| php | MIT | b31b6f4eabd8b5ff3f873e808abd183d3f5cb244 | 2026-01-04T15:03:06.866936Z | false |
SpartnerNL/Laravel-Excel | https://github.com/SpartnerNL/Laravel-Excel/blob/b31b6f4eabd8b5ff3f873e808abd183d3f5cb244/tests/Data/Stubs/Database/Factories/GroupFactory.php | tests/Data/Stubs/Database/Factories/GroupFactory.php | <?php
use Faker\Generator as Faker;
use Maatwebsite\Excel\Tests\Data\Stubs\Database\Group;
/*
|--------------------------------------------------------------------------
| Model Factories
|--------------------------------------------------------------------------
|
| This directory should contain each of the model factory definitions for
| your application. Factories provide a convenient way to generate new
| model instances for testing / seeding your application's database.
|
*/
$factory->define(Group::class, function (Faker $faker) {
return [
'name' => $faker->word,
];
});
| php | MIT | b31b6f4eabd8b5ff3f873e808abd183d3f5cb244 | 2026-01-04T15:03:06.866936Z | false |
SpartnerNL/Laravel-Excel | https://github.com/SpartnerNL/Laravel-Excel/blob/b31b6f4eabd8b5ff3f873e808abd183d3f5cb244/tests/Data/Stubs/Views/users.blade.php | tests/Data/Stubs/Views/users.blade.php | <table>
<thead>
<tr>
<th>Name</th>
<th>Email</th>
</tr>
</thead>
<tbody>
@foreach($users as $user)
<tr>
<td>{{ $user->name }}</td>
<td>{{ $user->email }}</td>
</tr>
@endforeach
</tbody>
</table> | php | MIT | b31b6f4eabd8b5ff3f873e808abd183d3f5cb244 | 2026-01-04T15:03:06.866936Z | false |
SpartnerNL/Laravel-Excel | https://github.com/SpartnerNL/Laravel-Excel/blob/b31b6f4eabd8b5ff3f873e808abd183d3f5cb244/config/excel.php | config/excel.php | <?php
use Maatwebsite\Excel\Excel;
use PhpOffice\PhpSpreadsheet\Reader\Csv;
return [
'exports' => [
/*
|--------------------------------------------------------------------------
| Chunk size
|--------------------------------------------------------------------------
|
| When using FromQuery, the query is automatically chunked.
| Here you can specify how big the chunk should be.
|
*/
'chunk_size' => 1000,
/*
|--------------------------------------------------------------------------
| Pre-calculate formulas during export
|--------------------------------------------------------------------------
*/
'pre_calculate_formulas' => false,
/*
|--------------------------------------------------------------------------
| Enable strict null comparison
|--------------------------------------------------------------------------
|
| When enabling strict null comparison empty cells ('') will
| be added to the sheet.
*/
'strict_null_comparison' => false,
/*
|--------------------------------------------------------------------------
| CSV Settings
|--------------------------------------------------------------------------
|
| Configure e.g. delimiter, enclosure and line ending for CSV exports.
|
*/
'csv' => [
'delimiter' => ',',
'enclosure' => '"',
'line_ending' => PHP_EOL,
'use_bom' => false,
'include_separator_line' => false,
'excel_compatibility' => false,
'output_encoding' => '',
'test_auto_detect' => true,
],
/*
|--------------------------------------------------------------------------
| Worksheet properties
|--------------------------------------------------------------------------
|
| Configure e.g. default title, creator, subject,...
|
*/
'properties' => [
'creator' => '',
'lastModifiedBy' => '',
'title' => '',
'description' => '',
'subject' => '',
'keywords' => '',
'category' => '',
'manager' => '',
'company' => '',
],
],
'imports' => [
/*
|--------------------------------------------------------------------------
| Read Only
|--------------------------------------------------------------------------
|
| When dealing with imports, you might only be interested in the
| data that the sheet exists. By default we ignore all styles,
| however if you want to do some logic based on style data
| you can enable it by setting read_only to false.
|
*/
'read_only' => true,
/*
|--------------------------------------------------------------------------
| Ignore Empty
|--------------------------------------------------------------------------
|
| When dealing with imports, you might be interested in ignoring
| rows that have null values or empty strings. By default rows
| containing empty strings or empty values are not ignored but can be
| ignored by enabling the setting ignore_empty to true.
|
*/
'ignore_empty' => false,
/*
|--------------------------------------------------------------------------
| Heading Row Formatter
|--------------------------------------------------------------------------
|
| Configure the heading row formatter.
| Available options: none|slug|custom
|
*/
'heading_row' => [
'formatter' => 'slug',
],
/*
|--------------------------------------------------------------------------
| CSV Settings
|--------------------------------------------------------------------------
|
| Configure e.g. delimiter, enclosure and line ending for CSV imports.
|
*/
'csv' => [
'delimiter' => null,
'enclosure' => '"',
'escape_character' => '\\',
'contiguous' => false,
'input_encoding' => Csv::GUESS_ENCODING,
],
/*
|--------------------------------------------------------------------------
| Worksheet properties
|--------------------------------------------------------------------------
|
| Configure e.g. default title, creator, subject,...
|
*/
'properties' => [
'creator' => '',
'lastModifiedBy' => '',
'title' => '',
'description' => '',
'subject' => '',
'keywords' => '',
'category' => '',
'manager' => '',
'company' => '',
],
/*
|--------------------------------------------------------------------------
| Cell Middleware
|--------------------------------------------------------------------------
|
| Configure middleware that is executed on getting a cell value
|
*/
'cells' => [
'middleware' => [
//\Maatwebsite\Excel\Middleware\TrimCellValue::class,
//\Maatwebsite\Excel\Middleware\ConvertEmptyCellValuesToNull::class,
],
],
],
/*
|--------------------------------------------------------------------------
| Extension detector
|--------------------------------------------------------------------------
|
| Configure here which writer/reader type should be used when the package
| needs to guess the correct type based on the extension alone.
|
*/
'extension_detector' => [
'xlsx' => Excel::XLSX,
'xlsm' => Excel::XLSX,
'xltx' => Excel::XLSX,
'xltm' => Excel::XLSX,
'xls' => Excel::XLS,
'xlt' => Excel::XLS,
'ods' => Excel::ODS,
'ots' => Excel::ODS,
'slk' => Excel::SLK,
'xml' => Excel::XML,
'gnumeric' => Excel::GNUMERIC,
'htm' => Excel::HTML,
'html' => Excel::HTML,
'csv' => Excel::CSV,
'tsv' => Excel::TSV,
/*
|--------------------------------------------------------------------------
| PDF Extension
|--------------------------------------------------------------------------
|
| Configure here which Pdf driver should be used by default.
| Available options: Excel::MPDF | Excel::TCPDF | Excel::DOMPDF
|
*/
'pdf' => Excel::DOMPDF,
],
/*
|--------------------------------------------------------------------------
| Value Binder
|--------------------------------------------------------------------------
|
| PhpSpreadsheet offers a way to hook into the process of a value being
| written to a cell. In there some assumptions are made on how the
| value should be formatted. If you want to change those defaults,
| you can implement your own default value binder.
|
| Possible value binders:
|
| [x] Maatwebsite\Excel\DefaultValueBinder::class
| [x] PhpOffice\PhpSpreadsheet\Cell\StringValueBinder::class
| [x] PhpOffice\PhpSpreadsheet\Cell\AdvancedValueBinder::class
|
*/
'value_binder' => [
'default' => Maatwebsite\Excel\DefaultValueBinder::class,
],
'cache' => [
/*
|--------------------------------------------------------------------------
| Default cell caching driver
|--------------------------------------------------------------------------
|
| By default PhpSpreadsheet keeps all cell values in memory, however when
| dealing with large files, this might result into memory issues. If you
| want to mitigate that, you can configure a cell caching driver here.
| When using the illuminate driver, it will store each value in the
| cache store. This can slow down the process, because it needs to
| store each value. You can use the "batch" store if you want to
| only persist to the store when the memory limit is reached.
|
| Drivers: memory|illuminate|batch
|
*/
'driver' => 'memory',
/*
|--------------------------------------------------------------------------
| Batch memory caching
|--------------------------------------------------------------------------
|
| When dealing with the "batch" caching driver, it will only
| persist to the store when the memory limit is reached.
| Here you can tweak the memory limit to your liking.
|
*/
'batch' => [
'memory_limit' => 60000,
],
/*
|--------------------------------------------------------------------------
| Illuminate cache
|--------------------------------------------------------------------------
|
| When using the "illuminate" caching driver, it will automatically use
| your default cache store. However if you prefer to have the cell
| cache on a separate store, you can configure the store name here.
| You can use any store defined in your cache config. When leaving
| at "null" it will use the default store.
|
*/
'illuminate' => [
'store' => null,
],
/*
|--------------------------------------------------------------------------
| Cache Time-to-live (TTL)
|--------------------------------------------------------------------------
|
| The TTL of items written to cache. If you want to keep the items cached
| indefinitely, set this to null. Otherwise, set a number of seconds,
| a \DateInterval, or a callable.
|
| Allowable types: callable|\DateInterval|int|null
|
*/
'default_ttl' => 10800,
],
/*
|--------------------------------------------------------------------------
| Transaction Handler
|--------------------------------------------------------------------------
|
| By default the import is wrapped in a transaction. This is useful
| for when an import may fail and you want to retry it. With the
| transactions, the previous import gets rolled-back.
|
| You can disable the transaction handler by setting this to null.
| Or you can choose a custom made transaction handler here.
|
| Supported handlers: null|db
|
*/
'transactions' => [
'handler' => 'db',
'db' => [
'connection' => null,
],
],
'temporary_files' => [
/*
|--------------------------------------------------------------------------
| Local Temporary Path
|--------------------------------------------------------------------------
|
| When exporting and importing files, we use a temporary file, before
| storing reading or downloading. Here you can customize that path.
| permissions is an array with the permission flags for the directory (dir)
| and the create file (file).
|
*/
'local_path' => storage_path('framework/cache/laravel-excel'),
/*
|--------------------------------------------------------------------------
| Local Temporary Path Permissions
|--------------------------------------------------------------------------
|
| Permissions is an array with the permission flags for the directory (dir)
| and the create file (file).
| If omitted the default permissions of the filesystem will be used.
|
*/
'local_permissions' => [
// 'dir' => 0755,
// 'file' => 0644,
],
/*
|--------------------------------------------------------------------------
| Remote Temporary Disk
|--------------------------------------------------------------------------
|
| When dealing with a multi server setup with queues in which you
| cannot rely on having a shared local temporary path, you might
| want to store the temporary file on a shared disk. During the
| queue executing, we'll retrieve the temporary file from that
| location instead. When left to null, it will always use
| the local path. This setting only has effect when using
| in conjunction with queued imports and exports.
|
*/
'remote_disk' => null,
'remote_prefix' => null,
/*
|--------------------------------------------------------------------------
| Force Resync
|--------------------------------------------------------------------------
|
| When dealing with a multi server setup as above, it's possible
| for the clean up that occurs after entire queue has been run to only
| cleanup the server that the last AfterImportJob runs on. The rest of the server
| would still have the local temporary file stored on it. In this case your
| local storage limits can be exceeded and future imports won't be processed.
| To mitigate this you can set this config value to be true, so that after every
| queued chunk is processed the local temporary file is deleted on the server that
| processed it.
|
*/
'force_resync_remote' => null,
],
];
| php | MIT | b31b6f4eabd8b5ff3f873e808abd183d3f5cb244 | 2026-01-04T15:03:06.866936Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/lang/en/passwords.php | lang/en/passwords.php | <?php
return [
/*
|--------------------------------------------------------------------------
| Password Reset Language Lines
|--------------------------------------------------------------------------
|
| The following language lines are the default lines which match reasons
| that are given by the password broker for a password update attempt
| has failed, such as for an invalid token or invalid new password.
|
*/
'reset' => 'Your password has been reset!',
'sent' => 'We have emailed your password reset link!',
'throttled' => 'Please wait before retrying.',
'token' => 'This password reset token is invalid.',
'user' => "We can't find a user with that email address.",
];
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/lang/en/pagination.php | lang/en/pagination.php | <?php
return [
/*
|--------------------------------------------------------------------------
| Pagination Language Lines
|--------------------------------------------------------------------------
|
| The following language lines are used by the paginator library to build
| the simple pagination links. You are free to change them to anything
| you want to customize your views to better match your application.
|
*/
'previous' => '« Previous',
'next' => 'Next »',
];
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/lang/en/validation.php | lang/en/validation.php | <?php
return [
/*
|--------------------------------------------------------------------------
| Validation Language Lines
|--------------------------------------------------------------------------
|
| The following language lines contain the default error messages used by
| the validator class. Some of these rules have multiple versions such
| as the size rules. Feel free to tweak each of these messages here.
|
*/
'accepted' => 'The :attribute must be accepted.',
'active_url' => 'The :attribute is not a valid URL.',
'after' => 'The :attribute must be a date after :date.',
'after_or_equal' => 'The :attribute must be a date after or equal to :date.',
'alpha' => 'The :attribute may only contain letters.',
'alpha_dash' => 'The :attribute may only contain letters, numbers, dashes and underscores.',
'alpha_num' => 'The :attribute may only contain letters and numbers.',
'array' => 'The :attribute must be an array.',
'before' => 'The :attribute must be a date before :date.',
'before_or_equal' => 'The :attribute must be a date before or equal to :date.',
'between' => [
'numeric' => 'The :attribute must be between :min and :max.',
'file' => 'The :attribute must be between :min and :max kilobytes.',
'string' => 'The :attribute must be between :min and :max characters.',
'array' => 'The :attribute must have between :min and :max items.',
],
'boolean' => 'The :attribute field must be true or false.',
'confirmed' => 'The :attribute confirmation does not match.',
'date' => 'The :attribute is not a valid date.',
'date_equals' => 'The :attribute must be a date equal to :date.',
'date_format' => 'The :attribute does not match the format :format.',
'different' => 'The :attribute and :other must be different.',
'digits' => 'The :attribute must be :digits digits.',
'digits_between' => 'The :attribute must be between :min and :max digits.',
'dimensions' => 'The :attribute has invalid image dimensions.',
'distinct' => 'The :attribute field has a duplicate value.',
'email' => 'The :attribute must be a valid email address.',
'ends_with' => 'The :attribute must end with one of the following: :values.',
'exists' => 'The selected :attribute is invalid.',
'file' => 'The :attribute must be a file.',
'filled' => 'The :attribute field must have a value.',
'gt' => [
'numeric' => 'The :attribute must be greater than :value.',
'file' => 'The :attribute must be greater than :value kilobytes.',
'string' => 'The :attribute must be greater than :value characters.',
'array' => 'The :attribute must have more than :value items.',
],
'gte' => [
'numeric' => 'The :attribute must be greater than or equal :value.',
'file' => 'The :attribute must be greater than or equal :value kilobytes.',
'string' => 'The :attribute must be greater than or equal :value characters.',
'array' => 'The :attribute must have :value items or more.',
],
'image' => 'The :attribute must be an image.',
'in' => 'The selected :attribute is invalid.',
'in_array' => 'The :attribute field does not exist in :other.',
'integer' => 'The :attribute must be an integer.',
'ip' => 'The :attribute must be a valid IP address.',
'ipv4' => 'The :attribute must be a valid IPv4 address.',
'ipv6' => 'The :attribute must be a valid IPv6 address.',
'json' => 'The :attribute must be a valid JSON string.',
'lt' => [
'numeric' => 'The :attribute must be less than :value.',
'file' => 'The :attribute must be less than :value kilobytes.',
'string' => 'The :attribute must be less than :value characters.',
'array' => 'The :attribute must have less than :value items.',
],
'lte' => [
'numeric' => 'The :attribute must be less than or equal :value.',
'file' => 'The :attribute must be less than or equal :value kilobytes.',
'string' => 'The :attribute must be less than or equal :value characters.',
'array' => 'The :attribute must not have more than :value items.',
],
'max' => [
'numeric' => 'The :attribute may not be greater than :max.',
'file' => 'The :attribute may not be greater than :max kilobytes.',
'string' => 'The :attribute may not be greater than :max characters.',
'array' => 'The :attribute may not have more than :max items.',
],
'mimes' => 'The :attribute must be a file of type: :values.',
'mimetypes' => 'The :attribute must be a file of type: :values.',
'min' => [
'numeric' => 'The :attribute must be at least :min.',
'file' => 'The :attribute must be at least :min kilobytes.',
'string' => 'The :attribute must be at least :min characters.',
'array' => 'The :attribute must have at least :min items.',
],
'multiple_of' => 'The :attribute must be a multiple of :value.',
'not_in' => 'The selected :attribute is invalid.',
'not_regex' => 'The :attribute format is invalid.',
'numeric' => 'The :attribute must be a number.',
'password' => 'The password is incorrect.',
'present' => 'The :attribute field must be present.',
'regex' => 'The :attribute format is invalid.',
'required' => 'The :attribute field is required.',
'required_if' => 'The :attribute field is required when :other is :value.',
'required_unless' => 'The :attribute field is required unless :other is in :values.',
'required_with' => 'The :attribute field is required when :values is present.',
'required_with_all' => 'The :attribute field is required when :values are present.',
'required_without' => 'The :attribute field is required when :values is not present.',
'required_without_all' => 'The :attribute field is required when none of :values are present.',
'same' => 'The :attribute and :other must match.',
'size' => [
'numeric' => 'The :attribute must be :size.',
'file' => 'The :attribute must be :size kilobytes.',
'string' => 'The :attribute must be :size characters.',
'array' => 'The :attribute must contain :size items.',
],
'starts_with' => 'The :attribute must start with one of the following: :values.',
'string' => 'The :attribute must be a string.',
'timezone' => 'The :attribute must be a valid zone.',
'unique' => 'The :attribute has already been taken.',
'uploaded' => 'The :attribute failed to upload.',
'url' => 'The :attribute format is invalid.',
'uuid' => 'The :attribute must be a valid UUID.',
/*
|--------------------------------------------------------------------------
| Custom Validation Language Lines
|--------------------------------------------------------------------------
|
| Here you may specify custom validation messages for attributes using the
| convention "attribute.rule" to name the lines. This makes it quick to
| specify a specific custom language line for a given attribute rule.
|
*/
'custom' => [
'attribute-name' => [
'rule-name' => 'custom-message',
],
],
/*
|--------------------------------------------------------------------------
| Custom Validation Attributes
|--------------------------------------------------------------------------
|
| The following language lines are used to swap our attribute placeholder
| with something more reader friendly such as "E-Mail Address" instead
| of "email". This simply helps us make our message more expressive.
|
*/
'attributes' => [],
];
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/lang/en/auth.php | lang/en/auth.php | <?php
return [
/*
|--------------------------------------------------------------------------
| Authentication Language Lines
|--------------------------------------------------------------------------
|
| The following language lines are used during authentication for various
| messages that we need to display to the user. You are free to modify
| these language lines according to your application's requirements.
|
*/
'failed' => 'These credentials do not match our records.',
'password' => 'The provided password is incorrect.',
'throttle' => 'Too many login attempts. Please try again in :seconds seconds.',
];
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/app/Exceptions/Handler.php | app/Exceptions/Handler.php | <?php
namespace App\Exceptions;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Throwable;
class Handler extends ExceptionHandler
{
/**
* A list of the inputs that are never flashed for validation exceptions.
*
* @var array<int, string>
*/
protected $dontFlash = [
'current_password',
'password',
'password_confirmation',
];
/**
* Register the exception handling callbacks for the application.
*/
public function register(): void
{
$this->reportable(function (Throwable $e) {
//
});
}
}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/app/Http/Kernel.php | app/Http/Kernel.php | <?php
namespace App\Http;
use Illuminate\Foundation\Http\Kernel as HttpKernel;
class Kernel extends HttpKernel
{
/**
* The application's global HTTP middleware stack.
*
* These middleware are run during every request to your application.
*
* @var array
*/
protected $middleware = [
// \App\Http\Middleware\TrustHosts::class,
\App\Http\Middleware\TrustProxies::class,
\Illuminate\Http\Middleware\HandleCors::class,
\App\Http\Middleware\PreventRequestsDuringMaintenance::class,
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
\App\Http\Middleware\TrimStrings::class,
\Webkul\Installer\Http\Middleware\CanInstall::class,
];
/**
* The application's route middleware groups.
*
* @var array
*/
protected $middlewareGroups = [
'web' => [
\App\Http\Middleware\EncryptCookies::class,
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
\Illuminate\Session\Middleware\StartSession::class,
// \Illuminate\Session\Middleware\AuthenticateSession::class,
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
\App\Http\Middleware\VerifyCsrfToken::class,
\Illuminate\Routing\Middleware\SubstituteBindings::class,
],
'api' => [
\Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class,
'throttle:api',
\Illuminate\Routing\Middleware\SubstituteBindings::class,
],
];
/**
* The application's route middleware.
*
* These middleware may be assigned to groups or used individually.
*
* @var array
*/
protected $routeMiddleware = [
'auth' => \App\Http\Middleware\Authenticate::class,
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
'can' => \Illuminate\Auth\Middleware\Authorize::class,
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class,
'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
];
}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/app/Http/Controllers/Controller.php | app/Http/Controllers/Controller.php | <?php
namespace App\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 Controller extends BaseController
{
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/app/Http/Middleware/Authenticate.php | app/Http/Middleware/Authenticate.php | <?php
namespace App\Http\Middleware;
use Illuminate\Auth\Middleware\Authenticate as Middleware;
class Authenticate extends Middleware
{
/**
* Get the path the user should be redirected to when they are not authenticated.
*
* @param \Illuminate\Http\Request $request
* @return string|null
*/
protected function redirectTo($request)
{
if (! $request->expectsJson()) {
return route('login');
}
}
}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/app/Http/Middleware/RedirectIfAuthenticated.php | app/Http/Middleware/RedirectIfAuthenticated.php | <?php
namespace App\Http\Middleware;
use App\Providers\RouteServiceProvider;
use Closure;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
class RedirectIfAuthenticated
{
/**
* Handle an incoming request.
*
* @param string|null ...$guards
* @return mixed
*/
public function handle(Request $request, Closure $next, ...$guards)
{
$guards = empty($guards) ? [null] : $guards;
foreach ($guards as $guard) {
if (Auth::guard($guard)->check()) {
return redirect(RouteServiceProvider::HOME);
}
}
return $next($request);
}
}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/app/Http/Middleware/TrustProxies.php | app/Http/Middleware/TrustProxies.php | <?php
namespace App\Http\Middleware;
use Illuminate\Http\Middleware\TrustProxies as Middleware;
use Illuminate\Http\Request;
class TrustProxies extends Middleware
{
/**
* The trusted proxies for this application.
*
* @var array|string|null
*/
protected $proxies;
/**
* The headers that should be used to detect proxies.
*
* @var int
*/
protected $headers =
Request::HEADER_X_FORWARDED_FOR |
Request::HEADER_X_FORWARDED_HOST |
Request::HEADER_X_FORWARDED_PORT |
Request::HEADER_X_FORWARDED_PROTO |
Request::HEADER_X_FORWARDED_AWS_ELB;
}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/app/Http/Middleware/PreventRequestsDuringMaintenance.php | app/Http/Middleware/PreventRequestsDuringMaintenance.php | <?php
namespace App\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance as Middleware;
class PreventRequestsDuringMaintenance extends Middleware
{
/**
* The URIs that should be reachable while maintenance mode is enabled.
*
* @var array
*/
protected $except = [
//
];
}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/app/Http/Middleware/TrimStrings.php | app/Http/Middleware/TrimStrings.php | <?php
namespace App\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\TrimStrings as Middleware;
class TrimStrings extends Middleware
{
/**
* The names of the attributes that should not be trimmed.
*
* @var array
*/
protected $except = [
'current_password',
'password',
'password_confirmation',
];
}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/app/Http/Middleware/TrustHosts.php | app/Http/Middleware/TrustHosts.php | <?php
namespace App\Http\Middleware;
use Illuminate\Http\Middleware\TrustHosts as Middleware;
class TrustHosts extends Middleware
{
/**
* Get the host patterns that should be trusted.
*
* @return array
*/
public function hosts()
{
return [
$this->allSubdomainsOfApplicationUrl(),
];
}
}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/app/Http/Middleware/EncryptCookies.php | app/Http/Middleware/EncryptCookies.php | <?php
namespace App\Http\Middleware;
use Illuminate\Cookie\Middleware\EncryptCookies as Middleware;
class EncryptCookies extends Middleware
{
/**
* The names of the cookies that should not be encrypted.
*
* @var array
*/
protected $except = [
'dark_mode',
];
}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/app/Http/Middleware/VerifyCsrfToken.php | app/Http/Middleware/VerifyCsrfToken.php | <?php
namespace App\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware;
class VerifyCsrfToken extends Middleware
{
/**
* The URIs that should be excluded from CSRF verification.
*
* @var array
*/
protected $except = [
'admin/mail/inbound-parse',
'admin/web-forms/forms/*',
];
}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/app/Console/Kernel.php | app/Console/Kernel.php | <?php
namespace App\Console;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
class Kernel extends ConsoleKernel
{
/**
* Define the application's command schedule.
*/
protected function schedule(Schedule $schedule): void
{
$schedule->command('inbound-emails:process')->everyFiveMinutes();
}
/**
* Register the commands for the application.
*/
protected function commands(): void
{
$this->load(__DIR__.'/Commands');
require base_path('routes/console.php');
}
}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/app/Models/User.php | app/Models/User.php | <?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
class User extends Authenticatable
{
use HasFactory, Notifiable;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'name',
'email',
'password',
];
/**
* The attributes that should be hidden for arrays.
*
* @var array
*/
protected $hidden = [
'password',
'remember_token',
];
/**
* The attributes that should be cast to native types.
*
* @var array
*/
protected $casts = [
'email_verified_at' => 'datetime',
];
}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/app/Providers/BroadcastServiceProvider.php | app/Providers/BroadcastServiceProvider.php | <?php
namespace App\Providers;
use Illuminate\Support\Facades\Broadcast;
use Illuminate\Support\ServiceProvider;
class BroadcastServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*/
public function boot(): void
{
Broadcast::routes();
require base_path('routes/channels.php');
}
}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/app/Providers/RouteServiceProvider.php | app/Providers/RouteServiceProvider.php | <?php
namespace App\Providers;
use Illuminate\Cache\RateLimiting\Limit;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\RateLimiter;
use Illuminate\Support\Facades\Route;
class RouteServiceProvider extends ServiceProvider
{
/**
* The path to your application's "home" route.
*
* Typically, users are redirected here after authentication.
*
* @var string
*/
public const HOME = '/home';
/**
* Define your route model bindings, pattern filters, and other route configuration.
*/
public function boot(): void
{
RateLimiter::for('api', function (Request $request) {
return Limit::perMinute(60)->by($request->user()?->id ?: $request->ip());
});
$this->routes(function () {
Route::middleware('api')
->prefix('api')
->group(base_path('routes/api.php'));
Route::middleware('web')
->group(base_path('routes/web.php'));
});
}
}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/app/Providers/EventServiceProvider.php | app/Providers/EventServiceProvider.php | <?php
namespace App\Providers;
use Illuminate\Auth\Events\Registered;
use Illuminate\Auth\Listeners\SendEmailVerificationNotification;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Event;
class EventServiceProvider extends ServiceProvider
{
/**
* The event to listener mappings for the application.
*
* @var array<class-string, array<int, class-string>>
*/
protected $listen = [
Registered::class => [
SendEmailVerificationNotification::class,
],
];
/**
* Register any events for your application.
*/
public function boot(): void
{
//
}
/**
* Determine if events and listeners should be automatically discovered.
*/
public function shouldDiscoverEvents(): bool
{
return false;
}
}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/app/Providers/AppServiceProvider.php | app/Providers/AppServiceProvider.php | <?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*
* @return void
*/
public function register()
{
//
}
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
//
}
}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/app/Providers/AuthServiceProvider.php | app/Providers/AuthServiceProvider.php | <?php
namespace App\Providers;
// use Illuminate\Support\Facades\Gate;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
class AuthServiceProvider extends ServiceProvider
{
/**
* The model to policy mappings for the application.
*
* @var array<class-string, class-string>
*/
protected $policies = [
//
];
/**
* Register any authentication / authorization services.
*/
public function boot(): void
{
//
}
}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/bootstrap/app.php | bootstrap/app.php | <?php
/*
|--------------------------------------------------------------------------
| Create The Application
|--------------------------------------------------------------------------
|
| The first thing we will do is create a new Laravel application instance
| which serves as the "glue" for all the components of Laravel, and is
| the IoC container for the system binding all of the various parts.
|
*/
$app = new Illuminate\Foundation\Application(
$_ENV['APP_BASE_PATH'] ?? dirname(__DIR__)
);
/*
|--------------------------------------------------------------------------
| Bind Important Interfaces
|--------------------------------------------------------------------------
|
| Next, we need to bind some important interfaces into the container so
| we will be able to resolve them when needed. The kernels serve the
| incoming requests to this application from both the web and CLI.
|
*/
$app->singleton(
Illuminate\Contracts\Http\Kernel::class,
App\Http\Kernel::class
);
$app->singleton(
Illuminate\Contracts\Console\Kernel::class,
App\Console\Kernel::class
);
$app->singleton(
Illuminate\Contracts\Debug\ExceptionHandler::class,
App\Exceptions\Handler::class
);
/*
|--------------------------------------------------------------------------
| Return The Application
|--------------------------------------------------------------------------
|
| This script returns the application instance. The instance is given to
| the calling script so we can separate the building of the instances
| from the actual running of the application and sending responses.
|
*/
return $app;
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/tests/Pest.php | tests/Pest.php | <?php
/*
|--------------------------------------------------------------------------
| Test Case
|--------------------------------------------------------------------------
|
| The closure you provide to your test functions is always bound to a specific PHPUnit test
| case class. By default, that class is "PHPUnit\Framework\TestCase". Of course, you may
| need to change it using the "uses()" function to bind a different classes or traits.
|
*/
uses(\Tests\TestCase::class)->in('Feature');
/*
|--------------------------------------------------------------------------
| Expectations
|--------------------------------------------------------------------------
|
| When you're writing tests, you often need to check that values meet certain conditions. The
| "expect()" function gives you access to a set of "expectations" methods that you can use
| to assert different things. Of course, you may extend the Expectation API at any time.
|
*/
expect()->extend('toBeOne', function () {
return $this->toBe(1);
});
/*
|--------------------------------------------------------------------------
| Functions
|--------------------------------------------------------------------------
|
| While Pest is very powerful out-of-the-box, you may have some testing code specific to your
| project that you don't want to repeat in every file. Here you can also expose helpers as
| global functions to help you to reduce the number of lines of code in your test files.
|
*/
/**
* Get default admin which is created on fresh instance.
*
* @return \Webkul\User\Models\User
*/
function getDefaultAdmin()
{
$admin = \Webkul\User\Models\User::find(1);
return $admin;
}
/**
* Sanctum authenticated admin.
*
* @return \Webkul\User\Models\User
*/
function actingAsSanctumAuthenticatedAdmin()
{
return \Laravel\Sanctum\Sanctum::actingAs(
getDefaultAdmin(),
['*']
);
}
/**
* Get first name.
*
* @param string $fullName
* @return string
*/
function getFirstName($fullName)
{
return explode(' ', $fullName)[0];
}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/tests/TestCase.php | tests/TestCase.php | <?php
namespace Tests;
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
abstract class TestCase extends BaseTestCase
{
use CreatesApplication;
}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/tests/CreatesApplication.php | tests/CreatesApplication.php | <?php
namespace Tests;
use Illuminate\Contracts\Console\Kernel;
trait CreatesApplication
{
/**
* Creates the application.
*
* @return \Illuminate\Foundation\Application
*/
public function createApplication()
{
$app = require __DIR__.'/../bootstrap/app.php';
$app->make(Kernel::class)->bootstrap();
return $app;
}
}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/tests/Feature/AuthenticationTest.php | tests/Feature/AuthenticationTest.php | <?php
it('can see the admin login page', function () {
test()->get(route('admin.session.create'))
->assertOK();
});
it('can see the dashboard page after login', function () {
$admin = getDefaultAdmin();
test()->actingAs($admin)
->get(route('admin.dashboard.index'))
->assertOK();
expect(auth()->guard('user')->user()->name)->toBe($admin->name);
});
it('can logout from the admin panel', function () {
$admin = getDefaultAdmin();
test()->actingAs($admin)
->delete(route('admin.session.destroy'), [
'_token' => csrf_token(),
])
->assertStatus(302);
expect(auth()->guard('user')->user())->toBeNull();
});
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/tests/Unit/BasicTest.php | tests/Unit/BasicTest.php | <?php
test('check basic unit test', function () {
$this->assertTrue(true);
expect(true)->toBeTrue();
});
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/routes/web.php | routes/web.php | <?php
use Illuminate\Support\Facades\Route;
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
Route::get('/', function () {
return view('welcome');
});
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/routes/breadcrumbs.php | routes/breadcrumbs.php | <?php
use Diglactic\Breadcrumbs\Breadcrumbs;
use Diglactic\Breadcrumbs\Generator as BreadcrumbTrail;
// Dashboard
Breadcrumbs::for('dashboard', function (BreadcrumbTrail $trail) {
$trail->push(trans('admin::app.layouts.dashboard'), route('admin.dashboard.index'));
});
// Dashboard > Leads
Breadcrumbs::for('leads', function (BreadcrumbTrail $trail) {
$trail->parent('dashboard');
$trail->push(trans('admin::app.layouts.leads'), route('admin.leads.index'));
});
// Dashboard > Leads > Create
Breadcrumbs::for('leads.create', function (BreadcrumbTrail $trail) {
$trail->parent('leads');
$trail->push(trans('admin::app.leads.create.title'), route('admin.leads.create'));
});
// Leads Edit
Breadcrumbs::for('leads.edit', function (BreadcrumbTrail $trail, $lead) {
$trail->parent('leads');
$trail->push(trans('admin::app.leads.edit.title'), route('admin.leads.edit', $lead->id));
});
// Dashboard > Leads > Title
Breadcrumbs::for('leads.view', function (BreadcrumbTrail $trail, $lead) {
$trail->parent('leads');
$trail->push('#'.$lead->id, route('admin.leads.view', $lead->id));
});
// Dashboard > Quotes
Breadcrumbs::for('quotes', function (BreadcrumbTrail $trail) {
$trail->parent('dashboard');
$trail->push(trans('admin::app.layouts.quotes'), route('admin.quotes.index'));
});
// Dashboard > Quotes > Add Quote
Breadcrumbs::for('quotes.create', function (BreadcrumbTrail $trail) {
$trail->parent('quotes');
$trail->push(trans('admin::app.quotes.create.title'), route('admin.quotes.create'));
});
// Dashboard > Quotes > Edit Quote
Breadcrumbs::for('quotes.edit', function (BreadcrumbTrail $trail, $quote) {
$trail->parent('quotes');
$trail->push(trans('admin::app.quotes.edit.title'), route('admin.quotes.edit', $quote->id));
});
// Mail
Breadcrumbs::for('mail', function (BreadcrumbTrail $trail) {
$trail->parent('dashboard');
$trail->push(trans('admin::app.layouts.mail.title'), route('admin.mail.index', ['route' => 'inbox']));
});
// Mail > [Compose | Inbox | Outbox | Draft | Sent | Trash]
Breadcrumbs::for('mail.route', function (BreadcrumbTrail $trail, $route) {
$trail->parent('mail');
$trail->push(trans('admin::app.mail.index.'.$route), route('admin.mail.index', ['route' => $route]));
});
// Mail > [Inbox | Outbox | Draft | Sent | Trash] > Title
Breadcrumbs::for('mail.route.view', function (BreadcrumbTrail $trail, $route, $email) {
$trail->parent('mail.route', $route);
$trail->push($email->subject ?? '', route('admin.mail.view', ['route' => $route, 'id' => $email->id]));
});
// Dashboard > Activities
Breadcrumbs::for('activities', function (BreadcrumbTrail $trail) {
$trail->parent('dashboard');
$trail->push(trans('admin::app.layouts.activities'), route('admin.activities.index'));
});
// Dashboard > activities > Edit Activity
Breadcrumbs::for('activities.edit', function (BreadcrumbTrail $trail, $activity) {
$trail->parent('activities');
$trail->push(trans('admin::app.activities.edit.title'), route('admin.activities.edit', $activity->id));
});
// Dashboard > Contacts
Breadcrumbs::for('contacts', function (BreadcrumbTrail $trail) {
$trail->parent('dashboard');
$trail->push(trans('admin::app.layouts.contacts'), route('admin.contacts.persons.index'));
});
// Dashboard > Contacts > Persons
Breadcrumbs::for('contacts.persons', function (BreadcrumbTrail $trail) {
$trail->parent('contacts');
$trail->push(trans('admin::app.layouts.persons'), route('admin.contacts.persons.index'));
});
// Dashboard > Contacts > Persons > Create
Breadcrumbs::for('contacts.persons.create', function (BreadcrumbTrail $trail) {
$trail->parent('contacts.persons');
$trail->push(trans('admin::app.contacts.persons.create.title'), route('admin.contacts.persons.create'));
});
// Dashboard > Contacts > Persons > Edit
Breadcrumbs::for('contacts.persons.edit', function (BreadcrumbTrail $trail, $person) {
$trail->parent('contacts.persons');
$trail->push(trans('admin::app.contacts.persons.edit.title'), route('admin.contacts.persons.edit', $person->id));
});
// Dashboard > Contacts > Persons > View
Breadcrumbs::for('contacts.persons.view', function (BreadcrumbTrail $trail, $person) {
$trail->parent('contacts.persons');
$trail->push('#'.$person->id, route('admin.contacts.persons.index'));
});
// Dashboard > Contacts > Organizations
Breadcrumbs::for('contacts.organizations', function (BreadcrumbTrail $trail) {
$trail->parent('contacts');
$trail->push(trans('admin::app.layouts.organizations'), route('admin.contacts.organizations.index'));
});
// Dashboard > Contacts > Organizations > Create
Breadcrumbs::for('contacts.organizations.create', function (BreadcrumbTrail $trail) {
$trail->parent('contacts.organizations');
$trail->push(trans('admin::app.contacts.organizations.create.title'), route('admin.contacts.organizations.create'));
});
// Dashboard > Contacts > Organizations > Edit
Breadcrumbs::for('contacts.organizations.edit', function (BreadcrumbTrail $trail, $organization) {
$trail->parent('contacts.organizations');
$trail->push(trans('admin::app.contacts.organizations.edit.title'), route('admin.contacts.organizations.edit', $organization->id));
});
// Products
Breadcrumbs::for('products', function (BreadcrumbTrail $trail) {
$trail->parent('dashboard');
$trail->push(trans('admin::app.layouts.products'), route('admin.products.index'));
});
// Dashboard > Products > Create Product
Breadcrumbs::for('products.create', function (BreadcrumbTrail $trail) {
$trail->parent('products');
$trail->push(trans('admin::app.products.create.title'), route('admin.products.create'));
});
// Dashboard > Products > View Product
Breadcrumbs::for('products.view', function (BreadcrumbTrail $trail, $product) {
$trail->parent('products');
$trail->push('#'.$product->id, route('admin.products.view', $product->id));
});
// Dashboard > Products > Edit Product
Breadcrumbs::for('products.edit', function (BreadcrumbTrail $trail, $product) {
$trail->parent('products');
$trail->push(trans('admin::app.products.edit.title'), route('admin.products.edit', $product->id));
});
// Settings
Breadcrumbs::for('settings', function (BreadcrumbTrail $trail) {
$trail->parent('dashboard');
$trail->push(trans('admin::app.layouts.settings'), route('admin.settings.index'));
});
// Settings > Groups
Breadcrumbs::for('settings.groups', function (BreadcrumbTrail $trail) {
$trail->parent('settings');
$trail->push(trans('admin::app.layouts.groups'), route('admin.settings.groups.index'));
});
// Dashboard > Groups > Create Group
Breadcrumbs::for('settings.groups.create', function (BreadcrumbTrail $trail) {
$trail->parent('settings.groups');
$trail->push(trans('admin::app.settings.groups.create-title'), route('admin.settings.groups.create'));
});
// Dashboard > Groups > Edit Group
Breadcrumbs::for('settings.groups.edit', function (BreadcrumbTrail $trail, $role) {
$trail->parent('settings.groups');
$trail->push(trans('admin::app.settings.groups.edit-title'), route('admin.settings.groups.edit', $role->id));
});
// Settings > Roles
Breadcrumbs::for('settings.roles', function (BreadcrumbTrail $trail) {
$trail->parent('settings');
$trail->push(trans('admin::app.layouts.roles'), route('admin.settings.roles.index'));
});
// Dashboard > Roles > Create Role
Breadcrumbs::for('settings.roles.create', function (BreadcrumbTrail $trail) {
$trail->parent('settings.roles');
$trail->push(trans('admin::app.settings.roles.create.title'), route('admin.settings.roles.create'));
});
// Dashboard > Roles > Edit Role
Breadcrumbs::for('settings.roles.edit', function (BreadcrumbTrail $trail, $role) {
$trail->parent('settings.roles');
$trail->push(trans('admin::app.settings.roles.edit.title'), route('admin.settings.roles.edit', $role->id));
});
// Settings > Users
Breadcrumbs::for('settings.users', function (BreadcrumbTrail $trail) {
$trail->parent('settings');
$trail->push(trans('admin::app.layouts.users'), route('admin.settings.users.index'));
});
// Dashboard > Users > Create Role
Breadcrumbs::for('settings.users.create', function (BreadcrumbTrail $trail) {
$trail->parent('settings.users');
$trail->push(trans('admin::app.settings.users.create-title'), route('admin.settings.users.create'));
});
// Dashboard > Users > Edit Role
Breadcrumbs::for('settings.users.edit', function (BreadcrumbTrail $trail, $user) {
$trail->parent('settings.users');
$trail->push(trans('admin::app.settings.users.edit-title'), route('admin.settings.users.edit', $user->id));
});
// Settings > Attributes
Breadcrumbs::for('settings.attributes', function (BreadcrumbTrail $trail) {
$trail->parent('settings');
$trail->push(trans('admin::app.layouts.attributes'), route('admin.settings.attributes.index'));
});
// Dashboard > Attributes > Create Attribute
Breadcrumbs::for('settings.attributes.create', function (BreadcrumbTrail $trail) {
$trail->parent('settings.attributes');
$trail->push(trans('admin::app.settings.attributes.create.title'), route('admin.settings.attributes.create'));
});
// Dashboard > Attributes > Edit Attribute
Breadcrumbs::for('settings.attributes.edit', function (BreadcrumbTrail $trail, $attribute) {
$trail->parent('settings.attributes');
$trail->push(trans('admin::app.settings.attributes.edit.title'), route('admin.settings.attributes.edit', $attribute->id));
});
// Settings > Pipelines
Breadcrumbs::for('settings.pipelines', function (BreadcrumbTrail $trail) {
$trail->parent('settings');
$trail->push(trans('admin::app.layouts.pipelines'), route('admin.settings.pipelines.index'));
});
// Dashboard > Pipelines > Create Pipeline
Breadcrumbs::for('settings.pipelines.create', function (BreadcrumbTrail $trail) {
$trail->parent('settings.pipelines');
$trail->push(trans('admin::app.settings.pipelines.create.title'), route('admin.settings.pipelines.create'));
});
// Dashboard > Pipelines > Edit Pipeline
Breadcrumbs::for('settings.pipelines.edit', function (BreadcrumbTrail $trail, $pipeline) {
$trail->parent('settings.pipelines');
$trail->push(trans('admin::app.settings.pipelines.edit.title'), route('admin.settings.pipelines.edit', $pipeline->id));
});
// Settings > Sources
Breadcrumbs::for('settings.sources', function (BreadcrumbTrail $trail) {
$trail->parent('settings');
$trail->push(trans('admin::app.layouts.sources'), route('admin.settings.sources.index'));
});
// Dashboard > Sources > Edit Source
Breadcrumbs::for('settings.sources.edit', function (BreadcrumbTrail $trail, $source) {
$trail->parent('settings.sources');
$trail->push(trans('admin::app.settings.sources.edit-title'), route('admin.settings.sources.edit', $source->id));
});
// Settings > Types
Breadcrumbs::for('settings.types', function (BreadcrumbTrail $trail) {
$trail->parent('settings');
$trail->push(trans('admin::app.layouts.types'), route('admin.settings.types.index'));
});
// Dashboard > Types > Edit Type
Breadcrumbs::for('settings.types.edit', function (BreadcrumbTrail $trail, $type) {
$trail->parent('settings.types');
$trail->push(trans('admin::app.settings.types.edit-title'), route('admin.settings.types.edit', $type->id));
});
// Settings > Email Templates
Breadcrumbs::for('settings.email_templates', function (BreadcrumbTrail $trail) {
$trail->parent('settings');
$trail->push(trans('admin::app.settings.email-template.index.title'), route('admin.settings.email_templates.index'));
});
// Dashboard > Email Templates > Create Email Template
Breadcrumbs::for('settings.email_templates.create', function (BreadcrumbTrail $trail) {
$trail->parent('settings.email_templates');
$trail->push(trans('admin::app.settings.email-template.create.title'), route('admin.settings.email_templates.create'));
});
// Dashboard > Email Templates > Edit Email Template
Breadcrumbs::for('settings.email_templates.edit', function (BreadcrumbTrail $trail, $emailTemplate) {
$trail->parent('settings.email_templates');
$trail->push(trans('admin::app.settings.email-template.edit.title'), route('admin.settings.email_templates.edit', $emailTemplate->id));
});
// Settings > Marketing Events
Breadcrumbs::for('settings.marketing.events', function (BreadcrumbTrail $trail) {
$trail->parent('settings');
$trail->push(trans('admin::app.settings.marketing.events.index.title'), route('admin.settings.marketing.events.index'));
});
Breadcrumbs::for('settings.marketing.campaigns', function (BreadcrumbTrail $trail) {
$trail->parent('settings');
$trail->push(trans('admin::app.settings.marketing.campaigns.index.title'), route('admin.settings.marketing.campaigns.index'));
});
// Settings > Workflows
Breadcrumbs::for('settings.workflows', function (BreadcrumbTrail $trail) {
$trail->parent('settings');
$trail->push(trans('admin::app.layouts.workflows'), route('admin.settings.workflows.index'));
});
// Dashboard > Workflows > Create Workflow
Breadcrumbs::for('settings.workflows.create', function (BreadcrumbTrail $trail) {
$trail->parent('settings.workflows');
$trail->push(trans('admin::app.settings.workflows.create.title'), route('admin.settings.workflows.create'));
});
// Dashboard > Workflows > Edit Workflow
Breadcrumbs::for('settings.workflows.edit', function (BreadcrumbTrail $trail, $workflow) {
$trail->parent('settings.workflows');
$trail->push(trans('admin::app.settings.workflows.edit.title'), route('admin.settings.workflows.edit', $workflow->id));
});
// Settings > Webhooks
Breadcrumbs::for('settings.webhooks', function (BreadcrumbTrail $trail) {
$trail->parent('settings');
$trail->push(trans('admin::app.settings.webhooks.index.title'), route('admin.settings.webhooks.index'));
});
// Dashboard > Webhooks > Create Workflow
Breadcrumbs::for('settings.webhooks.create', function (BreadcrumbTrail $trail) {
$trail->parent('settings.webhooks');
$trail->push(trans('admin::app.settings.webhooks.create.title'), route('admin.settings.webhooks.create'));
});
// Dashboard > Webhooks > Edit Workflow
Breadcrumbs::for('settings.webhooks.edit', function (BreadcrumbTrail $trail, $workflow) {
$trail->parent('settings.webhooks');
$trail->push(trans('admin::app.settings.webhooks.edit.edit-btn'), route('admin.settings.workflows.edit', $workflow->id));
});
// Settings > Tags
Breadcrumbs::for('settings.tags', function (BreadcrumbTrail $trail) {
$trail->parent('settings');
$trail->push(trans('admin::app.layouts.tags'), route('admin.settings.tags.index'));
});
// Dashboard > Tags > Edit Tag
Breadcrumbs::for('settings.tags.edit', function (BreadcrumbTrail $trail, $tag) {
$trail->parent('settings.tags');
$trail->push(trans('admin::app.settings.tags.edit-title'), route('admin.settings.tags.edit', $tag->id));
});
// Settings > Web Form
Breadcrumbs::for('settings.web_forms', function (BreadcrumbTrail $trail) {
$trail->parent('settings');
$trail->push(trans('admin::app.settings.webforms.index.title'), route('admin.settings.web_forms.index'));
});
// Dashboard > Web Form > Create Web Form
Breadcrumbs::for('settings.web_forms.create', function (BreadcrumbTrail $trail) {
$trail->parent('settings.web_forms');
$trail->push(trans('admin::app.settings.webforms.create.title'), route('admin.settings.web_forms.create'));
});
// Dashboard > Web Form > Edit Web Form
Breadcrumbs::for('settings.web_forms.edit', function (BreadcrumbTrail $trail, $webForm) {
$trail->parent('settings.web_forms');
$trail->push(trans('admin::app.settings.webforms.edit.title'), route('admin.settings.web_forms.edit', $webForm->id));
});
// Settings > Warehouse
Breadcrumbs::for('settings.warehouses', function (BreadcrumbTrail $trail) {
$trail->parent('settings');
$trail->push(trans('admin::app.settings.warehouses.index.title'), route('admin.settings.warehouses.index'));
});
// Dashboard > Settings > Warehouse > Create Warehouse
Breadcrumbs::for('settings.warehouses.create', function (BreadcrumbTrail $trail) {
$trail->parent('settings.warehouses');
$trail->push(trans('admin::app.settings.warehouses.create.title'), route('admin.settings.warehouses.create'));
});
// Dashboard > Settings > Warehouse > Edit Warehouse
Breadcrumbs::for('settings.warehouses.edit', function (BreadcrumbTrail $trail, $warehouse) {
$trail->parent('settings.warehouses');
$trail->push(trans('admin::app.settings.warehouses.edit.title'), route('admin.settings.warehouses.edit', $warehouse->id));
});
// Dashboard > Settings > Warehouse > View Warehouse
Breadcrumbs::for('settings.warehouses.view', function (BreadcrumbTrail $trail, $warehouse) {
$trail->parent('settings.warehouses');
$trail->push('#'.$warehouse->id, route('admin.settings.warehouses.view', $warehouse->id));
});
// Dashboard > Settings > Warehouse > View Warehouse > Products
Breadcrumbs::for('settings.warehouses.view.products', function (BreadcrumbTrail $trail, $warehouse) {
$trail->parent('settings.warehouses.view', $warehouse);
$trail->push(trans('admin::app.settings.warehouses.products'), route('admin.settings.warehouses.products.index', $warehouse->id));
});
// Dashboard > Settings > Locations
Breadcrumbs::for('settings.locations', function (BreadcrumbTrail $trail) {
$trail->parent('settings');
$trail->push(trans('admin::app.settings.locations.title'), route('admin.settings.locations.index'));
});
// Dashboard > Settings > Locations > Create Warehouse
Breadcrumbs::for('settings.locations.create', function (BreadcrumbTrail $trail) {
$trail->parent('settings.locations');
$trail->push(trans('admin::app.settings.locations.create-title'), route('admin.settings.locations.create'));
});
// Dashboard > Settings > Locations > Edit Warehouse
Breadcrumbs::for('settings.locations.edit', function (BreadcrumbTrail $trail, $location) {
$trail->parent('settings.locations');
$trail->push(trans('admin::app.settings.locations.edit-title'), route('admin.settings.locations.edit', $location->id));
});
// Dashboard > Settings > Data Transfers
Breadcrumbs::for('settings.data_transfers', function (BreadcrumbTrail $trail) {
$trail->parent('settings');
$trail->push(trans('admin::app.settings.data-transfer.imports.index.title'), route('admin.settings.data_transfer.imports.index'));
});
// Dashboard > Settings > Data Transfers > Create Data Transfer
Breadcrumbs::for('settings.data_transfers.create', function (BreadcrumbTrail $trail) {
$trail->parent('settings.data_transfers');
$trail->push(trans('admin::app.settings.data-transfer.imports.create.title'), route('admin.settings.data_transfer.imports.create'));
});
// Dashboard > Settings > Data Transfers > Edit Data Transfer
Breadcrumbs::for('settings.data_transfers.edit', function (BreadcrumbTrail $trail, $import) {
$trail->parent('settings.data_transfers');
$trail->push(trans('admin::app.settings.data-transfer.imports.edit.title'), route('admin.settings.data_transfer.imports.edit', $import->id));
});
// Dashboard > Settings > Data Transfers > Import Data Transfer
Breadcrumbs::for('settings.data_transfers.import', function (BreadcrumbTrail $trail, $import) {
$trail->parent('settings.data_transfers');
$trail->push(trans('admin::app.settings.data-transfer.imports.import.title'), route('admin.settings.data_transfer.imports.import', $import->id));
});
// Configuration
Breadcrumbs::for('configuration', function (BreadcrumbTrail $trail) {
$trail->parent('dashboard');
$trail->push(trans('admin::app.layouts.configuration'), route('admin.configuration.index'));
});
// Configuration > Config
Breadcrumbs::for('configuration.slug', function (BreadcrumbTrail $trail, $slug) {
$trail->parent('configuration');
$trail->push('', route('admin.configuration.index', ['slug' => $slug]));
});
// Dashboard > Account > Edit
Breadcrumbs::for('dashboard.account.edit', function (BreadcrumbTrail $trail, $user) {
$trail->parent('dashboard');
$trail->push(trans('admin::app.account.edit.title'), route('admin.user.account.edit', $user->id));
});
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/routes/channels.php | routes/channels.php | <?php
use Illuminate\Support\Facades\Broadcast;
/*
|--------------------------------------------------------------------------
| Broadcast Channels
|--------------------------------------------------------------------------
|
| Here you may register all of the event broadcasting channels that your
| application supports. The given channel authorization callbacks are
| used to check if an authenticated user can listen to the channel.
|
*/
Broadcast::channel('App.Models.User.{id}', function ($user, $id) {
return (int) $user->id === (int) $id;
});
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/routes/api.php | routes/api.php | <?php
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/
Route::middleware('auth:api')->get('/user', function (Request $request) {
return $request->user();
});
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/routes/console.php | routes/console.php | <?php
use Illuminate\Foundation\Inspiring;
use Illuminate\Support\Facades\Artisan;
/*
|--------------------------------------------------------------------------
| Console Routes
|--------------------------------------------------------------------------
|
| This file is where you may define all of your Closure based console
| commands. Each Closure is bound to a command instance allowing a
| simple approach to interacting with each command's IO methods.
|
*/
Artisan::command('inspire', function () {
$this->comment(Inspiring::quote());
})->purpose('Display an inspiring quote');
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/public/index.php | public/index.php | <?php
use Illuminate\Contracts\Http\Kernel;
use Illuminate\Http\Request;
define('LARAVEL_START', microtime(true));
/*
|--------------------------------------------------------------------------
| Check If Application Is Under Maintenance
|--------------------------------------------------------------------------
|
| If the application is maintenance / demo mode via the "down" command we
| will require this file so that any pre rendered template can be shown
| instead of starting the framework, which could cause an exception.
|
*/
if (file_exists(__DIR__.'/../storage/framework/maintenance.php')) {
require __DIR__.'/../storage/framework/maintenance.php';
}
/*
|--------------------------------------------------------------------------
| Register The Auto Loader
|--------------------------------------------------------------------------
|
| Composer provides a convenient, automatically generated class loader for
| this application. We just need to utilize it! We'll simply require it
| into the script here so we don't need to manually load our classes.
|
*/
require __DIR__.'/../vendor/autoload.php';
/*
|--------------------------------------------------------------------------
| Run The Application
|--------------------------------------------------------------------------
|
| Once we have the application, we can handle the incoming request using
| the application's HTTP kernel. Then, we will send the response back
| to this client's browser, allowing them to enjoy our application.
|
*/
$app = require_once __DIR__.'/../bootstrap/app.php';
$kernel = $app->make(Kernel::class);
$response = tap($kernel->handle(
$request = Request::capture()
))->send();
$kernel->terminate($request, $response);
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/config/app.php | config/app.php | <?php
use Illuminate\Support\Facades\Facade;
use Illuminate\Support\ServiceProvider;
return [
/*
|--------------------------------------------------------------------------
| Application Name
|--------------------------------------------------------------------------
|
| This value is the name of your application. This value is used when the
| framework needs to place the application's name in a notification or
| any other location as required by the application or its packages.
|
*/
'name' => env('APP_NAME', 'Laravel'),
/*
|--------------------------------------------------------------------------
| Application Environment
|--------------------------------------------------------------------------
|
| This value determines the "environment" your application is currently
| running in. This may determine how you prefer to configure various
| services the application utilizes. Set this in your ".env" file.
|
*/
'env' => env('APP_ENV', 'production'),
/*
|--------------------------------------------------------------------------
| Application Debug Mode
|--------------------------------------------------------------------------
|
| When your application is in debug mode, detailed error messages with
| stack traces will be shown on every error that occurs within your
| application. If disabled, a simple generic error page is shown.
|
*/
'debug' => (bool) env('APP_DEBUG', false),
/*
|--------------------------------------------------------------------------
| Application URL
|--------------------------------------------------------------------------
|
| This URL is used by the console to properly generate URLs when using
| the Artisan command line tool. You should set this to the root of
| your application so that it is used when running Artisan tasks.
|
*/
'url' => env('APP_URL', 'http://localhost'),
/*
|--------------------------------------------------------------------------
| Application Admin URL
|--------------------------------------------------------------------------
|
| This URL suffix is used to define the admin url for example
| admin/ or backend/
|
*/
'admin_path' => env('APP_ADMIN_PATH', 'admin'),
'asset_url' => env('ASSET_URL', null),
/*
|--------------------------------------------------------------------------
| Application Timezone
|--------------------------------------------------------------------------
|
| Here you may specify the default timezone for your application, which
| will be used by the PHP date and date-time functions. We have gone
| ahead and set this to a sensible default for you out of the box.
|
*/
'timezone' => env('APP_TIMEZONE', 'Asia/Kolkata'),
/*
|--------------------------------------------------------------------------
| Application Locale Configuration
|--------------------------------------------------------------------------
|
| The application locale determines the default locale that will be used
| by the translation service provider. You are free to set this value
| to any of the locales which will be supported by the application.
|
*/
'locale' => env('APP_LOCALE', 'en'),
/*
|--------------------------------------------------------------------------
| Available Locales Configuration
|--------------------------------------------------------------------------
|
| The application available locale determines the supported locales
| by application
|
*/
'available_locales' => [
'ar' => 'Arabic',
'en' => 'English',
'es' => 'Español',
'fa' => 'Persian',
'pt_BR' => 'Portuguese',
'tr' => 'Türkçe',
'vi' => 'Vietnamese',
],
/*
|--------------------------------------------------------------------------
| Application Fallback Locale
|--------------------------------------------------------------------------
|
| The fallback locale determines the locale to use when the current one
| is not available. You may change the value to correspond to any of
| the language folders that are provided through your application.
|
*/
'fallback_locale' => 'en',
/*
|--------------------------------------------------------------------------
| Faker Locale
|--------------------------------------------------------------------------
|
| This locale will be used by the Faker PHP library when generating fake
| data for your database seeds. For example, this will be used to get
| localized telephone numbers, street address information and more.
|
*/
'faker_locale' => 'en_US',
/*
|--------------------------------------------------------------------------
| Base Currency Code
|--------------------------------------------------------------------------
|
| Here you may specify the base currency code for your application.
|
*/
'currency' => env('APP_CURRENCY', 'USD'),
/*
|--------------------------------------------------------------------------
| Encryption Key
|--------------------------------------------------------------------------
|
| This key is used by the Illuminate encrypter service and should be set
| to a random, 32 character string, otherwise these encrypted strings
| will not be safe. Please do this before deploying an application!
|
*/
'key' => env('APP_KEY'),
'cipher' => 'AES-256-CBC',
/*
|--------------------------------------------------------------------------
| Autoloaded Service Providers
|--------------------------------------------------------------------------
|
| The service providers listed here will be automatically loaded on the
| request to your application. Feel free to add your own services to
| this array to grant expanded functionality to your applications.
|
*/
'providers' => ServiceProvider::defaultProviders()->merge([
/*
* Package Service Providers...
*/
Barryvdh\DomPDF\ServiceProvider::class,
Konekt\Concord\ConcordServiceProvider::class,
Prettus\Repository\Providers\RepositoryServiceProvider::class,
/*
* Application Service Providers...
*/
App\Providers\AppServiceProvider::class,
App\Providers\AuthServiceProvider::class,
// App\Providers\BroadcastServiceProvider::class,
App\Providers\EventServiceProvider::class,
App\Providers\RouteServiceProvider::class,
/*
* Webkul Service Providers...
*/
Webkul\Activity\Providers\ActivityServiceProvider::class,
Webkul\Admin\Providers\AdminServiceProvider::class,
Webkul\Attribute\Providers\AttributeServiceProvider::class,
Webkul\Automation\Providers\WorkflowServiceProvider::class,
Webkul\Contact\Providers\ContactServiceProvider::class,
Webkul\Core\Providers\CoreServiceProvider::class,
Webkul\DataGrid\Providers\DataGridServiceProvider::class,
Webkul\DataTransfer\Providers\DataTransferServiceProvider::class,
Webkul\EmailTemplate\Providers\EmailTemplateServiceProvider::class,
Webkul\Email\Providers\EmailServiceProvider::class,
Webkul\Marketing\Providers\MarketingServiceProvider::class,
Webkul\Installer\Providers\InstallerServiceProvider::class,
Webkul\Lead\Providers\LeadServiceProvider::class,
Webkul\Product\Providers\ProductServiceProvider::class,
Webkul\Quote\Providers\QuoteServiceProvider::class,
Webkul\Tag\Providers\TagServiceProvider::class,
Webkul\User\Providers\UserServiceProvider::class,
Webkul\Warehouse\Providers\WarehouseServiceProvider::class,
Webkul\WebForm\Providers\WebFormServiceProvider::class,
])->toArray(),
/*
|--------------------------------------------------------------------------
| Class Aliases
|--------------------------------------------------------------------------
|
| This array of class aliases will be registered when this application
| is started. However, feel free to register as many as you wish as
| the aliases are "lazy" loaded so they don't hinder performance.
|
*/
'aliases' => Facade::defaultAliases()->merge([])->toArray(),
];
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/config/breadcrumbs.php | config/breadcrumbs.php | <?php
return [
/*
|--------------------------------------------------------------------------
| View Name
|--------------------------------------------------------------------------
|
| Choose a view to display when Breadcrumbs::render() is called.
| Built in templates are:
|
| - 'breadcrumbs::bootstrap5' - Bootstrap 5
| - 'breadcrumbs::bootstrap4' - Bootstrap 4
| - 'breadcrumbs::bulma' - Bulma
| - 'breadcrumbs::foundation6' - Foundation 6
| - 'breadcrumbs::json-ld' - JSON-LD Structured Data
| - 'breadcrumbs::materialize' - Materialize
| - 'breadcrumbs::tailwind' - Tailwind CSS
| - 'breadcrumbs::uikit' - UIkit
|
| Or a custom view, e.g. '_partials/breadcrumbs'.
|
*/
'view' => 'breadcrumbs::bootstrap5',
/*
|--------------------------------------------------------------------------
| Breadcrumbs File(s)
|--------------------------------------------------------------------------
|
| The file(s) where breadcrumbs are defined. e.g.
|
| - base_path('routes/breadcrumbs.php')
| - glob(base_path('breadcrumbs/*.php'))
|
*/
'files' => base_path('routes/breadcrumbs.php'),
/*
|--------------------------------------------------------------------------
| Exceptions
|--------------------------------------------------------------------------
|
| Determine when to throw an exception.
|
*/
// When route-bound breadcrumbs are used but the current route doesn't have a name (UnnamedRouteException)
'unnamed-route-exception' => true,
// When route-bound breadcrumbs are used and the matching breadcrumb doesn't exist (InvalidBreadcrumbException)
'missing-route-bound-breadcrumb-exception' => true,
// When a named breadcrumb is used but doesn't exist (InvalidBreadcrumbException)
'invalid-named-breadcrumb-exception' => true,
/*
|--------------------------------------------------------------------------
| Classes
|--------------------------------------------------------------------------
|
| Subclass the default classes for more advanced customisations.
|
*/
// Manager
'manager-class' => Diglactic\Breadcrumbs\Manager::class,
// Generator
'generator-class' => Diglactic\Breadcrumbs\Generator::class,
];
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/config/mail-receiver.php | config/mail-receiver.php | <?php
return [
/*
|--------------------------------------------------------------------------
| Default Mail Receiver
|--------------------------------------------------------------------------
|
| This option controls the default mail receiver that is used to receive any email
| messages sent by third party application.
|
| Supported: "webklex-imap", "sendgrid"
|
*/
'default' => env('MAIL_RECEIVER_DRIVER', 'sendgrid'),
];
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/config/krayin-vite.php | config/krayin-vite.php | <?php
return [
/*
|--------------------------------------------------------------------------
| Krayin Vite Configuration
|--------------------------------------------------------------------------
|
| Please add your Vite registry here to seamlessly support the `assets` function.
|
*/
'viters' => [
'admin' => [
'hot_file' => 'admin-vite.hot',
'build_directory' => 'admin/build',
'package_assets_directory' => 'src/Resources/assets',
],
'installer' => [
'hot_file' => 'installer-vite.hot',
'build_directory' => 'installer/build',
'package_assets_directory' => 'src/Resources/assets',
],
'webform' => [
'hot_file' => 'webform-vite.hot',
'build_directory' => 'webform/build',
'package_assets_directory' => 'src/Resources/assets',
],
],
];
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/config/logging.php | config/logging.php | <?php
use Monolog\Handler\NullHandler;
use Monolog\Handler\StreamHandler;
use Monolog\Handler\SyslogUdpHandler;
return [
/*
|--------------------------------------------------------------------------
| Default Log Channel
|--------------------------------------------------------------------------
|
| This option defines the default log channel that gets used when writing
| messages to the logs. The name specified in this option should match
| one of the channels defined in the "channels" configuration array.
|
*/
'default' => env('LOG_CHANNEL', 'stack'),
/*
|--------------------------------------------------------------------------
| Log Channels
|--------------------------------------------------------------------------
|
| Here you may configure the log channels for your application. Out of
| the box, Laravel uses the Monolog PHP logging library. This gives
| you a variety of powerful log handlers / formatters to utilize.
|
| Available Drivers: "single", "daily", "slack", "syslog",
| "errorlog", "monolog",
| "custom", "stack"
|
*/
'channels' => [
'stack' => [
'driver' => 'stack',
'channels' => ['single'],
'ignore_exceptions' => false,
],
'single' => [
'driver' => 'single',
'path' => storage_path('logs/laravel.log'),
'level' => env('LOG_LEVEL', 'debug'),
],
'daily' => [
'driver' => 'daily',
'path' => storage_path('logs/laravel.log'),
'level' => env('LOG_LEVEL', 'debug'),
'days' => 14,
],
'slack' => [
'driver' => 'slack',
'url' => env('LOG_SLACK_WEBHOOK_URL'),
'username' => 'Laravel Log',
'emoji' => ':boom:',
'level' => env('LOG_LEVEL', 'critical'),
],
'papertrail' => [
'driver' => 'monolog',
'level' => env('LOG_LEVEL', 'debug'),
'handler' => SyslogUdpHandler::class,
'handler_with' => [
'host' => env('PAPERTRAIL_URL'),
'port' => env('PAPERTRAIL_PORT'),
],
],
'stderr' => [
'driver' => 'monolog',
'handler' => StreamHandler::class,
'formatter' => env('LOG_STDERR_FORMATTER'),
'with' => [
'stream' => 'php://stderr',
],
],
'syslog' => [
'driver' => 'syslog',
'level' => env('LOG_LEVEL', 'debug'),
],
'errorlog' => [
'driver' => 'errorlog',
'level' => env('LOG_LEVEL', 'debug'),
],
'null' => [
'driver' => 'monolog',
'handler' => NullHandler::class,
],
'emergency' => [
'path' => storage_path('logs/laravel.log'),
],
],
];
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/config/session.php | config/session.php | <?php
use Illuminate\Support\Str;
return [
/*
|--------------------------------------------------------------------------
| Default Session Driver
|--------------------------------------------------------------------------
|
| This option controls the default session "driver" that will be used on
| requests. By default, we will use the lightweight native driver but
| you may specify any of the other wonderful drivers provided here.
|
| Supported: "file", "cookie", "database", "apc",
| "memcached", "redis", "dynamodb", "array"
|
*/
'driver' => env('SESSION_DRIVER', 'file'),
/*
|--------------------------------------------------------------------------
| Session Lifetime
|--------------------------------------------------------------------------
|
| Here you may specify the number of minutes that you wish the session
| to be allowed to remain idle before it expires. If you want them
| to immediately expire on the browser closing, set that option.
|
*/
'lifetime' => env('SESSION_LIFETIME', 120),
'expire_on_close' => false,
/*
|--------------------------------------------------------------------------
| Session Encryption
|--------------------------------------------------------------------------
|
| This option allows you to easily specify that all of your session data
| should be encrypted before it is stored. All encryption will be run
| automatically by Laravel and you can use the Session like normal.
|
*/
'encrypt' => false,
/*
|--------------------------------------------------------------------------
| Session File Location
|--------------------------------------------------------------------------
|
| When using the native session driver, we need a location where session
| files may be stored. A default has been set for you but a different
| location may be specified. This is only needed for file sessions.
|
*/
'files' => storage_path('framework/sessions'),
/*
|--------------------------------------------------------------------------
| Session Database Connection
|--------------------------------------------------------------------------
|
| When using the "database" or "redis" session drivers, you may specify a
| connection that should be used to manage these sessions. This should
| correspond to a connection in your database configuration options.
|
*/
'connection' => env('SESSION_CONNECTION', null),
/*
|--------------------------------------------------------------------------
| Session Database Table
|--------------------------------------------------------------------------
|
| When using the "database" session driver, you may specify the table we
| should use to manage the sessions. Of course, a sensible default is
| provided for you; however, you are free to change this as needed.
|
*/
'table' => 'sessions',
/*
|--------------------------------------------------------------------------
| Session Cache Store
|--------------------------------------------------------------------------
|
| While using one of the framework's cache driven session backends you may
| list a cache store that should be used for these sessions. This value
| must match with one of the application's configured cache "stores".
|
| Affects: "apc", "dynamodb", "memcached", "redis"
|
*/
'store' => env('SESSION_STORE', null),
/*
|--------------------------------------------------------------------------
| Session Sweeping Lottery
|--------------------------------------------------------------------------
|
| Some session drivers must manually sweep their storage location to get
| rid of old sessions from storage. Here are the chances that it will
| happen on a given request. By default, the odds are 2 out of 100.
|
*/
'lottery' => [2, 100],
/*
|--------------------------------------------------------------------------
| Session Cookie Name
|--------------------------------------------------------------------------
|
| Here you may change the name of the cookie used to identify a session
| instance by ID. The name specified here will get used every time a
| new session cookie is created by the framework for every driver.
|
*/
'cookie' => env(
'SESSION_COOKIE',
Str::slug(env('APP_NAME', 'laravel'), '_').'_session'
),
/*
|--------------------------------------------------------------------------
| Session Cookie Path
|--------------------------------------------------------------------------
|
| The session cookie path determines the path for which the cookie will
| be regarded as available. Typically, this will be the root path of
| your application but you are free to change this when necessary.
|
*/
'path' => '/',
/*
|--------------------------------------------------------------------------
| Session Cookie Domain
|--------------------------------------------------------------------------
|
| Here you may change the domain of the cookie used to identify a session
| in your application. This will determine which domains the cookie is
| available to in your application. A sensible default has been set.
|
*/
'domain' => env('SESSION_DOMAIN', null),
/*
|--------------------------------------------------------------------------
| HTTPS Only Cookies
|--------------------------------------------------------------------------
|
| By setting this option to true, session cookies will only be sent back
| to the server if the browser has a HTTPS connection. This will keep
| the cookie from being sent to you if it can not be done securely.
|
*/
'secure' => env('SESSION_SECURE_COOKIE'),
/*
|--------------------------------------------------------------------------
| HTTP Access Only
|--------------------------------------------------------------------------
|
| Setting this value to true will prevent JavaScript from accessing the
| value of the cookie and the cookie will only be accessible through
| the HTTP protocol. You are free to modify this option if needed.
|
*/
'http_only' => true,
/*
|--------------------------------------------------------------------------
| Same-Site Cookies
|--------------------------------------------------------------------------
|
| This option determines how your cookies behave when cross-site requests
| take place, and can be used to mitigate CSRF attacks. By default, we
| will set this value to "lax" since this is a secure default value.
|
| Supported: "lax", "strict", "none", null
|
*/
'same_site' => 'lax',
];
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/config/queue.php | config/queue.php | <?php
return [
/*
|--------------------------------------------------------------------------
| Default Queue Connection Name
|--------------------------------------------------------------------------
|
| Laravel's queue API supports an assortment of back-ends via a single
| API, giving you convenient access to each back-end using the same
| syntax for every one. Here you may define a default connection.
|
*/
'default' => env('QUEUE_CONNECTION', 'sync'),
/*
|--------------------------------------------------------------------------
| Queue Connections
|--------------------------------------------------------------------------
|
| Here you may configure the connection information for each server that
| is used by your application. A default configuration has been added
| for each back-end shipped with Laravel. You are free to add more.
|
| Drivers: "sync", "database", "beanstalkd", "sqs", "redis", "null"
|
*/
'connections' => [
'sync' => [
'driver' => 'sync',
],
'database' => [
'driver' => 'database',
'table' => 'jobs',
'queue' => 'default',
'retry_after' => 90,
],
'beanstalkd' => [
'driver' => 'beanstalkd',
'host' => 'localhost',
'queue' => 'default',
'retry_after' => 90,
'block_for' => 0,
],
'sqs' => [
'driver' => 'sqs',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'),
'queue' => env('SQS_QUEUE', 'your-queue-name'),
'suffix' => env('SQS_SUFFIX'),
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
],
'redis' => [
'driver' => 'redis',
'connection' => 'default',
'queue' => env('REDIS_QUEUE', 'default'),
'retry_after' => 90,
'block_for' => null,
],
],
/*
|--------------------------------------------------------------------------
| Failed Queue Jobs
|--------------------------------------------------------------------------
|
| These options configure the behavior of failed queue job logging so you
| can control which database and table are used to store the jobs that
| have failed. You may change them to any database / table you wish.
|
*/
'failed' => [
'driver' => env('QUEUE_FAILED_DRIVER', 'database-uuids'),
'database' => env('DB_CONNECTION', 'mysql'),
'table' => 'failed_jobs',
],
];
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/config/cache.php | config/cache.php | <?php
use Illuminate\Support\Str;
return [
/*
|--------------------------------------------------------------------------
| Default Cache Store
|--------------------------------------------------------------------------
|
| This option controls the default cache connection that gets used while
| using this caching library. This connection is used when another is
| not explicitly specified when executing a given caching function.
|
*/
'default' => env('CACHE_DRIVER', 'file'),
/*
|--------------------------------------------------------------------------
| Cache Stores
|--------------------------------------------------------------------------
|
| Here you may define all of the cache "stores" for your application as
| well as their drivers. You may even define multiple stores for the
| same cache driver to group types of items stored in your caches.
|
| Supported drivers: "apc", "array", "database", "file",
| "memcached", "redis", "dynamodb", "null"
|
*/
'stores' => [
'apc' => [
'driver' => 'apc',
],
'array' => [
'driver' => 'array',
'serialize' => false,
],
'database' => [
'driver' => 'database',
'table' => 'cache',
'connection' => null,
'lock_connection' => null,
],
'file' => [
'driver' => 'file',
'path' => storage_path('framework/cache/data'),
],
'memcached' => [
'driver' => 'memcached',
'persistent_id' => env('MEMCACHED_PERSISTENT_ID'),
'sasl' => [
env('MEMCACHED_USERNAME'),
env('MEMCACHED_PASSWORD'),
],
'options' => [
// Memcached::OPT_CONNECT_TIMEOUT => 2000,
],
'servers' => [
[
'host' => env('MEMCACHED_HOST', '127.0.0.1'),
'port' => env('MEMCACHED_PORT', 11211),
'weight' => 100,
],
],
],
'redis' => [
'driver' => 'redis',
'connection' => 'cache',
'lock_connection' => 'default',
],
'dynamodb' => [
'driver' => 'dynamodb',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
'table' => env('DYNAMODB_CACHE_TABLE', 'cache'),
'endpoint' => env('DYNAMODB_ENDPOINT'),
],
],
/*
|--------------------------------------------------------------------------
| Cache Key Prefix
|--------------------------------------------------------------------------
|
| When utilizing a RAM based store such as APC or Memcached, there might
| be other applications utilizing the same cache. So, we'll specify a
| value to get prefixed to all our keys so we can avoid collisions.
|
*/
'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache'),
];
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/config/repository.php | config/repository.php | <?php
/*
|--------------------------------------------------------------------------
| Prettus Repository Config
|--------------------------------------------------------------------------
|
|
*/
return [
/*
|--------------------------------------------------------------------------
| Repository Pagination Limit Default
|--------------------------------------------------------------------------
|
*/
'pagination' => [
'limit' => 15,
],
/*
|--------------------------------------------------------------------------
| Fractal Presenter Config
|--------------------------------------------------------------------------
|
Available serializers:
ArraySerializer
DataArraySerializer
JsonApiSerializer
*/
'fractal' => [
'params' => [
'include' => 'include',
],
'serializer' => League\Fractal\Serializer\DataArraySerializer::class,
],
/*
|--------------------------------------------------------------------------
| Cache Config
|--------------------------------------------------------------------------
|
*/
'cache' => [
/*
|--------------------------------------------------------------------------
| Cache Status
|--------------------------------------------------------------------------
|
| Enable or disable cache
|
*/
'enabled' => false,
/*
|--------------------------------------------------------------------------
| Cache Minutes
|--------------------------------------------------------------------------
|
| Time of expiration cache
|
*/
'minutes' => 30,
/*
|--------------------------------------------------------------------------
| Cache Repository
|--------------------------------------------------------------------------
|
| Instance of Illuminate\Contracts\Cache\Repository
|
*/
'repository' => 'cache',
/*
|--------------------------------------------------------------------------
| Cache Clean Listener
|--------------------------------------------------------------------------
|
|
|
*/
'clean' => [
/*
|--------------------------------------------------------------------------
| Enable clear cache on repository changes
|--------------------------------------------------------------------------
|
*/
'enabled' => true,
/*
|--------------------------------------------------------------------------
| Actions in Repository
|--------------------------------------------------------------------------
|
| create : Clear Cache on create Entry in repository
| update : Clear Cache on update Entry in repository
| delete : Clear Cache on delete Entry in repository
|
*/
'on' => [
'create' => true,
'update' => true,
'delete' => true,
],
],
'params' => [
/*
|--------------------------------------------------------------------------
| Skip Cache Params
|--------------------------------------------------------------------------
|
|
| Ex: http://prettus.local/?search=lorem&skipCache=true
|
*/
'skipCache' => 'skipCache',
],
/*
|--------------------------------------------------------------------------
| Methods Allowed
|--------------------------------------------------------------------------
|
| methods cacheable : all, paginate, find, findByField, findWhere, getByCriteria
|
| Ex:
|
| 'only' =>['all','paginate'],
|
| or
|
| 'except' =>['find'],
*/
'allowed' => [
'only' => null,
'except' => null,
],
],
/*
|--------------------------------------------------------------------------
| Criteria Config
|--------------------------------------------------------------------------
|
| Settings of request parameters names that will be used by Criteria
|
*/
'criteria' => [
/*
|--------------------------------------------------------------------------
| Accepted Conditions
|--------------------------------------------------------------------------
|
| Conditions accepted in consultations where the Criteria
|
| Ex:
|
| 'acceptedConditions'=>['=','like']
|
| $query->where('foo','=','bar')
| $query->where('foo','like','bar')
|
*/
'acceptedConditions' => [
'=',
'like',
'in',
],
/*
|--------------------------------------------------------------------------
| Request Params
|--------------------------------------------------------------------------
|
| Request parameters that will be used to filter the query in the repository
|
| Params :
|
| - search : Searched value
| Ex: http://prettus.local/?search=lorem
|
| - searchFields : Fields in which research should be carried out
| Ex:
| http://prettus.local/?search=lorem&searchFields=name;email
| http://prettus.local/?search=lorem&searchFields=name:like;email
| http://prettus.local/?search=lorem&searchFields=name:like
|
| - filter : Fields that must be returned to the response object
| Ex:
| http://prettus.local/?search=lorem&filter=id,name
|
| - orderBy : Order By
| Ex:
| http://prettus.local/?search=lorem&orderBy=id
|
| - sortedBy : Sort
| Ex:
| http://prettus.local/?search=lorem&orderBy=id&sortedBy=asc
| http://prettus.local/?search=lorem&orderBy=id&sortedBy=desc
|
| - searchJoin: Specifies the search method (AND / OR), by default the
| application searches each parameter with OR
| EX:
| http://prettus.local/?search=lorem&searchJoin=and
| http://prettus.local/?search=lorem&searchJoin=or
|
*/
'params' => [
'search' => 'search',
'searchFields' => 'searchFields',
'filter' => 'filter',
'orderBy' => 'orderBy',
'sortedBy' => 'sortedBy',
'with' => 'with',
'searchJoin' => 'searchJoin',
'withCount' => 'withCount',
],
],
/*
|--------------------------------------------------------------------------
| Generator Config
|--------------------------------------------------------------------------
|
*/
'generator' => [
'basePath' => app()->path(),
'rootNamespace' => 'App\\',
'stubsOverridePath' => app()->path(),
'paths' => [
'models' => 'Entities',
'repositories' => 'Repositories',
'interfaces' => 'Repositories',
'transformers' => 'Transformers',
'presenters' => 'Presenters',
'validators' => 'Validators',
'controllers' => 'Http/Controllers',
'provider' => 'RepositoryServiceProvider',
'criteria' => 'Criteria',
],
],
];
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/config/hashing.php | config/hashing.php | <?php
return [
/*
|--------------------------------------------------------------------------
| Default Hash Driver
|--------------------------------------------------------------------------
|
| This option controls the default hash driver that will be used to hash
| passwords for your application. By default, the bcrypt algorithm is
| used; however, you remain free to modify this option if you wish.
|
| Supported: "bcrypt", "argon", "argon2id"
|
*/
'driver' => 'bcrypt',
/*
|--------------------------------------------------------------------------
| Bcrypt Options
|--------------------------------------------------------------------------
|
| Here you may specify the configuration options that should be used when
| passwords are hashed using the Bcrypt algorithm. This will allow you
| to control the amount of time it takes to hash the given password.
|
*/
'bcrypt' => [
'rounds' => env('BCRYPT_ROUNDS', 10),
],
/*
|--------------------------------------------------------------------------
| Argon Options
|--------------------------------------------------------------------------
|
| Here you may specify the configuration options that should be used when
| passwords are hashed using the Argon algorithm. These will allow you
| to control the amount of time it takes to hash the given password.
|
*/
'argon' => [
'memory' => 1024,
'threads' => 2,
'time' => 2,
],
];
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/config/view.php | config/view.php | <?php
return [
/*
|--------------------------------------------------------------------------
| View Storage Paths
|--------------------------------------------------------------------------
|
| Most templating systems load templates from disk. Here you may specify
| an array of paths that should be checked for your views. Of course
| the usual Laravel view path has already been registered for you.
|
*/
'paths' => [
resource_path('views'),
],
/*
|--------------------------------------------------------------------------
| Compiled View Path
|--------------------------------------------------------------------------
|
| This option determines where all the compiled Blade templates will be
| stored for your application. Typically, this is within the storage
| directory. However, as usual, you are free to change this value.
|
*/
'compiled' => env(
'VIEW_COMPILED_PATH',
realpath(storage_path('framework/views'))
),
];
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/config/database.php | config/database.php | <?php
use Illuminate\Support\Str;
return [
/*
|--------------------------------------------------------------------------
| Default Database Connection Name
|--------------------------------------------------------------------------
|
| Here you may specify which of the database connections below you wish
| to use as your default connection for all database work. Of course
| you may use many connections at once using the Database library.
|
*/
'default' => env('DB_CONNECTION', 'mysql'),
/*
|--------------------------------------------------------------------------
| Database Connections
|--------------------------------------------------------------------------
|
| Here are each of the database connections setup for your application.
| Of course, examples of configuring each database platform that is
| supported by Laravel is shown below to make development simple.
|
|
| All database work in Laravel is done through the PHP PDO facilities
| so make sure you have the driver for your particular database of
| choice installed on your machine before you begin development.
|
*/
'connections' => [
'sqlite' => [
'driver' => 'sqlite',
'url' => env('DATABASE_URL'),
'database' => env('DB_DATABASE', database_path('database.sqlite')),
'prefix' => env('DB_PREFIX', ''),
'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true),
],
'mysql' => [
'driver' => 'mysql',
'url' => env('DATABASE_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => env('DB_PREFIX', ''),
'prefix_indexes' => true,
'strict' => false,
'engine' => null,
'options' => extension_loaded('pdo_mysql') ? array_filter([
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
]) : [],
],
'pgsql' => [
'driver' => 'pgsql',
'url' => env('DATABASE_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '5432'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'prefix' => env('DB_PREFIX', ''),
'prefix_indexes' => true,
'schema' => 'public',
'sslmode' => 'prefer',
],
'sqlsrv' => [
'driver' => 'sqlsrv',
'url' => env('DATABASE_URL'),
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', '1433'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'prefix' => env('DB_PREFIX', ''),
'prefix_indexes' => true,
],
],
/*
|--------------------------------------------------------------------------
| Migration Repository Table
|--------------------------------------------------------------------------
|
| This table keeps track of all the migrations that have already run for
| your application. Using this information, we can determine which of
| the migrations on disk haven't actually been run in the database.
|
*/
'migrations' => 'migrations',
/*
|--------------------------------------------------------------------------
| Redis Databases
|--------------------------------------------------------------------------
|
| Redis is an open source, fast, and advanced key-value store that also
| provides a richer body of commands than a typical key-value system
| such as APC or Memcached. Laravel makes it easy to dig right in.
|
*/
'redis' => [
'client' => env('REDIS_CLIENT', 'phpredis'),
'options' => [
'cluster' => env('REDIS_CLUSTER', 'redis'),
'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'),
],
'default' => [
'url' => env('REDIS_URL'),
'host' => env('REDIS_HOST', '127.0.0.1'),
'password' => env('REDIS_PASSWORD', null),
'port' => env('REDIS_PORT', '6379'),
'database' => env('REDIS_DB', '0'),
],
'cache' => [
'url' => env('REDIS_URL'),
'host' => env('REDIS_HOST', '127.0.0.1'),
'password' => env('REDIS_PASSWORD', null),
'port' => env('REDIS_PORT', '6379'),
'database' => env('REDIS_CACHE_DB', '1'),
],
],
];
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/config/services.php | config/services.php | <?php
return [
/*
|--------------------------------------------------------------------------
| Third Party Services
|--------------------------------------------------------------------------
|
| This file is for storing the credentials for third party services such
| as Mailgun, Postmark, AWS and more. This file provides the de facto
| location for this type of information, allowing packages to have
| a conventional file to locate the various service credentials.
|
*/
'mailgun' => [
'domain' => env('MAILGUN_DOMAIN'),
'secret' => env('MAILGUN_SECRET'),
'endpoint' => env('MAILGUN_ENDPOINT', 'api.mailgun.net'),
],
'postmark' => [
'token' => env('POSTMARK_TOKEN'),
],
'ses' => [
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
],
];
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/config/concord.php | 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/config/filesystems.php | config/filesystems.php | <?php
return [
/*
|--------------------------------------------------------------------------
| Default Filesystem Disk
|--------------------------------------------------------------------------
|
| Here you may specify the default filesystem disk that should be used
| by the framework. The "local" disk, as well as a variety of cloud
| based disks are available to your application. Just store away!
|
*/
'default' => env('FILESYSTEM_DISK', 'public'),
/*
|--------------------------------------------------------------------------
| Filesystem Disks
|--------------------------------------------------------------------------
|
| Here you may configure as many filesystem "disks" as you wish, and you
| may even configure multiple disks of the same driver. Defaults have
| been setup for each driver as an example of the required options.
|
| Supported Drivers: "local", "ftp", "sftp", "s3"
|
*/
'disks' => [
'local' => [
'driver' => 'local',
'root' => storage_path('app'),
],
'public' => [
'driver' => 'local',
'root' => storage_path('app/public'),
'url' => env('APP_URL').'/storage',
'visibility' => 'public',
],
's3' => [
'driver' => 's3',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION'),
'bucket' => env('AWS_BUCKET'),
'url' => env('AWS_URL'),
'endpoint' => env('AWS_ENDPOINT'),
],
],
/*
|--------------------------------------------------------------------------
| Symbolic Links
|--------------------------------------------------------------------------
|
| Here you may configure the symbolic links that will be created when the
| `storage:link` Artisan command is executed. The array keys should be
| the locations of the links and the values should be their targets.
|
*/
'links' => [
public_path('storage') => storage_path('app/public'),
],
];
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/config/tinker.php | config/tinker.php | <?php
return [
/*
|--------------------------------------------------------------------------
| Console Commands
|--------------------------------------------------------------------------
|
| This option allows you to add additional Artisan commands that should
| be available within the Tinker environment. Once the command is in
| this array you may execute the command in Tinker using its name.
|
*/
'commands' => [
// App\Console\Commands\ExampleCommand::class,
],
/*
|--------------------------------------------------------------------------
| Auto Aliased Classes
|--------------------------------------------------------------------------
|
| Tinker will not automatically alias classes in your vendor namespaces
| but you may explicitly allow a subset of classes to get aliased by
| adding the names of each of those classes to the following list.
|
*/
'alias' => [
//
],
/*
|--------------------------------------------------------------------------
| Classes That Should Not Be Aliased
|--------------------------------------------------------------------------
|
| Typically, Tinker automatically aliases classes as you require them in
| Tinker. However, you may wish to never alias certain classes, which
| you may accomplish by listing the classes in the following array.
|
*/
'dont_alias' => [
'App\Nova',
],
];
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/config/mail.php | config/mail.php | <?php
return [
/*
|--------------------------------------------------------------------------
| Default Mailer
|--------------------------------------------------------------------------
|
| This option controls the default mailer that is used to send any email
| messages sent by your application. Alternative mailers may be setup
| and used as needed; however, this mailer will be used by default.
|
*/
'default' => env('MAIL_MAILER', 'smtp'),
/*
|--------------------------------------------------------------------------
| Mailer Configurations
|--------------------------------------------------------------------------
|
| Here you may configure all of the mailers used by your application plus
| their respective settings. Several examples have been configured for
| you and you are free to add your own as your application requires.
|
| Laravel supports a variety of mail "transport" drivers to be used while
| sending an e-mail. You will specify which one you are using for your
| mailers below. You are free to add additional mailers as required.
|
| Supported: "smtp", "sendmail", "mailgun", "ses",
| "postmark", "log", "array", "failover"
|
*/
'mailers' => [
'smtp' => [
'transport' => 'smtp',
'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
'port' => env('MAIL_PORT', 587),
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
'username' => env('MAIL_USERNAME'),
'password' => env('MAIL_PASSWORD'),
'timeout' => null,
'verify_peer' => false,
],
'ses' => [
'transport' => 'ses',
],
'mailgun' => [
'transport' => 'mailgun',
],
'postmark' => [
'transport' => 'postmark',
],
'sendmail' => [
'transport' => 'sendmail',
'path' => env('MAIL_SENDMAIL_PATH', '/usr/sbin/sendmail -bs -i'),
],
'log' => [
'transport' => 'log',
'channel' => env('MAIL_LOG_CHANNEL'),
],
'array' => [
'transport' => 'array',
],
'failover' => [
'transport' => 'failover',
'mailers' => [
'smtp',
'log',
],
],
],
/*
|--------------------------------------------------------------------------
| Global "From" Address
|--------------------------------------------------------------------------
|
| You may wish for all e-mails sent by your application to be sent from
| the same address. Here, you may specify a name and address that is
| used globally for all e-mails that are sent by your application.
|
*/
'from' => [
'address' => env('MAIL_FROM_ADDRESS'),
'name' => env('MAIL_FROM_NAME'),
],
/*
|--------------------------------------------------------------------------
| Default Mailer Domain
|--------------------------------------------------------------------------
|
| This option controls the domain for email message_id that is used to send email
| messages sent by your application.
|
*/
'domain' => env('MAIL_DOMAIN', 'webkul.com'),
/*
|--------------------------------------------------------------------------
| Markdown Mail Settings
|--------------------------------------------------------------------------
|
| If you are using Markdown based email rendering, you may configure your
| theme and component paths here, allowing you to customize the design
| of the emails. Or, you may simply stick with the Laravel defaults!
|
*/
'markdown' => [
'theme' => 'default',
'paths' => [
resource_path('views/vendor/mail'),
],
],
];
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/config/imap.php | config/imap.php | <?php
return [
/*
|--------------------------------------------------------------------------
| IMAP default account
|--------------------------------------------------------------------------
|
| The default account identifier. It will be used as default for any missing account parameters.
| If however the default account is missing a parameter the package default will be used.
| Set to 'false' [boolean] to disable this functionality.
|
*/
'default' => env('IMAP_DEFAULT_ACCOUNT', 'default'),
/*
|--------------------------------------------------------------------------
| Default date format
|--------------------------------------------------------------------------
|
| The default date format is used to convert any given Carbon::class object into a valid date string.
| These are currently known working formats: "d-M-Y", "d-M-y", "d M y"
|
*/
'date_format' => 'd-M-Y',
/*
|--------------------------------------------------------------------------
| Available IMAP accounts
|--------------------------------------------------------------------------
|
| Please list all IMAP accounts which you are planning to use within the
| array below.
|
*/
'accounts' => [
'default' => [
'host' => env('IMAP_HOST', 'localhost'),
'port' => env('IMAP_PORT', 993),
'protocol' => env('IMAP_PROTOCOL', 'imap'), // might also use imap, [pop3 or nntp (untested)]
'encryption' => env('IMAP_ENCRYPTION', 'ssl'), // Supported: false, 'ssl', 'tls', 'notls', 'starttls'
'validate_cert' => env('IMAP_VALIDATE_CERT', true),
'username' => env('IMAP_USERNAME', 'root@example.com'),
'password' => env('IMAP_PASSWORD', ''),
'authentication' => env('IMAP_AUTHENTICATION', null),
'proxy' => [
'socket' => null,
'request_fulluri' => false,
'username' => null,
'password' => null,
],
'timeout' => 30,
'extensions' => [],
],
],
/*
|--------------------------------------------------------------------------
| Available IMAP options
|--------------------------------------------------------------------------
|
| Available php imap config parameters are listed below
| -Delimiter (optional):
| This option is only used when calling $oClient->
| You can use any supported char such as ".", "/", (...)
| -Fetch option:
| IMAP::FT_UID - Message marked as read by fetching the body message
| IMAP::FT_PEEK - Fetch the message without setting the "seen" flag
| -Fetch sequence id:
| IMAP::ST_UID - Fetch message components using the message uid
| IMAP::ST_MSGN - Fetch message components using the message number
| -Body download option
| Default TRUE
| -Flag download option
| Default TRUE
| -Soft fail
| Default FALSE - Set to TRUE if you want to ignore certain exception while fetching bulk messages
| -RFC822
| Default TRUE - Set to FALSE to prevent the usage of \imap_rfc822_parse_headers().
| See https://github.com/Webklex/php-imap/issues/115 for more information.
| -Debug enable to trace communication traffic
| -UID cache enable the UID cache
| -Fallback date is used if the given message date could not be parsed
| -Boundary regex used to detect message boundaries. If you are having problems with empty messages, missing
| attachments or anything like this. Be advised that it likes to break which causes new problems..
| -Message key identifier option
| You can choose between the following:
| 'id' - Use the MessageID as array key (default, might cause hickups with yahoo mail)
| 'number' - Use the message number as array key (isn't always unique and can cause some interesting behavior)
| 'list' - Use the message list number as array key (incrementing integer (does not always start at 0 or 1)
| 'uid' - Use the message uid as array key (isn't always unique and can cause some interesting behavior)
| -Fetch order
| 'asc' - Order all messages ascending (probably results in oldest first)
| 'desc' - Order all messages descending (probably results in newest first)
| -Disposition types potentially considered an attachment
| Default ['attachment', 'inline']
| -Common folders
| Default folder locations and paths assumed if none is provided
| -Open IMAP options:
| DISABLE_AUTHENTICATOR - Disable authentication properties.
| Use 'GSSAPI' if you encounter the following
| error: "Kerberos error: No credentials cache
| file found (try running kinit) (...)"
| or ['GSSAPI','PLAIN'] if you are using outlook mail
| -Decoder options (currently only the message subject and attachment name decoder can be set)
| 'utf-8' - Uses imap_utf8($string) to decode a string
| 'mimeheader' - Uses mb_decode_mimeheader($string) to decode a string
|
*/
'options' => [
'delimiter' => '/',
'fetch' => \Webklex\PHPIMAP\IMAP::FT_PEEK,
'sequence' => \Webklex\PHPIMAP\IMAP::ST_UID,
'fetch_body' => true,
'fetch_flags' => true,
'soft_fail' => false,
'rfc822' => true,
'debug' => false,
'uid_cache' => true,
// 'fallback_date' => "01.01.1970 00:00:00",
'boundary' => '/boundary=(.*?(?=;)|(.*))/i',
'message_key' => 'list',
'fetch_order' => 'asc',
'dispositions' => ['attachment', 'inline'],
'common_folders' => [
'root' => 'INBOX',
'junk' => 'INBOX/Junk',
'draft' => 'INBOX/Drafts',
'sent' => 'INBOX/Sent',
'trash' => 'INBOX/Trash',
],
'decoder' => [
'message' => 'utf-8', // mimeheader
'attachment' => 'utf-8', // mimeheader
],
'open' => [
// 'DISABLE_AUTHENTICATOR' => 'GSSAPI'
],
],
/*
|--------------------------------------------------------------------------
| Available flags
|--------------------------------------------------------------------------
|
| List all available / supported flags. Set to null to accept all given flags.
*/
'flags' => ['recent', 'flagged', 'answered', 'deleted', 'seen', 'draft'],
/*
|--------------------------------------------------------------------------
| Available events
|--------------------------------------------------------------------------
|
*/
'events' => [
'message' => [
'new' => \Webklex\IMAP\Events\MessageNewEvent::class,
'moved' => \Webklex\IMAP\Events\MessageMovedEvent::class,
'copied' => \Webklex\IMAP\Events\MessageCopiedEvent::class,
'deleted' => \Webklex\IMAP\Events\MessageDeletedEvent::class,
'restored' => \Webklex\IMAP\Events\MessageRestoredEvent::class,
],
'folder' => [
'new' => \Webklex\IMAP\Events\FolderNewEvent::class,
'moved' => \Webklex\IMAP\Events\FolderMovedEvent::class,
'deleted' => \Webklex\IMAP\Events\FolderDeletedEvent::class,
],
'flag' => [
'new' => \Webklex\IMAP\Events\FlagNewEvent::class,
'deleted' => \Webklex\IMAP\Events\FlagDeletedEvent::class,
],
],
/*
|--------------------------------------------------------------------------
| Available masking options
|--------------------------------------------------------------------------
|
| By using your own custom masks you can implement your own methods for
| a better and faster access and less code to write.
|
| Checkout the two examples custom_attachment_mask and custom_message_mask
| for a quick start.
|
| The provided masks below are used as the default masks.
*/
'masks' => [
'message' => \Webklex\PHPIMAP\Support\Masks\MessageMask::class,
'attachment' => \Webklex\PHPIMAP\Support\Masks\AttachmentMask::class,
],
];
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/config/cors.php | 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/config/broadcasting.php | config/broadcasting.php | <?php
return [
/*
|--------------------------------------------------------------------------
| Default Broadcaster
|--------------------------------------------------------------------------
|
| This option controls the default broadcaster that will be used by the
| framework when an event needs to be broadcast. You may set this to
| any of the connections defined in the "connections" array below.
|
| Supported: "pusher", "ably", "redis", "log", "null"
|
*/
'default' => env('BROADCAST_DRIVER', 'null'),
/*
|--------------------------------------------------------------------------
| Broadcast Connections
|--------------------------------------------------------------------------
|
| Here you may define all of the broadcast connections that will be used
| to broadcast events to other systems or over websockets. Samples of
| each available type of connection are provided inside this array.
|
*/
'connections' => [
'pusher' => [
'driver' => 'pusher',
'key' => env('PUSHER_APP_KEY'),
'secret' => env('PUSHER_APP_SECRET'),
'app_id' => env('PUSHER_APP_ID'),
'options' => [
'cluster' => env('PUSHER_APP_CLUSTER'),
'useTLS' => true,
],
],
'ably' => [
'driver' => 'ably',
'key' => env('ABLY_KEY'),
],
'redis' => [
'driver' => 'redis',
'connection' => 'default',
],
'log' => [
'driver' => 'log',
],
'null' => [
'driver' => 'null',
],
],
];
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/config/auth.php | config/auth.php | <?php
return [
/*
|--------------------------------------------------------------------------
| Authentication Defaults
|--------------------------------------------------------------------------
|
| This option controls the default authentication "guard" and password
| reset options for your application. You may change these defaults
| as required, but they're a perfect start for most applications.
|
*/
'defaults' => [
'guard' => 'user',
'passwords' => 'users',
],
/*
|--------------------------------------------------------------------------
| Authentication Guards
|--------------------------------------------------------------------------
|
| Next, you may define every authentication guard for your application.
| Of course, a great default configuration has been defined for you
| here which uses session storage and the Eloquent user provider.
|
| All authentication drivers have a user provider. This defines how the
| users are actually retrieved out of your database or other storage
| mechanisms used by this application to persist your user's data.
|
| Supported: "session", "token"
|
*/
'guards' => [
'user' => [
'driver' => 'session',
'provider' => 'users',
],
],
/*
|--------------------------------------------------------------------------
| User Providers
|--------------------------------------------------------------------------
|
| All authentication drivers have a user provider. This defines how the
| users are actually retrieved out of your database or other storage
| mechanisms used by this application to persist your user's data.
|
| If you have multiple user tables or models you may configure multiple
| sources which represent each model / table. These sources may then
| be assigned to any extra authentication guards you have defined.
|
| Supported: "database", "eloquent"
|
*/
'providers' => [
'users' => [
'driver' => 'eloquent',
'model' => Webkul\User\Models\User::class,
],
],
/*
|--------------------------------------------------------------------------
| Resetting Passwords
|--------------------------------------------------------------------------
|
| You may specify multiple password reset configurations if you have more
| than one user table or model in the application and you want to have
| separate password reset settings based on the specific user types.
|
| The expire time is the number of minutes that the reset token should be
| considered valid. This security feature keeps tokens short-lived so
| they have less time to be guessed. You may change this as needed.
|
*/
'passwords' => [
'users' => [
'provider' => 'users',
'table' => 'user_password_resets',
'expire' => 60,
],
],
/*
|--------------------------------------------------------------------------
| Password Confirmation Timeout
|--------------------------------------------------------------------------
|
| Here you may define the amount of seconds before a password confirmation
| times out and the user is prompted to re-enter their password via the
| confirmation screen. By default, the timeout lasts for three hours.
|
*/
'password_timeout' => 10800,
];
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/config/sanctum.php | 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/database/factories/UserFactory.php | database/factories/UserFactory.php | <?php
namespace Database\Factories;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;
class UserFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = User::class;
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
return [
'name' => $this->faker->name,
'email' => $this->faker->unique()->safeEmail,
'email_verified_at' => now(),
'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password
'remember_token' => Str::random(10),
];
}
/**
* Indicate that the model's email address should be unverified.
*
* @return \Illuminate\Database\Eloquent\Factories\Factory
*/
public function unverified()
{
return $this->state(function (array $attributes) {
return [
'email_verified_at' => null,
];
});
}
}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/database/migrations/2019_08_19_000000_create_failed_jobs_table.php | database/migrations/2019_08_19_000000_create_failed_jobs_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('failed_jobs', function (Blueprint $table) {
$table->id();
$table->string('uuid')->unique();
$table->text('connection');
$table->text('queue');
$table->longText('payload');
$table->longText('exception');
$table->timestamp('failed_at')->useCurrent();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('failed_jobs');
}
};
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/database/migrations/2024_09_09_094040_create_job_batches_table.php | database/migrations/2024_09_09_094040_create_job_batches_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('job_batches', function (Blueprint $table) {
$table->string('id')->primary();
$table->string('name');
$table->integer('total_jobs');
$table->integer('pending_jobs');
$table->integer('failed_jobs');
$table->text('failed_job_ids');
$table->mediumText('options')->nullable();
$table->integer('cancelled_at')->nullable();
$table->integer('created_at');
$table->integer('finished_at')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('job_batches');
}
};
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/database/migrations/2024_09_09_094042_create_jobs_table.php | database/migrations/2024_09_09_094042_create_jobs_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('jobs', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('queue')->index();
$table->longText('payload');
$table->unsignedTinyInteger('attempts');
$table->unsignedInteger('reserved_at')->nullable();
$table->unsignedInteger('available_at');
$table->unsignedInteger('created_at');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('jobs');
}
};
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/database/migrations/2019_12_14_000001_create_personal_access_tokens_table.php | database/migrations/2019_12_14_000001_create_personal_access_tokens_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('personal_access_tokens', function (Blueprint $table) {
$table->id();
$table->morphs('tokenable');
$table->string('name');
$table->string('token', 64)->unique();
$table->text('abilities')->nullable();
$table->timestamp('last_used_at')->nullable();
$table->timestamp('expires_at')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('personal_access_tokens');
}
};
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/database/seeders/DatabaseSeeder.php | database/seeders/DatabaseSeeder.php | <?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
use Webkul\Installer\Database\Seeders\DatabaseSeeder as KrayinDatabaseSeeder;
class DatabaseSeeder extends Seeder
{
/**
* Seed the application's database.
*
* @return void
*/
public function run()
{
$this->call(KrayinDatabaseSeeder::class);
}
}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Email/src/Helpers/Attachment.php | packages/Webkul/Email/src/Helpers/Attachment.php | <?php
namespace Webkul\Email\Helpers;
class Attachment
{
/**
* Content.
*
* @var File Content
*/
private $content = null;
/**
* Create an helper instance
*/
public function __construct(
public $filename,
public $contentType,
public $stream,
public $contentDisposition = 'attachment',
public $contentId = '',
public $headers = []
) {}
/**
* Retrieve the attachment filename.
*
* @return string
*/
public function getFilename()
{
return $this->filename;
}
/**
* Retrieve the attachment content type.
*
* @return string
*/
public function getContentType()
{
return $this->contentType;
}
/**
* Retrieve the attachment content disposition.
*
* @return string
*/
public function getContentDisposition()
{
return $this->contentDisposition;
}
/**
* Retrieve the attachment content ID.
*
* @return string
*/
public function getContentID()
{
return $this->contentId;
}
/**
* Retrieve the attachment headers.
*
* @return string
*/
public function getHeaders()
{
return $this->headers;
}
/**
* Read the contents a few bytes at a time until completed.
*
* Once read to completion, it always returns false.
*
* @param int $bytes
* @return string
*/
public function read($bytes = 2082)
{
return feof($this->stream) ? false : fread($this->stream, $bytes);
}
/**
* Retrieve the file content in one go.
*
* Once you retrieve the content you cannot use MimeMailParser_attachment::read().
*
* @return string
*/
public function getContent()
{
if ($this->content === null) {
fseek($this->stream, 0);
while (($buf = $this->read()) !== false) {
$this->content .= $buf;
}
}
return $this->content;
}
}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Email/src/Helpers/Parser.php | packages/Webkul/Email/src/Helpers/Parser.php | <?php
namespace Webkul\Email\Helpers;
use Webkul\Email\Helpers\Contracts\CharsetManager;
class Parser
{
/**
* Resource.
*/
public $resource;
/**
* A file pointer to email.
*/
public $stream;
/**
* Data.
*/
public $data;
/**
* Container.
*/
public $container;
/**
* Entity.
*/
public $entity;
/**
* Files.
*/
public $files;
/**
* Parts of an email.
*/
public $parts;
/**
* Charset manager object.
*/
public $charset;
/**
* Create a new instance.
*
* @return void
*/
public function __construct(?CharsetManager $charset = null)
{
if (is_null($charset)) {
$charset = new Charset;
}
$this->charset = $charset;
}
/**
* Free the held resouces.
*
* @return void
*/
public function __destruct()
{
// clear the email file resource
if (is_resource($this->stream)) {
fclose($this->stream);
}
// clear the mail parse resource
if (is_resource($this->resource)) {
mailparse_msg_free($this->resource);
}
}
/**
* Set the file path we use to get the email text.
*
* @param string $path
* @return object
*/
public function setPath($path)
{
$this->resource = mailparse_msg_parse_file($path);
$this->stream = fopen($path, 'r');
$this->parse();
return $this;
}
/**
* Set the stream resource we use to get the email text.
*
* @return object
*/
public function setStream($stream)
{
// streams have to be cached to file first
$meta = @stream_get_meta_data($stream);
if (
! $meta
|| ! $meta['mode']
|| $meta['mode'][0] != 'r'
|| $meta['eof']
) {
throw new \Exception(
'setStream() expects parameter stream to be readable stream resource.'
);
}
$tmp_fp = tmpfile();
if ($tmp_fp) {
while (! feof($stream)) {
fwrite($tmp_fp, fread($stream, 2028));
}
fseek($tmp_fp, 0);
$this->stream = &$tmp_fp;
} else {
throw new \Exception(
'Could not create temporary files for attachments. Your tmp directory may be un-writable by PHP.'
);
}
fclose($stream);
$this->resource = mailparse_msg_create();
// parses the message incrementally (low memory usage but slower)
while (! feof($this->stream)) {
mailparse_msg_parse($this->resource, fread($this->stream, 2082));
}
$this->parse();
return $this;
}
/**
* Set the email text.
*
* @return object
*/
public function setText($data)
{
$this->resource = \mailparse_msg_create();
// does not parse incrementally, fast memory hog might explode
mailparse_msg_parse($this->resource, $data);
$this->data = $data;
$this->parse();
return $this;
}
/**
* Parse the message into parts.
*
* @return void
*/
private function parse()
{
$structure = mailparse_msg_get_structure($this->resource);
$headerType = (stripos($this->data, 'Content-Language:') !== false) ? 'Content-Language:' : 'Content-Type:';
if (count($structure) == 1) {
$tempParts = explode(PHP_EOL, $this->data);
foreach ($tempParts as $key => $part) {
if (stripos($part, $headerType) !== false) {
break;
}
if (trim($part) == '') {
unset($tempParts[$key]);
}
}
$data = implode(PHP_EOL, $tempParts);
$this->resource = \mailparse_msg_create();
mailparse_msg_parse($this->resource, $data);
$this->data = $data;
$structure = mailparse_msg_get_structure($this->resource);
}
$this->parts = [];
foreach ($structure as $part_id) {
$part = mailparse_msg_get_part($this->resource, $part_id);
$this->parts[$part_id] = mailparse_msg_get_part_data($part);
}
}
/**
* Parse sender name.
*
* @return string
*/
public function parseSenderName()
{
if (! $fromNameParts = mailparse_rfc822_parse_addresses($this->getHeader('from'))) {
$fromNameParts = mailparse_rfc822_parse_addresses($this->getHeader('sender'));
}
return $fromNameParts[0]['display'] == $fromNameParts[0]['address']
? current(explode('@', $fromNameParts[0]['display']))
: $fromNameParts[0]['display'];
}
/**
* Parse email address.
*
* @param string $type
* @return array
*/
public function parseEmailAddress($type)
{
$emails = [];
$addresses = mailparse_rfc822_parse_addresses($this->getHeader($type));
if (count($addresses) > 1) {
foreach ($addresses as $address) {
if (filter_var($address['address'], FILTER_VALIDATE_EMAIL)) {
$emails[] = $address['address'];
}
}
} elseif ($addresses) {
$emails[] = $addresses[0]['address'];
}
return $emails;
}
/**
* Retrieve a specific email header, without charset conversion.
*
* @return string
*/
public function getRawHeader($name)
{
if (isset($this->parts[1])) {
$headers = $this->getPart('headers', $this->parts[1]);
return (isset($headers[$name])) ? $headers[$name] : false;
} else {
throw new \Exception(
'setPath() or setText() or setStream() must be called before retrieving email headers.'
);
}
}
/**
* Retrieve a specific email header.
*
* @return string
*/
public function getHeader($name)
{
$rawHeader = $this->getRawHeader($name);
if ($rawHeader === false) {
return false;
}
return $this->decodeHeader($rawHeader);
}
/**
* Retrieve all mail headers.
*
* @return array
*/
public function getHeaders()
{
if (isset($this->parts[1])) {
$headers = $this->getPart('headers', $this->parts[1]);
foreach ($headers as $name => &$value) {
if (is_array($value)) {
foreach ($value as &$v) {
$v = $this->decodeSingleHeader($v);
}
} else {
$value = $this->decodeSingleHeader($value);
}
}
return $headers;
} else {
throw new \Exception(
'setPath() or setText() or setStream() must be called before retrieving email headers.'
);
}
}
/**
* Get from name.
*
* @return string
*/
public function getFromName()
{
$headers = $this->getHeaders();
return $headers['from'];
}
/**
* Extract multipart MIME text.
*
* @return string
*/
public function extractMultipartMIMEText($part, $source, $encodingType)
{
$boundary = trim($part['content-boundary']);
$boundary = substr($boundary, strpos($boundary, '----=') + strlen('----='));
preg_match_all('/------=(3D_.*)\sContent-Type:\s(.*)\s*boundary=3D"----=(3D_.*)"/', $source, $matches);
$delimeter = array_shift($matches);
$content_delimeter = end($delimeter);
[$relations, $content_types, $boundaries] = $matches;
$messageToProcess = substr($source, stripos($source, (string) $content_delimeter) + strlen($content_delimeter));
array_unshift($boundaries, $boundary);
// Extract the text
foreach (array_reverse($boundaries) as $index => $boundary) {
$processedEmailSegments = [];
$emailSegments = explode('------='.$boundary, $messageToProcess);
// Remove empty parts
foreach ($emailSegments as $emailSegment) {
if (! empty(trim($emailSegment))) {
$processedEmailSegments[] = trim($emailSegment);
}
}
// Remove unrelated parts
array_pop($processedEmailSegments);
for ($i = 0; $i < $index; $i++) {
if (count($processedEmailSegments) > 1) {
array_shift($processedEmailSegments);
}
}
// Parse each parts for text|html content
foreach ($processedEmailSegments as $emailSegment) {
$emailSegment = quoted_printable_decode(quoted_printable_decode($emailSegment));
if (stripos($emailSegment, 'content-type: text/plain;') !== false
|| stripos($emailSegment, 'content-type: text/html;') !== false
) {
$search = 'content-transfer-encoding: '.$encodingType;
return substr($emailSegment, stripos($emailSegment, $search) + strlen($search));
}
}
}
return '';
}
/**
* Returns the email message body in the specified format.
*
* @return mixed
*/
public function getMessageBody($type = 'text')
{
$textBody = $htmlBody = $body = false;
$mime_types = [
'text'=> 'text/plain',
'text'=> 'text/plain; (error)',
'html'=> 'text/html',
];
if (in_array($type, array_keys($mime_types))) {
foreach ($this->parts as $key => $part) {
if (in_array($this->getPart('content-type', $part), $mime_types)
&& $this->getPart('content-disposition', $part) != 'attachment'
) {
$headers = $this->getPart('headers', $part);
$encodingType = array_key_exists('content-transfer-encoding', $headers) ? $headers['content-transfer-encoding'] : '';
if ($this->getPart('content-type', $part) == 'text/plain') {
$textBody .= $this->decodeContentTransfer($this->getPartBody($part), $encodingType);
$textBody = nl2br($this->charset->decodeCharset($textBody, $this->getPartCharset($part)));
} elseif ($this->getPart('content-type', $part) == 'text/plain; (error)') {
if (empty($part['headers']) || ! isset($part['headers']['from'])) {
$parentKey = explode('.', $key)[0];
if (isset($this->parts[$parentKey]) && isset($this->parts[$parentKey]['headers']['from'])) {
$part_from_sender = is_array($this->parts[$parentKey]['headers']['from'])
? $this->parts[$parentKey]['headers']['from'][0]
: $this->parts[$parentKey]['headers']['from'];
} else {
continue;
}
} else {
$part_from_sender = is_array($part['headers']['from'])
? $part['headers']['from'][0]
: $part['headers']['from'];
}
$mail_part_addresses = mailparse_rfc822_parse_addresses($part_from_sender);
if (! empty($mail_part_addresses[0]['address'])
&& strrpos($mail_part_addresses[0]['address'], 'pcsms.com') !== false
) {
$last_header = end($headers);
$partMessage = substr($this->data, strrpos($this->data, $last_header) + strlen($last_header), $part['ending-pos-body']);
$textBody .= $this->decodeContentTransfer($partMessage, $encodingType);
$textBody = nl2br($this->charset->decodeCharset($textBody, $this->getPartCharset($part)));
}
} elseif ($this->getPart('content-type', $part) == 'multipart/mixed'
|| $this->getPart('content-type', $part) == 'multipart/related'
) {
$emailContent = $this->extractMultipartMIMEText($part, $this->data, $encodingType);
$textBody .= $this->decodeContentTransfer($emailContent, $encodingType);
$textBody = nl2br($this->charset->decodeCharset($textBody, $this->getPartCharset($part)));
} else {
$htmlBody .= $this->decodeContentTransfer($this->getPartBody($part), $encodingType);
$htmlBody = $this->charset->decodeCharset($htmlBody, $this->getPartCharset($part));
}
}
}
$body = $htmlBody ?: $textBody;
if (is_array($this->files)) {
foreach ($this->files as $file) {
if ($file['contentId']) {
$body = str_replace('cid:'.preg_replace('/[<>]/', '', $file['contentId']), $file['path'], $body);
$path = $file['path'];
}
}
}
} else {
throw new \Exception('Invalid type specified for getMessageBody(). "type" can either be text or html.');
}
return $body;
}
/**
* Get text message body.
*
* @return string
*/
public function getTextMessageBody()
{
$textBody = null;
foreach ($this->parts as $key => $part) {
if ($this->getPart('content-disposition', $part) != 'attachment') {
$headers = $this->getPart('headers', $part);
$encodingType = array_key_exists('content-transfer-encoding', $headers) ? $headers['content-transfer-encoding'] : '';
if ($this->getPart('content-type', $part) == 'text/plain') {
$textBody .= $this->decodeContentTransfer($this->getPartBody($part), $encodingType);
$textBody = nl2br($this->charset->decodeCharset($textBody, $this->getPartCharset($part)));
} elseif ($this->getPart('content-type', $part) == 'text/plain; (error)') {
$part_from_sender = is_array($part['headers']['from']) ? $part['headers']['from'][0] : $part['headers']['from'];
$mail_part_addresses = mailparse_rfc822_parse_addresses($part_from_sender);
if (! empty($mail_part_addresses[0]['address'])
&& strrpos($mail_part_addresses[0]['address'], 'pcsms.com') !== false
) {
$last_header = end($headers);
$partMessage = substr($this->data, strrpos($this->data, $last_header) + strlen($last_header), $part['ending-pos-body']);
$textBody .= $this->decodeContentTransfer($partMessage, $encodingType);
$textBody = nl2br($this->charset->decodeCharset($textBody, $this->getPartCharset($part)));
}
} elseif ($this->getPart('content-type', $part) == 'multipart/mixed'
|| $this->getPart('content-type', $part) == 'multipart/related'
) {
$emailContent = $this->extractMultipartMIMEText($part, $this->data, $encodingType);
$textBody .= $this->decodeContentTransfer($emailContent, $encodingType);
$textBody = nl2br($this->charset->decodeCharset($textBody, $this->getPartCharset($part)));
}
}
}
return $textBody;
}
/**
* Returns the attachments contents in order of appearance.
*
* @return array
*/
public function getAttachments()
{
$attachments = [];
$dispositions = ['attachment', 'inline'];
$non_attachment_types = ['text/plain', 'text/html', 'text/plain; (error)'];
$nonameIter = 0;
foreach ($this->parts as $part) {
$disposition = $this->getPart('content-disposition', $part);
$filename = 'noname';
if (isset($part['disposition-filename'])) {
$filename = $this->decodeHeader($part['disposition-filename']);
} elseif (isset($part['content-name'])) {
// if we have no disposition but we have a content-name, it's a valid attachment.
// we simulate the presence of an attachment disposition with a disposition filename
$filename = $this->decodeHeader($part['content-name']);
$disposition = 'attachment';
} elseif (! in_array($part['content-type'], $non_attachment_types, true)
&& substr($part['content-type'], 0, 10) !== 'multipart/'
) {
// if we cannot get it by getMessageBody(), we assume it is an attachment
$disposition = 'attachment';
}
if (in_array($disposition, $dispositions) === true && isset($filename) === true) {
if ($filename == 'noname') {
$nonameIter++;
$filename = 'noname'.$nonameIter;
}
$headersAttachments = $this->getPart('headers', $part);
$contentidAttachments = $this->getPart('content-id', $part);
if (! $contentidAttachments
&& $disposition == 'inline'
&& ! strpos($this->getPart('content-type', $part), 'image/')
&& ! stripos($filename, 'noname') == false
) {
// skip
} else {
$attachments[] = new Attachment(
$filename,
$this->getPart('content-type', $part),
$this->getAttachmentStream($part),
$disposition,
$contentidAttachments,
$headersAttachments
);
}
}
}
return ! empty($attachments) ? $attachments : $this->extractMultipartMIMEAttachments();
}
/**
* Extract attachments from multipart MIME.
*
* @return array
*/
public function extractMultipartMIMEAttachments()
{
$attachmentCollection = $processedAttachmentCollection = [];
foreach ($this->parts as $part) {
$boundary = isset($part['content-boundary']) ? trim($part['content-boundary']) : '';
$boundary = substr($boundary, strpos($boundary, '----=') + strlen('----='));
preg_match_all('/------=(3D_.*)\sContent-Type:\s(.*)\s*boundary=3D"----=(3D_.*)"/', $this->data, $matches);
$delimeter = array_shift($matches);
$content_delimeter = end($delimeter);
[$relations, $content_types, $boundaries] = $matches;
$messageToProcess = substr($this->data, stripos($this->data, (string) $content_delimeter) + strlen($content_delimeter));
array_unshift($boundaries, $boundary);
// Extract the text
foreach (array_reverse($boundaries) as $index => $boundary) {
$processedEmailSegments = [];
$emailSegments = explode('------='.$boundary, $messageToProcess);
// Remove empty parts
foreach ($emailSegments as $emailSegment) {
if (! empty(trim($emailSegment))) {
$processedEmailSegments[] = trim($emailSegment);
}
}
// Remove unrelated parts
array_pop($processedEmailSegments);
for ($i = 0; $i < $index; $i++) {
if (count($processedEmailSegments) > 1) {
array_shift($processedEmailSegments);
}
}
// Parse each parts for text|html content
foreach ($processedEmailSegments as $emailSegment) {
$emailSegment = quoted_printable_decode(quoted_printable_decode($emailSegment));
if (stripos($emailSegment, 'content-type: text/plain;') === false
&& stripos($emailSegment, 'content-type: text/html;') === false
) {
$attachmentParts = explode("\n\n", $emailSegment);
if (! empty($attachmentParts) && count($attachmentParts) == 2) {
$attachmentDetails = explode("\n", $attachmentParts[0]);
$attachmentDetails = array_map(function ($item) {
return trim($item);
}, $attachmentDetails);
$attachmentData = trim($attachmentParts[1]);
$attachmentCollection[] = [
'details' => $attachmentDetails,
'data' => $attachmentData,
];
}
}
}
}
}
foreach ($attachmentCollection as $attachmentDetails) {
$stream = '';
$resourceDetails = [
'name' => '',
'fileName' => '',
'contentType' => '',
'encodingType' => 'base64',
'contentDisposition' => 'inline',
'contentId' => '',
];
foreach ($attachmentDetails['details'] as $attachmentDetail) {
if (stripos($attachmentDetail, 'Content-Type: ') === 0) {
$resourceDetails['contentType'] = substr($attachmentDetail, strlen('Content-Type: '));
} elseif (stripos($attachmentDetail, 'name="') === 0) {
$resourceDetails['name'] = substr($attachmentDetail, strlen('name="'), -1);
} elseif (stripos($attachmentDetail, 'Content-Transfer-Encoding: ') === 0) {
$resourceDetails['encodingType'] = substr($attachmentDetail, strlen('Content-Transfer-Encoding: '));
} elseif (stripos($attachmentDetail, 'Content-ID: ') === 0) {
$resourceDetails['contentId'] = substr($attachmentDetail, strlen('Content-ID: '));
} elseif (stripos($attachmentDetail, 'filename="') === 0) {
$resourceDetails['fileName'] = substr($attachmentDetail, strlen('filename="'), -1);
} elseif (stripos($attachmentDetail, 'Content-Disposition: ') === 0) {
$resourceDetails['contentDisposition'] = substr($attachmentDetail, strlen('Content-Disposition: '), -1);
}
}
$resourceDetails['name'] = empty($resourceDetails['name']) ? $resourceDetails['fileName'] : $resourceDetails['name'];
$resourceDetails['fileName'] = empty($resourceDetails['fileName']) ? $resourceDetails['name'] : $resourceDetails['fileName'];
$temp_fp = tmpfile();
fwrite($temp_fp, base64_decode($attachmentDetails['data']), strlen($attachmentDetails['data']));
fseek($temp_fp, 0, SEEK_SET);
$processedAttachmentCollection[] = new Attachment(
$resourceDetails['fileName'],
$resourceDetails['contentType'],
$temp_fp,
$resourceDetails['contentDisposition'],
$resourceDetails['contentId'], []
);
}
return $processedAttachmentCollection;
}
/**
* Read the attachment body and save temporary file resource.
*
* @return string
*/
private function getAttachmentStream(&$part)
{
$temp_fp = tmpfile();
$headers = $this->getPart('headers', $part);
$encodingType = array_key_exists('content-transfer-encoding', $headers)
? $headers['content-transfer-encoding']
: '';
if ($temp_fp) {
if ($this->stream) {
$start = $part['starting-pos-body'];
$end = $part['ending-pos-body'];
fseek($this->stream, $start, SEEK_SET);
$len = $end - $start;
$written = 0;
while ($written < $len) {
$write = $len;
$part = fread($this->stream, $write);
fwrite($temp_fp, $this->decodeContentTransfer($part, $encodingType));
$written += $write;
}
} elseif ($this->data) {
$attachment = $this->decodeContentTransfer($this->getPartBodyFromText($part), $encodingType);
fwrite($temp_fp, $attachment, strlen($attachment));
}
fseek($temp_fp, 0, SEEK_SET);
} else {
throw new \Exception(
'Could not create temporary files for attachments. Your tmp directory may be unwritable by PHP.'
);
}
return $temp_fp;
}
/**
* Decode the string from Content-Transfer-Encoding.
*
* @return string
*/
private function decodeContentTransfer($encodedString, $encodingType)
{
$encodingType = strtolower($encodingType);
if ($encodingType == 'base64') {
return base64_decode($encodedString);
} elseif ($encodingType == 'quoted-printable') {
return quoted_printable_decode($encodedString);
} else {
return $encodedString; // 8bit, 7bit, binary
}
}
/**
* Decode header.
*
* @param string|array $input
* @return string
*/
private function decodeHeader($input)
{
// sometimes we have 2 label From so we take only the first
if (is_array($input)) {
return $this->decodeSingleHeader($input[0]);
}
return $this->decodeSingleHeader($input);
}
/**
* Decodes a single header (= string).
*
* @param string
* @return string
*/
private function decodeSingleHeader($input)
{
// Remove white space between encoded-words
$input = preg_replace('/(=\?[^?]+\?(q|b)\?[^?]*\?=)(\s)+=\?/i', '\1=?', $input);
// For each encoded-word...
while (preg_match('/(=\?([^?]+)\?(q|b)\?([^?]*)\?=)/i', $input, $matches)) {
$encoded = $matches[1];
$charset = $matches[2];
$encoding = $matches[3];
$text = $matches[4];
switch (strtolower($encoding)) {
case 'b':
$text = $this->decodeContentTransfer($text, 'base64');
break;
case 'q':
$text = str_replace('_', ' ', $text);
preg_match_all('/=([a-f0-9]{2})/i', $text, $matches);
foreach ($matches[1] as $value) {
$text = str_replace('='.$value, chr(hexdec($value)), $text);
}
break;
}
$text = $this->charset->decodeCharset($text, $this->charset->getCharsetAlias($charset));
$input = str_replace($encoded, $text, $input);
}
return $input;
}
/**
* Return the charset of the MIME part.
*
* @return string|false
*/
private function getPartCharset($part)
{
if (isset($part['charset'])) {
return $charset = $this->charset->getCharsetAlias($part['charset']);
} else {
return false;
}
}
/**
* Retrieve a specified MIME part.
*
* @return string|array
*/
private function getPart($type, $parts)
{
return (isset($parts[$type])) ? $parts[$type] : false;
}
/**
* Retrieve the Body of a MIME part.
*
* @return string
*/
private function getPartBody(&$part)
{
$body = '';
if ($this->stream) {
$body = $this->getPartBodyFromFile($part);
} elseif ($this->data) {
$body = $this->getPartBodyFromText($part);
}
return $body;
}
/**
* Retrieve the Body from a MIME part from file.
*
* @return string
*/
private function getPartBodyFromFile(&$part)
{
$start = $part['starting-pos-body'];
$end = $part['ending-pos-body'];
fseek($this->stream, $start, SEEK_SET);
return fread($this->stream, $end - $start);
}
/**
* Retrieve the Body from a MIME part from text.
*
* @return string
*/
private function getPartBodyFromText(&$part)
{
$start = $part['starting-pos-body'];
$end = $part['ending-pos-body'];
return substr($this->data, $start, $end - $start);
}
}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Email/src/Helpers/Charset.php | packages/Webkul/Email/src/Helpers/Charset.php | <?php
namespace Webkul\Email\Helpers;
use Webkul\Email\Helpers\Contracts\CharsetManager;
class Charset implements CharsetManager
{
/**
* Charset aliases.
*
* @var array
*/
private $charsetAlias = [
'ascii' => 'us-ascii',
'us-ascii' => 'us-ascii',
'ansi_x3.4-1968' => 'us-ascii',
'646' => 'us-ascii',
'iso-8859-1' => 'ISO-8859-1',
'iso-8859-2' => 'ISO-8859-2',
'iso-8859-3' => 'ISO-8859-3',
'iso-8859-4' => 'ISO-8859-4',
'iso-8859-5' => 'ISO-8859-5',
'iso-8859-6' => 'ISO-8859-6',
'iso-8859-6-i' => 'ISO-8859-6-I',
'iso-8859-6-e' => 'ISO-8859-6-E',
'iso-8859-7' => 'ISO-8859-7',
'iso-8859-8' => 'ISO-8859-8',
'iso-8859-8-i' => 'ISO-8859-8-I',
'iso-8859-8-e' => 'ISO-8859-8-E',
'iso-8859-9' => 'ISO-8859-9',
'iso-8859-10' => 'ISO-8859-10',
'iso-8859-11' => 'ISO-8859-11',
'iso-8859-13' => 'ISO-8859-13',
'iso-8859-14' => 'ISO-8859-14',
'iso-8859-15' => 'ISO-8859-15',
'iso-8859-16' => 'ISO-8859-16',
'iso-ir-111' => 'ISO-IR-111',
'iso-2022-cn' => 'ISO-2022-CN',
'iso-2022-cn-ext' => 'ISO-2022-CN',
'iso-2022-kr' => 'ISO-2022-KR',
'iso-2022-jp' => 'ISO-2022-JP',
'utf-16be' => 'UTF-16BE',
'utf-16le' => 'UTF-16LE',
'utf-16' => 'UTF-16',
'windows-1250' => 'windows-1250',
'windows-1251' => 'windows-1251',
'windows-1252' => 'windows-1252',
'windows-1253' => 'windows-1253',
'windows-1254' => 'windows-1254',
'windows-1255' => 'windows-1255',
'windows-1256' => 'windows-1256',
'windows-1257' => 'windows-1257',
'windows-1258' => 'windows-1258',
'ibm866' => 'IBM866',
'ibm850' => 'IBM850',
'ibm852' => 'IBM852',
'ibm855' => 'IBM855',
'ibm857' => 'IBM857',
'ibm862' => 'IBM862',
'ibm864' => 'IBM864',
'utf-8' => 'UTF-8',
'utf-7' => 'UTF-7',
'shift_jis' => 'Shift_JIS',
'big5' => 'Big5',
'euc-jp' => 'EUC-JP',
'euc-kr' => 'EUC-KR',
'gb2312' => 'GB2312',
'gb18030' => 'gb18030',
'viscii' => 'VISCII',
'koi8-r' => 'KOI8-R',
'koi8_r' => 'KOI8-R',
'cskoi8r' => 'KOI8-R',
'koi' => 'KOI8-R',
'koi8' => 'KOI8-R',
'koi8-u' => 'KOI8-U',
'tis-620' => 'TIS-620',
't.61-8bit' => 'T.61-8bit',
'hz-gb-2312' => 'HZ-GB-2312',
'big5-hkscs' => 'Big5-HKSCS',
'gbk' => 'gbk',
'cns11643' => 'x-euc-tw',
'x-imap4-modified-utf7' => 'x-imap4-modified-utf7',
'x-euc-tw' => 'x-euc-tw',
'x-mac-ce' => 'x-mac-ce',
'x-mac-turkish' => 'x-mac-turkish',
'x-mac-greek' => 'x-mac-greek',
'x-mac-icelandic' => 'x-mac-icelandic',
'x-mac-croatian' => 'x-mac-croatian',
'x-mac-romanian' => 'x-mac-romanian',
'x-mac-cyrillic' => 'x-mac-cyrillic',
'x-mac-ukrainian' => 'x-mac-cyrillic',
'x-mac-hebrew' => 'x-mac-hebrew',
'x-mac-arabic' => 'x-mac-arabic',
'x-mac-farsi' => 'x-mac-farsi',
'x-mac-devanagari' => 'x-mac-devanagari',
'x-mac-gujarati' => 'x-mac-gujarati',
'x-mac-gurmukhi' => 'x-mac-gurmukhi',
'armscii-8' => 'armscii-8',
'x-viet-tcvn5712' => 'x-viet-tcvn5712',
'x-viet-vps' => 'x-viet-vps',
'iso-10646-ucs-2' => 'UTF-16BE',
'x-iso-10646-ucs-2-be' => 'UTF-16BE',
'x-iso-10646-ucs-2-le' => 'UTF-16LE',
'x-user-defined' => 'x-user-defined',
'x-johab' => 'x-johab',
'latin1' => 'ISO-8859-1',
'iso_8859-1' => 'ISO-8859-1',
'iso8859-1' => 'ISO-8859-1',
'iso8859-2' => 'ISO-8859-2',
'iso8859-3' => 'ISO-8859-3',
'iso8859-4' => 'ISO-8859-4',
'iso8859-5' => 'ISO-8859-5',
'iso8859-6' => 'ISO-8859-6',
'iso8859-7' => 'ISO-8859-7',
'iso8859-8' => 'ISO-8859-8',
'iso8859-9' => 'ISO-8859-9',
'iso8859-10' => 'ISO-8859-10',
'iso8859-11' => 'ISO-8859-11',
'iso8859-13' => 'ISO-8859-13',
'iso8859-14' => 'ISO-8859-14',
'iso8859-15' => 'ISO-8859-15',
'iso_8859-1:1987' => 'ISO-8859-1',
'iso-ir-100' => 'ISO-8859-1',
'l1' => 'ISO-8859-1',
'ibm819' => 'ISO-8859-1',
'cp819' => 'ISO-8859-1',
'csisolatin1' => 'ISO-8859-1',
'latin2' => 'ISO-8859-2',
'iso_8859-2' => 'ISO-8859-2',
'iso_8859-2:1987' => 'ISO-8859-2',
'iso-ir-101' => 'ISO-8859-2',
'l2' => 'ISO-8859-2',
'csisolatin2' => 'ISO-8859-2',
'latin3' => 'ISO-8859-3',
'iso_8859-3' => 'ISO-8859-3',
'iso_8859-3:1988' => 'ISO-8859-3',
'iso-ir-109' => 'ISO-8859-3',
'l3' => 'ISO-8859-3',
'csisolatin3' => 'ISO-8859-3',
'latin4' => 'ISO-8859-4',
'iso_8859-4' => 'ISO-8859-4',
'iso_8859-4:1988' => 'ISO-8859-4',
'iso-ir-110' => 'ISO-8859-4',
'l4' => 'ISO-8859-4',
'csisolatin4' => 'ISO-8859-4',
'cyrillic' => 'ISO-8859-5',
'iso_8859-5' => 'ISO-8859-5',
'iso_8859-5:1988' => 'ISO-8859-5',
'iso-ir-144' => 'ISO-8859-5',
'csisolatincyrillic' => 'ISO-8859-5',
'arabic' => 'ISO-8859-6',
'iso_8859-6' => 'ISO-8859-6',
'iso_8859-6:1987' => 'ISO-8859-6',
'iso-ir-127' => 'ISO-8859-6',
'ecma-114' => 'ISO-8859-6',
'asmo-708' => 'ISO-8859-6',
'csisolatinarabic' => 'ISO-8859-6',
'csiso88596i' => 'ISO-8859-6-I',
'csiso88596e' => 'ISO-8859-6-E',
'greek' => 'ISO-8859-7',
'greek8' => 'ISO-8859-7',
'sun_eu_greek' => 'ISO-8859-7',
'iso_8859-7' => 'ISO-8859-7',
'iso_8859-7:1987' => 'ISO-8859-7',
'iso-ir-126' => 'ISO-8859-7',
'elot_928' => 'ISO-8859-7',
'ecma-118' => 'ISO-8859-7',
'csisolatingreek' => 'ISO-8859-7',
'hebrew' => 'ISO-8859-8',
'iso_8859-8' => 'ISO-8859-8',
'visual' => 'ISO-8859-8',
'iso_8859-8:1988' => 'ISO-8859-8',
'iso-ir-138' => 'ISO-8859-8',
'csisolatinhebrew' => 'ISO-8859-8',
'csiso88598i' => 'ISO-8859-8-I',
'iso-8859-8i' => 'ISO-8859-8-I',
'logical' => 'ISO-8859-8-I',
'csiso88598e' => 'ISO-8859-8-E',
'latin5' => 'ISO-8859-9',
'iso_8859-9' => 'ISO-8859-9',
'iso_8859-9:1989' => 'ISO-8859-9',
'iso-ir-148' => 'ISO-8859-9',
'l5' => 'ISO-8859-9',
'csisolatin5' => 'ISO-8859-9',
'unicode-1-1-utf-8' => 'UTF-8',
'utf8' => 'UTF-8',
'x-sjis' => 'Shift_JIS',
'shift-jis' => 'Shift_JIS',
'ms_kanji' => 'Shift_JIS',
'csshiftjis' => 'Shift_JIS',
'windows-31j' => 'Shift_JIS',
'cp932' => 'Shift_JIS',
'sjis' => 'Shift_JIS',
'cseucpkdfmtjapanese' => 'EUC-JP',
'x-euc-jp' => 'EUC-JP',
'csiso2022jp' => 'ISO-2022-JP',
'iso-2022-jp-2' => 'ISO-2022-JP',
'csiso2022jp2' => 'ISO-2022-JP',
'csbig5' => 'Big5',
'cn-big5' => 'Big5',
'x-x-big5' => 'Big5',
'zh_tw-big5' => 'Big5',
'cseuckr' => 'EUC-KR',
'ks_c_5601-1987' => 'EUC-KR',
'iso-ir-149' => 'EUC-KR',
'ks_c_5601-1989' => 'EUC-KR',
'ksc_5601' => 'EUC-KR',
'ksc5601' => 'EUC-KR',
'korean' => 'EUC-KR',
'csksc56011987' => 'EUC-KR',
'5601' => 'EUC-KR',
'windows-949' => 'EUC-KR',
'gb_2312-80' => 'GB2312',
'iso-ir-58' => 'GB2312',
'chinese' => 'GB2312',
'csiso58gb231280' => 'GB2312',
'csgb2312' => 'GB2312',
'zh_cn.euc' => 'GB2312',
'gb_2312' => 'GB2312',
'x-cp1250' => 'windows-1250',
'x-cp1251' => 'windows-1251',
'x-cp1252' => 'windows-1252',
'x-cp1253' => 'windows-1253',
'x-cp1254' => 'windows-1254',
'x-cp1255' => 'windows-1255',
'x-cp1256' => 'windows-1256',
'x-cp1257' => 'windows-1257',
'x-cp1258' => 'windows-1258',
'windows-874' => 'windows-874',
'ibm874' => 'windows-874',
'dos-874' => 'windows-874',
'macintosh' => 'macintosh',
'x-mac-roman' => 'macintosh',
'mac' => 'macintosh',
'csmacintosh' => 'macintosh',
'cp866' => 'IBM866',
'cp-866' => 'IBM866',
'866' => 'IBM866',
'csibm866' => 'IBM866',
'cp850' => 'IBM850',
'850' => 'IBM850',
'csibm850' => 'IBM850',
'cp852' => 'IBM852',
'852' => 'IBM852',
'csibm852' => 'IBM852',
'cp855' => 'IBM855',
'855' => 'IBM855',
'csibm855' => 'IBM855',
'cp857' => 'IBM857',
'857' => 'IBM857',
'csibm857' => 'IBM857',
'cp862' => 'IBM862',
'862' => 'IBM862',
'csibm862' => 'IBM862',
'cp864' => 'IBM864',
'864' => 'IBM864',
'csibm864' => 'IBM864',
'ibm-864' => 'IBM864',
't.61' => 'T.61-8bit',
'iso-ir-103' => 'T.61-8bit',
'csiso103t618bit' => 'T.61-8bit',
'x-unicode-2-0-utf-7' => 'UTF-7',
'unicode-2-0-utf-7' => 'UTF-7',
'unicode-1-1-utf-7' => 'UTF-7',
'csunicode11utf7' => 'UTF-7',
'csunicode' => 'UTF-16BE',
'csunicode11' => 'UTF-16BE',
'iso-10646-ucs-basic' => 'UTF-16BE',
'csunicodeascii' => 'UTF-16BE',
'iso-10646-unicode-latin1' => 'UTF-16BE',
'csunicodelatin1' => 'UTF-16BE',
'iso-10646' => 'UTF-16BE',
'iso-10646-j-1' => 'UTF-16BE',
'latin6' => 'ISO-8859-10',
'iso-ir-157' => 'ISO-8859-10',
'l6' => 'ISO-8859-10',
'csisolatin6' => 'ISO-8859-10',
'iso_8859-15' => 'ISO-8859-15',
'csisolatin9' => 'ISO-8859-15',
'l9' => 'ISO-8859-15',
'ecma-cyrillic' => 'ISO-IR-111',
'csiso111ecmacyrillic' => 'ISO-IR-111',
'csiso2022kr' => 'ISO-2022-KR',
'csviscii' => 'VISCII',
'zh_tw-euc' => 'x-euc-tw',
'iso88591' => 'ISO-8859-1',
'iso88592' => 'ISO-8859-2',
'iso88593' => 'ISO-8859-3',
'iso88594' => 'ISO-8859-4',
'iso88595' => 'ISO-8859-5',
'iso88596' => 'ISO-8859-6',
'iso88597' => 'ISO-8859-7',
'iso88598' => 'ISO-8859-8',
'iso88599' => 'ISO-8859-9',
'iso885910' => 'ISO-8859-10',
'iso885911' => 'ISO-8859-11',
'iso885912' => 'ISO-8859-12',
'iso885913' => 'ISO-8859-13',
'iso885914' => 'ISO-8859-14',
'iso885915' => 'ISO-8859-15',
'tis620' => 'TIS-620',
'cp1250' => 'windows-1250',
'cp1251' => 'windows-1251',
'cp1252' => 'windows-1252',
'cp1253' => 'windows-1253',
'cp1254' => 'windows-1254',
'cp1255' => 'windows-1255',
'cp1256' => 'windows-1256',
'cp1257' => 'windows-1257',
'cp1258' => 'windows-1258',
'x-gbk' => 'gbk',
'windows-936' => 'gbk',
'ansi-1251' => 'windows-1251',
];
/**
* Decode the string from charset.
*
* @param string $encodedString
* @param string $charset
* @return string
*/
public function decodeCharset($encodedString, $charset)
{
if (strtolower($charset) == 'utf-8' || strtolower($charset) == 'us-ascii') {
return $encodedString;
}
try {
return iconv($this->getCharsetAlias($charset), 'UTF-8//TRANSLIT', $encodedString);
} catch (\Exception $e) {
return iconv($this->getCharsetAlias($charset), 'UTF-8//IGNORE', $encodedString);
}
}
/**
* Get charset alias.
*
* @param string $charset.
* @return string
*/
public function getCharsetAlias($charset)
{
$charset = strtolower($charset);
if (array_key_exists($charset, $this->charsetAlias)) {
return $this->charsetAlias[$charset];
}
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/Email/src/Helpers/HtmlFilter.php | packages/Webkul/Email/src/Helpers/HtmlFilter.php | <?php
namespace Webkul\Email\Helpers;
class HtmlFilter
{
/**
* Tag print.
*
* @param string $tagname
* @param array $attary
* @param int $tagtype
* @return string
*/
public function tln_tagprint($tagname, $attary, $tagtype)
{
if ($tagtype == 2) {
$fulltag = '</'.$tagname.'>';
} else {
$fulltag = '<'.$tagname;
if (is_array($attary) && count($attary)) {
$atts = [];
foreach ($attary as $attname => $attvalue) {
array_push($atts, "$attname=$attvalue");
}
$fulltag .= ' '.implode(' ', $atts);
}
if ($tagtype == 3) {
$fulltag .= ' /';
}
$fulltag .= '>';
}
return $fulltag;
}
/**
* A small helper function to use with array_walk. Modifies a by-ref
* value and makes it lowercase.
*
* @param string $val
* @return void
*/
public function tln_casenormalize(&$val)
{
$val = strtolower($val);
}
/**
* This function skips any whitespace from the current position within
* a string and to the next non-whitespace value.
*
* @param string $body
* @param int $offset
* @return int
*/
public function tln_skipspace($body, $offset)
{
preg_match('/^(\s*)/s', substr($body, $offset), $matches);
try {
if (! empty($matches[1])) {
$count = strlen($matches[1]);
$offset += $count;
}
} catch (\Exception $e) {
}
return $offset;
}
/**
* This function looks for the next character within a string. It's
* really just a glorified "strpos", except it catches the failures
* nicely.
*
* @param string $body
* @param int $offset
* @param string $needle
* @return int
*/
public function tln_findnxstr($body, $offset, $needle)
{
$pos = strpos($body, $needle, $offset);
if ($pos === false) {
$pos = strlen($body);
}
return $pos;
}
/**
* This function takes a PCRE-style regexp and tries to match it
* within the string.
*
* @param string $body
* @param int $offset
* @param string $reg
* @return array|bool
*/
public function tln_findnxreg($body, $offset, $reg)
{
$matches = $retarr = [];
$preg_rule = '%^(.*?)('.$reg.')%s';
preg_match($preg_rule, substr($body, $offset), $matches);
if (! isset($matches[0]) || ! $matches[0]) {
$retarr = false;
} else {
$retarr[0] = $offset + strlen($matches[1]);
$retarr[1] = $matches[1];
$retarr[2] = $matches[2];
}
return $retarr;
}
/**
* This function looks for the next tag.
*
* @param string $body
* @param int $offset
* @return array|bool
*/
public function tln_getnxtag($body, $offset)
{
if ($offset > strlen($body)) {
return false;
}
$lt = $this->tln_findnxstr($body, $offset, '<');
if ($lt == strlen($body)) {
return false;
}
/**
* We are here:
* blah blah <tag attribute="value">
* \---------^
*/
$pos = $this->tln_skipspace($body, $lt + 1);
if ($pos >= strlen($body)) {
return [false, false, false, $lt, strlen($body)];
}
/**
* There are 3 kinds of tags:
* 1. Opening tag, e.g.:
* <a href="blah">
* 2. Closing tag, e.g.:
* </a>
* 3. XHTML-style content-less tag, e.g.:
* <img src="blah"/>
*/
switch (substr($body, $pos, 1)) {
case '/':
$tagtype = 2;
$pos++;
break;
case '!':
/**
* A comment or an SGML declaration.
*/
if (substr($body, $pos + 1, 2) == '--') {
$gt = strpos($body, '-->', $pos);
if ($gt === false) {
$gt = strlen($body);
} else {
$gt += 2;
}
return [false, false, false, $lt, $gt];
} else {
$gt = $this->tln_findnxstr($body, $pos, '>');
return [false, false, false, $lt, $gt];
}
break;
default:
$tagtype = 1;
break;
}
/**
* Look for next [\W-_], which will indicate the end of the tag name.
*/
$regary = $this->tln_findnxreg($body, $pos, '[^\w\-_]');
if ($regary == false) {
return [false, false, false, $lt, strlen($body)];
}
[$pos, $tagname, $match] = $regary;
$tagname = strtolower($tagname);
/**
* $match can be either of these:
* '>' indicating the end of the tag entirely.
* '\s' indicating the end of the tag name.
* '/' indicating that this is type-3 xhtml tag.
*
* Whatever else we find there indicates an invalid tag.
*/
switch ($match) {
case '/':
/**
* This is an xhtml-style tag with a closing / at the
* end, like so: <img src="blah"/>. Check if it's followed
* by the closing bracket. If not, then this tag is invalid
*/
if (substr($body, $pos, 2) == '/>') {
$pos++;
$tagtype = 3;
} else {
$gt = $this->tln_findnxstr($body, $pos, '>');
$retary = [false, false, false, $lt, $gt];
return $retary;
}
// intentional fall-through
case '>':
return [$tagname, false, $tagtype, $lt, $pos];
default:
/**
* Check if it's whitespace.
*/
if (! preg_match('/\s/', $match)) {
/**
* This is an invalid tag! Look for the next closing ">".
*/
$gt = $this->tln_findnxstr($body, $lt, '>');
return [false, false, false, $lt, $gt];
}
break;
}
/**
* At this point we're here:
* <tagname attribute='blah'>
* \-------^
*
* At this point we loop in order to find all attributes.
*/
$attary = [];
while ($pos <= strlen($body)) {
$pos = $this->tln_skipspace($body, $pos);
if ($pos == strlen($body)) {
/**
* Non-closed tag.
*/
return [false, false, false, $lt, $pos];
}
/**
* See if we arrived at a ">" or "/>", which means that we reached
* the end of the tag.
*/
$matches = [];
if (preg_match('%^(\s*)(>|/>)%s', substr($body, $pos), $matches)) {
/**
* Yep. So we did.
*/
$pos += strlen($matches[1]);
if ($matches[2] == '/>') {
$tagtype = 3;
$pos++;
}
return [$tagname, $attary, $tagtype, $lt, $pos];
}
/**
* There are several types of attributes, with optional
* [:space:] between members.
* Type 1:
* attrname[:space:]=[:space:]'CDATA'
* Type 2:
* attrname[:space:]=[:space:]"CDATA"
* Type 3:
* attr[:space:]=[:space:]CDATA
* Type 4:
* attrname
*
* We leave types 1 and 2 the same, type 3 we check for
* '"' and convert to """ if needed, then wrap in
* double quotes. Type 4 we convert into:
* attrname="yes".
*/
$regary = $this->tln_findnxreg($body, $pos, '[^\w\-_]');
if ($regary == false) {
/**
* Looks like body ended before the end of tag.
*/
return [false, false, false, $lt, strlen($body)];
}
[$pos, $attname, $match] = $regary;
$attname = strtolower($attname);
/**
* We arrived at the end of attribute name. Several things possible
* here:
* '>' means the end of the tag and this is attribute type 4
* '/' if followed by '>' means the same thing as above
* '\s' means a lot of things -- look what it's followed by.
* anything else means the attribute is invalid.
*/
switch ($match) {
case '/':
/**
* This is an xhtml-style tag with a closing / at the
* end, like so: <img src="blah"/>. Check if it's followed
* by the closing bracket. If not, then this tag is invalid
*/
if (substr($body, $pos, 2) == '/>') {
$pos++;
$tagtype = 3;
} else {
$gt = $this->tln_findnxstr($body, $pos, '>');
$retary = [false, false, false, $lt, $gt];
return $retary;
}
// intentional fall-through
case '>':
$attary[$attname] = '"yes"';
return [$tagname, $attary, $tagtype, $lt, $pos];
break;
default:
/**
* Skip whitespace and see what we arrive at.
*/
$pos = $this->tln_skipspace($body, $pos);
$char = substr($body, $pos, 1);
/**
* Two things are valid here:
* '=' means this is attribute type 1 2 or 3.
* \w means this was attribute type 4.
* anything else we ignore and re-loop. End of tag and
* invalid stuff will be caught by our checks at the beginning
* of the loop.
*/
if ($char == '=') {
$pos++;
$pos = $this->tln_skipspace($body, $pos);
/**
* Here are 3 possibilities:
* "'" attribute type 1
* '"' attribute type 2
* everything else is the content of tag type 3
*/
$quot = substr($body, $pos, 1);
if ($quot == '\'') {
$regary = $this->tln_findnxreg($body, $pos + 1, '\'');
if ($regary == false) {
return [false, false, false, $lt, strlen($body)];
}
[$pos, $attval, $match] = $regary;
$pos++;
$attary[$attname] = '\''.$attval.'\'';
} elseif ($quot == '"') {
$regary = $this->tln_findnxreg($body, $pos + 1, '\"');
if ($regary == false) {
return [false, false, false, $lt, strlen($body)];
}
[$pos, $attval, $match] = $regary;
$pos++;
$attary[$attname] = '"'.$attval.'"';
} else {
/**
* These are hateful. Look for \s, or >.
*/
$regary = $this->tln_findnxreg($body, $pos, '[\s>]');
if ($regary == false) {
return [false, false, false, $lt, strlen($body)];
}
[$pos, $attval, $match] = $regary;
$attval = preg_replace('/\"/s', '"', $attval);
$attary[$attname] = '"'.$attval.'"';
}
} elseif (preg_match('|[\w/>]|', $char)) {
$attary[$attname] = '"yes"';
} else {
$gt = $this->tln_findnxstr($body, $pos, '>');
return [false, false, false, $lt, $gt];
}
break;
}
}
/**
* The fact that we got here indicates that the tag end was never
* found. Return invalid tag indication so it gets stripped.
*/
return [false, false, false, $lt, strlen($body)];
}
/**
* Translates entities into literal values so they can be checked.
*
* @param string $attvalue
* @param string $regex
* @param bool $hex
* @return bool
*/
public function tln_deent(&$attvalue, $regex, $hex = false)
{
preg_match_all($regex, $attvalue, $matches);
if (is_array($matches) && count($matches[0]) > 0) {
$repl = [];
for ($i = 0; $i < count($matches[0]); $i++) {
$numval = $matches[1][$i];
if ($hex) {
$numval = hexdec($numval);
}
$repl[$matches[0][$i]] = chr($numval);
}
$attvalue = strtr($attvalue, $repl);
return true;
} else {
return false;
}
}
/**
* This function checks attribute values for entity-encoded values
* and returns them translated into 8-bit strings so we can run
* checks on them.
*
* @param string $attvalue
* @return void
*/
public function tln_defang(&$attvalue)
{
/**
* Skip this if there aren't ampersands or backslashes.
*/
if (strpos($attvalue, '&') === false
&& strpos($attvalue, '\\') === false
) {
return;
}
do {
$m = false;
$m = $m || $this->tln_deent($attvalue, '/\�*(\d+);*/s');
$m = $m || $this->tln_deent($attvalue, '/\�*((\d|[a-f])+);*/si', true);
$m = $m || $this->tln_deent($attvalue, '/\\\\(\d+)/s', true);
} while ($m == true);
$attvalue = stripslashes($attvalue);
}
/**
* Kill any tabs, newlines, or carriage returns. Our friends the
* makers of the browser with 95% market value decided that it'd
* be funny to make "java[tab]script" be just as good as "javascript".
*
* @param string $attvalue
* @return void
*/
public function tln_unspace(&$attvalue)
{
if (strcspn($attvalue, "\t\r\n\0 ") != strlen($attvalue)) {
$attvalue = str_replace(
["\t", "\r", "\n", "\0", ' '],
['', '', '', '', ''],
$attvalue
);
}
}
/**
* This function runs various checks against the attributes.
*
* @param string $tagname
* @param array $attary
* @param array $rm_attnames
* @param array $bad_attvals
* @param array $add_attr_to_tag
* @param string $trans_image_path
* @param bool $block_external_images
* @return array with modified attributes.
*/
public function tln_fixatts(
$tagname,
$attary,
$rm_attnames,
$bad_attvals,
$add_attr_to_tag,
$trans_image_path,
$block_external_images
) {
/**
* Convert to array if is not.
*/
$attary = is_array($attary) ? $attary : [];
foreach ($attary as $attname => $attvalue) {
/**
* See if this attribute should be removed.
*/
foreach ($rm_attnames as $matchtag => $matchattrs) {
if (preg_match($matchtag, $tagname)) {
foreach ($matchattrs as $matchattr) {
if (preg_match($matchattr, $attname)) {
unset($attary[$attname]);
continue 2;
}
}
}
}
$this->tln_defang($attvalue);
$this->tln_unspace($attvalue);
/**
* Now let's run checks on the attvalues.
* I don't expect anyone to comprehend this. If you do,
* get in touch with me so I can drive to where you live and
* shake your hand personally. :)
*/
foreach ($bad_attvals as $matchtag => $matchattrs) {
if (preg_match($matchtag, $tagname)) {
foreach ($matchattrs as $matchattr => $valary) {
if (preg_match($matchattr, $attname)) {
[$valmatch, $valrepl] = $valary;
$newvalue = preg_replace($valmatch, $valrepl, $attvalue);
if ($newvalue != $attvalue) {
$attary[$attname] = $newvalue;
$attvalue = $newvalue;
}
}
}
}
}
}
/**
* See if we need to append any attributes to this tag.
*/
foreach ($add_attr_to_tag as $matchtag => $addattary) {
if (preg_match($matchtag, $tagname)) {
$attary = array_merge($attary, $addattary);
}
}
return $attary;
}
/**
* Fix url.
*
* @return void
*/
public function tln_fixurl($attname, &$attvalue, $trans_image_path, $block_external_images)
{
$sQuote = '"';
$attvalue = trim($attvalue);
if ($attvalue && ($attvalue[0] == '"' || $attvalue[0] == "'")) {
// remove the double quotes
$sQuote = $attvalue[0];
$attvalue = trim(substr($attvalue, 1, -1));
}
/**
* Replace empty src tags with the blank image. src is only used
* for frames, images, and image inputs. Doing a replace should
* not affect them working as should be, however it will stop
* IE from being kicked off when src for img tags are not set.
*/
if ($attvalue == '') {
$attvalue = $sQuote.$trans_image_path.$sQuote;
} else {
// first, disallow 8 bit characters and control characters
if (preg_match('/[\0-\37\200-\377]+/', $attvalue)) {
switch ($attname) {
case 'href':
$attvalue = $sQuote.'http://invalid-stuff-detected.example.com'.$sQuote;
break;
default:
$attvalue = $sQuote.$trans_image_path.$sQuote;
break;
}
} else {
$aUrl = parse_url($attvalue);
if (isset($aUrl['scheme'])) {
switch (strtolower($aUrl['scheme'])) {
case 'mailto':
case 'http':
case 'https':
case 'ftp':
if ($attname != 'href') {
if ($block_external_images == true) {
$attvalue = $sQuote.$trans_image_path.$sQuote;
} else {
if (! isset($aUrl['path'])) {
$attvalue = $sQuote.$trans_image_path.$sQuote;
}
}
} else {
$attvalue = $sQuote.$attvalue.$sQuote;
}
break;
case 'outbind':
$attvalue = $sQuote.$attvalue.$sQuote;
break;
case 'cid':
$attvalue = $sQuote.$attvalue.$sQuote;
break;
default:
$attvalue = $sQuote.$trans_image_path.$sQuote;
break;
}
} else {
if (! isset($aUrl['path']) || $aUrl['path'] != $trans_image_path) {
$$attvalue = $sQuote.$trans_image_path.$sQuote;
}
}
}
}
}
/**
* Fix style.
*
* @return void
*/
public function tln_fixstyle($body, $pos, $trans_image_path, $block_external_images)
{
$me = 'tln_fixstyle';
$content = '';
$sToken = '';
$bSucces = false;
$bEndTag = false;
for ($i = $pos,$iCount = strlen($body); $i < $iCount; $i++) {
$char = $body[$i];
switch ($char) {
case '<':
$sToken = $char;
break;
case '/':
if ($sToken == '<') {
$sToken .= $char;
$bEndTag = true;
} else {
$content .= $char;
}
break;
case '>':
if ($bEndTag) {
$sToken .= $char;
if (preg_match('/\<\/\s*style\s*\>/i', $sToken, $aMatch)) {
$newpos = $i + 1;
$bSucces = true;
break 2;
} else {
$content .= $sToken;
}
$bEndTag = false;
} else {
$content .= $char;
}
break;
case '!':
if ($sToken == '<') {
if (isset($body[$i + 2]) && substr($body, $i, 3) == '!--') {
$i = strpos($body, '-->', $i + 3);
if (! $i) {
$i = strlen($body);
}
$sToken = '';
}
} else {
$content .= $char;
}
break;
default:
if ($bEndTag) {
$sToken .= $char;
} else {
$content .= $char;
}
break;
}
}
if (! $bSucces) {
return [false, strlen($body)];
}
/**
* First look for general BODY style declaration, which would be
* like so:
* body {background: blah-blah}
* and change it to .bodyclass so we can just assign it to a <div>
*/
$content = preg_replace("|body(\s*\{.*?\})|si", '.bodyclass\\1', $content);
$trans_image_path = $trans_image_path;
// first check for 8bit sequences and disallowed control characters
if (preg_match('/[\16-\37\200-\377]+/', $content)) {
$content = '<!-- style block removed by html filter due to presence of 8bit characters -->';
return [$content, $newpos];
}
// remove @import line
$content = preg_replace("/^\s*(@import.*)$/mi", "\n<!-- @import rules forbidden -->\n", $content);
$content = preg_replace('/(\\\\)?u(\\\\)?r(\\\\)?l(\\\\)?/i', 'url', $content);
preg_match_all("/url\s*\((.+)\)/si", $content, $aMatch);
if (count($aMatch)) {
$aValue = $aReplace = [];
foreach ($aMatch[1] as $sMatch) {
$urlvalue = $sMatch;
$this->tln_fixurl('style', $urlvalue, $trans_image_path, $block_external_images);
$aValue[] = $sMatch;
$aReplace[] = $urlvalue;
}
$content = str_replace($aValue, $aReplace, $content);
}
/**
* Remove any backslashes, entities, and extraneous whitespace.
*/
$contentTemp = $content;
$this->tln_defang($contentTemp);
$this->tln_unspace($contentTemp);
$match = ['/\/\*.*\*\//',
'/expression/i',
'/behaviou*r/i',
'/binding/i',
'/include-source/i',
'/javascript/i',
'/script/i',
'/position/i'];
$replace = ['', 'idiocy', 'idiocy', 'idiocy', 'idiocy', 'idiocy', 'idiocy', ''];
$contentNew = preg_replace($match, $replace, $contentTemp);
if ($contentNew !== $contentTemp) {
$content = $contentNew;
}
return [$content, $newpos];
}
/**
* Body to div.
*
* @return void
*/
public function tln_body2div($attary, $trans_image_path)
{
$me = 'tln_body2div';
$divattary = ['class' => "'bodyclass'"];
$has_bgc_stl = $has_txt_stl = false;
$styledef = '';
if (is_array($attary) && count($attary) > 0) {
foreach ($attary as $attname=>$attvalue) {
$quotchar = substr($attvalue, 0, 1);
$attvalue = str_replace($quotchar, '', $attvalue);
switch ($attname) {
case 'background':
$styledef .= "background-image: url('$trans_image_path'); ";
break;
case 'bgcolor':
$has_bgc_stl = true;
$styledef .= "background-color: $attvalue; ";
break;
case 'text':
$has_txt_stl = true;
$styledef .= "color: $attvalue; ";
break;
}
}
// Outlook defines a white bgcolor and no text color. This can lead to white text on a white bg with certain themes.
if ($has_bgc_stl && ! $has_txt_stl) {
$styledef .= 'color: #000000; ';
}
if (strlen($styledef) > 0) {
$divattary['style'] = "\"$styledef\"";
}
}
return $divattary;
}
/**
* Sanitize.
*
* @param string $body
* @param array $tag_list
* @param array $rm_tags_with_content
* @param array $self_closing_tags
* @param bool $force_tag_closing
* @param array $rm_attnames
* @param array $bad_attvals
* @param array $add_attr_to_tag
* @param string $trans_image_path
* @param bool $block_external_images
* @return string
*/
public function tln_sanitize(
$body,
$tag_list,
$rm_tags_with_content,
$self_closing_tags,
$force_tag_closing,
$rm_attnames,
$bad_attvals,
$add_attr_to_tag,
$trans_image_path,
$block_external_images
) {
/**
* Normalize rm_tags and rm_tags_with_content.
*/
$rm_tags = array_shift($tag_list);
@array_walk($tag_list, [$this, 'tln_casenormalize']);
@array_walk($rm_tags_with_content, [$this, 'tln_casenormalize']);
@array_walk($self_closing_tags, [$this, 'tln_casenormalize']);
/**
* See if tag_list is of tags to remove or tags to allow.
* false means remove these tags
* true means allow these tags
*/
$curpos = 0;
$open_tags = [];
$trusted = '';
$skip_content = false;
/**
* Take care of netscape's stupid javascript entities like
* &{alert('boo')};
*/
$body = preg_replace('/&(\{.*?\};)/si', '&\\1', $body);
while (($curtag = $this->tln_getnxtag($body, $curpos)) != false) {
[$tagname, $attary, $tagtype, $lt, $gt] = $curtag;
$free_content = substr($body, $curpos, $lt - $curpos);
/**
* Take care of <style>.
*/
if ($tagname == 'style' && $tagtype == 1) {
[$free_content, $curpos] =
$this->tln_fixstyle($body, $gt + 1, $trans_image_path, $block_external_images);
if ($free_content != false) {
if (! empty($attary)) {
$attary = $this->tln_fixatts($tagname,
$attary,
$rm_attnames,
$bad_attvals,
$add_attr_to_tag,
$trans_image_path,
$block_external_images
);
}
$trusted .= $this->tln_tagprint($tagname, $attary, $tagtype);
if (isset($this->$free_content)) {
$trusted .= $this->$free_content;
}
$trusted .= $this->tln_tagprint($tagname, false, 2);
}
continue;
}
if ($skip_content == false) {
$trusted .= $free_content;
}
if ($tagname != false) {
if ($tagtype == 2) {
if ($skip_content == $tagname) {
$tagname = false;
$skip_content = false;
} else {
if ($skip_content == false) {
if ($tagname == 'body') {
$tagname = 'div';
}
if (isset($open_tags[$tagname]) &&
$open_tags[$tagname] > 0
) {
$open_tags[$tagname]--;
} else {
$tagname = false;
}
}
}
} else {
if (! $skip_content) {
if (
$tagtype == 1
&& in_array($tagname, $self_closing_tags)
) {
$tagtype = 3;
}
/**
* See if we should skip this tag and any content
* inside it.
*/
if (
$tagtype == 1
&& in_array($tagname, $rm_tags_with_content)
) {
$skip_content = $tagname;
} else {
if ((
! $rm_tags
&& in_array($tagname, $tag_list))
|| (
$rm_tags
&& ! in_array($tagname, $tag_list)
)
) {
$tagname = false;
} else {
/**
* Convert body into div.
*/
if ($tagname == 'body') {
$tagname = 'div';
$attary = $this->tln_body2div($attary, $trans_image_path);
}
if ($tagtype == 1) {
if (isset($open_tags[$tagname])) {
$open_tags[$tagname]++;
} else {
$open_tags[$tagname] = 1;
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | true |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Email/src/Helpers/Contracts/CharsetManager.php | packages/Webkul/Email/src/Helpers/Contracts/CharsetManager.php | <?php
namespace Webkul\Email\Helpers\Contracts;
interface CharsetManager
{
/**
* Decode the string from Charset.
*
* @return string
*/
public function decodeCharset($encodedString, $charset);
/**
* Get charset alias.
*
* @return string
*/
public function getCharsetAlias($charset);
}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Email/src/InboundEmailProcessor/SendgridEmailProcessor.php | packages/Webkul/Email/src/InboundEmailProcessor/SendgridEmailProcessor.php | <?php
namespace Webkul\Email\InboundEmailProcessor;
use Webkul\Email\Helpers\HtmlFilter;
use Webkul\Email\Helpers\Parser;
use Webkul\Email\InboundEmailProcessor\Contracts\InboundEmailProcessor;
use Webkul\Email\Repositories\AttachmentRepository;
use Webkul\Email\Repositories\EmailRepository;
class SendgridEmailProcessor implements InboundEmailProcessor
{
/**
* Create a new repository instance.
*
* @return void
*/
public function __construct(
protected EmailRepository $emailRepository,
protected AttachmentRepository $attachmentRepository,
protected Parser $emailParser,
protected HtmlFilter $htmlFilter
) {}
/**
* Process messages from all folders.
*/
public function processMessagesFromAllFolders()
{
/**
* SendGrid's Inbound Parse is a specialized tool for developers to handle incoming emails in
* their applications, but it doesn't replace the full functionality of IMAP for typical
* email client usage. Thats why we can't process the messages.
*/
throw new \Exception('Currently bulk processing is not supported for Sendgrid.');
}
/**
* Process the inbound email.
*/
public function processMessage($message = null): void
{
$this->emailParser->setText($message);
$email = $this->emailRepository->findOneWhere(['message_id' => $messageID = $this->emailParser->getHeader('message-id')]);
if ($email) {
return;
}
$headers = [
'from' => $this->emailParser->parseEmailAddress('from'),
'sender' => $this->emailParser->parseEmailAddress('sender'),
'reply_to' => $this->emailParser->parseEmailAddress('to'),
'cc' => $this->emailParser->parseEmailAddress('cc'),
'bcc' => $this->emailParser->parseEmailAddress('bcc'),
'subject' => $this->emailParser->getHeader('subject'),
'name' => $this->emailParser->parseSenderName(),
'source' => 'email',
'user_type' => 'person',
'message_id' => $messageID ?? time().'@'.config('mail.domain'),
'reference_ids' => htmlspecialchars_decode($this->emailParser->getHeader('references')),
'in_reply_to' => htmlspecialchars_decode($this->emailParser->getHeader('in-reply-to')),
];
foreach ($headers['reply_to'] as $to) {
if ($email = $this->emailRepository->findOneWhere(['message_id' => $to])) {
break;
}
}
if (! isset($email) && $headers['in_reply_to']) {
$email = $this->emailRepository->findOneWhere(['message_id' => $headers['in_reply_to']]);
if (! $email) {
$email = $this->emailRepository->findOneWhere([['reference_ids', 'like', '%'.$headers['in_reply_to'].'%']]);
}
}
if (! isset($email) && $headers['reference_ids']) {
$referenceIds = explode(' ', $headers['reference_ids']);
foreach ($referenceIds as $referenceId) {
if ($email = $this->emailRepository->findOneWhere([['reference_ids', 'like', '%'.$referenceId.'%']])) {
break;
}
}
}
if (! $reply = $this->emailParser->getMessageBody('text')) {
$reply = $this->emailParser->getTextMessageBody();
}
if (! isset($email)) {
$email = $this->emailRepository->create(array_merge($headers, [
'folders' => ['inbox'],
'reply' => $reply,
'unique_id' => time().'@'.config('mail.domain'),
'reference_ids' => [$headers['message_id']],
'user_type' => 'person',
]));
$this->attachmentRepository->uploadAttachments($email, [
'source' => 'email',
'attachments' => $this->emailParser->getAttachments(),
]);
} else {
$parentEmail = $this->emailRepository->update([
'folders' => array_unique(array_merge($email->folders, ['inbox'])),
'reference_ids' => array_merge($email->reference_ids ?? [], [$headers['message_id']]),
], $email->id);
$email = $this->emailRepository->create(array_merge($headers, [
'reply' => $this->htmlFilter->process($reply, ''),
'parent_id' => $parentEmail->id,
'user_type' => 'person',
]));
$this->attachmentRepository->uploadAttachments($email, [
'source' => 'email',
'attachments' => $this->emailParser->getAttachments(),
]);
}
}
}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Email/src/InboundEmailProcessor/WebklexImapEmailProcessor.php | packages/Webkul/Email/src/InboundEmailProcessor/WebklexImapEmailProcessor.php | <?php
namespace Webkul\Email\InboundEmailProcessor;
use Webklex\IMAP\Facades\Client;
use Webkul\Email\Enums\SupportedFolderEnum;
use Webkul\Email\InboundEmailProcessor\Contracts\InboundEmailProcessor;
use Webkul\Email\Repositories\AttachmentRepository;
use Webkul\Email\Repositories\EmailRepository;
class WebklexImapEmailProcessor implements InboundEmailProcessor
{
/**
* The IMAP client instance.
*/
protected $client;
/**
* Create a new repository instance.
*
* @return void
*/
public function __construct(
protected EmailRepository $emailRepository,
protected AttachmentRepository $attachmentRepository
) {
$this->client = Client::make($this->getDefaultConfigs());
$this->client->connect();
if (! $this->client->isConnected()) {
throw new \Exception('Failed to connect to the mail server.');
}
}
/**
* Close the connection.
*/
public function __destruct()
{
$this->client->disconnect();
}
/**
* Process messages from all folders.
*/
public function processMessagesFromAllFolders()
{
try {
$rootFolders = $this->client->getFolders();
$this->processMessagesFromLeafFolders($rootFolders);
} catch (\Exception $e) {
throw new \Exception($e->getMessage());
}
}
/**
* Process the inbound email.
*
* @param ?\Webklex\PHPIMAP\Message $message
*/
public function processMessage($message = null): void
{
$attributes = $message->getAttributes();
$messageId = $attributes['message_id']->first();
$email = $this->emailRepository->findOneByField('message_id', $messageId);
if ($email) {
return;
}
$replyToEmails = $this->getEmailsByAttributeCode($attributes, 'to');
foreach ($replyToEmails as $to) {
if ($email = $this->emailRepository->findOneWhere(['message_id' => $to])) {
break;
}
}
if (! isset($email) && isset($attributes['in_reply_to'])) {
$inReplyTo = $attributes['in_reply_to']->first();
$email = $this->emailRepository->findOneWhere(['message_id' => $inReplyTo]);
if (! $email) {
$email = $this->emailRepository->findOneWhere([['reference_ids', 'like', '%'.$inReplyTo.'%']]);
}
}
$references = [$messageId];
if (! isset($email) && isset($attributes['references'])) {
array_push($references, ...$attributes['references']->all());
foreach ($references as $reference) {
if ($email = $this->emailRepository->findOneWhere([['reference_ids', 'like', '%'.$reference.'%']])) {
break;
}
}
}
/**
* Maps the folder name to the supported folder in our application.
*
* To Do: Review this.
*/
$folderName = match ($message->getFolder()->name) {
'INBOX' => SupportedFolderEnum::INBOX->value,
'Important' => SupportedFolderEnum::IMPORTANT->value,
'Starred' => SupportedFolderEnum::STARRED->value,
'Drafts' => SupportedFolderEnum::DRAFT->value,
'Sent Mail' => SupportedFolderEnum::SENT->value,
'Trash' => SupportedFolderEnum::TRASH->value,
default => '',
};
$parentEmail = null;
if ($email) {
$parentEmail = $this->emailRepository->update([
'folders' => array_unique(array_merge($email->folders, [$folderName])),
'reference_ids' => array_merge($email->reference_ids ?? [], [$references]),
], $email->id);
}
$email = $this->emailRepository->create([
'from' => $attributes['from']->first()->mail,
'subject' => $attributes['subject']->first(),
'name' => $attributes['from']->first()->personal,
'reply' => $message->bodies['html'] ?? $message->bodies['text'],
'is_read' => (int) $message->flags()->has('seen'),
'folders' => [$folderName],
'reply_to' => $this->getEmailsByAttributeCode($attributes, 'to'),
'cc' => $this->getEmailsByAttributeCode($attributes, 'cc'),
'bcc' => $this->getEmailsByAttributeCode($attributes, 'bcc'),
'source' => 'email',
'user_type' => 'person',
'unique_id' => $messageId,
'message_id' => $messageId,
'reference_ids' => $references,
'created_at' => $this->convertToDesiredTimezone($message->date->toDate()),
'parent_id' => $parentEmail?->id,
]);
if ($message->hasAttachments()) {
$this->attachmentRepository->uploadAttachments($email, [
'source' => 'email',
'attachments' => $message->getAttachments(),
]);
}
}
/**
* Process the messages from all folders.
*
* @param \Webklex\IMAP\Support\FolderCollection $rootFoldersCollection
*/
protected function processMessagesFromLeafFolders($rootFoldersCollection = null): void
{
$rootFoldersCollection->each(function ($folder) {
if (! $folder->children->isEmpty()) {
$this->processMessagesFromLeafFolders($folder->children);
return;
}
if (in_array($folder->name, ['All Mail'])) {
return;
}
return $folder->query()->since(now()->subDays(10))->get()->each(function ($message) {
$this->processMessage($message);
});
});
}
/**
* Get the emails by the attribute code.
*/
protected function getEmailsByAttributeCode(array $attributes, string $attributeCode): array
{
$emails = [];
if (isset($attributes[$attributeCode])) {
$emails = collect($attributes[$attributeCode]->all())->map(fn ($attribute) => $attribute->mail)->toArray();
}
return $emails;
}
/**
* Convert the date to the desired timezone.
*
* @param \Carbon\Carbon $carbonDate
* @param ?string $targetTimezone
*/
protected function convertToDesiredTimezone($carbonDate, $targetTimezone = null)
{
$targetTimezone = $targetTimezone ?: config('app.timezone');
return $carbonDate->clone()->setTimezone($targetTimezone);
}
/**
* Get the default configurations.
*/
protected function getDefaultConfigs(): array
{
$defaultConfig = config('imap.accounts.default');
$defaultConfig['host'] = core()->getConfigData('email.imap.account.host') ?: $defaultConfig['host'];
$defaultConfig['port'] = core()->getConfigData('email.imap.account.port') ?: $defaultConfig['port'];
$defaultConfig['encryption'] = core()->getConfigData('email.imap.account.encryption') ?: $defaultConfig['encryption'];
$defaultConfig['validate_cert'] = (bool) core()->getConfigData('email.imap.account.validate_cert');
$defaultConfig['username'] = core()->getConfigData('email.imap.account.username') ?: $defaultConfig['username'];
$defaultConfig['password'] = core()->getConfigData('email.imap.account.password') ?: $defaultConfig['password'];
return $defaultConfig;
}
}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Email/src/InboundEmailProcessor/Contracts/InboundEmailProcessor.php | packages/Webkul/Email/src/InboundEmailProcessor/Contracts/InboundEmailProcessor.php | <?php
namespace Webkul\Email\InboundEmailProcessor\Contracts;
interface InboundEmailProcessor
{
/**
* Process messages from all folders.
*
* @return mixed
*/
public function processMessagesFromAllFolders();
/**
* Process the inbound email.
*
* @param mixed|null $content
*/
public function processMessage($content = null): void;
}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Email/src/Contracts/Attachment.php | packages/Webkul/Email/src/Contracts/Attachment.php | <?php
namespace Webkul\Email\Contracts;
interface Attachment {}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Email/src/Contracts/Email.php | packages/Webkul/Email/src/Contracts/Email.php | <?php
namespace Webkul\Email\Contracts;
interface Email {}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Email/src/Database/Migrations/2021_05_25_072700_create_email_attachments_table.php | packages/Webkul/Email/src/Database/Migrations/2021_05_25_072700_create_email_attachments_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('email_attachments', function (Blueprint $table) {
$table->increments('id');
$table->string('name')->nullable();
$table->string('path');
$table->integer('size')->nullable();
$table->string('content_type')->nullable();
$table->string('content_id')->nullable();
$table->integer('email_id')->unsigned();
$table->foreign('email_id')->references('id')->on('emails')->onDelete('cascade');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('email_attachments');
}
};
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Email/src/Database/Migrations/2021_05_24_075618_create_emails_table.php | packages/Webkul/Email/src/Database/Migrations/2021_05_24_075618_create_emails_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('emails', function (Blueprint $table) {
$table->increments('id');
$table->string('subject')->nullable();
$table->string('source');
$table->string('user_type');
$table->string('name')->nullable();
$table->text('reply')->nullable();
$table->boolean('is_read')->default(0);
$table->json('folders')->nullable();
$table->json('from')->nullable();
$table->json('sender')->nullable();
$table->json('reply_to')->nullable();
$table->json('cc')->nullable();
$table->json('bcc')->nullable();
$table->string('unique_id')->nullable()->unique();
$table->string('message_id')->unique();
$table->json('reference_ids')->nullable();
$table->integer('person_id')->unsigned()->nullable();
$table->foreign('person_id')->references('id')->on('persons')->onDelete('set null');
$table->integer('lead_id')->unsigned()->nullable();
$table->foreign('lead_id')->references('id')->on('leads')->onDelete('set null');
$table->timestamps();
});
Schema::table('emails', function (Blueprint $table) {
$table->integer('parent_id')->unsigned()->nullable();
$table->foreign('parent_id')->references('id')->on('emails')->onDelete('cascade');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('emails');
}
};
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Email/src/Database/Migrations/2024_08_27_091619_create_email_tags_table.php | packages/Webkul/Email/src/Database/Migrations/2024_08_27_091619_create_email_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.
*/
public function up(): void
{
Schema::create('email_tags', function (Blueprint $table) {
$table->integer('tag_id')->unsigned();
$table->foreign('tag_id')->references('id')->on('tags')->onDelete('cascade');
$table->integer('email_id')->unsigned();
$table->foreign('email_id')->references('id')->on('emails')->onDelete('cascade');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('email_tags');
}
};
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Email/src/Console/Commands/ProcessInboundEmails.php | packages/Webkul/Email/src/Console/Commands/ProcessInboundEmails.php | <?php
namespace Webkul\Email\Console\Commands;
use Illuminate\Console\Command;
use Webkul\Email\InboundEmailProcessor\Contracts\InboundEmailProcessor;
class ProcessInboundEmails extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'inbound-emails:process';
/**
* The console command description.
*
* @var string
*/
protected $description = 'This command will process the incoming emails from the mail server.';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct(
protected InboundEmailProcessor $inboundEmailProcessor
) {
parent::__construct();
}
/**
* Handle.
*
* @return void
*/
public function handle()
{
$this->info('Processing the incoming emails.');
$this->inboundEmailProcessor->processMessagesFromAllFolders();
$this->info('Incoming emails processed successfully.');
}
}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Email/src/Enums/SupportedFolderEnum.php | packages/Webkul/Email/src/Enums/SupportedFolderEnum.php | <?php
namespace Webkul\Email\Enums;
enum SupportedFolderEnum: string
{
/**
* Inbox.
*/
case INBOX = 'inbox';
/**
* Important.
*/
case IMPORTANT = 'important';
/**
* Starred.
*/
case STARRED = 'starred';
/**
* Draft.
*/
case DRAFT = 'draft';
/**
* Outbox.
*/
case OUTBOX = 'outbox';
/**
* Sent.
*/
case SENT = 'sent';
/**
* Spam.
*/
case SPAM = 'spam';
/**
* Trash.
*/
case TRASH = 'trash';
}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Email/src/Mails/Email.php | packages/Webkul/Email/src/Mails/Email.php | <?php
namespace Webkul\Email\Mails;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Symfony\Component\Mime\Email as MimeEmail;
class Email extends Mailable
{
use Queueable, SerializesModels;
/**
* Create a new email instance.
*
* @return void
*/
public function __construct(public $email) {}
/**
* Build the message.
*
* @return $this
*/
public function build()
{
$this->from($this->email->from)
->to($this->email->reply_to)
->replyTo($this->email->parent_id ? $this->email->parent->unique_id : $this->email->unique_id)
->cc($this->email->cc ?? [])
->bcc($this->email->bcc ?? [])
->subject($this->email->parent_id ? $this->email->parent->subject : $this->email->subject)
->html($this->email->reply);
$this->withSymfonyMessage(function (MimeEmail $message) {
$message->getHeaders()->addIdHeader('Message-ID', $this->email->message_id);
$message->getHeaders()->addTextHeader('References', $this->email->parent_id
? implode(' ', $this->email->parent->reference_ids)
: implode(' ', $this->email->reference_ids)
);
});
foreach ($this->email->attachments as $attachment) {
$this->attachFromStorage($attachment->path);
}
return $this;
}
}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Email/src/Models/Attachment.php | packages/Webkul/Email/src/Models/Attachment.php | <?php
namespace Webkul\Email\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Storage;
use Webkul\Email\Contracts\Attachment as AttachmentContract;
class Attachment extends Model implements AttachmentContract
{
/**
* The attributes that are mass assignable.
*
* @var string
*/
protected $table = 'email_attachments';
/**
* The attributes that are appended.
*
* @var array
*/
protected $appends = ['url'];
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'name',
'path',
'size',
'content_type',
'content_id',
'email_id',
];
/**
* Get the email.
*/
public function email()
{
return $this->belongsTo(EmailProxy::modelClass());
}
/**
* Get image url for the product image.
*/
public function url()
{
return Storage::url($this->path);
}
/**
* Accessor for the 'url' attribute.
*/
public function getUrlAttribute()
{
return $this->url();
}
}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Email/src/Models/AttachmentProxy.php | packages/Webkul/Email/src/Models/AttachmentProxy.php | <?php
namespace Webkul\Email\Models;
use Konekt\Concord\Proxies\ModelProxy;
class AttachmentProxy 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/Email/src/Models/Email.php | packages/Webkul/Email/src/Models/Email.php | <?php
namespace Webkul\Email\Models;
use Illuminate\Database\Eloquent\Model;
use Webkul\Contact\Models\PersonProxy;
use Webkul\Email\Contracts\Email as EmailContract;
use Webkul\Lead\Models\LeadProxy;
use Webkul\Tag\Models\TagProxy;
class Email extends Model implements EmailContract
{
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'emails';
/**
* The attributes that should be cast.
*
* @var array
*/
protected $casts = [
'folders' => 'array',
'sender' => 'array',
'from' => 'array',
'reply_to' => 'array',
'cc' => 'array',
'bcc' => 'array',
'reference_ids' => 'array',
];
/**
* The attributes that are appended.
*
* @var array
*/
protected $appends = [
'time_ago',
];
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'subject',
'source',
'name',
'user_type',
'is_read',
'folders',
'from',
'sender',
'reply_to',
'cc',
'bcc',
'unique_id',
'message_id',
'reference_ids',
'reply',
'person_id',
'parent_id',
'lead_id',
'created_at',
'updated_at',
];
/**
* Get the parent email.
*/
public function parent()
{
return $this->belongsTo(EmailProxy::modelClass(), 'parent_id');
}
/**
* Get the lead.
*/
public function lead()
{
return $this->belongsTo(LeadProxy::modelClass());
}
/**
* Get the emails.
*/
public function emails()
{
return $this->hasMany(EmailProxy::modelClass(), 'parent_id');
}
/**
* Get the person that owns the thread.
*/
public function person()
{
return $this->belongsTo(PersonProxy::modelClass());
}
/**
* The tags that belong to the lead.
*/
public function tags()
{
return $this->belongsToMany(TagProxy::modelClass(), 'email_tags');
}
/**
* Get the attachments.
*/
public function attachments()
{
return $this->hasMany(AttachmentProxy::modelClass(), 'email_id');
}
/**
* Get the time ago.
*/
public function getTimeAgoAttribute(): string
{
return $this->created_at->diffForHumans();
}
}
| php | MIT | 6b6fadfecea0ff5d80aedb9345602ff79e11922d | 2026-01-04T15:02:34.361572Z | false |
krayin/laravel-crm | https://github.com/krayin/laravel-crm/blob/6b6fadfecea0ff5d80aedb9345602ff79e11922d/packages/Webkul/Email/src/Models/EmailProxy.php | packages/Webkul/Email/src/Models/EmailProxy.php | <?php
namespace Webkul\Email\Models;
use Konekt\Concord\Proxies\ModelProxy;
class EmailProxy 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.