Browse Source

Remove agency entity

pull/1/head
Nafies Luthfi 8 years ago
parent
commit
44de4c1821
  1. 36
      app/Entities/Agencies/Agency.php
  2. 13
      app/Entities/Payments/Payment.php
  3. 6
      app/Entities/Projects/Project.php
  4. 5
      app/Entities/Users/User.php
  5. 9
      app/Entities/Users/UsersRepository.php
  6. 8
      app/Http/Controllers/AuthController.php
  7. 2
      app/Http/Controllers/Partners/CustomersController.php
  8. 2
      app/Http/Controllers/Partners/VendorsController.php
  9. 35
      app/Http/Controllers/Users/AgencyController.php
  10. 4
      app/Http/Requests/Accounts/RegisterRequest.php
  11. 17
      app/Policies/AgencyPolicy.php
  12. 6
      app/Policies/UserPolicy.php
  13. 9
      app/Providers/AuthServiceProvider.php
  14. 17
      app/Traits/OwnedByAgency.php
  15. 37
      database/migrations/2017_11_02_175711_create_agency_workers_table.php
  16. 33
      resources/lang/id/agency.php
  17. 1
      resources/lang/id/auth.php
  18. 12
      resources/views/auth/register.blade.php
  19. 2
      resources/views/layouts/partials/sidebar.blade.php
  20. 5
      resources/views/pages/partials/dashboard-nav-tabs.blade.php
  21. 12
      resources/views/payments/pdf.blade.php
  22. 19
      routes/web/account.php
  23. 2
      tests/Feature/Auth/MemberLoginTest.php
  24. 6
      tests/Feature/Auth/MemberRegistrationTest.php
  25. 4
      tests/Feature/ManageFeaturesTest.php
  26. 15
      tests/Feature/Users/ManageUsersTest.php
  27. 35
      tests/Feature/Users/UserProfileTest.php
  28. 2
      tests/TestCase.php
  29. 11
      tests/Unit/Models/UserTest.php
  30. 7
      tests/Unit/Policies/ProjectPolicyTest.php
  31. 3
      tests/Unit/Policies/UserPolicyTest.php

36
app/Entities/Agencies/Agency.php

@ -1,36 +0,0 @@
<?php
namespace App\Entities\Agencies;
use App\Entities\Users\User;
use Illuminate\Database\Eloquent\Model;
class Agency extends Model
{
protected $fillable = ['name', 'email', 'address', 'phone', 'website', 'owner_id'];
public function owner()
{
return $this->belongsTo('App\Entities\Users\User');
}
public function projects()
{
return $this->hasMany('App\Entities\Projects\Project', 'owner_id');
}
public function workers()
{
return $this->belongsToMany('App\Entities\Users\User', 'agency_workers', 'agency_id', 'worker_id');
}
public function addWorker(User $worker)
{
$this->workers()->attach($worker);
}
public function removeWorker(User $worker)
{
$this->workers()->detach($worker);
}
}

13
app/Entities/Payments/Payment.php

@ -4,7 +4,6 @@ namespace App\Entities\Payments;
use App\Entities\Payments\PaymentPresenter;
use App\Entities\Projects\Project;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
use Laracasts\Presenter\PresentableTrait;
@ -15,18 +14,6 @@ class Payment extends Model
protected $presenter = PaymentPresenter::class;
protected $guarded = ['id', 'created_at', 'updated_at'];
protected static function boot()
{
parent::boot();
// static::addGlobalScope('by_owner_project', function (Builder $builder) {
// if (auth()->user() && auth()->user()->agency) {
// $projectIds = auth()->user()->agency->projects->pluck('id')->all();
// $builder->whereIn('project_id', $projectIds);
// }
// });
}
public function project()
{
return $this->belongsTo(Project::class);

6
app/Entities/Projects/Project.php

@ -2,7 +2,6 @@
namespace App\Entities\Projects;
use App\Entities\Agencies\Agency;
use App\Entities\Invoices\Invoice;
use App\Entities\Partners\Customer;
use App\Entities\Payments\Payment;
@ -65,11 +64,6 @@ class Project extends Model
return $this->belongsTo(Customer::class);
}
public function owner()
{
return $this->belongsTo(Agency::class);
}
public function cashInTotal()
{
return $this->payments->sum(function ($payment) {

5
app/Entities/Users/User.php

@ -24,9 +24,4 @@ class User extends Authenticatable
{
return link_to_route('users.show', $this->name, [$this->id], ['target' => '_blank']);
}
public function agency()
{
return $this->hasOne('App\Entities\Agencies\Agency', 'owner_id');
}
}

9
app/Entities/Users/UsersRepository.php

@ -20,9 +20,8 @@ class UsersRepository extends BaseRepository
public function getUsers($q)
{
return auth()->user()->agency->workers()
->where('name', 'like', '%'.$q.'%')
->get();
return User::where('name', 'like', '%'.$q.'%')
->paginate($this->_paginate);
}
public function create($userData)
@ -33,8 +32,6 @@ class UsersRepository extends BaseRepository
$user = $this->storeArray($userData);
auth()->user()->agency->addWorker($user);
return $user;
}
@ -57,8 +54,6 @@ class UsersRepository extends BaseRepository
{
$user = $this->requireById($userId);
\DB::table('agency_workers')->where('worker_id', $userId)->delete();
return $user->delete();
}
}

