Merge branch 'develop' into feature/CheckPaymentHarim
This commit is contained in:
@@ -86,23 +86,18 @@ class City extends Model
|
||||
{
|
||||
try {
|
||||
$city = City::query()
|
||||
->whereRaw("
|
||||
ST_Contains(
|
||||
geometry,
|
||||
ST_GeomFromText('POINT($lng $lat)', 4326)
|
||||
)
|
||||
")
|
||||
->firstOrFail();
|
||||
}
|
||||
catch (ModelNotFoundException $exception) {
|
||||
->whereRaw("ST_Contains(
|
||||
geometry,
|
||||
ST_GeomFromText('POINT($lng $lat)', 4326))"
|
||||
)
|
||||
->firstOrFail(['id', 'name_fa', 'province_id']);
|
||||
} catch (ModelNotFoundException $exception) {
|
||||
$city = City::query()
|
||||
->orderByRaw("
|
||||
ST_Distance(
|
||||
geometry,
|
||||
ST_GeomFromText('POINT($lng $lat)', 4326)
|
||||
) ASC
|
||||
")
|
||||
->first();
|
||||
->orderByRaw("ST_Distance(
|
||||
geometry,
|
||||
ST_GeomFromText('POINT($lng $lat)', 4326)) ASC"
|
||||
)
|
||||
->first(['id', 'name_fa', 'province_id']);
|
||||
}
|
||||
|
||||
return $city;
|
||||
|
||||
@@ -44,5 +44,21 @@ class Harim extends Model
|
||||
|
||||
$this->update($data);
|
||||
});
|
||||
public function panjarehVahedHistories(): HasMany
|
||||
{
|
||||
return $this->hasMany(PanjarehVahedHistory::class);
|
||||
}
|
||||
|
||||
protected function data(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
set: function ($value) {
|
||||
$iv = config('harim_web_services.Harim_Info.iv');
|
||||
$keyString = config('harim_web_services.Harim_Info.keyString');
|
||||
$key = hash('sha256',$keyString, true);
|
||||
$decrypted = openssl_decrypt($value,'aes-256-cbc',$key,false, $iv);
|
||||
return json_decode($decrypted);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
13
app/Models/PanjarehVahedHistory.php
Normal file
13
app/Models/PanjarehVahedHistory.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class PanjarehVahedHistory extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $guarded = [];
|
||||
}
|
||||
Reference in New Issue
Block a user