mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-31 00:54:32 -04:00
Fixes for staticmodel scopes
This commit is contained in:
parent
e210d9f1bb
commit
886ca7f1e0
@ -23,7 +23,7 @@ class ShowActivityRequest extends Request
|
|||||||
*/
|
*/
|
||||||
public function authorize() : bool
|
public function authorize() : bool
|
||||||
{
|
{
|
||||||
return auth()->user()->isAdmin();
|
// return auth()->user()->isAdmin();
|
||||||
// return auth()->user()->can('view', Activity::class);
|
return auth()->user()->can('view', Activity::class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -375,18 +375,4 @@ class Activity extends StaticModel
|
|||||||
return $this->belongsTo(Company::class);
|
return $this->belongsTo(Company::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
// /**
|
|
||||||
// * @return mixed
|
|
||||||
// */
|
|
||||||
// public function resolveRouteBinding($value, $field = null)
|
|
||||||
// {
|
|
||||||
// if (is_numeric($value)) {
|
|
||||||
// throw new ModelNotFoundException("Record with value {$value} not found");
|
|
||||||
// }
|
|
||||||
|
|
||||||
// return $this
|
|
||||||
// //->withTrashed()
|
|
||||||
// ->where('id', $this->decodePrimaryKey($value))->firstOrFail();
|
|
||||||
// }
|
|
||||||
|
|
||||||
}
|
}
|
@ -69,17 +69,5 @@ class ClientGatewayToken extends BaseModel
|
|||||||
{
|
{
|
||||||
return $this->belongsTo(User::class)->withTrashed();
|
return $this->belongsTo(User::class)->withTrashed();
|
||||||
}
|
}
|
||||||
|
|
||||||
// /**
|
|
||||||
// * Retrieve the model for a bound value.
|
|
||||||
// *
|
|
||||||
// * @param mixed $value
|
|
||||||
// * @param null $field
|
|
||||||
// * @return Model|null
|
|
||||||
// */
|
|
||||||
// public function resolveRouteBinding($value, $field = null)
|
|
||||||
// {
|
|
||||||
// return $this
|
|
||||||
// ->where('id', $this->decodePrimaryKey($value))->firstOrFail();
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
@ -412,12 +412,4 @@ class CompanyGateway extends BaseModel
|
|||||||
return route('payment_webhook', ['company_key' => $this->company->company_key, 'company_gateway_id' => $this->hashed_id]);
|
return route('payment_webhook', ['company_key' => $this->company->company_key, 'company_gateway_id' => $this->hashed_id]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// public function resolveRouteBinding($value, $field = null)
|
|
||||||
// {
|
|
||||||
|
|
||||||
// return $this
|
|
||||||
// ->where('id', $this->decodePrimaryKey($value))->withTrashed()->firstOrFail();
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,6 @@ class Currency extends StaticModel
|
|||||||
'updated_at' => 'timestamp',
|
'updated_at' => 'timestamp',
|
||||||
'created_at' => 'timestamp',
|
'created_at' => 'timestamp',
|
||||||
'deleted_at' => 'timestamp',
|
'deleted_at' => 'timestamp',
|
||||||
//'precision' => 'string',
|
|
||||||
'precision' => 'integer',
|
'precision' => 'integer',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -14,14 +14,13 @@ namespace App\Models;
|
|||||||
use App\Utils\Traits\MakesHash;
|
use App\Utils\Traits\MakesHash;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
|
use Illuminate\Database\Eloquent\ModelNotFoundException as ModelNotFoundException;
|
||||||
|
|
||||||
class GroupSetting extends StaticModel
|
class GroupSetting extends StaticModel
|
||||||
{
|
{
|
||||||
use MakesHash;
|
use MakesHash;
|
||||||
use SoftDeletes;
|
use SoftDeletes;
|
||||||
|
|
||||||
//public $timestamps = false;
|
|
||||||
|
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
'settings' => 'object',
|
'settings' => 'object',
|
||||||
'updated_at' => 'timestamp',
|
'updated_at' => 'timestamp',
|
||||||
@ -65,4 +64,25 @@ class GroupSetting extends StaticModel
|
|||||||
return $this->morphMany(Document::class, 'documentable');
|
return $this->morphMany(Document::class, 'documentable');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve the model for a bound value.
|
||||||
|
*
|
||||||
|
* @param mixed $value
|
||||||
|
* @param null $field
|
||||||
|
* @return Model|null
|
||||||
|
*/
|
||||||
|
public function resolveRouteBinding($value, $field = null)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (is_numeric($value)) {
|
||||||
|
throw new ModelNotFoundException("Record with value {$value} not found");
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this
|
||||||
|
->withTrashed()
|
||||||
|
->company()
|
||||||
|
->where('id', $this->decodePrimaryKey($value))->firstOrFail();
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -292,14 +292,6 @@ class Payment extends BaseModel
|
|||||||
return new PaymentService($this);
|
return new PaymentService($this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// public function resolveRouteBinding($value, $field = null)
|
|
||||||
// {
|
|
||||||
// return $this
|
|
||||||
// ->withTrashed()
|
|
||||||
// ->where('id', $this->decodePrimaryKey($value))->firstOrFail();
|
|
||||||
// }
|
|
||||||
|
|
||||||
public function refund(array $data) :self
|
public function refund(array $data) :self
|
||||||
{
|
{
|
||||||
return $this->service()->refundPayment($data);
|
return $this->service()->refundPayment($data);
|
||||||
|
@ -57,8 +57,7 @@ class StaticModel extends Model
|
|||||||
}
|
}
|
||||||
|
|
||||||
return $this
|
return $this
|
||||||
->withTrashed()
|
|
||||||
->company()
|
|
||||||
->where('id', $this->decodePrimaryKey($value))->firstOrFail();
|
->where('id', $this->decodePrimaryKey($value))->firstOrFail();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user