8
app/Http/Controllers/AuthController.php

@ -2,7 +2,6 @@
namespace App\Http\Controllers;
use App\Entities\Agencies\Agency;
use App\Entities\Users\User;
use App\Http\Requests\Accounts\RegisterRequest;
use Auth;
@ -32,13 +31,6 @@ class AuthController extends Controller
$user = User::create($registerData);
$agency = Agency::create([
'name' => $request->get('agency_name'),
'email' => $request->get('email'),
'website' => $request->get('agency_website'),
'owner_id' => $user->id,
]);
Auth::login($user);
flash()->success(trans('auth.welcome', ['name' => $user->name]));

2
app/Http/Controllers/Partners/CustomersController.php

@ -52,8 +52,6 @@ class CustomersController extends Controller
'notes' => 'nullable|max:255',
]);
$newCustomerData['owner_id'] = auth()->user()->agency->id;
Customer::create($newCustomerData);
flash(trans('customer.created'), 'success');

2
app/Http/Controllers/Partners/VendorsController.php

@ -41,8 +41,6 @@ class VendorsController extends Controller
'website' => 'nullable|url|max:255',
]);
$newVendorData['owner_id'] = auth()->user()->agency->id;
Vendor::create($newVendorData);
flash(trans('vendor.created'), 'success');

35
app/Http/Controllers/Users/AgencyController.php

@ -1,35 +0,0 @@
<?php
namespace App\Http\Controllers\Users;
use App\Http\Controllers\Controller;
class AgencyController extends Controller
{
public function show()
{
$agency = auth()->user()->agency;
return view('users.agency.show', compact('agency'));
}
public function edit()
{
return view('users.agency.edit');
}
public function update()
{
$agency = auth()->user()->agency;
$agency->name = request('name');
$agency->email = request('email');
$agency->website = request('website');
$agency->address = request('address');
$agency->phone = request('phone');
$agency->save();
flash(trans('agency.updated'), 'success');
return redirect()->route('users.agency.show');
}
}

4
app/Http/Requests/Accounts/RegisterRequest.php

