Add new version in repository
This commit is contained in:
47
app/Models/Core/App/ApplicationClient.php
Normal file
47
app/Models/Core/App/ApplicationClient.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
namespace App\Models\Core\App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class ApplicationClient extends Model
|
||||
{
|
||||
protected $connection = 'system';
|
||||
protected $guarded = [];
|
||||
protected $table = 'application_clients';
|
||||
public $timestamps = false;
|
||||
|
||||
public function application()
|
||||
{
|
||||
return $this->belongsTo(\App\Models\Core\App\Application::class);
|
||||
}
|
||||
|
||||
public function client()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Partner\Client');
|
||||
}
|
||||
|
||||
public function scopeActive($query)
|
||||
{
|
||||
return $query->where('active', 1);
|
||||
}
|
||||
|
||||
public function scopeByApplication($query, $id)
|
||||
{
|
||||
return $query->where('application_id', $id);
|
||||
}
|
||||
|
||||
public function scopeByClient($query, $id)
|
||||
{
|
||||
return $query->where('client_id', $id);
|
||||
}
|
||||
|
||||
public function scopeBySlug($query, $slug)
|
||||
{
|
||||
return $query->whereHas(
|
||||
'application', function ($query) use ($slug) {
|
||||
$query->bySlug($slug);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user