refact App\User to App\Models\User
This commit is contained in:
@@ -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)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -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
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -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
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -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
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|||||||
@@ -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',
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ return [
|
|||||||
'providers' => [
|
'providers' => [
|
||||||
'users' => [
|
'users' => [
|
||||||
'driver' => 'eloquent',
|
'driver' => 'eloquent',
|
||||||
'model' => App\User::class,
|
'model' => App\Models\User::class,
|
||||||
],
|
],
|
||||||
|
|
||||||
// 'users' => [
|
// 'users' => [
|
||||||
|
|||||||
@@ -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(),
|
||||||
|
|||||||
@@ -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),
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -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]),
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|
||||||
|
|||||||
@@ -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');
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ namespace Tests\Feature;
|
|||||||
use App\Models\Event;
|
use App\Models\Event;
|
||||||
use App\Models\EventCategory;
|
use App\Models\EventCategory;
|
||||||
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;
|
||||||
@@ -50,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');
|
||||||
@@ -257,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');
|
||||||
@@ -267,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');
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -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');
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -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');
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user