@ -24,8 +24,6 @@ class RegisterRequest extends Request
public function rules()
{
return [
'agency_name' => 'required|max:255',
'agency_website' => 'nullable|url|max:255',
'name' => 'required|max:255',
'email' => 'required|email|max:255|unique:users,email|unique:agencies,email',
'password' => 'required|between:6,15|confirmed',
@ -36,8 +34,6 @@ class RegisterRequest extends Request
public function messages()
{
return [
'agency_name.required' => 'Nama Agensi harus diisi.',
'agency_website.url' => 'Alamat Website Agensi tidak valid.',
'name.required' => 'Nama harus diisi.',
'email.required' => 'Email harus diisi.',
'email.email' => 'Email tidak valid.',

17
app/Policies/AgencyPolicy.php

@ -1,17 +0,0 @@
<?php
namespace App\Policies;
use App\Entities\Agencies\Agency;
use App\Entities\Users\User;
use Illuminate\Auth\Access\HandlesAuthorization;
class AgencyPolicy
{
use HandlesAuthorization;
public function manage(User $user, Agency $agency)
{
return $user->id == $agency->owner_id;
}
}

6
app/Policies/UserPolicy.php

@ -19,7 +19,7 @@ class UserPolicy
*/
public function view(User $user, Worker $worker)
{
return $user->id == $user->id;
return true;
}
/**
@ -31,7 +31,7 @@ class UserPolicy
*/
public function create(User $user, Worker $worker)
{
return ! ! $user->agency;
return true;
}
/**
@ -43,7 +43,7 @@ class UserPolicy
*/
public function update(User $user, Worker $worker)
{
return $user->agency->workers->contains($worker);
return true;
}
/**

9
app/Providers/AuthServiceProvider.php

@ -18,7 +18,6 @@ class AuthServiceProvider extends ServiceProvider
'App\Entities\Partners\Customer' => 'App\Policies\Partners\CustomerPolicy',
'App\Entities\Projects\Project' => 'App\Policies\Projects\ProjectPolicy',
'App\Entities\Users\User' => 'App\Policies\UserPolicy',
'App\Entities\Agencies\Agency' => 'App\Policies\AgencyPolicy',
'App\Entities\Users\Event' => 'App\Policies\EventPolicy',
];
@ -34,12 +33,16 @@ class AuthServiceProvider extends ServiceProvider
// Dynamically register permissions with Laravel's Gate.
foreach ($this->getPermissions() as $permission) {
Gate::define($permission, function ($user) {
return true;
return true;
});
}
Gate::define('manage_agency', function ($user) {
return true;
});
Gate::define('add_project', function ($user) {
return ! is_null($user->agency);
return true;
});
Gate::define('manage_project', function ($user, $project) {

17
app/Traits/OwnedByAgency.php

@ -1,17 +0,0 @@
<?php
namespace App\Traits;
use Illuminate\Database\Eloquent\Builder;
trait OwnedByAgency
{
public static function bootOwnedByAgency()
{
static::addGlobalScope('by_owner', function (Builder $builder) {
if (auth()->user() && auth()->user()->agency) {
$builder->where('owner_id', auth()->user()->agency->id);
}
});
}
}

37
database/migrations/2017_11_02_175711_create_agency_workers_table.php

@ -1,37 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateAgencyWorkersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('agency_workers', function (Blueprint $table) {
$table->increments('id');
$table->unsignedInteger('agency_id');
$table->unsignedInteger('worker_id');
$table->timestamps();
$table->unique(['agency_id', 'worker_id'], 'agency_worker_unique');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('agency_workers', function (Blueprint $table) {
//
});
}
}

33
resources/lang/id/agency.php

@ -1,33 +0,0 @@
<?php
return [
// Labels
'agency' => 'Agensi',
'list' => 'Daftar Agensi',
'search' => 'Cari Agensi',
'not_found' => 'Agensi tidak ditemukan',
'empty' => 'Belum ada Agensi',
'back_to_show' => 'Kembali ke detail Agensi',
'back_to_index' => 'Kembali ke daftar Agensi',
// Actions
'create' => 'Input Agensi Baru',
'created' => 'Input Agensi baru telah berhasil.',
'show' => 'Detail Agensi',
'edit' => 'Edit Agensi',
'update' => 'Update Agensi',
'updated' => 'Update data Agensi telah berhasil.',
'delete' => 'Hapus Agensi',
'delete_confirm' => 'Anda yakin akan menghapus Agensi ini?',
'deleted' => 'Hapus data Agensi telah berhasil.',
'undeleted' => 'Data Agensi gagal dihapus.',
'undeleteable' => 'Data Agensi tidak dapat dihapus.',
// Attributes
'name' => 'Nama Agensi',
'email' => 'Email Agensi',
'website' => 'Website Agensi',
'address' => 'Alamat Agensi',
'phone' => 'Telp. Agensi',
'owner' => 'Pemilik Agensi',
];

1
resources/lang/id/auth.php

@ -6,7 +6,6 @@ return [
'profile_edit' => 'Edit Profil Saya',
'update_profile' => 'Update Profil',
'profile_updated' => 'Profil sudah diupdate.',
'agency' => 'Agensi Saya',
// Registration
'register' => 'Buat Akun Baru',

12
resources/views/auth/register.blade.php

@ -9,18 +9,6 @@
<div class="panel-body">
@include('auth.partials._notifications')
{!! Form::open(['route'=>'auth.register','class'=>'form-horizontal']) !!}
<div class="form-group {!! $errors->has('agency_name') ? 'has-error' : ''; !!}">
{!! Form::label('agency_name', trans('agency.name'), ['class'=>'col-md-4 control-label']) !!}
<div class="col-md-6">
{!! Form::text('agency_name', null, ['class'=>'form-control','placeholder' => trans('agency.name')]) !!}
</div>
</div>
<div class="form-group {!! $errors->has('agency_website') ? 'has-error' : ''; !!}">
{!! Form::label('agency_website', trans('agency.website'), ['class'=>'col-md-4 control-label']) !!}
<div class="col-md-6">
{!! Form::text('agency_website', null, ['class'=>'form-control','placeholder' => trans('agency.website')]) !!}
</div>
</div>
<div class="form-group {!! $errors->has('name') ? 'has-error' : ''; !!}">
{!! Form::label('name', trans('app.name'), ['class'=>'col-md-4 control-label']) !!}
<div class="col-md-6">

2
resources/views/layouts/partials/sidebar.blade.php

@ -15,7 +15,7 @@
</a>
<ul class="nav" id="side-menu">
<li>{!! html_link_to_route('home', trans('nav_menu.dashboard'), [], ['icon' => 'dashboard']) !!}</li>
@can('manage', auth()->user()->agency)
@can('manage_agency')
<li>{!! html_link_to_route('features.index', trans('feature.on_progress'), [], ['icon' => 'tasks']) !!}</li>
<li>
{!! html_link_to_route('projects.index', trans('project.projects') . ' <span class="fa arrow"></span>', [], ['icon' => 'table']) !!}

5
resources/views/pages/partials/dashboard-nav-tabs.blade.php

@ -6,10 +6,7 @@
<li class="{{ Request::segment(1) == 'profile' ? 'active' : '' }}">
{!! link_to_route('users.profile.show', trans('auth.profile')) !!}
</li>
@can('manage', auth()->user()->agency)
<li class="{{ Request::segment(1) == 'agency' ? 'active' : '' }}">
{!! link_to_route('users.agency.show', trans('auth.agency')) !!}
</li>
@can('manage_agency')
<li class="{{ Request::segment(1) == 'users' ? 'active' : '' }}">
{!! link_to_route('users.index', trans('user.list')) !!}
</li>

12
resources/views/payments/pdf.blade.php

@ -27,13 +27,14 @@
</td>
<td style="width:350px">
<div style="width:280px">
<h4 style="margin:0px; border-bottom: 3px; font-size: 21.5px">{{ auth()->user()->agency->name }}</h4>
{{-- TODO: Agency tagline attribute --}}
<h4 style="margin:0px; border-bottom: 3px; font-size: 21.5px">JasaWebsiteBanjarmasin.com</h4>
<div style="font-size:13px">Jasa Pembuatan Website dan Aplikasi Berbasis Web</div>
<hr style="margin: 2px 0">
<div style="font-size:11px">
{!! nl2br(auth()->user()->agency->address) !!}<br>
@lang('contact.phone_abb') {{ auth()->user()->agency->phone }}<br>
Jln. Pramuka, Gg. Mawar, Rt. 09, No. 60, Kel. Pemurus Luar<br>
Kec. Banjarmasin Timur, Kota Banjarmasin,
Kalsel - 70249,<br>
@lang('contact.phone_abb') 0817 532 654 / 0823 5035 5470
</div>
</div>
</td>
@ -62,7 +63,6 @@
<td>&nbsp;</td>
<td>&nbsp;</td>
<td style="text-align: center;">
{{-- TODO: Agency city attribute --}}
Banjarmasin, {{ dateId($payment->date) }}
</td>
</tr>
@ -73,7 +73,7 @@
</td>
<td style="text-align: center;vertical-align: bottom;">
<strong>{{ auth()->user()->name }}, S. Kom.</strong> <br>
{{ auth()->user()->agency->name }}
JasaWebsiteBanjarmasin.com
</td>
</tr>
</tbody>

19
routes/web/account.php

@ -40,22 +40,3 @@ Route::patch('profile/update', [
'uses' => 'Users\ProfileController@update',
'middleware' => ['web', 'auth'],
]);
// User's Agency routes
Route::get('agency', [
'as' => 'users.agency.show',
'uses' => 'Users\AgencyController@show',
'middleware' => ['web', 'auth'],
]);
Route::get('agency/edit', [
'as' => 'users.agency.edit',
'uses' => 'Users\AgencyController@edit',
'middleware' => ['web', 'auth'],
]);
Route::patch('agency/update', [
'as' => 'users.agency.update',
'uses' => 'Users\AgencyController@update',
'middleware' => ['web', 'auth'],
]);

2
tests/Feature/Auth/MemberLoginTest.php

@ -2,7 +2,6 @@
namespace Tests\Feature\Auth;
use App\Entities\Agencies\Agency;
use App\Entities\Users\User;
use Tests\TestCase;
@ -12,7 +11,6 @@ class MemberLoginTest extends TestCase
public function user_can_login_and_logout()
{
$user = factory(User::class)->create(['name' => 'Nama Member', 'email' => 'email@mail.com']);
factory(Agency::class)->create(['owner_id' => $user->id]);
$this->visit(route('auth.login'));

6
tests/Feature/Auth/MemberRegistrationTest.php

@ -44,7 +44,6 @@ class MemberRegistrationTest extends TestCase
{
$this->visit(route('auth.register'));
$this->submitForm(trans('auth.register'), [
'agency_name' => 'Nama Agency',
'name' => 'Nama Member',
'email' => 'email@mail.com',
'password' => 'password.111',
@ -59,10 +58,5 @@ class MemberRegistrationTest extends TestCase
'name' => 'Nama Member',
'email' => 'email@mail.com',
]);
$this->seeInDatabase('agencies', [
'name' => 'Nama Agency',
'email' => 'email@mail.com',
]);
}
}

4
tests/Feature/ManageFeaturesTest.php

@ -2,7 +2,6 @@
namespace Tests\Feature;
use App\Entities\Agencies\Agency;
use App\Entities\Partners\Customer;
use App\Entities\Projects\Feature;
use App\Entities\Projects\Project;
@ -48,8 +47,7 @@ class ManageFeaturesTest extends TestCase
/** @test */
public function admin_can_edit_feature_data()
{
$user = factory(User::class, 3)->create();
$agency = factory(Agency::class)->create();
$user = factory(User::class, 3)->create();
$this->actingAs($user[0]);
$customer = factory(Customer::class)->create();

15
tests/Feature/Users/ManageUsersTest.php

@ -10,15 +10,11 @@ class ManageUsersTest extends TestCase
/** @test */
public function user_can_see_user_list_from_dashboard_tab()
{
$admin = $this->adminUserSigningIn();
$agency = $admin->agency;
$admin = $this->adminUserSigningIn();
$user1 = factory(User::class)->create();
$user2 = factory(User::class)->create();
$agency->addWorker($user1);
$agency->addWorker($user2);
$this->visit(route('users.index'));
$this->see($user1->name);
$this->see($user2->name);
@ -32,6 +28,7 @@ class ManageUsersTest extends TestCase
$this->visit(route('users.index'));
$this->click(trans('user.create'));
$this->seePageIs(route('users.create'));
$this->submitForm(trans('user.create'), [
'name' => 'Nama User',
'email' => 'user@mail.com',
@ -55,9 +52,9 @@ class ManageUsersTest extends TestCase
{
$admin = $this->adminUserSigningIn();
$user2 = factory(User::class)->create();
$admin->agency->addWorker($user2);
$this->visit(route('users.edit', $user2->id));
$this->type('Ganti nama User', 'name');
$this->type('member@mail.dev', 'email');
$this->press(trans('user.update'));
@ -80,7 +77,6 @@ class ManageUsersTest extends TestCase
{
$admin = $this->adminUserSigningIn();
$user2 = factory(User::class)->create();
$admin->agency->addWorker($user2);
$this->visit(route('users.edit', $user2->id));
@ -103,10 +99,5 @@ class ManageUsersTest extends TestCase
'username' => $user2->username,
'email' => $user2->email,
]);
$this->notSeeInDatabase('agency_workers', [
'agency_id' => $admin->agency->id,
'worker_id' => $user2->id,
]);
}
}

35
tests/Feature/Users/UserProfileTest.php

@ -42,39 +42,4 @@ class UserProfileTest extends TestCase
'email' => 'me@domain.com',
]);
}
/** @test */
public function a_user_can_visit_their_agency_page()
{
$user = $this->adminUserSigningIn();
$this->visit(route('users.agency.show'));
$this->seePageIs(route('users.agency.show'));
}
/** @test */
public function a_user_can_update_their_agency_data()
{
$user = $this->adminUserSigningIn();
$this->visit(route('users.agency.edit'));
$this->submitForm(trans('agency.update'), [
'name' => 'Nama Agensi Saya',
'email' => 'nama_agensi@domain.com',
'address' => 'Jln. Kalimantan, No. 20, Kota',
'phone' => '081234567890',
'website' => 'https://example.com',
]);
$this->see(trans('agency.updated'));
$this->seePageIs(route('users.agency.show'));
$this->seeInDatabase('agencies', [
'id' => $user->agency->id,
'name' => 'Nama Agensi Saya',
'email' => 'nama_agensi@domain.com',
'address' => 'Jln. Kalimantan, No. 20, Kota',
'phone' => '081234567890',
'website' => 'https://example.com',
]);
}
}

2
tests/TestCase.php

@ -2,7 +2,6 @@
namespace Tests;
use App\Entities\Agencies\Agency;
use App\Entities\Users\User;
use Laravel\BrowserKitTesting\TestCase as BaseTestCase;
use Tests\Traits\DatabaseMigrateSeeds;
@ -24,7 +23,6 @@ abstract class TestCase extends BaseTestCase
protected function adminUserSigningIn()
{
$user = $this->createUser();
factory(Agency::class)->create(['owner_id' => $user->id]);
$this->actingAs($user);
return $user;

11
tests/Unit/Models/UserTest.php

@ -2,7 +2,6 @@
namespace Tests\Unit\Models;
use App\Entities\Agencies\Agency;
use App\Entities\Users\User;
use Tests\TestCase;
@ -17,14 +16,4 @@ class UserTest extends TestCase
'target' => '_blank',
]), $user->nameLink());
}
/** @test */
public function user_can_owns_one_agency()
{
$user = factory(User::class)->create();
$agency = factory(Agency::class)->create(['owner_id' => $user->id]);
$this->assertTrue($user->agency instanceof Agency);
$this->assertEquals($user->agency->id, $agency->id);
}
}

