Skip to content

Commit 473e040

Browse files
authored
Merge pull request #12 from BinarCode/2.x
2.x
2 parents 7aab176 + 2d3949f commit 473e040

File tree

6 files changed

+39
-24
lines changed

6 files changed

+39
-24
lines changed

.php-cs-fixer.cache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"php":"8.0.11","version":"3.2.1","indent":" ","lineEnding":"\n","rules":{"blank_line_after_opening_tag":true,"braces":{"allow_single_line_anonymous_class_with_empty_body":true},"class_definition":{"space_before_parenthesis":true},"compact_nullable_typehint":true,"declare_equal_normalize":true,"lowercase_cast":true,"lowercase_static_reference":true,"new_with_braces":true,"no_blank_lines_after_class_opening":true,"no_leading_import_slash":true,"no_whitespace_in_blank_line":true,"ordered_class_elements":{"order":["use_trait"]},"ordered_imports":{"sort_algorithm":"alpha"},"return_type_declaration":true,"short_scalar_cast":true,"single_blank_line_before_namespace":true,"single_trait_insert_per_statement":true,"ternary_operator_spaces":true,"visibility_required":true,"blank_line_after_namespace":true,"constant_case":true,"elseif":true,"function_declaration":true,"indentation_type":true,"line_ending":true,"lowercase_keywords":true,"method_argument_space":{"on_multiline":"ensure_fully_multiline","keep_multiple_spaces_after_comma":true},"no_break_comment":true,"no_closing_tag":true,"no_space_around_double_colon":true,"no_spaces_after_function_name":true,"no_spaces_inside_parenthesis":true,"no_trailing_whitespace":true,"no_trailing_whitespace_in_comment":true,"single_blank_line_at_eof":true,"single_class_element_per_statement":{"elements":["property"]},"single_import_per_statement":true,"single_line_after_imports":true,"switch_case_semicolon_to_colon":true,"switch_case_space":true,"encoding":true,"full_opening_tag":true,"array_syntax":{"syntax":"short"},"no_unused_imports":true,"not_operator_with_successor_space":true,"trailing_comma_in_multiline":true,"phpdoc_scalar":true,"unary_operator_spaces":true,"binary_operator_spaces":true,"blank_line_before_statement":{"statements":["break","continue","declare","return","throw","try"]},"phpdoc_single_line_var_spacing":true,"phpdoc_var_without_name":true,"class_attributes_separation":{"elements":{"method":"one"}}},"hashes":{"src\/Commands\/PruneCommand.php":1473367127,"src\/Telescope\/TelescopeException.php":1871046959,"src\/Telescope\/TelescopeDev.php":2309110818,"src\/LaravelDeveloper.php":1129170780,"src\/Dtos\/DevLogDto.php":1643551788,"src\/Dtos\/DevNotificationDto.php":412948095,"src\/Notifications\/DevNotification.php":2947327537,"src\/Notifications\/Slack.php":3934215647,"src\/Middleware\/DevSanctumAuthMiddleware.php":964085018,"src\/Middleware\/DevAuthMiddleware.php":1511410281,"src\/Models\/DeveloperLog.php":4104297917,"src\/Models\/Concerns\/WithUuid.php":1102884493,"src\/Models\/Concerns\/WithCreator.php":2183877251,"src\/Models\/Concerns\/InteractsWithDeveloper.php":1790705050,"src\/LaravelDeveloperServiceProvider.php":1956646152,"src\/Profiling\/ServerMemory.php":1460695193,"src\/Profiling\/ServerTiming.php":4274056244,"src\/helpers.php":715232250,"src\/Concerns\/Proxies.php":524787727,"src\/Concerns\/ClassResolver.php":1880027722,"src\/LaravelDeveloperFacade.php":3477645298,"src\/Nova\/DeveloperLogResource.php":9639465,"src\/Nova\/Fields\/Line.php":2270391664,"src\/Nova\/Fields\/CreatedAt.php":2148384209,"src\/Nova\/Fields\/Badge.php":1570922008,"src\/Nova\/Fields\/ExpirationDateBadge.php":4282897254,"src\/Nova\/Fields\/BelongsTo.php":1822753998,"src\/Nova\/Fields\/BadgeList.php":3076744754,"src\/Nova\/Fields\/DangerBadge.php":3216791755,"src\/Nova\/Filters\/EndingAtFilter.php":2850496008,"src\/Nova\/Filters\/HasResultsFilter.php":4116547610,"src\/Nova\/Filters\/FromDateFilter.php":1053058278,"src\/Nova\/Filters\/ToDateFilter.php":581993863,"src\/Nova\/Filters\/CreatedAtFilter.php":778019993,"src\/Nova\/Filters\/TagFilter.php":1978666758,"tests\/TestCase.php":3638931094,"tests\/Fixtures\/DummyNotification.php":3913031193,"tests\/Fixtures\/User.php":353028011,"tests\/Notifications\/DevNotificationTest.php":3587569263,"tests\/Middleware\/DevAuthMiddlewareTest.php":1606798965,"tests\/Middleware\/DevSanctumAuthMiddlewareTest.php":3421724279,"tests\/ExampleTest.php":1575370042,"tests\/Helpers\/SlackHelperTest.php":1334877550,"tests\/Helpers\/DevLogHelperTest.php":585022422,"tests\/Models\/ExceptionLogTest.php":2235509697,"tests\/Models\/LaravelDeveloperTest.php":1546634681,"tests\/Console\/PruneCommandTest.php":4199024702,"tests\/Mock\/CustomNotificationMock.php":2052176798,"tests\/Mock\/PayloadMock.php":1887690153,"tests\/Profiling\/ServerTimingTest.php":1295567184,"tests\/Profiling\/ServerMemoryTest.php":4137425435,"tests\/Mock.php":3663171411}}
1+
{"php":"8.0.11","version":"3.2.1","indent":" ","lineEnding":"\n","rules":{"blank_line_after_opening_tag":true,"braces":{"allow_single_line_anonymous_class_with_empty_body":true},"class_definition":{"space_before_parenthesis":true},"compact_nullable_typehint":true,"declare_equal_normalize":true,"lowercase_cast":true,"lowercase_static_reference":true,"new_with_braces":true,"no_blank_lines_after_class_opening":true,"no_leading_import_slash":true,"no_whitespace_in_blank_line":true,"ordered_class_elements":{"order":["use_trait"]},"ordered_imports":{"sort_algorithm":"alpha"},"return_type_declaration":true,"short_scalar_cast":true,"single_blank_line_before_namespace":true,"single_trait_insert_per_statement":true,"ternary_operator_spaces":true,"visibility_required":true,"blank_line_after_namespace":true,"constant_case":true,"elseif":true,"function_declaration":true,"indentation_type":true,"line_ending":true,"lowercase_keywords":true,"method_argument_space":{"on_multiline":"ensure_fully_multiline","keep_multiple_spaces_after_comma":true},"no_break_comment":true,"no_closing_tag":true,"no_space_around_double_colon":true,"no_spaces_after_function_name":true,"no_spaces_inside_parenthesis":true,"no_trailing_whitespace":true,"no_trailing_whitespace_in_comment":true,"single_blank_line_at_eof":true,"single_class_element_per_statement":{"elements":["property"]},"single_import_per_statement":true,"single_line_after_imports":true,"switch_case_semicolon_to_colon":true,"switch_case_space":true,"encoding":true,"full_opening_tag":true,"array_syntax":{"syntax":"short"},"no_unused_imports":true,"not_operator_with_successor_space":true,"trailing_comma_in_multiline":true,"phpdoc_scalar":true,"unary_operator_spaces":true,"binary_operator_spaces":true,"blank_line_before_statement":{"statements":["break","continue","declare","return","throw","try"]},"phpdoc_single_line_var_spacing":true,"phpdoc_var_without_name":true,"class_attributes_separation":{"elements":{"method":"one"}}},"hashes":{"src\/Commands\/PruneCommand.php":1473367127,"src\/Telescope\/TelescopeException.php":1871046959,"src\/Telescope\/TelescopeDev.php":2309110818,"src\/LaravelDeveloper.php":1129170780,"src\/Dtos\/DevLogDto.php":3583724619,"src\/Dtos\/DevNotificationDto.php":412948095,"src\/Notifications\/DevNotification.php":2947327537,"src\/Notifications\/Slack.php":3934215647,"src\/Middleware\/DevSanctumAuthMiddleware.php":964085018,"src\/Middleware\/DevAuthMiddleware.php":1511410281,"src\/Models\/DeveloperLog.php":46269680,"src\/Models\/Concerns\/WithUuid.php":1102884493,"src\/Models\/Concerns\/WithCreator.php":2183877251,"src\/Models\/Concerns\/InteractsWithDeveloper.php":1790705050,"src\/LaravelDeveloperServiceProvider.php":1956646152,"src\/Profiling\/ServerMemory.php":1460695193,"src\/Profiling\/ServerTiming.php":4274056244,"src\/helpers.php":715232250,"src\/Concerns\/Proxies.php":524787727,"src\/Concerns\/ClassResolver.php":1880027722,"src\/LaravelDeveloperFacade.php":3477645298,"src\/Nova\/DeveloperLogResource.php":9639465,"src\/Nova\/Fields\/Line.php":2270391664,"src\/Nova\/Fields\/CreatedAt.php":2148384209,"src\/Nova\/Fields\/Badge.php":1570922008,"src\/Nova\/Fields\/ExpirationDateBadge.php":4282897254,"src\/Nova\/Fields\/BelongsTo.php":1822753998,"src\/Nova\/Fields\/BadgeList.php":3076744754,"src\/Nova\/Fields\/DangerBadge.php":3216791755,"src\/Nova\/Filters\/EndingAtFilter.php":2850496008,"src\/Nova\/Filters\/HasResultsFilter.php":4116547610,"src\/Nova\/Filters\/FromDateFilter.php":1053058278,"src\/Nova\/Filters\/ToDateFilter.php":581993863,"src\/Nova\/Filters\/CreatedAtFilter.php":778019993,"src\/Nova\/Filters\/TagFilter.php":1074708485,"tests\/TestCase.php":3638931094,"tests\/Fixtures\/DummyNotification.php":3913031193,"tests\/Fixtures\/User.php":353028011,"tests\/Notifications\/DevNotificationTest.php":3587569263,"tests\/Middleware\/DevAuthMiddlewareTest.php":1606798965,"tests\/Middleware\/DevSanctumAuthMiddlewareTest.php":3421724279,"tests\/ExampleTest.php":1575370042,"tests\/Helpers\/SlackHelperTest.php":1334877550,"tests\/Helpers\/DevLogHelperTest.php":585022422,"tests\/Models\/ExceptionLogTest.php":2235509697,"tests\/Models\/LaravelDeveloperTest.php":1546634681,"tests\/Console\/PruneCommandTest.php":4199024702,"tests\/Mock\/CustomNotificationMock.php":2052176798,"tests\/Mock\/PayloadMock.php":1887690153,"tests\/Profiling\/ServerTimingTest.php":1295567184,"tests\/Profiling\/ServerMemoryTest.php":4137425435,"tests\/Mock.php":3663171411,"src\/Enums\/TagEnum.php":4176252147}}

