import app Models User change

This commit is contained in:
2020-09-11 20:42:45 +02:00
34 changed files with 665 additions and 556 deletions

10
.idea/php.xml generated
View File

@@ -95,8 +95,6 @@
<path value="$PROJECT_DIR$/vendor/symfony/polyfill-ctype" /> <path value="$PROJECT_DIR$/vendor/symfony/polyfill-ctype" />
<path value="$PROJECT_DIR$/vendor/psr/log" /> <path value="$PROJECT_DIR$/vendor/psr/log" />
<path value="$PROJECT_DIR$/vendor/symfony/http-foundation" /> <path value="$PROJECT_DIR$/vendor/symfony/http-foundation" />
<path value="$PROJECT_DIR$/vendor/laminas/laminas-zendframework-bridge" />
<path value="$PROJECT_DIR$/vendor/laminas/laminas-diactoros" />
<path value="$PROJECT_DIR$/vendor/symfony/psr-http-message-bridge" /> <path value="$PROJECT_DIR$/vendor/symfony/psr-http-message-bridge" />
<path value="$PROJECT_DIR$/vendor/league/oauth2-server" /> <path value="$PROJECT_DIR$/vendor/league/oauth2-server" />
<path value="$PROJECT_DIR$/vendor/league/event" /> <path value="$PROJECT_DIR$/vendor/league/event" />
@@ -118,6 +116,14 @@
<path value="$PROJECT_DIR$/vendor/symfony/polyfill-php80" /> <path value="$PROJECT_DIR$/vendor/symfony/polyfill-php80" />
<path value="$PROJECT_DIR$/vendor/ramsey/collection" /> <path value="$PROJECT_DIR$/vendor/ramsey/collection" />
<path value="$PROJECT_DIR$/vendor/brick/math" /> <path value="$PROJECT_DIR$/vendor/brick/math" />
<path value="$PROJECT_DIR$/vendor/jakub-onderka/php-console-color" />
<path value="$PROJECT_DIR$/vendor/jakub-onderka/php-console-highlighter" />
<path value="$PROJECT_DIR$/vendor/psr/http-client" />
<path value="$PROJECT_DIR$/vendor/league/mime-type-detection" />
<path value="$PROJECT_DIR$/vendor/graham-campbell/result-type" />
<path value="$PROJECT_DIR$/vendor/laminas/laminas-zendframework-bridge" />
<path value="$PROJECT_DIR$/vendor/laminas/laminas-diactoros" />
<path value="$PROJECT_DIR$/vendor/laravel/legacy-factories" />
</include_path> </include_path>
</component> </component>
<component name="PhpProjectSharedConfiguration" php_language_level="7.2" /> <component name="PhpProjectSharedConfiguration" php_language_level="7.2" />

6
.idea/portal.iml generated
View File