7
tests/Unit/Policies/ProjectPolicyTest.php

@ -2,7 +2,6 @@
namespace Tests\Unit\Policies;
use App\Entities\Agencies\Agency;
use App\Entities\Projects\Project;
use Tests\TestCase as TestCase;
@ -11,8 +10,7 @@ class ProjectPolicyTest extends TestCase
/** @test */
public function user_can_create_project()
{
$user = $this->userSigningIn();
$agency = factory(Agency::class)->create(['owner_id' => $user->id]);
$user = $this->userSigningIn();
$this->assertTrue($user->can('create', new Project));
}
@ -21,7 +19,6 @@ class ProjectPolicyTest extends TestCase
public function user_can_view_project()
{
$user = $this->userSigningIn();
$agency = factory(Agency::class)->create(['owner_id' => $user->id]);
$project = factory(Project::class)->create();
$this->assertTrue($user->can('view', $project));
@ -31,7 +28,6 @@ class ProjectPolicyTest extends TestCase
public function user_can_update_project()
{
$user = $this->userSigningIn();
$agency = factory(Agency::class)->create(['owner_id' => $user->id]);
$project = factory(Project::class)->create();
$this->assertTrue($user->can('update', $project));
@ -41,7 +37,6 @@ class ProjectPolicyTest extends TestCase
public function user_can_delete_project()
{
$user = $this->userSigningIn();
$agency = factory(Agency::class)->create(['owner_id' => $user->id]);
$project = factory(Project::class)->create();
$this->assertTrue($user->can('delete', $project));

3
tests/Unit/Policies/UserPolicyTest.php

@ -23,7 +23,6 @@ class UserPolicyTest extends TestCase
{
$admin = $this->adminUserSigningIn();
$user = factory(User::class)->create();
$admin->agency->addWorker($user);
$this->assertTrue($admin->can('view', $user));
}
@ -33,7 +32,6 @@ class UserPolicyTest extends TestCase
{
$admin = $this->adminUserSigningIn();
$user = factory(User::class)->create();
$admin->agency->addWorker($user);
$this->assertTrue($admin->can('update', $user));
}
@ -43,7 +41,6 @@ class UserPolicyTest extends TestCase
{
$admin = $this->adminUserSigningIn();
$user = factory(User::class)->create();
$admin->agency->addWorker($user);
$this->assertTrue($admin->can('delete', $user));
}

Loading…
Cancel
Save