Skip to content

Commit

Permalink
Merge pull request #26 from bildvitta/feture/insert-country
Browse files Browse the repository at this point in the history
Feture/insert country
  • Loading branch information
noemimpimentel authored Jan 14, 2025
2 parents 55c2aa3 + bb10be4 commit f579374
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 1 deletion.
17 changes: 17 additions & 0 deletions src/Models/Country.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

namespace Bildvitta\IssCrm\Models;

use Bildvitta\IssCrm\Traits\UsesCrmDB;
use Illuminate\Database\Eloquent\Model;

class Country extends Model
{
use UsesCrmDB;

protected $connection = 'iss-crm';

protected $table = 'countries';

protected $guard_name = 'web';
}
16 changes: 16 additions & 0 deletions src/Models/Customer/Customer.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Bildvitta\IssCrm\Models\Channel;
use Bildvitta\IssCrm\Models\CivilStatus;
use Bildvitta\IssCrm\Models\Country;
use Bildvitta\IssCrm\Models\Hub\HubCompany;
use Bildvitta\IssCrm\Models\Hub\User;
use Bildvitta\IssCrm\Models\Occupation;
Expand Down Expand Up @@ -191,4 +192,19 @@ public function scopeHasCompleteRegistration(Builder $query): Builder
->orWhereNotNull('phone_two');
});
}

public function country()
{
return $this->belongsTo(Country::class, 'country_id', 'id');
}

public function calling_code_phone()
{
return $this->belongsTo(Country::class, 'calling_code_phone_id', 'id');
}

public function calling_code_phone_two()
{
return $this->belongsTo(Country::class, 'calling_code_phone_two_id', 'id');
}
}
2 changes: 1 addition & 1 deletion tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

class TestCase extends Orchestra
{
public function setUp(): void
protected function setUp(): void
{
parent::setUp();

Expand Down

0 comments on commit f579374

Please sign in to comment.