@@ -23,14 +23,14 @@
<excludeFolder url="file://$MODULE_DIR$/vendor/firebase/php-jwt" /> <excludeFolder url="file://$MODULE_DIR$/vendor/firebase/php-jwt" />
<excludeFolder url="file://$MODULE_DIR$/vendor/fruitcake/laravel-cors" /> <excludeFolder url="file://$MODULE_DIR$/vendor/fruitcake/laravel-cors" />
<excludeFolder url="file://$MODULE_DIR$/vendor/fzaninotto/faker" /> <excludeFolder url="file://$MODULE_DIR$/vendor/fzaninotto/faker" />
<excludeFolder url="file://$MODULE_DIR$/vendor/graham-campbell/result-type" />
<excludeFolder url="file://$MODULE_DIR$/vendor/guzzlehttp/guzzle" /> <excludeFolder url="file://$MODULE_DIR$/vendor/guzzlehttp/guzzle" />
<excludeFolder url="file://$MODULE_DIR$/vendor/guzzlehttp/promises" /> <excludeFolder url="file://$MODULE_DIR$/vendor/guzzlehttp/promises" />
<excludeFolder url="file://$MODULE_DIR$/vendor/guzzlehttp/psr7" /> <excludeFolder url="file://$MODULE_DIR$/vendor/guzzlehttp/psr7" />
<excludeFolder url="file://$MODULE_DIR$/vendor/hamcrest/hamcrest-php" /> <excludeFolder url="file://$MODULE_DIR$/vendor/hamcrest/hamcrest-php" />
<excludeFolder url="file://$MODULE_DIR$/vendor/intervention/image" /> <excludeFolder url="file://$MODULE_DIR$/vendor/intervention/image" />
<excludeFolder url="file://$MODULE_DIR$/vendor/laminas/laminas-diactoros" />
<excludeFolder url="file://$MODULE_DIR$/vendor/laminas/laminas-zendframework-bridge" />
<excludeFolder url="file://$MODULE_DIR$/vendor/laravel/framework" /> <excludeFolder url="file://$MODULE_DIR$/vendor/laravel/framework" />
<excludeFolder url="file://$MODULE_DIR$/vendor/laravel/legacy-factories" />
<excludeFolder url="file://$MODULE_DIR$/vendor/laravel/passport" /> <excludeFolder url="file://$MODULE_DIR$/vendor/laravel/passport" />
<excludeFolder url="file://$MODULE_DIR$/vendor/laravel/tinker" /> <excludeFolder url="file://$MODULE_DIR$/vendor/laravel/tinker" />
<excludeFolder url="file://$MODULE_DIR$/vendor/laravel/ui" /> <excludeFolder url="file://$MODULE_DIR$/vendor/laravel/ui" />
@@ -38,6 +38,7 @@
<excludeFolder url="file://$MODULE_DIR$/vendor/league/commonmark" /> <excludeFolder url="file://$MODULE_DIR$/vendor/league/commonmark" />
<excludeFolder url="file://$MODULE_DIR$/vendor/league/event" /> <excludeFolder url="file://$MODULE_DIR$/vendor/league/event" />
<excludeFolder url="file://$MODULE_DIR$/vendor/league/flysystem" /> <excludeFolder url="file://$MODULE_DIR$/vendor/league/flysystem" />
<excludeFolder url="file://$MODULE_DIR$/vendor/league/mime-type-detection" />
<excludeFolder url="file://$MODULE_DIR$/vendor/league/oauth2-server" /> <excludeFolder url="file://$MODULE_DIR$/vendor/league/oauth2-server" />
<excludeFolder url="file://$MODULE_DIR$/vendor/mockery/mockery" /> <excludeFolder url="file://$MODULE_DIR$/vendor/mockery/mockery" />
<excludeFolder url="file://$MODULE_DIR$/vendor/monolog/monolog" /> <excludeFolder url="file://$MODULE_DIR$/vendor/monolog/monolog" />
@@ -65,6 +66,7 @@
<excludeFolder url="file://$MODULE_DIR$/vendor/phpunit/phpunit" /> <excludeFolder url="file://$MODULE_DIR$/vendor/phpunit/phpunit" />
<excludeFolder url="file://$MODULE_DIR$/vendor/psr/container" /> <excludeFolder url="file://$MODULE_DIR$/vendor/psr/container" />
<excludeFolder url="file://$MODULE_DIR$/vendor/psr/event-dispatcher" /> <excludeFolder url="file://$MODULE_DIR$/vendor/psr/event-dispatcher" />
<excludeFolder url="file://$MODULE_DIR$/vendor/psr/http-client" />
<excludeFolder url="file://$MODULE_DIR$/vendor/psr/http-factory" /> <excludeFolder url="file://$MODULE_DIR$/vendor/psr/http-factory" />
<excludeFolder url="file://$MODULE_DIR$/vendor/psr/http-message" /> <excludeFolder url="file://$MODULE_DIR$/vendor/psr/http-message" />
<excludeFolder url="file://$MODULE_DIR$/vendor/psr/log" /> <excludeFolder url="file://$MODULE_DIR$/vendor/psr/log" />

View File

