Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
iamgergo committed Dec 31, 2023
1 parent e58e472 commit ad39b1e
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 8 deletions.
16 changes: 16 additions & 0 deletions src/Traits/InteractsWithTurbo.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

namespace Cone\Root\Traits;

use Illuminate\Http\Request;

trait InteractsWithTurbo
{
/**
* Determine if the request is Turbo request.
*/
public function isTurboRequest(Request $request): bool
{
return $request->hasHeader('Turbo-Frame');
}
}
10 changes: 2 additions & 8 deletions src/Widgets/Widget.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Cone\Root\Http\Controllers\WidgetController;
use Cone\Root\Traits\Authorizable;
use Cone\Root\Traits\HasAttributes;
use Cone\Root\Traits\InteractsWithTurbo;
use Cone\Root\Traits\Makeable;
use Cone\Root\Traits\RegistersRoutes;
use Cone\Root\Traits\ResolvesVisibility;
Expand All @@ -17,6 +18,7 @@ abstract class Widget implements Arrayable
{
use Authorizable;
use HasAttributes;
use InteractsWithTurbo;
use Makeable;
use RegistersRoutes;
use ResolvesVisibility;
Expand Down Expand Up @@ -73,14 +75,6 @@ public function data(Request $request): array
]);
}

/**
* Determine if the request is Turbo request.
*/
public function isTurboRequest(Request $request): bool
{
return $request->hasHeader('Turbo-Frame');
}

/**
* The routes should be registered.
*/
Expand Down
17 changes: 17 additions & 0 deletions tests/Fields/BelongsToTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

namespace Cone\Root\Tests;

use Cone\Root\Fields\BelongsTo;

class BelongsToTest extends TestCase
{
protected BelongsTo $field;

public function setUp(): void
{
parent::setUp();

//
}
}

0 comments on commit ad39b1e

Please sign in to comment.