Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated custom Eloquent relations for Laravel 5.8 #996

Merged
merged 15 commits into from
Jun 11, 2019
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

### Changed
- Account sprinkle now extend the Core `BakeCommand` class to add the `create-admin` to the general bake command. Any sprinkle already extending the Core `BakeCommand` might need adjustments.
- Updated custom Eloquent relations (`belongsToManyThrough`, `morphToManyUnique`, `belongsToManyUnique`, `morphToManyUnique`, etc.) to support Laravel 5.8. See [The `belongsToMany` Method](https://laravel.com/docs/5.5/upgrade#upgrade-5.5.0).

### Removed
- Removed `belongsToManyConstrained` (deprecated in 4.1.6)

## [v4.2.3]

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ If you simply want to show that you like this project, or want to remember it fo

Copyright (c) 2019, free to use in personal and commercial software as per the [license](LICENSE.md).

UserFrosting is a secure, modern user management system written in PHP and built on top of the [Slim Microframework](http://www.slimframework.com/), [Twig](http://twig.sensiolabs.org/) templating engine, and [Eloquent](https://laravel.com/docs/5.4/eloquent#introduction) ORM.
UserFrosting is a secure, modern user management system written in PHP and built on top of the [Slim Microframework](http://www.slimframework.com/), [Twig](http://twig.sensiolabs.org/) templating engine, and [Eloquent](https://laravel.com/docs/5.8/eloquent#introduction) ORM.

## Features

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* Sessions table migration
* Version 4.0.0.
*
* See https://laravel.com/docs/5.4/migrations#tables
* See https://laravel.com/docs/5.8/migrations#tables
*
* @author Alex Weissman (https://alexanderweissman.com)
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* "Group" now replaces the notion of "primary group" in earlier versions of UF. A user can belong to exactly one group.
* Version 4.0.0.
*
* See https://laravel.com/docs/5.4/migrations#tables
* See https://laravel.com/docs/5.8/migrations#tables
*
* @author Alex Weissman (https://alexanderweissman.com)
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* Manages requests for password resets.
* Version 4.0.0.
*
* See https://laravel.com/docs/5.4/migrations#tables
* See https://laravel.com/docs/5.8/migrations#tables
*
* @author Alex Weissman (https://alexanderweissman.com)
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* Many-to-many mapping between permissions and roles.
* Version 4.0.0.
*
* See https://laravel.com/docs/5.4/migrations#tables
* See https://laravel.com/docs/5.8/migrations#tables
*
* @author Alex Weissman (https://alexanderweissman.com)
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* Also, they now map many-to-many to roles.
* Version 4.0.0.
*
* See https://laravel.com/docs/5.4/migrations#tables
* See https://laravel.com/docs/5.8/migrations#tables
*
* @author Alex Weissman (https://alexanderweissman.com)
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* Many-to-many mapping between roles and users.
* Version 4.0.0.
*
* See https://laravel.com/docs/5.4/migrations#tables
* See https://laravel.com/docs/5.8/migrations#tables
*
* @author Alex Weissman (https://alexanderweissman.com)
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* Many-to-many mapping between roles and users.
* Version 4.0.0.
*
* See https://laravel.com/docs/5.4/migrations#tables
* See https://laravel.com/docs/5.8/migrations#tables
*
* @author Alex Weissman (https://alexanderweissman.com)
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* N.B.: Default roles will be added in `DefaultPermissions` seed
* Version 4.0.0.
*
* See https://laravel.com/docs/5.4/migrations#tables
* See https://laravel.com/docs/5.8/migrations#tables
*
* @author Alex Weissman (https://alexanderweissman.com)
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* Removed the 'display_name', 'title', 'secret_token', and 'flag_password_reset' fields, and added first and last name and 'last_activity_id'.
* Version 4.0.0.
*
* See https://laravel.com/docs/5.4/migrations#tables
* See https://laravel.com/docs/5.8/migrations#tables
*
* @author Alex Weissman (https://alexanderweissman.com)
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* Manages requests for email account verification.
* Version 4.0.0.
*
* See https://laravel.com/docs/5.4/migrations#tables
* See https://laravel.com/docs/5.8/migrations#tables
*
* @author Alex Weissman (https://alexanderweissman.com)
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
namespace UserFrosting\Sprinkle\Account\Database\Migrations\v420;

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\SQLiteConnection;
use UserFrosting\Sprinkle\Core\Database\Migration;

/**
Expand Down Expand Up @@ -71,6 +72,15 @@ public function up()
*/
public function down()
{
/*
* sqlite can't drop foreign key wihout dropping the entire table
* since Laravel 5.7. Skip drop if an sqlite connection is detected
* @see https://github.com/laravel/framework/issues/25475
*/
if ($this->schema->getConnection() instanceof SQLiteConnection) {
return;
}

foreach ($this->tables as $tableName => $keys) {
if ($this->schema->hasTable($tableName)) {
$this->schema->table($tableName, function (Blueprint $table) use ($keys) {
Expand Down
2 changes: 1 addition & 1 deletion app/sprinkles/account/src/Database/Models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class User extends Model implements UserInterface
/**
* A list of attributes to hide by default when using toArray() and toJson().
*
* @link https://laravel.com/docs/5.4/eloquent-serialization#hiding-attributes-from-json
* @link https://laravel.com/docs/5.8/eloquent-serialization#hiding-attributes-from-json
*
* @var string[]
*/
Expand Down
Loading