@@ -4,7 +4,7 @@ namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\Providers\RouteServiceProvider; use App\Providers\RouteServiceProvider;
use App\User; use App\Models\User;
use Illuminate\Foundation\Auth\RegistersUsers; use Illuminate\Foundation\Auth\RegistersUsers;
use Illuminate\Support\Facades\Hash; use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Validator; use Illuminate\Support\Facades\Validator;
@@ -60,7 +60,7 @@ class RegisterController extends Controller
* Create a new user instance after a valid registration. * Create a new user instance after a valid registration.
* *
* @param array $data * @param array $data
* @return \App\User * @return \App\Models\User
*/ */
protected function create(array $data) protected function create(array $data)
{ {

View File

@@ -6,7 +6,7 @@ use App\Http\Requests\EventRequest;
use App\Models\Event; use App\Models\Event;
use App\Http\Resources\Event as EventResource; use App\Http\Resources\Event as EventResource;
use App\Models\EventGuestsNonUsers; use App\Models\EventGuestsNonUsers;
use App\User; use App\Models\User;
use Illuminate\Http\Request; use Illuminate\Http\Request;
class EventController extends Controller class EventController extends Controller

View File

@@ -4,7 +4,7 @@ namespace App\Http\Controllers;
use App\Http\Resources\Image as ImageResource; use App\Http\Resources\Image as ImageResource;
use App\Models\Memo; use App\Models\Memo;
use App\User; use App\Models\User;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\File; use Illuminate\Support\Facades\File;
use Intervention\Image\Facades\Image; use Intervention\Image\Facades\Image;

View File

@@ -3,7 +3,7 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use App\Jobs\SendMailNewUserJob; use App\Jobs\SendMailNewUserJob;
use App\User; use App\Models\User;
use App\Http\Resources\User as UserResource; use App\Http\Resources\User as UserResource;
use Illuminate\Support\Facades\Hash; use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Str; use Illuminate\Support\Str;

View File

@@ -3,7 +3,7 @@
namespace App\Http\Resources; namespace App\Http\Resources;
use App\Http\Resources\User as UserResource; use App\Http\Resources\User as UserResource;
use App\Http\Resources\EventCategory as EventCategoryRessource; use App\Http\Resources\EventCategory as EventCategoryResource;
use App\Http\Resources\EventGuestWithoutEmail as GuestsWithoutEmailResource; use App\Http\Resources\EventGuestWithoutEmail as GuestsWithoutEmailResource;
use Illuminate\Http\Resources\Json\JsonResource; use Illuminate\Http\Resources\Json\JsonResource;
@@ -28,7 +28,7 @@ class Event extends JsonResource
'start_date' => $this->start_date, 'start_date' => $this->start_date,
'end_date' => $this->end_date, 'end_date' => $this->end_date,
'location' => $this->location, 'location' => $this->location,
'category' => new EventCategoryRessource($this->category), 'category' => new EventCategoryResource($this->category),
'invitations' => UserResource::collection($this->guests), 'invitations' => UserResource::collection($this->guests),
'invitations-with-email' => [ 'invitations-with-email' => [
'data' => GuestsWithoutEmailResource::collection($this->emailedGuests) 'data' => GuestsWithoutEmailResource::collection($this->emailedGuests)

View File

@@ -3,7 +3,7 @@
namespace App\Jobs; namespace App\Jobs;
use App\Mail\NewUserInvitation; use App\Mail\NewUserInvitation;
use App\User; use App\Models\User;
use Illuminate\Bus\Queueable; use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable; use Illuminate\Foundation\Bus\Dispatchable;

View File

@@ -2,7 +2,7 @@
namespace App\Mail; namespace App\Mail;
use App\User; use App\Models\User;
use Illuminate\Bus\Queueable; use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable; use Illuminate\Mail\Mailable;

View File

@@ -2,7 +2,6 @@
namespace App\Models; namespace App\Models;
use App\User;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\BelongsToMany; use Illuminate\Database\Eloquent\Relations\BelongsToMany;

View File

@@ -2,7 +2,7 @@
namespace App\Models; namespace App\Models;
use App\User; use App\Models\User;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\MorphMany; use Illuminate\Database\Eloquent\Relations\MorphMany;
use Illuminate\Database\Eloquent\Relations\MorphOne; use Illuminate\Database\Eloquent\Relations\MorphOne;

View File

@@ -2,7 +2,7 @@
namespace App\Models; namespace App\Models;
use App\User; use App\Models\User;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\Relations\HasMany;

View File

@@ -1,6 +1,6 @@
<?php <?php
namespace App; namespace App\Models;
use App\Models\Bookmark; use App\Models\Bookmark;
use App\Models\Event; use App\Models\Event;

View File

@@ -3,7 +3,7 @@
namespace App\Policies; namespace App\Policies;
use App\Models\Bookmark; use App\Models\Bookmark;
use App\User; use App\Models\User;
use Illuminate\Auth\Access\HandlesAuthorization; use Illuminate\Auth\Access\HandlesAuthorization;
class BookmarkPolicy class BookmarkPolicy
@@ -13,7 +13,7 @@ class BookmarkPolicy
/** /**
* Determine whether the user can view any bookmarks. * Determine whether the user can view any bookmarks.
* *
* @param \App\User $user * @param \App\Models\User $user
* @return mixed * @return mixed
*/ */
public function viewAny(User $user) public function viewAny(User $user)
@@ -24,7 +24,7 @@ class BookmarkPolicy
/** /**
* Determine whether the user can view the bookmark. * Determine whether the user can view the bookmark.
* *
* @param \App\User $user * @param \App\Models\User $user
* @param \App\Models\Bookmark $bookmark * @param \App\Models\Bookmark $bookmark
* @return mixed * @return mixed
*/ */
@@ -36,7 +36,7 @@ class BookmarkPolicy
/** /**
* Determine whether the user can create bookmarks. * Determine whether the user can create bookmarks.
* *
* @param \App\User $user * @param \App\Models\User $user
* @return mixed * @return mixed
*/ */
public function create(User $user) public function create(User $user)
@@ -47,7 +47,7 @@ class BookmarkPolicy
/** /**
* Determine whether the user can update the bookmark. * Determine whether the user can update the bookmark.
* *
* @param \App\User $user * @param \App\Models\User $user
* @param \App\Models\Bookmark $bookmark * @param \App\Models\Bookmark $bookmark
* @return mixed * @return mixed
*/ */
@@ -59,7 +59,7 @@ class BookmarkPolicy
/** /**
* Determine whether the user can delete the bookmark. * Determine whether the user can delete the bookmark.
* *
* @param \App\User $user * @param \App\Models\User $user
* @param \App\Models\Bookmark $bookmark * @param \App\Models\Bookmark $bookmark
* @return mixed * @return mixed
*/ */
@@ -71,7 +71,7 @@ class BookmarkPolicy
/** /**
* Determine whether the user can restore the bookmark. * Determine whether the user can restore the bookmark.
* *
* @param \App\User $user * @param \App\Models\User $user
* @param \App\Models\Bookmark $bookmark * @param \App\Models\Bookmark $bookmark
* @return mixed * @return mixed
*/ */
@@ -83,7 +83,7 @@ class BookmarkPolicy
/** /**
* Determine whether the user can permanently delete the bookmark. * Determine whether the user can permanently delete the bookmark.
* *
* @param \App\User $user * @param \App\Models\User $user
* @param \App\Models\Bookmark $bookmark * @param \App\Models\Bookmark $bookmark
* @return mixed * @return mixed
*/ */

View File

@@ -3,7 +3,7 @@
namespace App\Policies; namespace App\Policies;
use App\Models\Event; use App\Models\Event;
use App\User; use App\Models\User;
use Illuminate\Auth\Access\HandlesAuthorization; use Illuminate\Auth\Access\HandlesAuthorization;
class EventPolicy class EventPolicy

View File

@@ -3,7 +3,7 @@
namespace App\Policies; namespace App\Policies;
use App\Models\Memo; use App\Models\Memo;
use App\User; use App\Models\User;
use Illuminate\Auth\Access\HandlesAuthorization; use Illuminate\Auth\Access\HandlesAuthorization;
class MemoPolicy class MemoPolicy
@@ -13,7 +13,7 @@ class MemoPolicy
/** /**
* Determine whether the user can view any memos. * Determine whether the user can view any memos.
* *
* @param \App\User $user * @param \App\Models\User $user
* @return mixed * @return mixed
*/ */
public function viewAny(User $user) public function viewAny(User $user)
@@ -24,7 +24,7 @@ class MemoPolicy
/** /**
* Determine whether the user can view the memo. * Determine whether the user can view the memo.
* *
* @param \App\User $user * @param \App\Models\User $user
* @param \App\Models\Memo $memo * @param \App\Models\Memo $memo
* @return mixed * @return mixed
*/ */
@@ -36,7 +36,7 @@ class MemoPolicy
/** /**
* Determine whether the user can create memos. * Determine whether the user can create memos.
* *
* @param \App\User $user * @param \App\Models\User $user
* @return mixed * @return mixed
*/ */
public function create(User $user) public function create(User $user)
@@ -47,7 +47,7 @@ class MemoPolicy
/** /**
* Determine whether the user can update the memo. * Determine whether the user can update the memo.
* *
* @param \App\User $user * @param \App\Models\User $user
* @param \App\Models\Memo $memo * @param \App\Models\Memo $memo
* @return mixed * @return mixed
*/ */
@@ -59,7 +59,7 @@ class MemoPolicy
/** /**
* Determine whether the user can delete the memo. * Determine whether the user can delete the memo.
* *
* @param \App\User $user * @param \App\Models\User $user
* @param \App\Models\Memo $memo * @param \App\Models\Memo $memo
* @return mixed * @return mixed
*/ */
@@ -71,7 +71,7 @@ class MemoPolicy
/** /**
* Determine whether the user can restore the memo. * Determine whether the user can restore the memo.
* *
* @param \App\User $user * @param \App\Models\User $user
* @param \App\Models\Memo $memo * @param \App\Models\Memo $memo
* @return mixed * @return mixed
*/ */
@@ -83,7 +83,7 @@ class MemoPolicy
/** /**
* Determine whether the user can permanently delete the memo. * Determine whether the user can permanently delete the memo.
* *
* @param \App\User $user * @param \App\Models\User $user
* @param \App\Models\Memo $memo * @param \App\Models\Memo $memo
* @return mixed * @return mixed
*/ */

View File

@@ -3,7 +3,7 @@
namespace App\Policies; namespace App\Policies;
use App\Models\ToDoList; use App\Models\ToDoList;
use App\User; use App\Models\User;
use Illuminate\Auth\Access\HandlesAuthorization; use Illuminate\Auth\Access\HandlesAuthorization;
class ToDoListPolicy class ToDoListPolicy
@@ -13,7 +13,7 @@ class ToDoListPolicy
/** /**
* Determine whether the user can view any to do lists. * Determine whether the user can view any to do lists.
* *
* @param \App\User $user * @param \App\Models\User $user
* @return mixed * @return mixed
*/ */
public function viewAny(User $user) public function viewAny(User $user)
@@ -24,7 +24,7 @@ class ToDoListPolicy
/** /**
* Determine whether the user can view the to do list. * Determine whether the user can view the to do list.
* *
* @param \App\User $user * @param \App\Models\User $user
* @param \App\Models\ToDoList $toDoList * @param \App\Models\ToDoList $toDoList
* @return mixed * @return mixed
*/ */
@@ -36,7 +36,7 @@ class ToDoListPolicy
/** /**
* Determine whether the user can create to do lists. * Determine whether the user can create to do lists.
* *
* @param \App\User $user * @param \App\Models\User $user
* @return mixed * @return mixed
*/ */
public function create(User $user) public function create(User $user)
@@ -47,7 +47,7 @@ class ToDoListPolicy
/** /**
* Determine whether the user can update the to do list. * Determine whether the user can update the to do list.
* *
* @param \App\User $user * @param \App\Models\User $user
* @param \App\Models\ToDoList $toDoList * @param \App\Models\ToDoList $toDoList
* @return mixed * @return mixed
*/ */
@@ -59,7 +59,7 @@ class ToDoListPolicy
/** /**
* Determine whether the user can delete the to do list. * Determine whether the user can delete the to do list.
* *
* @param \App\User $user * @param \App\Models\User $user
* @param \App\Models\ToDoList $toDoList * @param \App\Models\ToDoList $toDoList
* @return mixed * @return mixed
*/ */
@@ -71,7 +71,7 @@ class ToDoListPolicy
/** /**
* Determine whether the user can restore the to do list. * Determine whether the user can restore the to do list.
* *
* @param \App\User $user * @param \App\Models\User $user
* @param \App\Models\ToDoList $toDoList * @param \App\Models\ToDoList $toDoList
* @return mixed * @return mixed
*/ */
@@ -83,7 +83,7 @@ class ToDoListPolicy
/** /**
* Determine whether the user can permanently delete the to do list. * Determine whether the user can permanently delete the to do list.
* *
* @param \App\User $user * @param \App\Models\User $user
* @param \App\Models\ToDoList $toDoList * @param \App\Models\ToDoList $toDoList
* @return mixed * @return mixed
*/ */

View File

@@ -2,7 +2,7 @@
namespace App\Policies; namespace App\Policies;
use App\User; use App\Models\User;
use Illuminate\Auth\Access\HandlesAuthorization; use Illuminate\Auth\Access\HandlesAuthorization;
class UserPolicy class UserPolicy
@@ -12,7 +12,7 @@ class UserPolicy
/** /**
* Determine whether the user can view any models. * Determine whether the user can view any models.
* *
* @param \App\User $user * @param \App\Models\User $user
* @return mixed * @return mixed
*/ */
public function viewAny(User $user) public function viewAny(User $user)
@@ -23,8 +23,8 @@ class UserPolicy
/** /**
* Determine whether the user can view the model. * Determine whether the user can view the model.
* *
* @param \App\User $user * @param \App\Models\User $user
* @param \App\User $model * @param \App\Models\User $model
* @return mixed * @return mixed
*/ */
public function view(User $user, User $model) public function view(User $user, User $model)
@@ -35,7 +35,7 @@ class UserPolicy
/** /**
* Determine whether the user can create models. * Determine whether the user can create models.
* *
* @param \App\User $user * @param \App\Models\User $user
* @return mixed * @return mixed
*/ */
public function create(User $user) public function create(User $user)
@@ -46,8 +46,8 @@ class UserPolicy
/** /**
* Determine whether the user can update the model. * Determine whether the user can update the model.
* *
* @param \App\User $user * @param \App\Models\User $user
* @param \App\User $model * @param \App\Models\User $model
* @return mixed * @return mixed
*/ */
public function update(User $user, User $model) public function update(User $user, User $model)
@@ -58,8 +58,8 @@ class UserPolicy
/** /**
* Determine whether the user can delete the model. * Determine whether the user can delete the model.
* *
* @param \App\User $user * @param \App\Models\User $user
* @param \App\User $model * @param \App\Models\User $model
* @return mixed * @return mixed
*/ */
public function delete(User $user, User $model) public function delete(User $user, User $model)
@@ -70,8 +70,8 @@ class UserPolicy
/** /**
* Determine whether the user can restore the model. * Determine whether the user can restore the model.
* *
* @param \App\User $user * @param \App\Models\User $user
* @param \App\User $model * @param \App\Models\User $model
* @return mixed * @return mixed
*/ */
public function restore(User $user, User $model) public function restore(User $user, User $model)
@@ -82,8 +82,8 @@ class UserPolicy
/** /**
* Determine whether the user can permanently delete the model. * Determine whether the user can permanently delete the model.
* *
* @param \App\User $user * @param \App\Models\User $user
* @param \App\User $model * @param \App\Models\User $model
* @return mixed * @return mixed
*/ */
public function forceDelete(User $user, User $model) public function forceDelete(User $user, User $model)

View File

@@ -15,7 +15,7 @@ class AuthServiceProvider extends ServiceProvider
*/ */
protected $policies = [ protected $policies = [
// 'App\Model' => 'App\Policies\ModelPolicy', // 'App\Model' => 'App\Policies\ModelPolicy',
'App\User' => 'App\Policies\UserPolicy', 'App\Models\User' => 'App\Policies\UserPolicy',
'App\Models\Memo' => 'App\Policies\MemoPolicy', 'App\Models\Memo' => 'App\Policies\MemoPolicy',
'App\Models\ToDoList' => 'App\Policies\ToDoListPolicy', 'App\Models\ToDoList' => 'App\Policies\ToDoListPolicy',
'App\Models\Bookmark' => 'App\Policies\BookmarkPolicy', 'App\Models\Bookmark' => 'App\Policies\BookmarkPolicy',

View File

@@ -11,18 +11,19 @@
"php": "^7.2.5", "php": "^7.2.5",
"fideloper/proxy": "^4.2", "fideloper/proxy": "^4.2",
"fruitcake/laravel-cors": "^1.0", "fruitcake/laravel-cors": "^1.0",
"guzzlehttp/guzzle": "^6.5", "guzzlehttp/guzzle": "^7.0.1",
"intervention/image": "^2.5", "intervention/image": "^2.5",
"laravel/framework": "^7.0", "laravel/framework": "^8.0",
"laravel/passport": "^9.3", "laravel/legacy-factories": "^1.0",
"laravel/passport": "^10.0",
"laravel/tinker": "^2.0", "laravel/tinker": "^2.0",
"laravel/ui": "^2.0" "laravel/ui": "^2.0"
}, },
"require-dev": { "require-dev": {
"facade/ignition": "^2.0", "facade/ignition": "^2.3.6",
"fzaninotto/faker": "^1.9.1", "fzaninotto/faker": "^1.9.1",
"mockery/mockery": "^1.3.1", "mockery/mockery": "^1.3.1",
"nunomaduro/collision": "^4.1", "nunomaduro/collision": "^5.0",
"phpunit/phpunit": "^8.5", "phpunit/phpunit": "^8.5",
"spatie/laravel-web-tinker": "^1.7" "spatie/laravel-web-tinker": "^1.7"
}, },

1038
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -68,7 +68,7 @@ return [
'providers' => [ 'providers' => [
'users' => [ 'users' => [
'driver' => 'eloquent', 'driver' => 'eloquent',
'model' => App\User::class, 'model' => App\Models\User::class,
], ],
// 'users' => [ // 'users' => [

View File

@@ -7,7 +7,7 @@ use Faker\Generator as Faker;
$factory->define(Bookmark::class, function (Faker $faker) { $factory->define(Bookmark::class, function (Faker $faker) {
return [ return [
'user_id' => factory(\App\User::class), 'user_id' => factory(\App\Models\User::class),
'name' => $faker->words(3, [false]), 'name' => $faker->words(3, [false]),
'url' => $faker->url, 'url' => $faker->url,
'favicon' => $faker->imageUrl(), 'favicon' => $faker->imageUrl(),

View File

@@ -2,6 +2,7 @@
/** @var \Illuminate\Database\Eloquent\Factory $factory */ /** @var \Illuminate\Database\Eloquent\Factory $factory */
use App\Models\User;
use App\Models\Event; use App\Models\Event;
use App\Models\EventCategory; use App\Models\EventCategory;
use Faker\Generator as Faker; use Faker\Generator as Faker;
@@ -11,7 +12,7 @@ $factory->define(Event::class, function (Faker $faker) {
$endDate = $faker->dateTimeBetween($startDate, date_add($startDate, date_interval_create_from_date_string('10 days'))); $endDate = $faker->dateTimeBetween($startDate, date_add($startDate, date_interval_create_from_date_string('10 days')));
$endDate = (rand(0, 1) === 0) ? null : $endDate; $endDate = (rand(0, 1) === 0) ? null : $endDate;
return [ return [
'user_id' => factory(\App\User::class), 'user_id' => factory(User::class),
'category_id' => factory(EventCategory::class), 'category_id' => factory(EventCategory::class),
'name' => $faker->words(3, [false]), 'name' => $faker->words(3, [false]),
'description' => $faker->words(rand(10, 300), [false]), 'description' => $faker->words(rand(10, 300), [false]),

View File

@@ -7,7 +7,7 @@ use Faker\Generator as Faker;
$factory->define(\App\Models\Memo::class, function (Faker $faker) { $factory->define(\App\Models\Memo::class, function (Faker $faker) {
return [ return [
'user_id' => factory(\App\User::class), 'user_id' => factory(\App\Models\User::class),
'name' => $faker->words(3, [false]), 'name' => $faker->words(3, [false]),
'memo' => $faker->text($maxNbChars = 200), 'memo' => $faker->text($maxNbChars = 200),
]; ];

View File

@@ -7,7 +7,7 @@ use Faker\Generator as Faker;
$factory->define(ToDoList::class, function (Faker $faker) { $factory->define(ToDoList::class, function (Faker $faker) {
return [ return [
'user_id' => factory(\App\User::class), 'user_id' => factory(\App\Models\User::class),
'name' => $faker->words(3, [false]), 'name' => $faker->words(3, [false]),
]; ];
}); });

View File

@@ -2,7 +2,7 @@
/** @var \Illuminate\Database\Eloquent\Factory $factory */ /** @var \Illuminate\Database\Eloquent\Factory $factory */
use App\User; use App\Models\User;
use Faker\Generator as Faker; use Faker\Generator as Faker;
use Illuminate\Support\Str; use Illuminate\Support\Str;

View File

@@ -3,7 +3,7 @@
namespace Tests\Feature; namespace Tests\Feature;
use App\Models\Bookmark; use App\Models\Bookmark;
use App\User; use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase; use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Foundation\Testing\WithFaker; use Illuminate\Foundation\Testing\WithFaker;
use Tests\TestCase; use Tests\TestCase;
@@ -17,7 +17,7 @@ class BookmarkTest extends TestCase
{ {
$this->withoutExceptionHandling(); $this->withoutExceptionHandling();
$this->actingAs($user = factory(\App\User::class)->create(), 'api'); $this->actingAs($user = factory(\App\Models\User::class)->create(), 'api');
$response = $this->post('/api/bookmarks', $this->data()); $response = $this->post('/api/bookmarks', $this->data());
@@ -49,7 +49,7 @@ class BookmarkTest extends TestCase
/** @test */ /** @test */
public function bookmark_url_are_required() public function bookmark_url_are_required()
{ {
$this->actingAs($user = factory(\App\User::class)->create(), 'api'); $this->actingAs($user = factory(\App\Models\User::class)->create(), 'api');
$response = $this->post('/api/bookmarks', array_merge($this->data(), ['url' => ''])); $response = $this->post('/api/bookmarks', array_merge($this->data(), ['url' => '']));
$response->assertSessionHasErrors('url'); $response->assertSessionHasErrors('url');

View File

@@ -5,7 +5,8 @@ namespace Tests\Feature;
use App\Models\Event; use App\Models\Event;
use App\Models\EventCategory; use App\Models\EventCategory;
use App\Models\EventGuestsNonUsers; use App\Models\EventGuestsNonUsers;
use App\User; use App\Models\Memo;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase; use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Str; use Illuminate\Support\Str;
use Tests\TestCase; use Tests\TestCase;
@@ -49,7 +50,7 @@ class EventsTest extends TestCase
/** @test */ /** @test */
public function event_category_name_are_required() public function event_category_name_are_required()
{ {
$this->actingAs($user = factory(\App\User::class)->create(['role' => 2]), 'api'); $this->actingAs($user = factory(\App\Models\User::class)->create(['role' => 2]), 'api');
$response = $this->post('/api/events/categories', ['name' => '', 'description' => 'test name required']); $response = $this->post('/api/events/categories', ['name' => '', 'description' => 'test name required']);
$response->assertSessionHasErrors('name'); $response->assertSessionHasErrors('name');
@@ -241,7 +242,7 @@ class EventsTest extends TestCase
'location' => $event->location, 'location' => $event->location,
'category' => [ 'category' => [
'data' => [ 'data' => [
'category_id' => 1 'event_category_id' => 1
], ],
], ],
] ]
@@ -256,7 +257,7 @@ class EventsTest extends TestCase
/** @test */ /** @test */
public function event_name_are_required() public function event_name_are_required()
{ {
$this->actingAs($user = factory(\App\User::class)->create(), 'api'); $this->actingAs($user = factory(\App\Models\User::class)->create(), 'api');
$response = $this->post('/api/events', array_merge($this->data(), ['name' => ''])); $response = $this->post('/api/events', array_merge($this->data(), ['name' => '']));
$response->assertSessionHasErrors('name'); $response->assertSessionHasErrors('name');
@@ -266,7 +267,7 @@ class EventsTest extends TestCase
/** @test */ /** @test */
public function event_start_date_are_required() public function event_start_date_are_required()
{ {
$this->actingAs($user = factory(\App\User::class)->create(), 'api'); $this->actingAs($user = factory(\App\Models\User::class)->create(), 'api');
$response = $this->post('/api/events', array_merge($this->data(), ['start_date' => ''])); $response = $this->post('/api/events', array_merge($this->data(), ['start_date' => '']));
$response->assertSessionHasErrors('start_date'); $response->assertSessionHasErrors('start_date');
@@ -296,7 +297,7 @@ class EventsTest extends TestCase
'location' => $event->location, 'location' => $event->location,
'category' => [ 'category' => [
'data' => [ 'data' => [
'category_id' => 1 'event_category_id' => 1
], ],
], ],
] ]
@@ -308,6 +309,7 @@ class EventsTest extends TestCase
/** @test */ /** @test */
public function all_event_can_be_retrieved() public function all_event_can_be_retrieved()
{ {
$this->withoutExceptionHandling();
$this->actingAs($user = factory(User::class)->create(), 'api'); $this->actingAs($user = factory(User::class)->create(), 'api');
$events = factory(Event::class, 10)->create(['user_id' => $user->id]); $events = factory(Event::class, 10)->create(['user_id' => $user->id]);
@@ -348,7 +350,7 @@ class EventsTest extends TestCase
'start_date' => '2020-07-20 09:00:00', 'start_date' => '2020-07-20 09:00:00',
'category' => [ 'category' => [
'data' => [ 'data' => [
'category_id' => $event->category_id, 'event_category_id' => $event->category_id,
], ],
], ],
] ]

View File

@@ -4,7 +4,7 @@ namespace Tests\Feature;
use App\Models\Image; use App\Models\Image;
use App\Models\Memo; use App\Models\Memo;
use App\User; use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase; use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Foundation\Testing\WithFaker; use Illuminate\Foundation\Testing\WithFaker;
use Illuminate\Http\UploadedFile; use Illuminate\Http\UploadedFile;

View File

@@ -3,7 +3,7 @@
namespace Tests\Feature; namespace Tests\Feature;
use App\Models\Memo; use App\Models\Memo;
use App\User; use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase; use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Foundation\Testing\WithFaker; use Illuminate\Foundation\Testing\WithFaker;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
@@ -28,7 +28,7 @@ class MemosTest extends TestCase
{ {
$this->withoutExceptionHandling(); $this->withoutExceptionHandling();
$this->actingAs($user = factory(\App\User::class)->create(), 'api'); $this->actingAs($user = factory(\App\Models\User::class)->create(), 'api');
$response = $this->post('/api/memos', $this->data()); $response = $this->post('/api/memos', $this->data());
@@ -52,7 +52,7 @@ class MemosTest extends TestCase
/** @test */ /** @test */
public function memo_name_are_required() public function memo_name_are_required()
{ {
$this->actingAs($user = factory(\App\User::class)->create(), 'api'); $this->actingAs($user = factory(\App\Models\User::class)->create(), 'api');
$response = $this->post('/api/memos', array_merge($this->data(), ['name' => ''])); $response = $this->post('/api/memos', array_merge($this->data(), ['name' => '']));
$response->assertSessionHasErrors('name'); $response->assertSessionHasErrors('name');
@@ -62,7 +62,7 @@ class MemosTest extends TestCase
/** @test */ /** @test */
public function memo_are_required() public function memo_are_required()
{ {
$this->actingAs($user = factory(\App\User::class)->create(), 'api'); $this->actingAs($user = factory(\App\Models\User::class)->create(), 'api');
$response = $this->post('/api/memos', array_merge($this->data(), ['memo' => ''])); $response = $this->post('/api/memos', array_merge($this->data(), ['memo' => '']));
$response->assertSessionHasErrors('memo'); $response->assertSessionHasErrors('memo');

View File

@@ -4,7 +4,7 @@ namespace Tests\Feature;
use App\Models\ToDo; use App\Models\ToDo;
use App\Models\ToDoList; use App\Models\ToDoList;
use App\User; use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase; use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Foundation\Testing\WithFaker; use Illuminate\Foundation\Testing\WithFaker;
use Tests\TestCase; use Tests\TestCase;

View File

@@ -3,7 +3,7 @@
namespace Tests\Feature; namespace Tests\Feature;
use App\Models\ToDoList; use App\Models\ToDoList;
use App\User; use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase; use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Foundation\Testing\WithFaker; use Illuminate\Foundation\Testing\WithFaker;
use Tests\TestCase; use Tests\TestCase;
@@ -44,7 +44,7 @@ class ToDoListsTest extends TestCase
/** @test */ /** @test */
public function to_do_list_name_are_required() public function to_do_list_name_are_required()
{ {
$this->actingAs($user = factory(\App\User::class)->create(), 'api'); $this->actingAs($user = factory(\App\Models\User::class)->create(), 'api');
$response = $this->post('/api/to-do-lists/', ['name' => '']); $response = $this->post('/api/to-do-lists/', ['name' => '']);
$response->assertSessionHasErrors('name'); $response->assertSessionHasErrors('name');

View File

@@ -2,7 +2,7 @@
namespace Tests\Feature; namespace Tests\Feature;
use App\User; use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase; use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Foundation\Testing\WithFaker; use Illuminate\Foundation\Testing\WithFaker;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;