src/Dtos/DevLogDto.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Binarcode\LaravelDeveloper\Dtos;
44

5+
use Binarcode\LaravelDeveloper\Enums\TagEnum;
56
use Binarcode\LaravelDeveloper\Models\DeveloperLog;
67
use Illuminate\Database\Eloquent\Model;
78
use Illuminate\Support\Collection;
@@ -12,7 +13,7 @@ class DevLogDto
1213

1314
public array $payload = [];
1415

15-
public ?string $tags;
16+
public string $tags = TagEnum::info;
1617

1718
public ?Model $target = null;
1819

@@ -24,7 +25,7 @@ public function __construct(string $name = 'Dev Log', ?array $payload = [], ?str
2425
{
2526
$this->payload = $payload ?? [];
2627
$this->name = $name;
27-
$this->tags = $tags;
28+
$this->tags = $tags ?? TagEnum::info;
2829
$this->relatedModels = collect();
2930
$this->meta = collect();
3031
}

src/Enums/TagEnum.php

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
3+
namespace Binarcode\LaravelDeveloper\Enums;
4+
5+
class TagEnum
6+
{
7+
public const success = 'success';
8+
public const info = 'info';
9+
public const danger = 'danger';
10+
public const warning = 'warning';
11+
12+
public static function toArray(): array
13+
{
14+
return [
15+
static::success,
16+
static::info,
17+
static::danger,
18+
static::warning,
19+
];
20+
}
21+
22+
public static function keyValue(): array
23+
{
24+
return [
25+
static::success => static::success,
26+
static::info => static::info,
27+
static::danger => static::danger,
28+
static::warning => static::warning,
29+
];
30+
}
31+
}

src/Models/DeveloperLog.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Binarcode\LaravelDeveloper\Models;
44

55
use Binarcode\LaravelDeveloper\Dtos\DevLogDto;
6+
use Binarcode\LaravelDeveloper\Enums\TagEnum;
67
use Binarcode\LaravelDeveloper\LaravelDeveloper;
78
use Binarcode\LaravelDeveloper\Models\Concerns\WithCreator;
89
use Binarcode\LaravelDeveloper\Models\Concerns\WithUuid;
@@ -38,9 +39,6 @@ class DeveloperLog extends Model
3839
use WithUuid;
3940
use WithCreator;
4041

41-
public const TAG_DANGER = 'danger';
42-
public const TAG_INFO = 'info';
43-
4442
protected $table = 'developer_logs';
4543

4644
protected $guarded = [];
@@ -82,7 +80,7 @@ public static function makeFromException(Throwable $throwable, JsonSerializable
8280
'exception' => $throwable->__toString(),
8381
'previous' => (string) $throwable->getPrevious(),
8482
'payload' => optional($payload)->jsonSerialize(),
85-
'tags' => static::TAG_DANGER,
83+
'tags' => TagEnum::danger,
8684
]);
8785
}
8886

src/Nova/Filters/TagFilter.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace Binarcode\LaravelDeveloper\Nova\Filters;
44

5-
use App\Domains\Developer\Models\ExceptionLog;
5+
use Binarcode\LaravelDeveloper\Enums\TagEnum;
66
use Illuminate\Http\Request;
77
use Laravel\Nova\Filters\Filter;
88

@@ -15,9 +15,6 @@ public function apply(Request $request, $query, $value)
1515

1616
public function options(Request $request)
1717
{
18-
return [
19-
'Error' => ExceptionLog::TAG_DANGER,
20-
'Info' => ExceptionLog::TAG_INFO,
21-
];
18+
return TagEnum::keyValue();
2219
}
2320
}

tests/ExampleTest.php

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)