Skip to content

Commit

Permalink
Fix styling
Browse files Browse the repository at this point in the history
  • Loading branch information
james2doyle authored and actions-user committed Jul 28, 2021
1 parent a335b19 commit 8877062
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/HasNotes.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace EngineDigital\Note;

use Illuminate\Database\Eloquent\Relations\Relation;
use Illuminate\Database\Eloquent\Relations\MorphMany;
use Illuminate\Database\Eloquent\Relations\Relation;

trait HasNotes
{
Expand Down
14 changes: 8 additions & 6 deletions src/Note.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@

namespace EngineDigital\Note;

use Exception;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\MorphTo;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Exception;
use Illuminate\Database\Eloquent\Relations\MorphTo;
use InvalidArgumentException;

class Note extends Model {
class Note extends Model
{
protected $table = 'notes';

protected $fillable = [
Expand All @@ -35,7 +36,7 @@ public function tenant(): BelongsTo
{
$tenantClass = config('model-notes.tenant_model');

if (!$tenantClass) {
if (! $tenantClass) {
throw new Exception('Tenant class was not set');
}

Expand All @@ -46,7 +47,7 @@ public function setTypeAttribute(string $value = ''): void
{
$types = config('model-notes.note_types');

if (!in_array($value, $types)) {
if (! in_array($value, $types)) {
throw new InvalidArgumentException(sprintf('Type of "%s" does not exist in "%s"', $value, implode(', ', $types)));
}

Expand All @@ -65,7 +66,8 @@ public function __toString(): string
return $this->note;
}

public function getTimeAgoAttribute(): string {
public function getTimeAgoAttribute(): string
{
return $this->created_at ? $this->created_at->diffForHumans() : '';
}
}
3 changes: 2 additions & 1 deletion src/NoteServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Spatie\LaravelPackageTools\Package;
use Spatie\LaravelPackageTools\PackageServiceProvider;

// use EngineDigital\Note\Commands\NoteCommand;

class NoteServiceProvider extends PackageServiceProvider
Expand All @@ -19,7 +20,7 @@ public function configurePackage(Package $package): void
->name('model-notes')
->hasConfigFile()
->hasMigration('create_model_notes_table');
// ->hasCommand(NoteCommand::class);
// ->hasCommand(NoteCommand::class);
}

// public function packageRegistered()
Expand Down
4 changes: 2 additions & 2 deletions tests/NoteTenantTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

use EngineDigital\Note\Note;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;

class FakeCompany extends Model {
class FakeCompany extends Model
{
protected $table = 'company';
protected $fillable = ['name'];
}
Expand Down
8 changes: 4 additions & 4 deletions tests/NoteTraitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@

namespace EngineDigital\Note\Tests;

use EngineDigital\Note\Note;
use EngineDigital\Note\HasNotes;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;

class AnotherFakeCompany extends Model {
class AnotherFakeCompany extends Model
{
use HasNotes;
protected $table = 'company';
protected $fillable = ['name'];
}

class TenantResolver {
class TenantResolver
{
public function __invoke()
{
return '123';
Expand Down
3 changes: 1 addition & 2 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@

namespace EngineDigital\Note\Tests;

use EngineDigital\Note\NoteServiceProvider;
use Illuminate\Database\Eloquent\Factories\Factory;
use Orchestra\Testbench\TestCase as Orchestra;
use Spatie\LaravelPackageTools\CreatePackageTable;
use EngineDigital\Note\NoteServiceProvider;

class TestCase extends Orchestra
{
Expand Down
3 changes: 1 addition & 2 deletions tests/create_company_table.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
return new class() extends Migration {
public function up()
{
Schema::create('company', function (Blueprint $table) {
Expand Down

0 comments on commit 8877062

Please sign in to comment.