Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
laravel-adminpanel
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
laravel-adminpanel
Commits
65bd6e58
Commit
65bd6e58
authored
Jan 02, 2018
by
Viral Solani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
create seperate model factories for user , role and permission
parent
6122c375
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
81 additions
and
0 deletions
+81
-0
PermissionFactory.php
database/factories/PermissionFactory.php
+18
-0
RoleFactory.php
database/factories/RoleFactory.php
+21
-0
UserFactory.php
database/factories/UserFactory.php
+42
-0
No files found.
database/factories/PermissionFactory.php
0 → 100644
View file @
65bd6e58
<?php
use
App\Models\Access\Permission\Permission
;
use
Faker\Generator
;
/*
* Permissions
*/
$factory
->
define
(
Permission
::
class
,
function
(
Generator
$faker
)
{
$name
=
$faker
->
word
;
return
[
'name'
=>
$name
,
'display_name'
=>
$name
,
'sort'
=>
$faker
->
numberBetween
(
1
,
100
),
];
});
database/factories/RoleFactory.php
0 → 100644
View file @
65bd6e58
<?php
use
App\Models\Access\Role\Role
;
use
Faker\Generator
;
/*
* Roles
*/
$factory
->
define
(
Role
::
class
,
function
(
Generator
$faker
)
{
return
[
'name'
=>
$faker
->
name
,
'all'
=>
0
,
'sort'
=>
$faker
->
numberBetween
(
1
,
100
),
];
});
$factory
->
state
(
Role
::
class
,
'admin'
,
function
()
{
return
[
'all'
=>
1
,
];
});
database/factories/
Model
Factory.php
→
database/factories/
User
Factory.php
100755 → 100644
View file @
65bd6e58
<?php
<?php
use
App\Models\Access\Permission\Permission
;
use
App\Models\Access\Role\Role
;
use
App\Models\Access\User\User
;
use
App\Models\Access\User\User
;
use
Faker\Generator
;
use
Faker\Generator
;
/*
|--------------------------------------------------------------------------
| Model Factories
|--------------------------------------------------------------------------
|
| Here you may define all of your model factories. Model factories give
| you a convenient way to create models for testing and seeding your
| database. Just tell the factory how a default model should look.
|
*/
$factory
->
define
(
User
::
class
,
function
(
Generator
$faker
)
{
$factory
->
define
(
User
::
class
,
function
(
Generator
$faker
)
{
static
$password
;
static
$password
;
...
@@ -53,33 +40,3 @@ $factory->state(User::class, 'unconfirmed', function () {
...
@@ -53,33 +40,3 @@ $factory->state(User::class, 'unconfirmed', function () {
];
];
});
});
/*
* Roles
*/
$factory
->
define
(
Role
::
class
,
function
(
Generator
$faker
)
{
return
[
'name'
=>
$faker
->
name
,
'all'
=>
0
,
'sort'
=>
$faker
->
numberBetween
(
1
,
100
),
];
});
$factory
->
state
(
Role
::
class
,
'admin'
,
function
()
{
return
[
'all'
=>
1
,
];
});
/*
* Permissions
*/
$factory
->
define
(
Permission
::
class
,
function
(
Generator
$faker
)
{
$name
=
$faker
->
word
;
return
[
'name'
=>
$name
,
'display_name'
=>
$name
,
'sort'
=>
$faker
->
numberBetween
(
1
,
100
),
];
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment