This package now requires at least PHP 8.2 and Laravel 10. To install this new version you must update your application accordingly.
This package now requires at least PHP 8 and Laravel 8. To install this new version you must update your application accordingly.
In version 2.x, the trait Axn\Illuminate\Database\Eloquent\ModelTrait
was needed
on model classes to use these features:
In version 3.x, this trait has been removed so you need to remove it from model classes.
For example, replace:
namespace App\Models;
use Axn\Illuminate\Database\Eloquent\ModelTrait;
class User extends Model
{
use ModelTrait;
// ...
}
By:
namespace App\Models;
class User extends Model
{
// ...
}
This feature is now implemented using Eloquent macros and no longer require any additions on model classes to work.
This feature is now implemented using a global scope and need to replace the attribute
$orderBy
in model classes by the registration of the global scope instead.
For example, replace:
class User extends Model
{
// ...
protected $orderBy = [
'lastname' => 'asc',
'firstname' => 'asc',
];
// ...
}
By:
use Axn\Illuminate\Database\Eloquent\DefaultOrderScope;
class User extends Model
{
// ...
protected static function booted()
{
static::addGlobalScope(new DefaultOrderScope([
'lastname' => 'asc',
'firstname' => 'desc',
]));
}
// ...
}
And for disabling default order on queries, replace the call of disableDefaultOrderBy()
by withoutGlobalScope(DefaultOrderScope::class)
.
For example, replace:
$users = User::disableDefaultOrderBy()->get();
By:
use Axn\Illuminate\Database\Eloquent\DefaultOrderScope;
$users = User::withoutGlobalScope(DefaultOrderScope::class)->get();
In version 2.x, when using Schema::create()
, engine was automatically set to "InnoDB"
on Blueprint instance if not set manually.
In version 3.x, this feature has been removed because this can be done by adding
'engine' => 'InnoDB'
option to mysql connection in config/database.php
.
For example:
// config/database.php
return [
// ...
'connections' => [
// ...
'mysql' => [
// ...
'engine' => 'InnoDB',
],
// ...
],
// ...
];