Compare commits
178 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| edf75865dc | |||
| 176a26e6c3 | |||
| 10a4d7e849 | |||
| cbe008d52f | |||
| aeb5152789 | |||
| 938490df16 | |||
| 45c2af80a3 | |||
| 892c1b04fd | |||
| 1fbf3753bc | |||
| 5ead5a94e3 | |||
| bcf435f625 | |||
| 8638c46b1d | |||
| b107280b7b | |||
| 1a60c20117 | |||
| f1a6926ad9 | |||
| c27a7f09bd | |||
| ba7b9d8168 | |||
| 5b070ee32f | |||
| 59a126c47c | |||
| 322e62418e | |||
| a98d94ccdc | |||
| 5addcb517f | |||
| 56cbc005ae | |||
| 22e9246031 | |||
| c0b39701cc | |||
| e2bac62e36 | |||
| c12a23b84a | |||
| fa95f6d836 | |||
| 280e8c7ed1 | |||
| 7617fda978 | |||
| af69f7636b | |||
| 6d4574130f | |||
| 485b6397d0 | |||
| 93990327de | |||
| 4ee7765403 | |||
| bdbad067b4 | |||
| 13a716310c | |||
| d0c77c228b | |||
| 36cbffa183 | |||
| 5edf9e143f | |||
| b6a1e0d12f | |||
| 2fda3a2d26 | |||
| f56eb16941 | |||
| c15c082fb4 | |||
| 64e7ab3a12 | |||
| afbd6c811b | |||
| f64c02ce12 | |||
| a0d8aa77d3 | |||
| bed7b29417 | |||
| 40ed86bfe0 | |||
| 33497c9811 | |||
| 52a8597813 | |||
| eeb07f73e5 | |||
| 57422c9135 | |||
| adca7cb0c5 | |||
| 059f8f5bc9 | |||
| c676e9d794 | |||
| e9f10dd74e | |||
| e29d878d4f | |||
| d4e3ea1412 | |||
| c5462c5f1f | |||
| d1328c3ba9 | |||
| 8c406e8e55 | |||
| 6e33f36595 | |||
| 48277606de | |||
| d7c9fcc8df | |||
| 508576544b | |||
| 9f2fc21649 | |||
| 11f99a963a | |||
| 27ab0271a1 | |||
| f858b2858d | |||
| e2809f7bd0 | |||
| f468b37f36 | |||
| 0b3d3de30f | |||
| 907b909223 | |||
| 9dc79f7165 | |||
| 324d44dbac | |||
| 7a0e695ea0 | |||
| a69a939034 | |||
| ed8efbe759 | |||
| 834c6ad8f9 | |||
| 2ce48fbc7e | |||
| 5d18937e94 | |||
| b3186ba5ea | |||
| f51dc9a1c4 | |||
| f3f9920bd3 | |||
| ea6140e786 | |||
| 05c4d6dead | |||
| e2c6f36c70 | |||
| 21b1ecb6b3 | |||
| a62cf358ee | |||
| 20c429b600 | |||
| 38e25a388c | |||
| 2c6cedd62c | |||
| 9b0cca4a37 | |||
| f6d198a39c | |||
| d12fc6b13c | |||
| a12c7c83d4 | |||
| affd4035c3 | |||
| ecfe1a5442 | |||
| e9c77198d7 | |||
| 20be670648 | |||
| a03207e5b4 | |||
| 6555b3a49d | |||
| 61a634bc1a | |||
| 00696a3668 | |||
| e20271791b | |||
| 86b9fdbffe | |||
| 7e728094a1 | |||
| f865c621ef | |||
| e2f4685a55 | |||
| 2148ea94bb | |||
| 1d2787250b | |||
| 7f02ff12cf | |||
| 65341a5d8a | |||
| 1608edbb28 | |||
| 776da1dea4 | |||
| a6b3e4bbb1 | |||
| 3b2ecda243 | |||
| 57cbb5c5ce | |||
| 7b27d32121 | |||
| ccfba324ee | |||
| 9f55a76fcf | |||
| 8fdddc310f | |||
| 064a4ebe33 | |||
| 4981077cb1 | |||
| fbea1c0823 | |||
| a84da88114 | |||
| 282b3b5b0a | |||
| 130a99c46f | |||
| df4cb7d351 | |||
| 1dcff8d463 | |||
| ae4ba6176d | |||
| e461c25428 | |||
| ea4bfdc51d | |||
| 554ea8bb95 | |||
| f2be409914 | |||
| 3fc1bbea73 | |||
| a97f7d2277 | |||
| af70cdaeac | |||
| 8919c3b52a | |||
| f580e20bc3 | |||
| a054cec7c9 | |||
| 1ad7bbdd0c | |||
| cfe6759825 | |||
| 10c13baf2b | |||
| 9fe4e11874 | |||
| f6d8642799 | |||
| adddc5324b | |||
| f442b70ae7 | |||
| 7b10213b3a | |||
| ddc79b9070 | |||
| 5e9b04b0f5 | |||
| 2562eb2aeb | |||
| 85da30894b | |||
| bf344e9322 | |||
| f66e222f3d | |||
| fb180d74a1 | |||
| eaf55f5e79 | |||
| 8edb586576 | |||
| 32b01b8f38 | |||
| 340386f282 | |||
| 6dd4282f1f | |||
| 3f44987799 | |||
| b4fec068d0 | |||
| 512632ce60 | |||
| 58a9b0d3e8 | |||
| fcb1283a14 | |||
| 54671af7f0 | |||
| aedabb0920 | |||
| aaf4acef83 | |||
| 8e73cacf4e | |||
| b4b2daebbd | |||
| 3e2c18cb4d | |||
| c721fdd793 | |||
| d119372ff0 | |||
| c8bed867da | |||
| 3a470ce789 |
@@ -755,6 +755,24 @@
|
||||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "imjennyli",
|
||||
"name": "Jenny Li",
|
||||
"avatar_url": "https://avatars3.githubusercontent.com/u/404729?v=4",
|
||||
"profile": "https://github.com/imjennyli",
|
||||
"contributions": [
|
||||
"doc"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "GeoffYoung",
|
||||
"name": "Geoff Young",
|
||||
"avatar_url": "https://avatars0.githubusercontent.com/u/869227?v=4",
|
||||
"profile": "https://github.com/GeoffYoung",
|
||||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
+6
-6
@@ -8,7 +8,6 @@ APP_URL=null
|
||||
APP_TIMEZONE='UTC'
|
||||
APP_LOCALE=en
|
||||
|
||||
|
||||
# --------------------------------------------
|
||||
# REQUIRED: DATABASE SETTINGS
|
||||
# --------------------------------------------
|
||||
@@ -31,7 +30,6 @@ DB_SSL_CERT_PATH=null
|
||||
DB_SSL_CA_PATH=null
|
||||
DB_SSL_CIPHER=null
|
||||
|
||||
|
||||
# --------------------------------------------
|
||||
# REQUIRED: OUTGOING MAIL SERVER SETTINGS
|
||||
# --------------------------------------------
|
||||
@@ -46,14 +44,12 @@ MAIL_FROM_NAME='Snipe-IT'
|
||||
MAIL_REPLYTO_ADDR=you@example.com
|
||||
MAIL_REPLYTO_NAME='Snipe-IT'
|
||||
|
||||
|
||||
# --------------------------------------------
|
||||
# REQUIRED: IMAGE LIBRARY
|
||||
# This should be gd or imagick
|
||||
# --------------------------------------------
|
||||
IMAGE_LIB=gd
|
||||
|
||||
|
||||
# --------------------------------------------
|
||||
# OPTIONAL: SESSION SETTINGS
|
||||
# --------------------------------------------
|
||||
@@ -64,14 +60,12 @@ COOKIE_NAME=snipeit_session
|
||||
COOKIE_DOMAIN=null
|
||||
SECURE_COOKIES=false
|
||||
|
||||
|
||||
# --------------------------------------------
|
||||
# OPTIONAL: SECURITY HEADER SETTINGS
|
||||
# --------------------------------------------
|
||||
REFERRER_POLICY=same-origin
|
||||
ENABLE_CSP=false
|
||||
|
||||
|
||||
# --------------------------------------------
|
||||
# OPTIONAL: CACHE SETTINGS
|
||||
# --------------------------------------------
|
||||
@@ -79,6 +73,12 @@ CACHE_DRIVER=file
|
||||
SESSION_DRIVER=file
|
||||
QUEUE_DRIVER=sync
|
||||
|
||||
# --------------------------------------------
|
||||
# OPTIONAL: REDIS SETTINGS
|
||||
# --------------------------------------------
|
||||
REDIS_HOST=null
|
||||
REDIS_PASSWORD=null
|
||||
REDIS_PORT-null
|
||||
|
||||
# --------------------------------------------
|
||||
# OPTIONAL: AWS S3 SETTINGS
|
||||
|
||||
+1
-1
@@ -55,7 +55,7 @@ further defined and clarified by project maintainers.
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||
reported by contacting the project team at [INSERT EMAIL ADDRESS]. All
|
||||
reported by contacting the project team at abuse@snipeitapp.com. All
|
||||
complaints will be reviewed and investigated and will result in a response that
|
||||
is deemed necessary and appropriate to the circumstances. The project team is
|
||||
obligated to maintain confidentiality with regard to the reporter of an incident.
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
### Contributing
|
||||
|
||||
Please see the documentation on [contributing and developing for Snipe-IT](https://snipe-it.readme.io/docs/contributing).
|
||||
Please see the documentation on [contributing and developing for Snipe-IT](https://snipe-it.readme.io/docs/contributing-overview).
|
||||
|
||||
|
||||
Please note that this project is released with a [Contributor Code of Conduct](CODE_OF_CONDUCT.md). By participating in this project you agree to abide by its terms.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
[](https://travis-ci.org/snipe/snipe-it) [](http://waffle.io/snipe/snipe-it) []() [](https://crowdin.com/project/snipe-it) [](https://gitter.im/snipe/snipe-it?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [](https://hub.docker.com/r/snipe/snipe-it/) [](https://twitter.com/snipeyhead) [](https://zenhub.io) [](https://www.codacy.com/app/snipe/snipe-it?utm_source=github.com&utm_medium=referral&utm_content=snipe/snipe-it&utm_campaign=Badge_Grade)
|
||||
[](#contributors)
|
||||
[](#contributors)
|
||||
|
||||
|
||||
## Snipe-IT - Open Source Asset Management System
|
||||
@@ -67,7 +67,7 @@ Thanks goes to all of these wonderful people ([emoji key](https://github.com/ken
|
||||
| [<img src="https://avatars0.githubusercontent.com/u/8341172?v=3" width="110px;"/><br /><sub>Jay Richards</sub>](http://www.cordeos.com)<br />[💻](https://github.com/snipe/snipe-it/commits?author=technogenus "Code") | [<img src="https://avatars2.githubusercontent.com/u/7295127?v=3" width="110px;"/><br /><sub>Alexander Innes</sub>](https://necurity.co.uk)<br />[💻](https://github.com/snipe/snipe-it/commits?author=leostat "Code") | [<img src="https://avatars2.githubusercontent.com/u/334485?v=3" width="110px;"/><br /><sub>Danny Garcia</sub>](https://buzzedword.codes)<br />[💻](https://github.com/snipe/snipe-it/commits?author=buzzedword "Code") | [<img src="https://avatars2.githubusercontent.com/u/366855?v=3" width="110px;"/><br /><sub>archpoint</sub>](https://github.com/archpoint)<br />[💻](https://github.com/snipe/snipe-it/commits?author=archpoint "Code") | [<img src="https://avatars1.githubusercontent.com/u/67991?v=3" width="110px;"/><br /><sub>Jake McGraw</sub>](http://www.jakemcgraw.com)<br />[💻](https://github.com/snipe/snipe-it/commits?author=jakemcgraw "Code") | [<img src="https://avatars1.githubusercontent.com/u/1714374?v=3" width="110px;"/><br /><sub>FleischKarussel</sub>](https://github.com/FleischKarussel)<br />[📖](https://github.com/snipe/snipe-it/commits?author=FleischKarussel "Documentation") | [<img src="https://avatars3.githubusercontent.com/u/319644?v=3" width="110px;"/><br /><sub>Dylan Yi</sub>](https://github.com/feeva)<br />[💻](https://github.com/snipe/snipe-it/commits?author=feeva "Code") |
|
||||
| [<img src="https://avatars2.githubusercontent.com/u/857740?v=3" width="110px;"/><br /><sub>Gil Rutkowski</sub>](http://FlashingCursor.com)<br />[💻](https://github.com/snipe/snipe-it/commits?author=flashingcursor "Code") | [<img src="https://avatars3.githubusercontent.com/u/129360?v=3" width="110px;"/><br /><sub>Desmond Morris</sub>](http://www.desmondmorris.com)<br />[💻](https://github.com/snipe/snipe-it/commits?author=desmondmorris "Code") | [<img src="https://avatars2.githubusercontent.com/u/52936?v=3" width="110px;"/><br /><sub>Nick Peelman</sub>](http://peelman.us)<br />[💻](https://github.com/snipe/snipe-it/commits?author=peelman "Code") | [<img src="https://avatars0.githubusercontent.com/u/53161?v=3" width="110px;"/><br /><sub>Abraham Vegh</sub>](https://abrahamvegh.com)<br />[💻](https://github.com/snipe/snipe-it/commits?author=abrahamvegh "Code") | [<img src="https://avatars0.githubusercontent.com/u/2818680?v=3" width="110px;"/><br /><sub>Mohamed Rashid</sub>](https://github.com/rashivkp)<br />[📖](https://github.com/snipe/snipe-it/commits?author=rashivkp "Documentation") | [<img src="https://avatars3.githubusercontent.com/u/1509456?v=3" width="110px;"/><br /><sub>Kasey</sub>](http://hinchk.github.io)<br />[💻](https://github.com/snipe/snipe-it/commits?author=HinchK "Code") | [<img src="https://avatars2.githubusercontent.com/u/10522541?v=3" width="110px;"/><br /><sub>Brett</sub>](https://github.com/BrettFagerlund)<br />[⚠️](https://github.com/snipe/snipe-it/commits?author=BrettFagerlund "Tests") |
|
||||
| [<img src="https://avatars2.githubusercontent.com/u/16108587?v=3" width="110px;"/><br /><sub>Jason Spriggs</sub>](http://jasonspriggs.com)<br />[💻](https://github.com/snipe/snipe-it/commits?author=jasonspriggs "Code") | [<img src="https://avatars2.githubusercontent.com/u/1134568?v=3" width="110px;"/><br /><sub>Nate Felton</sub>](http://n8felton.wordpress.com)<br />[💻](https://github.com/snipe/snipe-it/commits?author=n8felton "Code") | [<img src="https://avatars2.githubusercontent.com/u/14036694?v=3" width="110px;"/><br /><sub>Manasses Ferreira</sub>](http://homepages.dcc.ufmg.br/~manassesferreira)<br />[💻](https://github.com/snipe/snipe-it/commits?author=manassesferreira "Code") | [<img src="https://avatars0.githubusercontent.com/u/15913949?v=3" width="110px;"/><br /><sub>Steve</sub>](https://github.com/steveelwood)<br />[⚠️](https://github.com/snipe/snipe-it/commits?author=steveelwood "Tests") | [<img src="https://avatars1.githubusercontent.com/u/3361683?v=3" width="110px;"/><br /><sub>matc</sub>](http://twitter.com/matc)<br />[⚠️](https://github.com/snipe/snipe-it/commits?author=matc "Tests") | [<img src="https://avatars3.githubusercontent.com/u/7405702?v=3" width="110px;"/><br /><sub>Cole R. Davis</sub>](http://www.davisracingteam.com)<br />[⚠️](https://github.com/snipe/snipe-it/commits?author=VanillaNinjaD "Tests") | [<img src="https://avatars2.githubusercontent.com/u/10167681?v=3" width="110px;"/><br /><sub>gibsonjoshua55</sub>](https://github.com/gibsonjoshua55)<br />[💻](https://github.com/snipe/snipe-it/commits?author=gibsonjoshua55 "Code") |
|
||||
| [<img src="https://avatars2.githubusercontent.com/u/2809241?v=4" width="110px;"/><br /><sub>Robin Temme</sub>](https://github.com/zwerch)<br />[💻](https://github.com/snipe/snipe-it/commits?author=zwerch "Code") | [<img src="https://avatars0.githubusercontent.com/u/6961695?v=4" width="110px;"/><br /><sub>Iman</sub>](https://github.com/imanghafoori1)<br />[💻](https://github.com/snipe/snipe-it/commits?author=imanghafoori1 "Code") | [<img src="https://avatars1.githubusercontent.com/u/6551003?v=4" width="110px;"/><br /><sub>Richard Hofman</sub>](https://github.com/richardhofman6)<br />[💻](https://github.com/snipe/snipe-it/commits?author=richardhofman6 "Code") | [<img src="https://avatars0.githubusercontent.com/u/3697569?v=4" width="110px;"/><br /><sub>gizzmojr</sub>](https://github.com/gizzmojr)<br />[💻](https://github.com/snipe/snipe-it/commits?author=gizzmojr "Code") |
|
||||
| [<img src="https://avatars2.githubusercontent.com/u/2809241?v=4" width="110px;"/><br /><sub>Robin Temme</sub>](https://github.com/zwerch)<br />[💻](https://github.com/snipe/snipe-it/commits?author=zwerch "Code") | [<img src="https://avatars0.githubusercontent.com/u/6961695?v=4" width="110px;"/><br /><sub>Iman</sub>](https://github.com/imanghafoori1)<br />[💻](https://github.com/snipe/snipe-it/commits?author=imanghafoori1 "Code") | [<img src="https://avatars1.githubusercontent.com/u/6551003?v=4" width="110px;"/><br /><sub>Richard Hofman</sub>](https://github.com/richardhofman6)<br />[💻](https://github.com/snipe/snipe-it/commits?author=richardhofman6 "Code") | [<img src="https://avatars0.githubusercontent.com/u/3697569?v=4" width="110px;"/><br /><sub>gizzmojr</sub>](https://github.com/gizzmojr)<br />[💻](https://github.com/snipe/snipe-it/commits?author=gizzmojr "Code") | [<img src="https://avatars3.githubusercontent.com/u/404729?v=4" width="110px;"/><br /><sub>Jenny Li</sub>](https://github.com/imjennyli)<br />[📖](https://github.com/snipe/snipe-it/commits?author=imjennyli "Documentation") | [<img src="https://avatars0.githubusercontent.com/u/869227?v=4" width="110px;"/><br /><sub>Geoff Young</sub>](https://github.com/GeoffYoung)<br />[💻](https://github.com/snipe/snipe-it/commits?author=GeoffYoung "Code") |
|
||||
<!-- ALL-CONTRIBUTORS-LIST:END -->
|
||||
|
||||
This project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification. Contributions of any kind welcome!
|
||||
|
||||
@@ -16,7 +16,7 @@ class LdapSync extends Command
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'snipeit:ldap-sync {--location=} {--location_id=} {--summary}';
|
||||
protected $signature = 'snipeit:ldap-sync {--location=} {--location_id=} {--summary} {--json_summary}';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
@@ -55,27 +55,35 @@ class LdapSync extends Command
|
||||
|
||||
try {
|
||||
$ldapconn = Ldap::connectToLdap();
|
||||
} catch (\Exception $e) {
|
||||
LOG::error($e);
|
||||
}
|
||||
|
||||
try {
|
||||
Ldap::bindAdminToLdap($ldapconn);
|
||||
} catch (\Exception $e) {
|
||||
if ($this->option('json_summary')) {
|
||||
$json_summary = [ "error" => true, "error_message" => $e->getMessage(), "summary" => [] ];
|
||||
$this->info(json_encode($json_summary));
|
||||
}
|
||||
LOG::error($e);
|
||||
return [];
|
||||
}
|
||||
|
||||
$summary = array();
|
||||
|
||||
$results = Ldap::findLdapUsers();
|
||||
|
||||
$ldap_ou_locations = Location::whereNotNull('ldap_ou')->get();
|
||||
|
||||
// Retrieve locations with a mapped OU, and sort them from the shallowest to deepest OU (see #3993)
|
||||
$ldap_ou_locations = Location::whereNotNull('ldap_ou')->get()->toArray();
|
||||
$ldap_ou_lengths = array();
|
||||
|
||||
foreach ($ldap_ou_locations as $location) {
|
||||
$ldap_ou_lengths[] = strlen($location["ldap_ou"]);
|
||||
}
|
||||
|
||||
array_multisort($ldap_ou_lengths, SORT_ASC, $ldap_ou_locations);
|
||||
|
||||
if (sizeof($ldap_ou_locations) > 0) {
|
||||
LOG::debug('Some locations have special OUs set. Locations will be automatically set for users in those OUs.');
|
||||
}
|
||||
|
||||
$results = Ldap::findLdapUsers();
|
||||
// Inject location information fields
|
||||
for ($i = 0; $i < $results["count"]; $i++) {
|
||||
$results[$i]["ldap_location_override"] = false;
|
||||
$results[$i]["location_id"] = 0;
|
||||
@@ -90,8 +98,8 @@ class LdapSync extends Command
|
||||
LOG::debug('Location ID '.$this->option('location_id').' passed');
|
||||
LOG::debug('Importing to '.$location->name.' ('.$location->id.')');
|
||||
} else {
|
||||
$location = NULL;
|
||||
}
|
||||
$location = NULL;
|
||||
}
|
||||
|
||||
if (!isset($location)) {
|
||||
LOG::debug('That location is invalid or a location was not provided, so no location will be assigned by default.');
|
||||
@@ -99,11 +107,11 @@ class LdapSync extends Command
|
||||
|
||||
// Grab subsets based on location-specific DNs, and overwrite location for these users.
|
||||
foreach ($ldap_ou_locations as $ldap_loc) {
|
||||
$location_users = Ldap::findLdapUsers($ldap_loc->ldap_ou);
|
||||
$location_users = Ldap::findLdapUsers($ldap_loc["ldap_ou"]);
|
||||
$usernames = array();
|
||||
for ($i = 0; $i < $location_users["count"]; $i++) {
|
||||
$location_users[$i]["ldap_location_override"] = true;
|
||||
$location_users[$i]["location_id"] = $ldap_loc->id;
|
||||
$location_users[$i]["location_id"] = $ldap_loc["id"];
|
||||
$usernames[] = $location_users[$i][$ldap_result_username][0];
|
||||
}
|
||||
|
||||
@@ -135,6 +143,14 @@ class LdapSync extends Command
|
||||
$item["ldap_location_override"] = isset($results[$i]["ldap_location_override"]) ? $results[$i]["ldap_location_override"]:"";
|
||||
$item["location_id"] = isset($results[$i]["location_id"]) ? $results[$i]["location_id"]:"";
|
||||
|
||||
if ( array_key_exists('useraccountcontrol', $results[$i]) ) {
|
||||
$enabled_accounts = [
|
||||
'512', '544', '66048', '66080', '262656', '262688', '328192', '328224'
|
||||
];
|
||||
$item['activated'] = ( in_array($results[$i]['useraccountcontrol'][0], $enabled_accounts) ) ? 1 : 0;
|
||||
} else {
|
||||
$item['activated'] = 0;
|
||||
}
|
||||
|
||||
// User exists
|
||||
$item["createorupdate"] = 'updated';
|
||||
@@ -145,14 +161,12 @@ class LdapSync extends Command
|
||||
}
|
||||
|
||||
// Create the user if they don't exist.
|
||||
|
||||
|
||||
$user->first_name = e($item["firstname"]);
|
||||
$user->last_name = e($item["lastname"]);
|
||||
$user->username = e($item["username"]);
|
||||
$user->email = e($item["email"]);
|
||||
$user->employee_num = e($item["employee_number"]);
|
||||
$user->activated = 1;
|
||||
$user->activated = $item['activated'];
|
||||
|
||||
if ($item['ldap_location_override'] == true) {
|
||||
$user->location_id = $item['location_id'];
|
||||
@@ -188,13 +202,12 @@ class LdapSync extends Command
|
||||
} else {
|
||||
$this->info('User '.$summary[$x]['firstname'].' '.$summary[$x]['lastname'].' (username: '.$summary[$x]['username'].' was '.strtoupper($summary[$x]['createorupdate']).'.');
|
||||
}
|
||||
|
||||
}
|
||||
} else if ($this->option('json_summary')) {
|
||||
$json_summary = [ "error" => false, "error_message" => "", "summary" => $summary ];
|
||||
$this->info(json_encode($json_summary));
|
||||
} else {
|
||||
return $summary;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use App\Models\Setting;
|
||||
use App\Models\User;
|
||||
|
||||
class ResetDemoSettings extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'snipeit:demo-settings';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'This will reset the Snipe-IT demo settings back to default. ';
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
|
||||
$this->info('Resetting the demo settings.');
|
||||
$settings = Setting::first();
|
||||
$settings->per_page = 20;
|
||||
$settings->site_name = 'Snipe-IT Asset Management Demo';
|
||||
$settings->auto_increment_assets = 1;
|
||||
$settings->logo = 'snipe-logo.png';
|
||||
$settings->alert_email = 'service@snipe-it.io';
|
||||
$settings->header_color = null;
|
||||
$settings->barcode_type = 'QRCODE';
|
||||
$settings->default_currency = 'USD';
|
||||
$settings->brand = 3;
|
||||
$settings->ldap_enabled = 0;
|
||||
$settings->full_multiple_companies_support = 1;
|
||||
$settings->alt_barcode = 'C128';
|
||||
$settings->email_domain = 'snipeitapp.com';
|
||||
$settings->email_format = 'filastname';
|
||||
$settings->username_format = 'filastname';
|
||||
$settings->date_display_format = 'D M d, Y';
|
||||
$settings->time_display_format = 'g:iA';
|
||||
$settings->thumbnail_max_h = '30';
|
||||
$settings->locale = 'en';
|
||||
$settings->save();
|
||||
|
||||
if ($user = User::where('username', '=', 'admin')->first()) {
|
||||
$user->locale = 'en';
|
||||
$user->save();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -25,7 +25,8 @@ class Kernel extends ConsoleKernel
|
||||
Commands\Purge::class,
|
||||
Commands\LdapSync::class,
|
||||
Commands\FixDoubleEscape::class,
|
||||
Commands\RecryptFromMcrypt::class
|
||||
Commands\RecryptFromMcrypt::class,
|
||||
Commands\ResetDemoSettings::class
|
||||
];
|
||||
|
||||
/**
|
||||
@@ -39,7 +40,7 @@ class Kernel extends ConsoleKernel
|
||||
|
||||
$schedule->command('snipeit:inventory-alerts')->daily();
|
||||
$schedule->command('snipeit:expiring-alerts')->daily();
|
||||
$schedule->command('snipeit:expected-checkins')->daily();
|
||||
$schedule->command('snipeit:expected-checkin')->daily();
|
||||
$schedule->command('snipeit:backup')->weekly();
|
||||
$schedule->command('backup:clean')->daily();
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ use Illuminate\Auth\AuthenticationException;
|
||||
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
||||
use App\Helpers\Helper;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
use Log;
|
||||
|
||||
class Handler extends ExceptionHandler
|
||||
{
|
||||
@@ -34,8 +35,10 @@ class Handler extends ExceptionHandler
|
||||
*/
|
||||
public function report(Exception $exception)
|
||||
{
|
||||
\Log::error($exception); // rollbar
|
||||
parent::report($exception);
|
||||
if ($this->shouldReport($exception)) {
|
||||
Log::error($exception);
|
||||
return parent::report($exception);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -369,143 +369,5 @@ class AccessoriesController extends Controller
|
||||
return redirect()->route('accessories.index')->with('error', trans('admin/accessories/message.checkin.error'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates the JSON response for accessories listing view.
|
||||
*
|
||||
* Example:
|
||||
* {
|
||||
* "actions": "(links to available actions)",
|
||||
* "category": "(link to category)",
|
||||
* "company": "My Company",
|
||||
* "location": "My Location",
|
||||
* "min_amt": 2,
|
||||
* "name": "(link to accessory),
|
||||
* "numRemaining": 6,
|
||||
* "order_number": null,
|
||||
* "purchase_cost": "0.00",
|
||||
* "purchase_date": null,
|
||||
* "qty": 7
|
||||
* },
|
||||
*
|
||||
* The names of the fields in the returns JSON correspond directly to the the
|
||||
* names of the fields in the bootstrap-tables in the view.
|
||||
*
|
||||
* For debugging, see at /api/accessories/list
|
||||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @param Request $request
|
||||
* @return string JSON containing accessories and their associated atrributes.
|
||||
* @internal param int $accessoryId
|
||||
*/
|
||||
public function getDatatable(Request $request)
|
||||
{
|
||||
$this->authorize('index', Accessory::class);
|
||||
$accessories = Company::scopeCompanyables(
|
||||
Accessory::select('accessories.*')
|
||||
->whereNull('accessories.deleted_at')
|
||||
->with('category', 'company', 'manufacturer', 'users', 'location')
|
||||
);
|
||||
if (Input::has('search')) {
|
||||
$accessories = $accessories->TextSearch(e(Input::get('search')));
|
||||
}
|
||||
$offset = request('offset', 0);
|
||||
$limit = request('limit', 50);
|
||||
|
||||
$allowed_columns = ['name','min_amt','order_number','purchase_date','purchase_cost','company','category','model_number', 'manufacturer', 'location'];
|
||||
$order = Input::get('order') === 'asc' ? 'asc' : 'desc';
|
||||
$sort = in_array(Input::get('sort'), $allowed_columns) ? e(Input::get('sort')) : 'created_at';
|
||||
|
||||
switch ($sort) {
|
||||
case 'category':
|
||||
$accessories = $accessories->OrderCategory($order);
|
||||
break;
|
||||
case 'company':
|
||||
$accessories = $accessories->OrderCompany($order);
|
||||
break;
|
||||
case 'location':
|
||||
$accessories = $accessories->OrderLocation($order);
|
||||
break;
|
||||
case 'manufacturer':
|
||||
$accessories = $accessories->OrderManufacturer($order);
|
||||
break;
|
||||
default:
|
||||
$accessories = $accessories->orderBy($sort, $order);
|
||||
break;
|
||||
}
|
||||
|
||||
$accessCount = $accessories->count();
|
||||
$accessories = $accessories->skip($offset)->take($limit)->get();
|
||||
|
||||
$rows = array();
|
||||
|
||||
foreach ($accessories as $accessory) {
|
||||
$rows[] = $accessory->present()->forDataTable();
|
||||
}
|
||||
|
||||
$data = array('total'=>$accessCount, 'rows'=>$rows);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generates the JSON response for accessory detail view.
|
||||
*
|
||||
* Example:
|
||||
* <code>
|
||||
* {
|
||||
* "rows": [
|
||||
* {
|
||||
* "actions": "(link to available actions)",
|
||||
* "name": "(link to user)"
|
||||
* }
|
||||
* ],
|
||||
* "total": 1
|
||||
* }
|
||||
* </code>
|
||||
*
|
||||
* The names of the fields in the returns JSON correspond directly to the the
|
||||
* names of the fields in the bootstrap-tables in the view.
|
||||
*
|
||||
* For debugging, see at /api/accessories/$accessoryID/view
|
||||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @param int $accessoryId
|
||||
* @return string JSON containing accessories and their associated atrributes.
|
||||
**/
|
||||
public function getDataView(Request $request, $accessoryID)
|
||||
{
|
||||
$accessory = Accessory::find($accessoryID);
|
||||
|
||||
if (!Company::isCurrentUserHasAccess($accessory)) {
|
||||
return ['total' => 0, 'rows' => []];
|
||||
}
|
||||
|
||||
$accessory_users = $accessory->users;
|
||||
$count = $accessory_users->count();
|
||||
|
||||
$rows = array();
|
||||
|
||||
foreach ($accessory_users as $user) {
|
||||
$actions = '';
|
||||
if (Gate::allows('checkin', $accessory)) {
|
||||
$actions .= Helper::generateDatatableButton('checkin', route('checkin/accessory', $user->pivot->id));
|
||||
}
|
||||
|
||||
if (Gate::allows('view', $user)) {
|
||||
$name = (string) link_to_route('users.show', e($user->present()->fullName()), [$user->id]);
|
||||
} else {
|
||||
$name = e($user->present()->fullName());
|
||||
}
|
||||
|
||||
$rows[] = array(
|
||||
'name' => $name,
|
||||
'actions' => $actions
|
||||
);
|
||||
}
|
||||
|
||||
$data = array('total'=>$count, 'rows'=>$rows);
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ use App\Http\Controllers\Controller;
|
||||
use App\Helpers\Helper;
|
||||
use App\Models\Accessory;
|
||||
use App\Http\Transformers\AccessoriesTransformer;
|
||||
use App\Models\Company;
|
||||
|
||||
|
||||
class AccessoriesController extends Controller
|
||||
@@ -128,9 +129,15 @@ class AccessoriesController extends Controller
|
||||
public function checkedout($id)
|
||||
{
|
||||
$this->authorize('view', Accessory::class);
|
||||
$accessory = Accessory::findOrFail($id)->with('users')->first();
|
||||
$total = $accessory->users->count();
|
||||
return (new AccessoriesTransformer)->transformCheckedoutAccessory($accessory, $total);
|
||||
|
||||
$accessory = Accessory::findOrFail($id);
|
||||
if (!Company::isCurrentUserHasAccess($accessory)) {
|
||||
return ['total' => 0, 'rows' => []];
|
||||
}
|
||||
$accessory_users = $accessory->users;
|
||||
$total = $accessory_users->count();
|
||||
|
||||
return (new AccessoriesTransformer)->transformCheckedoutAccessory($accessory_users, $total);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ class AssetModelsController extends Controller
|
||||
$this->authorize('view', AssetModel::class);
|
||||
$allowed_columns = ['id','image','name','model_number','eol','notes','created_at','manufacturer'];
|
||||
|
||||
$assetmodels = AssetModel::select(['models.id','models.image','models.name','model_number','eol','models.notes','models.created_at','category_id','manufacturer_id','depreciation_id','fieldset_id'])
|
||||
$assetmodels = AssetModel::select(['models.id','models.image','models.name','model_number','eol','models.notes','models.created_at','category_id','manufacturer_id','depreciation_id','fieldset_id', 'models.deleted_at'])
|
||||
->with('category','depreciation', 'manufacturer','fieldset')
|
||||
->withCount('assets');
|
||||
|
||||
@@ -39,6 +39,10 @@ class AssetModelsController extends Controller
|
||||
$assetmodels->TextSearch($request->input('search'));
|
||||
}
|
||||
|
||||
if ($request->has('status')) {
|
||||
$assetmodels->onlyTrashed();
|
||||
}
|
||||
|
||||
|
||||
$offset = $request->input('offset', 0);
|
||||
$limit = $request->input('limit', 50);
|
||||
|
||||
@@ -125,7 +125,7 @@ class AssetsController extends Controller
|
||||
$assets->ByManufacturer($request->input('manufacturer_id'));
|
||||
}
|
||||
|
||||
$request->has('order_number') ? $assets = $assets->where('order_number', '=', e($request->get('order_number'))) : '';
|
||||
$request->has('order_number') ? $assets = $assets->where('assets.order_number', '=', e($request->get('order_number'))) : '';
|
||||
|
||||
$offset = request('offset', 0);
|
||||
$limit = $request->input('limit', 50);
|
||||
|
||||
@@ -20,9 +20,9 @@ class CategoriesController extends Controller
|
||||
public function index(Request $request)
|
||||
{
|
||||
$this->authorize('view', Category::class);
|
||||
$allowed_columns = ['id', 'name','category_type','use_default_eula','require_acceptance','checkin_email'];
|
||||
$allowed_columns = ['id', 'name','category_type','use_default_eula','eula_text', 'require_acceptance','checkin_email'];
|
||||
|
||||
$categories = Category::select(['id', 'created_at', 'updated_at', 'name','category_type','use_default_eula','require_acceptance','checkin_email'])
|
||||
$categories = Category::select(['id', 'created_at', 'updated_at', 'name','category_type','use_default_eula','eula_text', 'require_acceptance','checkin_email'])
|
||||
->withCount('assets', 'accessories', 'consumables', 'components');
|
||||
|
||||
if ($request->has('search')) {
|
||||
|
||||
@@ -158,6 +158,6 @@ class ComponentsController extends Controller
|
||||
$limit = $request->input('limit', 50);
|
||||
$total = $assets->count();
|
||||
$assets = $assets->skip($offset)->take($limit)->get();
|
||||
return (new ComponentsAssetsTransformer)->transformAssets($assets, $total);
|
||||
return (new ComponentsTransformer)->transformCheckedoutComponents($assets, $total);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,8 @@ namespace App\Http\Controllers\Api;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Ldap;
|
||||
use Validator;
|
||||
use App\Models\Setting;
|
||||
|
||||
class SettingsController extends Controller
|
||||
{
|
||||
@@ -75,8 +77,14 @@ class SettingsController extends Controller
|
||||
//
|
||||
}
|
||||
|
||||
public function getLdapTest()
|
||||
public function ldaptest()
|
||||
{
|
||||
|
||||
if (Setting::getSettings()->ldap_enabled!='1') {
|
||||
\Log::debug('LDAP is not enabled cannot test.');
|
||||
return response()->json(['message' => 'LDAP is not enabled, cannot test.'], 400);
|
||||
}
|
||||
|
||||
\Log::debug('Preparing to test LDAP connection');
|
||||
|
||||
try {
|
||||
@@ -98,4 +106,58 @@ class SettingsController extends Controller
|
||||
|
||||
}
|
||||
|
||||
public function ldaptestlogin(Request $request)
|
||||
{
|
||||
|
||||
if (Setting::getSettings()->ldap_enabled!='1') {
|
||||
\Log::debug('LDAP is not enabled. Cannot test.');
|
||||
return response()->json(['message' => 'LDAP is not enabled, cannot test.'], 400);
|
||||
}
|
||||
|
||||
|
||||
$rules = array(
|
||||
'ldaptest_user' => 'required',
|
||||
'ldaptest_password' => 'required'
|
||||
);
|
||||
|
||||
$validator = Validator::make($request->all(), $rules);
|
||||
if ($validator->fails()) {
|
||||
\Log::debug('LDAP Validation test failed.');
|
||||
$validation_errors = implode(' ',$validator->errors()->all());
|
||||
return response()->json(['message' => $validator->errors()->all()], 400);
|
||||
}
|
||||
|
||||
|
||||
\Log::debug('Preparing to test LDAP login');
|
||||
try {
|
||||
$connection = Ldap::connectToLdap();
|
||||
try {
|
||||
Ldap::bindAdminToLdap($connection);
|
||||
\Log::debug('Attempting to bind to LDAP for LDAP test');
|
||||
try {
|
||||
$ldap_user = Ldap::findAndBindUserLdap($request->input('ldaptest_user'), $request->input('ldaptest_password'));
|
||||
if ($ldap_user) {
|
||||
\Log::debug('It worked! '. $request->input('ldaptest_user').' successfully binded to LDAP.');
|
||||
return response()->json(['message' => 'It worked! '. $request->input('ldaptest_user').' successfully binded to LDAP.'], 200);
|
||||
}
|
||||
return response()->json(['message' => 'Login Failed. '. $request->input('ldaptest_user').' did not successfully bind to LDAP.'], 400);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
\Log::debug('LDAP login failed');
|
||||
return response()->json(['message' => $e->getMessage()], 400);
|
||||
}
|
||||
|
||||
} catch (\Exception $e) {
|
||||
\Log::debug('Bind failed');
|
||||
return response()->json(['message' => $e->getMessage()], 400);
|
||||
//return response()->json(['message' => $e->getMessage()], 500);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
\Log::debug('Connection failed');
|
||||
return response()->json(['message' => $e->getMessage()], 500);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -155,7 +155,7 @@ class StatuslabelsController extends Controller
|
||||
public function getAssetCountByStatuslabel()
|
||||
{
|
||||
|
||||
$statusLabels = Statuslabel::with('assets')->get();
|
||||
$statusLabels = Statuslabel::get();
|
||||
$labels=[];
|
||||
$points=[];
|
||||
$colors=[];
|
||||
@@ -168,9 +168,7 @@ class StatuslabelsController extends Controller
|
||||
}
|
||||
}
|
||||
}
|
||||
$labels[]='Deployed';
|
||||
$points[]=Asset::whereNotNull('assigned_to')->count();
|
||||
|
||||
|
||||
$colors_array = array_merge($colors, Helper::chartColors());
|
||||
|
||||
$result= [
|
||||
|
||||
@@ -17,6 +17,7 @@ use App\Models\Company;
|
||||
use Config;
|
||||
use App\Helpers\Helper;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Requests\ImageUploadRequest;
|
||||
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
|
||||
@@ -68,7 +69,7 @@ class AssetModelsController extends Controller
|
||||
* @since [v1.0]
|
||||
* @return Redirect
|
||||
*/
|
||||
public function store(Request $request)
|
||||
public function store(ImageUploadRequest $request)
|
||||
{
|
||||
|
||||
// Create a new asset model
|
||||
@@ -90,14 +91,21 @@ class AssetModelsController extends Controller
|
||||
}
|
||||
|
||||
if (Input::file('image')) {
|
||||
|
||||
$image = Input::file('image');
|
||||
$file_name = str_random(25).".".$image->getClientOriginalExtension();
|
||||
$path = public_path('uploads/models/'.$file_name);
|
||||
Image::make($image->getRealPath())->resize(500, null, function ($constraint) {
|
||||
$constraint->aspectRatio();
|
||||
$constraint->upsize();
|
||||
})->save($path);
|
||||
$file_name = str_random(25) . "." . $image->getClientOriginalExtension();
|
||||
$path = public_path('uploads/models/');
|
||||
|
||||
if ($image->getClientOriginalExtension()!='svg') {
|
||||
Image::make($image->getRealPath())->resize(500, null, function ($constraint) {
|
||||
$constraint->aspectRatio();
|
||||
$constraint->upsize();
|
||||
})->save($path.'/'.$file_name);
|
||||
} else {
|
||||
$image->move($path, $file_name);
|
||||
}
|
||||
$model->image = $file_name;
|
||||
|
||||
}
|
||||
|
||||
// Was it created?
|
||||
@@ -180,7 +188,7 @@ class AssetModelsController extends Controller
|
||||
* @param int $modelId
|
||||
* @return Redirect
|
||||
*/
|
||||
public function update(Request $request, $modelId = null)
|
||||
public function update(ImageUploadRequest $request, $modelId = null)
|
||||
{
|
||||
// Check if the model exists
|
||||
if (is_null($model = AssetModel::find($modelId))) {
|
||||
@@ -206,13 +214,19 @@ class AssetModelsController extends Controller
|
||||
|
||||
if (Input::file('image')) {
|
||||
$image = Input::file('image');
|
||||
$file_name = str_random(25).".".$image->getClientOriginalExtension();
|
||||
$path = public_path('uploads/models/'.$file_name);
|
||||
Image::make($image->getRealPath())->resize(300, null, function ($constraint) {
|
||||
$constraint->aspectRatio();
|
||||
$constraint->upsize();
|
||||
})->save($path);
|
||||
$file_name = str_random(25) . "." . $image->getClientOriginalExtension();
|
||||
$path = public_path('uploads/models/');
|
||||
|
||||
if ($image->getClientOriginalExtension()!='svg') {
|
||||
Image::make($image->getRealPath())->resize(500, null, function ($constraint) {
|
||||
$constraint->aspectRatio();
|
||||
$constraint->upsize();
|
||||
})->save($path.'/'.$file_name);
|
||||
} else {
|
||||
$image->move($path, $file_name);
|
||||
}
|
||||
$model->image = $file_name;
|
||||
|
||||
}
|
||||
|
||||
if ($request->input('image_delete') == 1 && Input::file('image') == "") {
|
||||
@@ -352,49 +366,6 @@ class AssetModelsController extends Controller
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get the asset information to present to the model view detail page
|
||||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v2.0]
|
||||
* @param Request $request
|
||||
* @param $modelID
|
||||
* @return String JSON
|
||||
* @internal param int $modelId
|
||||
*/
|
||||
public function getDataView(Request $request, $modelID)
|
||||
{
|
||||
$assets = Asset::where('model_id', '=', $modelID)->with('company', 'assetstatus');
|
||||
|
||||
if (Input::has('search')) {
|
||||
$assets = $assets->TextSearch(e($request->input('search')));
|
||||
}
|
||||
$offset = request('offset', 0);
|
||||
$limit = request('limit', 50);
|
||||
|
||||
|
||||
$allowed_columns = ['name', 'serial','asset_tag'];
|
||||
$order = $request->input('order') === 'asc' ? 'asc' : 'desc';
|
||||
$sort = in_array($request->input('sort'), $allowed_columns) ? e($request->input('sort')) : 'created_at';
|
||||
|
||||
$assets = $assets->orderBy($sort, $order);
|
||||
|
||||
$assetsCount = $assets->count();
|
||||
$assets = $assets->skip($offset)->take($limit)->get();
|
||||
|
||||
$rows = array();
|
||||
|
||||
$all_custom_fields = CustomField::all();
|
||||
foreach ($assets as $asset) {
|
||||
|
||||
$rows[] = $asset->present()->forDataTable($all_custom_fields);
|
||||
}
|
||||
|
||||
$data = array('total' => $assetsCount, 'rows' => $rows);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns a view that allows the user to bulk edit model attrbutes
|
||||
|
||||
@@ -432,7 +432,7 @@ class AssetsController extends Controller
|
||||
// Get the dropdown of users and then pass it to the checkout view
|
||||
return view('hardware/checkout', compact('asset'))
|
||||
->with('users_list', Helper::usersList())
|
||||
->with('assets_list', Helper::assetsList())
|
||||
->with('assets_list', Helper::detailedAssetList())
|
||||
->with('locations_list', Helper::locationsList());
|
||||
}
|
||||
|
||||
@@ -673,7 +673,8 @@ class AssetsController extends Controller
|
||||
return response()->file($barcode_file, $header);
|
||||
} else {
|
||||
$barcode = new \Com\Tecnick\Barcode\Barcode();
|
||||
$barcode_obj = $barcode->getBarcodeObj($settings->alt_barcode, $asset->asset_tag, 250, 20);
|
||||
$barcode_obj = $barcode->getBarcodeObj($settings->alt_barcode,$asset->asset_tag,300,50);
|
||||
|
||||
file_put_contents($barcode_file, $barcode_obj->getPngData());
|
||||
return response($barcode_obj->getPngData())->header('Content-type', 'image/png');
|
||||
}
|
||||
|
||||
@@ -98,10 +98,8 @@ class CategoriesController extends Controller
|
||||
*/
|
||||
public function edit($categoryId = null)
|
||||
{
|
||||
// Check if the category exists
|
||||
if (is_null($item = Category::find($categoryId))) {
|
||||
// Redirect to the blogs management page
|
||||
return redirect()->to('admin/settings/categories')->with('error', trans('admin/categories/message.does_not_exist'));
|
||||
return redirect()->route('categories.index')->with('error', trans('admin/categories/message.does_not_exist'));
|
||||
}
|
||||
$category_types= Helper::categoryTypeList();
|
||||
|
||||
@@ -158,22 +156,22 @@ class CategoriesController extends Controller
|
||||
{
|
||||
// Check if the category exists
|
||||
if (is_null($category = Category::find($categoryId))) {
|
||||
return redirect()->to('admin/settings/categories')->with('error', trans('admin/categories/message.not_found'));
|
||||
return redirect()->route('categories.index')->with('error', trans('admin/categories/message.not_found'));
|
||||
}
|
||||
|
||||
if ($category->has_models() > 0) {
|
||||
return redirect()->to('admin/settings/categories')->with('error', trans('admin/categories/message.assoc_items', ['asset_type'=>'model']));
|
||||
return redirect()->route('categories.index')->with('error', trans('admin/categories/message.assoc_items', ['asset_type'=>'model']));
|
||||
} elseif ($category->accessories()->count() > 0) {
|
||||
return redirect()->to('admin/settings/categories')->with('error', trans('admin/categories/message.assoc_items', ['asset_type'=>'accessory']));
|
||||
return redirect()->route('categories.index')->with('error', trans('admin/categories/message.assoc_items', ['asset_type'=>'accessory']));
|
||||
} elseif ($category->consumables()->count() > 0) {
|
||||
return redirect()->to('admin/settings/categories')->with('error', trans('admin/categories/message.assoc_items', ['asset_type'=>'consumable']));
|
||||
return redirect()->route('categories.index')->with('error', trans('admin/categories/message.assoc_items', ['asset_type'=>'consumable']));
|
||||
} elseif ($category->components()->count() > 0) {
|
||||
return redirect()->to('admin/settings/categories')->with('error', trans('admin/categories/message.assoc_items', ['asset_type'=>'component']));
|
||||
return redirect()->route('categories.index')->with('error', trans('admin/categories/message.assoc_items', ['asset_type'=>'component']));
|
||||
}
|
||||
|
||||
$category->delete();
|
||||
// Redirect to the locations management page
|
||||
return redirect()->to(route('categories.index'))->with('success', trans('admin/categories/message.delete.success'));
|
||||
return redirect()->route('categories.index')->with('success', trans('admin/categories/message.delete.success'));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -288,35 +288,4 @@ class ComponentsController extends Controller
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return JSON data to populate the components view,
|
||||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @see ComponentsController::getView() method that returns the view.
|
||||
* @since [v3.0]
|
||||
* @param int $componentId
|
||||
* @return string JSON
|
||||
*/
|
||||
public function getDataView($componentId)
|
||||
{
|
||||
if (is_null($component = Component::with('assets')->find($componentId))) {
|
||||
// Redirect to the component management page with error
|
||||
return redirect()->route('components.index')->with('error', trans('admin/components/message.not_found'));
|
||||
}
|
||||
|
||||
if (!Company::isCurrentUserHasAccess($component)) {
|
||||
return ['total' => 0, 'rows' => []];
|
||||
}
|
||||
$this->authorize('view', $component);
|
||||
|
||||
$rows = array();
|
||||
$all_custom_fields = CustomField::all(); // Cached for table;
|
||||
foreach ($component->assets as $component_assignment) {
|
||||
$rows[] = $component_assignment->present()->forDataTable($all_custom_fields);
|
||||
}
|
||||
|
||||
$componentCount = $component->assets->count();
|
||||
$data = array('total' => $componentCount, 'rows' => $rows);
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,8 +39,8 @@ class DashboardController extends Controller
|
||||
$counts['grand_total'] = $counts['asset'] + $counts['accessory'] + $counts['license'] + $counts['consumable'];
|
||||
|
||||
if ((!file_exists(storage_path().'/oauth-private.key')) || (!file_exists(storage_path().'/oauth-public.key'))) {
|
||||
\Artisan::call('passport:install');
|
||||
\Artisan::call('migrate', ['--force' => true]);
|
||||
\Artisan::call('passport:install');
|
||||
}
|
||||
|
||||
return view('dashboard')->with('asset_stats', $asset_stats)->with('counts', $counts);
|
||||
|
||||
@@ -27,13 +27,11 @@ class DepartmentsController extends Controller
|
||||
public function index(Request $request)
|
||||
{
|
||||
$this->authorize('index', Department::class);
|
||||
$company = null;
|
||||
if ($request->has('company_id')) {
|
||||
$company = Company::find($request->input('company_id'));
|
||||
} else {
|
||||
$company = null;
|
||||
}
|
||||
return view('departments/index')->with('company',$company);
|
||||
|
||||
return view('departments/index')->with('company', $company);
|
||||
}
|
||||
|
||||
|
||||
@@ -53,12 +51,10 @@ class DepartmentsController extends Controller
|
||||
$department->user_id = Auth::user()->id;
|
||||
$department->manager_id = ($request->has('manager_id' ) ? $request->input('manager_id') : null);
|
||||
|
||||
|
||||
if ($department->save()) {
|
||||
return redirect()->route("departments.index")->with('success', trans('admin/departments/message.create.success'));
|
||||
}
|
||||
return redirect()->back()->withInput()->withErrors($department->getErrors());
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -140,25 +136,20 @@ class DepartmentsController extends Controller
|
||||
->with('location_list', Helper::locationsList())
|
||||
->with('company_list', Helper::companyList());
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function update(Request $request, $id) {
|
||||
|
||||
$this->authorize('create', Department::class);
|
||||
if (is_null($department = Department::find($id))) {
|
||||
return redirect()->to('admin/settings/departments')->with('error', trans('admin/departments/message.does_not_exist'));
|
||||
return redirect()->route('departments.index')->with('error', trans('admin/departments/message.does_not_exist'));
|
||||
}
|
||||
|
||||
|
||||
$department->fill($request->all());
|
||||
$department->manager_id = ($request->has('manager_id' ) ? $request->input('manager_id') : null);
|
||||
|
||||
if ($department->save()) {
|
||||
return redirect()->route("departments.index")->with('success', trans('admin/departments/message.update.success'));
|
||||
}
|
||||
|
||||
return redirect()->back()->withInput()->withErrors($department->getErrors());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -591,61 +591,10 @@ class LicensesController extends Controller
|
||||
$file = $log->get_src('licenses');
|
||||
return Response::download($file);
|
||||
}
|
||||
// Prepare the error message
|
||||
$error = trans('admin/licenses/message.does_not_exist', compact('id'));
|
||||
// Redirect to the licence management page
|
||||
return redirect()->route('licenses.index')->with('error', $error);
|
||||
return redirect()->route('licenses.index')->with('error', trans('admin/licenses/message.does_not_exist', compact('id')));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generates a JSON response to populate the licence index datatables.
|
||||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @see LicensesController::getIndex() method that provides the view
|
||||
* @since [v1.0]
|
||||
* @return String JSON
|
||||
*/
|
||||
public function getDatatable(Request $request)
|
||||
{
|
||||
$this->authorize('view', License::class);
|
||||
$licenses = Company::scopeCompanyables(License::with('company', 'licenseSeatsRelation', 'manufacturer'));
|
||||
|
||||
if (Input::has('search')) {
|
||||
$licenses = $licenses->TextSearch($request->input('search'));
|
||||
}
|
||||
$offset = request('offset', 0);
|
||||
$limit = request('limit', 50);
|
||||
|
||||
$allowed_columns = ['id','name','purchase_cost','expiration_date','purchase_order','order_number','notes','purchase_date','serial','manufacturer','company'];
|
||||
$order = $request->input('order') === 'asc' ? 'asc' : 'desc';
|
||||
$sort = in_array($request->input('sort'), $allowed_columns) ? e($request->input('sort')) : 'created_at';
|
||||
|
||||
switch ($sort) {
|
||||
case 'manufacturer':
|
||||
$licenses = $licenses->OrderManufacturer($order);
|
||||
break;
|
||||
case 'company':
|
||||
$licenses = $licenses->OrderCompany($order);
|
||||
break;
|
||||
default:
|
||||
$licenses = $licenses->orderBy($sort, $order);
|
||||
break;
|
||||
}
|
||||
|
||||
$licenseCount = $licenses->count();
|
||||
$licenses = $licenses->skip($offset)->take($limit)->get();
|
||||
|
||||
$rows = array();
|
||||
|
||||
foreach ($licenses as $license) {
|
||||
$rows[] = $license->present()->forDataTable();
|
||||
}
|
||||
|
||||
$data = array('total' => $licenseCount, 'rows' => $rows);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates the next free seat ID for checkout.
|
||||
|
||||
@@ -89,6 +89,7 @@ class LocationsController extends Controller
|
||||
$location->state = Input::get('state');
|
||||
$location->country = Input::get('country');
|
||||
$location->zip = Input::get('zip');
|
||||
$location->ldap_ou = Input::get('ldap_ou');
|
||||
$location->manager_id = Input::get('manager_id');
|
||||
$location->user_id = Auth::id();
|
||||
|
||||
@@ -147,7 +148,7 @@ class LocationsController extends Controller
|
||||
{
|
||||
// Check if the location exists
|
||||
if (is_null($item = Location::find($locationId))) {
|
||||
return redirect()->to('admin/settings/locations')->with('error', trans('admin/locations/message.does_not_exist'));
|
||||
return redirect()->route('locations.index')->with('error', trans('admin/locations/message.does_not_exist'));
|
||||
}
|
||||
|
||||
// Show the page
|
||||
@@ -156,7 +157,6 @@ class LocationsController extends Controller
|
||||
$location_options = Location::flattenLocationsArray($location_options_array);
|
||||
$location_options = array('' => 'Top Level') + $location_options;
|
||||
|
||||
|
||||
return view('locations/edit', compact('item'))
|
||||
->with('location_options', $location_options)
|
||||
->with('manager_list', Helper::managerList());
|
||||
@@ -176,7 +176,7 @@ class LocationsController extends Controller
|
||||
{
|
||||
// Check if the location exists
|
||||
if (is_null($location = Location::find($locationId))) {
|
||||
return redirect()->to('admin/settings/locations')->with('error', trans('admin/locations/message.does_not_exist'));
|
||||
return redirect()->route('locations.index')->with('error', trans('admin/locations/message.does_not_exist'));
|
||||
}
|
||||
|
||||
// Update the location data
|
||||
@@ -217,7 +217,6 @@ class LocationsController extends Controller
|
||||
return redirect()->to(route('locations.index'))->with('error', trans('admin/locations/message.not_found'));
|
||||
}
|
||||
|
||||
|
||||
if ($location->users->count() > 0) {
|
||||
return redirect()->to(route('locations.index'))->with('error', trans('admin/locations/message.assoc_users'));
|
||||
} elseif ($location->childLocations->count() > 0) {
|
||||
|
||||
@@ -212,116 +212,5 @@ class ManufacturersController extends Controller
|
||||
|
||||
}
|
||||
|
||||
protected function getDataAssetsView(Manufacturer $manufacturer, Request $request)
|
||||
{
|
||||
$manufacturer = $manufacturer->load('assets.model', 'assets.assignedTo', 'assets.assetstatus', 'assets.company');
|
||||
$manufacturer_assets = $manufacturer->assets();
|
||||
|
||||
if ($request->has('search')) {
|
||||
$manufacturer_assets = $manufacturer_assets->TextSearch(e($request->input('search')));
|
||||
}
|
||||
|
||||
$offset = request('offset', 0);
|
||||
$limit = request('limit', 50);
|
||||
|
||||
$order = $request->input('order') === 'asc' ? 'asc' : 'desc';
|
||||
|
||||
$allowed_columns = ['id','name','serial','asset_tag'];
|
||||
$sort = in_array($request->input('sort'), $allowed_columns) ? $request->input('sort') : 'created_at';
|
||||
$count = $manufacturer_assets->count();
|
||||
$manufacturer_assets = $manufacturer_assets->skip($offset)->take($limit)->get();
|
||||
$rows = array();
|
||||
$all_custom_fields = CustomField::all(); // cached;
|
||||
foreach ($manufacturer_assets as $asset) {
|
||||
$rows[] = $asset->present()->forDataTable($all_custom_fields);
|
||||
}
|
||||
|
||||
$data = array('total' => $count, 'rows' => $rows);
|
||||
return $data;
|
||||
}
|
||||
|
||||
protected function getDataLicensesView(Manufacturer $manufacturer, Request $request)
|
||||
{
|
||||
$manufacturer = $manufacturer->load('licenses.company', 'licenses.manufacturer', 'licenses.licenseSeatsRelation');
|
||||
$licenses = $manufacturer->licenses;
|
||||
|
||||
if ($request->has('search')) {
|
||||
$licenses = $licenses->TextSearch($request->input('search'));
|
||||
}
|
||||
|
||||
$licenseCount = $licenses->count();
|
||||
|
||||
$rows = array();
|
||||
|
||||
foreach ($licenses as $license) {
|
||||
$rows[] = $license->present()->forDataTable();
|
||||
}
|
||||
|
||||
$data = array('total' => $licenseCount, 'rows' => $rows);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getDataAccessoriesView(Manufacturer $manufacturer, Request $request)
|
||||
{
|
||||
$manufacturer = $manufacturer->load(
|
||||
'accessories.location',
|
||||
'accessories.company',
|
||||
'accessories.category',
|
||||
'accessories.manufacturer',
|
||||
'accessories.users'
|
||||
);
|
||||
$accessories = $manufacturer->accessories();
|
||||
|
||||
if ($request->has('search')) {
|
||||
$accessories = $accessories->TextSearch(e($request->input('search')));
|
||||
}
|
||||
|
||||
$offset = request('offset', 0);
|
||||
$limit = request('limit', 50);
|
||||
|
||||
$accessCount = $accessories->count();
|
||||
$accessories = $accessories->skip($offset)->take($limit)->get();
|
||||
$rows = array();
|
||||
|
||||
foreach ($accessories as $accessory) {
|
||||
$rows[] = $accessory->present()->forDataTable();
|
||||
}
|
||||
|
||||
$data = array('total'=>$accessCount, 'rows'=>$rows);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getDataConsumablesView($manufacturer, Request $request)
|
||||
{
|
||||
$manufacturer = $manufacturer->load(
|
||||
'consumables.location',
|
||||
'consumables.company',
|
||||
'consumables.category',
|
||||
'consumables.manufacturer',
|
||||
'consumables.users'
|
||||
);
|
||||
$consumables = $manufacturer->consumables();
|
||||
|
||||
if ($request->has('search')) {
|
||||
$consumables = $consumables->TextSearch(e($request->input('search')));
|
||||
}
|
||||
|
||||
$offset = request('offset', 0);
|
||||
$limit = request('limit', 50);
|
||||
|
||||
|
||||
$consumCount = $consumables->count();
|
||||
$consumables = $consumables->skip($offset)->take($limit)->get();
|
||||
$rows = array();
|
||||
|
||||
foreach ($consumables as $consumable) {
|
||||
$rows[] = $consumable->present()->forDataTable();
|
||||
}
|
||||
|
||||
$data = array('total' => $consumCount, 'rows' => $rows);
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ use Illuminate\Support\Facades\View;
|
||||
use Input;
|
||||
use League\Csv\Reader;
|
||||
use Symfony\Component\HttpFoundation\StreamedResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
/**
|
||||
* This controller handles all actions related to Reports for
|
||||
@@ -102,18 +103,45 @@ class ReportsController extends Controller
|
||||
* @since [v1.0]
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function exportAssetReport()
|
||||
public function exportAssetReport(Request $request)
|
||||
{
|
||||
|
||||
\Debugbar::disable();
|
||||
|
||||
$customfields = CustomField::get();
|
||||
|
||||
$response = new StreamedResponse(function () use ($customfields) {
|
||||
$response = new StreamedResponse(function () use ($customfields, $request) {
|
||||
// Open output stream
|
||||
$handle = fopen('php://output', 'w');
|
||||
|
||||
Asset::with('assignedTo', 'assetLoc','defaultLoc','assignedTo','model','supplier','assetstatus','model.manufacturer')->orderBy('created_at', 'DESC')->chunk(500, function($assets) use($handle, $customfields) {
|
||||
$assets = Asset::with('assignedTo', 'assetLoc','defaultLoc','assignedTo','model','supplier','assetstatus','model.manufacturer');
|
||||
|
||||
// This is used by the sidenav, mostly
|
||||
switch ($request->input('status')) {
|
||||
case 'Deleted':
|
||||
$assets->withTrashed()->Deleted();
|
||||
break;
|
||||
case 'Pending':
|
||||
$assets->Pending();
|
||||
break;
|
||||
case 'RTD':
|
||||
$assets->RTD();
|
||||
break;
|
||||
case 'Undeployable':
|
||||
$assets->Undeployable();
|
||||
break;
|
||||
case 'Archived':
|
||||
$assets->Archived();
|
||||
break;
|
||||
case 'Requestable':
|
||||
$assets->RequestableAssets();
|
||||
break;
|
||||
case 'Deployed':
|
||||
$assets->Deployed();
|
||||
break;
|
||||
}
|
||||
|
||||
$assets->orderBy('created_at', 'DESC')->chunk(500, function($assets) use($handle, $customfields) {
|
||||
$headers=[
|
||||
trans('general.company'),
|
||||
trans('admin/hardware/table.asset_tag'),
|
||||
@@ -126,7 +154,7 @@ class ReportsController extends Controller
|
||||
trans('admin/hardware/table.purchase_date'),
|
||||
trans('admin/hardware/table.purchase_cost'),
|
||||
trans('admin/hardware/form.order'),
|
||||
trans('admin/hardware/form.supplier'),
|
||||
trans('general.supplier'),
|
||||
trans('admin/hardware/table.checkoutto'),
|
||||
trans('admin/hardware/table.checkout_date'),
|
||||
trans('admin/hardware/table.location'),
|
||||
@@ -154,7 +182,7 @@ class ReportsController extends Controller
|
||||
($asset->supplier) ? e($asset->supplier->name) : '',
|
||||
($asset->assignedTo) ? e($asset->assignedTo->present()->name()) : '',
|
||||
($asset->last_checkout!='') ? e($asset->last_checkout) : '',
|
||||
e($asset->assetLoc->present()->name()),
|
||||
($asset->assetLoc) ? e($asset->assetLoc->present()->name()) : '',
|
||||
($asset->notes) ? e($asset->notes) : '',
|
||||
];
|
||||
foreach ($customfields as $field) {
|
||||
@@ -168,7 +196,8 @@ class ReportsController extends Controller
|
||||
fclose($handle);
|
||||
}, 200, [
|
||||
'Content-Type' => 'text/csv',
|
||||
'Content-Disposition' => 'attachment; filename="assets-'.date('Y-m-d-his').'.csv"',
|
||||
'Content-Disposition'
|
||||
=> 'attachment; filename="'.(($request->has('status')) ? trim($request->input('status')) : 'all').'-assets-'.date('Y-m-d-his').'.csv"',
|
||||
]);
|
||||
|
||||
return $response;
|
||||
@@ -543,8 +572,8 @@ class ReportsController extends Controller
|
||||
|
||||
|
||||
if (e(Input::get('assigned_to')) == '1') {
|
||||
if ($asset->assignedTo) {
|
||||
$row[] = '"' .e($asset->assignedTo->present()->name()). '"';
|
||||
if ($asset->assignedto) {
|
||||
$row[] = '"' .e($asset->assignedto->present()->name()). '"';
|
||||
} else {
|
||||
$row[] = ''; // Empty string if unassigned
|
||||
}
|
||||
@@ -553,7 +582,7 @@ class ReportsController extends Controller
|
||||
if (e(Input::get('username')) == '1') {
|
||||
// Only works if we're checked out to a user, not anything else.
|
||||
if ($asset->checkedOutToUser()) {
|
||||
$row[] = '"' .e($asset->assignedTo->username). '"';
|
||||
$row[] = '"' .e($asset->assignedto->username). '"';
|
||||
} else {
|
||||
$row[] = ''; // Empty string if unassigned
|
||||
}
|
||||
@@ -562,7 +591,7 @@ class ReportsController extends Controller
|
||||
if (e(Input::get('employee_num')) == '1') {
|
||||
// Only works if we're checked out to a user, not anything else.
|
||||
if ($asset->checkedOutToUser()) {
|
||||
$row[] = '"' .e($asset->assignedTo->employee_num). '"';
|
||||
$row[] = '"' .e($asset->assignedto->employee_num). '"';
|
||||
} else {
|
||||
$row[] = ''; // Empty string if unassigned
|
||||
}
|
||||
|
||||
@@ -263,8 +263,8 @@ class SettingsController extends Controller
|
||||
$output = Artisan::output();
|
||||
|
||||
if ((!file_exists(storage_path().'/oauth-private.key')) || (!file_exists(storage_path().'/oauth-public.key'))) {
|
||||
Artisan::call('passport:install');
|
||||
Artisan::call('migrate', ['--force' => true]);
|
||||
Artisan::call('passport:install');
|
||||
}
|
||||
|
||||
|
||||
@@ -414,7 +414,7 @@ class SettingsController extends Controller
|
||||
$file_name = "logo.".$image->getClientOriginalExtension();
|
||||
$path = public_path('uploads');
|
||||
if ($image->getClientOriginalExtension()!='svg') {
|
||||
Image::make($image->getRealPath())->resize(null, 40, function ($constraint) {
|
||||
Image::make($image->getRealPath())->resize(null, 150, function ($constraint) {
|
||||
$constraint->aspectRatio();
|
||||
$constraint->upsize();
|
||||
})->save($path.'/'.$file_name);
|
||||
|
||||
@@ -33,6 +33,7 @@ use URL;
|
||||
use View;
|
||||
use Illuminate\Http\Request;
|
||||
use Gate;
|
||||
use Artisan;
|
||||
|
||||
/**
|
||||
* This controller handles all actions related to Users for
|
||||
@@ -1029,128 +1030,20 @@ class UsersController extends Controller
|
||||
*/
|
||||
public function postLDAP(Request $request)
|
||||
{
|
||||
$this->authorize('update', User::class);
|
||||
ini_set('max_execution_time', 600); //600 seconds = 10 minutes
|
||||
ini_set('memory_limit', '500M');
|
||||
// Call Artisan LDAP import command.
|
||||
$location_id = $request->input('location_id');
|
||||
Artisan::call('snipeit:ldap-sync', ['--location_id' => $location_id, '--json_summary' => true]);
|
||||
|
||||
$ldap_result_username = Setting::getSettings()->ldap_username_field;
|
||||
$ldap_result_last_name = Setting::getSettings()->ldap_lname_field;
|
||||
$ldap_result_first_name = Setting::getSettings()->ldap_fname_field;
|
||||
// Collect and parse JSON summary.
|
||||
$ldap_results_json = Artisan::output();
|
||||
$ldap_results = json_decode($ldap_results_json, true);
|
||||
|
||||
$ldap_result_active_flag = Setting::getSettings()->ldap_active_flag_field;
|
||||
$ldap_result_emp_num = Setting::getSettings()->ldap_emp_num;
|
||||
$ldap_result_email = Setting::getSettings()->ldap_email;
|
||||
|
||||
try {
|
||||
$ldapconn = Ldap::connectToLdap();
|
||||
} catch (\Exception $e) {
|
||||
return redirect()->back()->withInput()->with('error', $e->getMessage());
|
||||
// Direct user to appropriate status page.
|
||||
if ($ldap_results['error']) {
|
||||
return redirect()->back()->withInput()->with('error', $ldap_results['error_message']);
|
||||
} else {
|
||||
return redirect()->route('ldap/user')->with('success', "LDAP Import successful.")->with('summary', $ldap_results['summary']);
|
||||
}
|
||||
|
||||
try {
|
||||
Ldap::bindAdminToLdap($ldapconn);
|
||||
} catch (\Exception $e) {
|
||||
return redirect()->back()->withInput()->with('error', $e->getMessage());
|
||||
}
|
||||
|
||||
$summary = array();
|
||||
|
||||
$ldap_ou_locations = Location::whereNotNull('ldap_ou')->get();
|
||||
|
||||
$results = Ldap::findLdapUsers();
|
||||
|
||||
// Inject location information fields
|
||||
for ($i = 0; $i < $results["count"]; $i++) {
|
||||
$results[$i]["ldap_location_override"] = false;
|
||||
$results[$i]["location_id"] = 0;
|
||||
}
|
||||
|
||||
// Grab subsets based on location-specific DNs, and overwrite location for these users.
|
||||
foreach ($ldap_ou_locations as $ldap_loc) {
|
||||
$location_users = Ldap::findLdapUsers($ldap_loc->ldap_ou);
|
||||
$usernames = array();
|
||||
for ($i = 0; $i < $location_users["count"]; $i++) {
|
||||
$location_users[$i]["ldap_location_override"] = true;
|
||||
$location_users[$i]["location_id"] = $ldap_loc->id;
|
||||
$usernames[] = $location_users[$i][$ldap_result_username][0];
|
||||
}
|
||||
|
||||
// Delete located users from the general group.
|
||||
foreach ($results as $key => $generic_entry) {
|
||||
if (in_array($generic_entry[$ldap_result_username][0], $location_users)) {
|
||||
unset($results[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
$global_count = $results['count'];
|
||||
$results = array_merge($location_users, $results);
|
||||
$results['count'] = $global_count;
|
||||
}
|
||||
|
||||
$tmp_pass = substr(str_shuffle("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), 0, 20);
|
||||
$pass = bcrypt($tmp_pass);
|
||||
|
||||
for ($i = 0; $i < $results["count"]; $i++) {
|
||||
if (empty($ldap_result_active_flag) || $results[$i][$ldap_result_active_flag][0] == "TRUE") {
|
||||
|
||||
$item = array();
|
||||
$item["username"] = isset($results[$i][$ldap_result_username][0]) ? $results[$i][$ldap_result_username][0] : "";
|
||||
$item["employee_number"] = isset($results[$i][$ldap_result_emp_num][0]) ? $results[$i][$ldap_result_emp_num][0] : "";
|
||||
$item["lastname"] = isset($results[$i][$ldap_result_last_name][0]) ? $results[$i][$ldap_result_last_name][0] : "";
|
||||
$item["firstname"] = isset($results[$i][$ldap_result_first_name][0]) ? $results[$i][$ldap_result_first_name][0] : "";
|
||||
$item["email"] = isset($results[$i][$ldap_result_email][0]) ? $results[$i][$ldap_result_email][0] : "" ;
|
||||
$item["ldap_location_override"] = isset($results[$i]["ldap_location_override"]) ? $results[$i]["ldap_location_override"]:"";
|
||||
$item["location_id"] = isset($results[$i]["location_id"]) ? $results[$i]["location_id"]:"";
|
||||
|
||||
if( array_key_exists('useraccountcontrol', $results[$i]) ) {
|
||||
$enabled_accounts = [
|
||||
'512', '544', '66048', '66080', '262656', '262688', '328192', '328224'
|
||||
];
|
||||
$item['activated'] = ( in_array($results[$i]['useraccountcontrol'][0], $enabled_accounts) ) ? 1 : 0;
|
||||
} else {
|
||||
$item['activated'] = 0;
|
||||
}
|
||||
|
||||
// User exists
|
||||
$item["createorupdate"] = 'updated';
|
||||
if (!$user = User::where('username', $item["username"])->first()) {
|
||||
$user = new User;
|
||||
$user->password = $pass;
|
||||
$item["createorupdate"] = 'created';
|
||||
}
|
||||
|
||||
// Create the user if they don't exist.
|
||||
$user->first_name = $item["firstname"];
|
||||
$user->last_name = $item["lastname"];
|
||||
$user->username = $item["username"];
|
||||
$user->email = $item["email"];
|
||||
$user->employee_num = e($item["employee_number"]);
|
||||
$user->activated = $item['activated'];
|
||||
|
||||
if ($item['ldap_location_override'] == true) {
|
||||
$user->location_id = $item['location_id'];
|
||||
} else if ($request->input('location_id')!='') {
|
||||
$user->location_id = e($request->input('location_id'));
|
||||
}
|
||||
$user->notes = 'Imported from LDAP';
|
||||
$user->ldap_import = 1;
|
||||
|
||||
$errors = '';
|
||||
|
||||
if ($user->save()) {
|
||||
$item["note"] = $item["createorupdate"];
|
||||
$item["status"]='success';
|
||||
} else {
|
||||
foreach ($user->getErrors()->getMessages() as $key => $err) {
|
||||
$errors .='<li>'.$err[0];
|
||||
}
|
||||
$item["note"] = $errors;
|
||||
$item["status"]='error';
|
||||
}
|
||||
array_push($summary, $item);
|
||||
}
|
||||
}
|
||||
return redirect()->route('ldap/user')->with('success', "LDAP Import successful.")->with('summary', $summary);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -59,14 +59,12 @@ class AccessoriesTransformer
|
||||
}
|
||||
|
||||
|
||||
public function transformCheckedoutAccessory (Accessory $accessory, $total)
|
||||
public function transformCheckedoutAccessory ($accessory_users, $total)
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
$array = array();
|
||||
foreach ($accessory->users as $user) {
|
||||
foreach ($accessory_users as $user) {
|
||||
$array[] = [
|
||||
'assigned_pivot_id' => $user->pivot->id,
|
||||
'id' => (int) $user->id,
|
||||
@@ -81,8 +79,6 @@ class AccessoriesTransformer
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
return (new DatatablesTransformer)->transformDatatables($array, $total);
|
||||
}
|
||||
|
||||
|
||||
@@ -47,13 +47,15 @@ class AssetModelsTransformer
|
||||
'notes' => e($assetmodel->notes),
|
||||
'created_at' => Helper::getFormattedDateObject($assetmodel->created_at, 'datetime'),
|
||||
'updated_at' => Helper::getFormattedDateObject($assetmodel->updated_at, 'datetime'),
|
||||
'deleted_at' => Helper::getFormattedDateObject($assetmodel->deleted_at, 'datetime'),
|
||||
|
||||
];
|
||||
|
||||
$permissions_array['available_actions'] = [
|
||||
'update' => Gate::allows('update', AssetModel::class) ? true : false,
|
||||
'delete' => Gate::allows('delete', AssetModel::class) ? true : false,
|
||||
'clone' => Gate::allows('create', AssetModel::class) ? true : false,
|
||||
'update' => (Gate::allows('update', AssetModel::class) && ($assetmodel->deleted_at=='')) ? true : false,
|
||||
'delete' => (Gate::allows('delete', AssetModel::class) && ($assetmodel->deleted_at=='')) ? true : false,
|
||||
'clone' => (Gate::allows('create', AssetModel::class) && ($assetmodel->deleted_at=='')) ,
|
||||
'restore' => (Gate::allows('create', AssetModel::class) && ($assetmodel->deleted_at!='')) ? true : false,
|
||||
];
|
||||
|
||||
$array += $permissions_array;
|
||||
|
||||
@@ -54,9 +54,9 @@ class AssetsTransformer
|
||||
'id' => (int) $asset->company->id,
|
||||
'name'=> e($asset->company->name)
|
||||
] : null,
|
||||
'location' => ($asset->assetLoc) ? [
|
||||
'id' => (int) $asset->assetLoc->id,
|
||||
'name'=> e($asset->assetLoc->name)
|
||||
'location' => ($asset->assetloc) ? [
|
||||
'id' => (int) $asset->assetloc->id,
|
||||
'name'=> e($asset->assetloc->name)
|
||||
] : null,
|
||||
'rtd_location' => ($asset->defaultLoc) ? [
|
||||
'id' => (int) $asset->defaultLoc->id,
|
||||
|
||||
@@ -26,7 +26,7 @@ class CategoriesTransformer
|
||||
'id' => (int) $category->id,
|
||||
'name' => e($category->name),
|
||||
'type' => e($category->category_type),
|
||||
'use_default_eula' => ($category->use_default_eula =='1') ? true : false,
|
||||
'eula' => ($category->getEula()) ? true : false,
|
||||
'checkin_email' => ($category->checkin_email =='1') ? true : false,
|
||||
'require_acceptance' => ($category->require_acceptance =='1') ? true : false,
|
||||
'assets_count' => $category->assets_count,
|
||||
|
||||
@@ -58,12 +58,22 @@ class ComponentsTransformer
|
||||
}
|
||||
|
||||
|
||||
public function transformCheckedoutComponents(Collection $components_users, $total)
|
||||
public function transformCheckedoutComponents(Collection $components_assets, $total)
|
||||
{
|
||||
$array = array();
|
||||
foreach ($components_users as $user) {
|
||||
$array[] = (new UsersTransformer)->transformUser($user);
|
||||
foreach ($components_assets as $asset) {
|
||||
$array[] = [
|
||||
'assigned_pivot_id' => $asset->pivot->id,
|
||||
'id' => (int) $asset->id,
|
||||
'name' => e($asset->model->present()->name) .' '.e($asset->present()->name),
|
||||
'qty' => $asset->pivot->assigned_qty,
|
||||
'type' => 'asset',
|
||||
'created_at' => Helper::getFormattedDateObject($asset->pivot->created_at, 'datetime'),
|
||||
'available_actions' => ['checkin' => true]
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
return (new DatatablesTransformer)->transformDatatables($array, $total);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,6 +42,7 @@ class UsersTransformer
|
||||
'id' => (int) $user->userloc->id,
|
||||
'name'=> e($user->userloc->name)
|
||||
] : null,
|
||||
'notes'=> e($user->notes),
|
||||
'permissions' => $user->decodePermissions(),
|
||||
'activated' => ($user->activated =='1') ? true : false,
|
||||
'two_factor_activated' => ($user->two_factor_active()) ? true : false,
|
||||
|
||||
@@ -33,10 +33,12 @@ class LicenseImporter extends ItemImporter
|
||||
public function createLicenseIfNotExists(array $row)
|
||||
{
|
||||
$editingLicense = false;
|
||||
$license = License::where('name', $this->item['name'])->first();
|
||||
$license = License::where('name', $this->item['name'])
|
||||
->where('serial', $this->item['serial'])
|
||||
->first();
|
||||
if ($license) {
|
||||
if (!$this->updating) {
|
||||
$this->log('A matching License ' . $this->item['name'] . ' already exists');
|
||||
$this->log('A matching License ' . $this->item['name'] . 'with serial ' . $this->item['serial'] . ' already exists');
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
+13
-10
@@ -487,7 +487,7 @@ class Asset extends Depreciable
|
||||
} elseif ($this->model->category->use_default_eula == '1') {
|
||||
return $Parsedown->text(e(Setting::getSettings()->default_eula_text));
|
||||
} else {
|
||||
return null;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -815,6 +815,7 @@ class Asset extends Depreciable
|
||||
{
|
||||
return $query->where(function ($query) use ($filter) {
|
||||
foreach ($filter as $key => $search_val) {
|
||||
|
||||
if ($key =='asset_tag') {
|
||||
$query->where('assets.asset_tag', 'LIKE', '%'.$search_val.'%');
|
||||
}
|
||||
@@ -856,10 +857,10 @@ class Asset extends Depreciable
|
||||
}
|
||||
|
||||
if ($key =='checkedout_to') {
|
||||
$query->whereHas('assigneduser', function ($query) use ($search) {
|
||||
$query->where(function ($query) use ($search) {
|
||||
$query->where('users.first_name', 'LIKE', '%' . $search . '%')
|
||||
->orWhere('users.last_name', 'LIKE', '%' . $search . '%');
|
||||
$query->whereHas('assigneduser', function ($query) use ($search_val) {
|
||||
$query->where(function ($query) use ($search_val) {
|
||||
$query->where('users.first_name', 'LIKE', '%' . $search_val . '%')
|
||||
->orWhere('users.last_name', 'LIKE', '%' . $search_val . '%');
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -876,8 +877,8 @@ class Asset extends Depreciable
|
||||
}
|
||||
|
||||
if ($key =='category') {
|
||||
$query->whereHas('model', function ($query) use ($search) {
|
||||
$query->whereHas('category', function ($query) use ($search) {
|
||||
$query->whereHas('model', function ($query) use ($search_val) {
|
||||
$query->whereHas('category', function ($query) use ($search_val) {
|
||||
$query->where(function ($query) use ($search_val) {
|
||||
$query->where('categories.name', 'LIKE', '%' . $search_val . '%')
|
||||
->orWhere('models.name', 'LIKE', '%' . $search_val . '%')
|
||||
@@ -914,11 +915,13 @@ class Asset extends Depreciable
|
||||
}
|
||||
|
||||
foreach (CustomField::all() as $field) {
|
||||
if (array_key_exists($field->db_column_name(), $filter)) {
|
||||
$query->orWhere($field->db_column_name(), 'LIKE', "%$search_val%");
|
||||
}
|
||||
if (array_key_exists('custom_fields.'.$field->db_column_name(), $filter)) {
|
||||
$query->orWhere($field->db_column_name(), 'LIKE', '%' . $search_val . '%');
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -153,17 +153,17 @@ class AssetModel extends SnipeModel
|
||||
->orWhere('model_number', 'LIKE', "%$search%")
|
||||
->orWhere(function ($query) use ($search) {
|
||||
$query->whereHas('depreciation', function ($query) use ($search) {
|
||||
$query->where('name', 'LIKE', '%'.$search.'%');
|
||||
$query->where('depreciations.name', 'LIKE', '%'.$search.'%');
|
||||
});
|
||||
})
|
||||
->orWhere(function ($query) use ($search) {
|
||||
$query->whereHas('category', function ($query) use ($search) {
|
||||
$query->where('name', 'LIKE', '%'.$search.'%');
|
||||
$query->where('categories.name', 'LIKE', '%'.$search.'%');
|
||||
});
|
||||
})
|
||||
->orWhere(function ($query) use ($search) {
|
||||
$query->whereHas('manufacturer', function ($query) use ($search) {
|
||||
$query->where('name', 'LIKE', '%'.$search.'%');
|
||||
$query->where('manufacturers.name', 'LIKE', '%'.$search.'%');
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ class Component extends SnipeModel
|
||||
|
||||
public function assets()
|
||||
{
|
||||
return $this->belongsToMany('\App\Models\Asset', 'components_assets')->withPivot('assigned_qty', 'created_at', 'user_id');
|
||||
return $this->belongsToMany('\App\Models\Asset', 'components_assets')->withPivot('id', 'assigned_qty', 'created_at', 'user_id');
|
||||
}
|
||||
|
||||
public function admin()
|
||||
|
||||
@@ -62,9 +62,18 @@ class CustomField extends Model
|
||||
return true;
|
||||
}
|
||||
|
||||
return Schema::table(CustomField::$table_name, function ($table) use ($custom_field) {
|
||||
$platform = Schema::getConnection()->getDoctrineSchemaManager()->getDatabasePlatform();
|
||||
$platform->registerDoctrineTypeMapping('enum', 'string');
|
||||
|
||||
Schema::table(CustomField::$table_name, function ($table) use ($custom_field) {
|
||||
$table->renameColumn($custom_field->convertUnicodeDbSlug($custom_field->getOriginal("name")), $custom_field->convertUnicodeDbSlug());
|
||||
});
|
||||
|
||||
|
||||
$custom_field->db_column = $custom_field->convertUnicodeDbSlug();
|
||||
$custom_field->save();
|
||||
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
||||
@@ -36,4 +36,21 @@ class Group extends SnipeModel
|
||||
{
|
||||
return json_decode($this->permissions, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Query builder scope to search on text
|
||||
*
|
||||
* @param Illuminate\Database\Query\Builder $query Query builder instance
|
||||
* @param text $search Search term
|
||||
*
|
||||
* @return Illuminate\Database\Query\Builder Modified query builder
|
||||
*/
|
||||
public function scopeTextSearch($query, $search)
|
||||
{
|
||||
|
||||
return $query->where(function ($query) use ($search) {
|
||||
|
||||
$query->where('name', 'LIKE', '%'.$search.'%');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,6 +96,8 @@ class Ldap extends Model
|
||||
$userDn = $ldap_username_field.'='.$username.','.$settings->ldap_basedn;
|
||||
}
|
||||
|
||||
\Log::debug('Attempting to login using distinguished name:'.$userDn);
|
||||
|
||||
|
||||
$filterQuery = $settings->ldap_auth_filter_query . $username;
|
||||
|
||||
|
||||
@@ -83,6 +83,11 @@ class Location extends SnipeModel
|
||||
// return $this->hasMany('\App\Models\Asset', 'assigned_to')->withTrashed();
|
||||
}
|
||||
|
||||
public function setLdapOuAttribute($ldap_ou)
|
||||
{
|
||||
return $this->attributes['ldap_ou'] = empty($ldap_ou) ? null : $ldap_ou;
|
||||
}
|
||||
|
||||
public static function getLocationHierarchy($locations, $parent_id = null)
|
||||
{
|
||||
|
||||
|
||||
@@ -45,13 +45,12 @@ class CheckoutNotification extends Notification
|
||||
$item = $this->params['item'];
|
||||
|
||||
if (class_basename(get_class($this->params['item']))=='Asset') {
|
||||
$notifyBy[] = 'mail';
|
||||
if ((method_exists($item, 'requireAcceptance') && ($item->requireAcceptance() == '1'))
|
||||
|| (method_exists($item, 'getEula') && ($item->getEula()))
|
||||
) {
|
||||
$notifyBy[] = 'mail';
|
||||
}
|
||||
}
|
||||
// if ((method_exists($item, 'requireAcceptance') && ($item->requireAcceptance()=='1'))
|
||||
// || (method_exists($item, 'getEula') && ($item->getEula()))
|
||||
// ) {
|
||||
// $notifyBy[] = 'mail';
|
||||
// }
|
||||
return $notifyBy;
|
||||
}
|
||||
|
||||
@@ -83,6 +82,7 @@ class CheckoutNotification extends Notification
|
||||
*/
|
||||
public function toMail($notifiable)
|
||||
{
|
||||
if (class_basename(get_class($this->params['item']))=='Asset') {
|
||||
|
||||
//TODO: Expand for non assets.
|
||||
$item = $this->params['item'];
|
||||
@@ -101,9 +101,14 @@ class CheckoutNotification extends Notification
|
||||
'log_id' => $this->params['log_id'],
|
||||
];
|
||||
|
||||
return (new MailMessage)
|
||||
->view('emails.accept-asset', $data)
|
||||
->subject(trans('mail.Confirm_asset_delivery'));
|
||||
if ((method_exists($item, 'requireAcceptance') && ($item->requireAcceptance() == '1'))
|
||||
|| (method_exists($item, 'getEula') && ($item->getEula()))
|
||||
) {
|
||||
return (new MailMessage)
|
||||
->view('emails.accept-asset', $data)
|
||||
->subject(trans('mail.Confirm_asset_delivery'));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
<?php
|
||||
|
||||
namespace App\Policies;
|
||||
|
||||
use App\Models\Company;
|
||||
use App\Models\Category;
|
||||
use App\Models\User;
|
||||
use Illuminate\Auth\Access\HandlesAuthorization;
|
||||
|
||||
class CategoryPolicy
|
||||
{
|
||||
use HandlesAuthorization;
|
||||
|
||||
|
||||
public function before(User $user, $category)
|
||||
{
|
||||
// Lets move all company related checks here.
|
||||
if ($category instanceof \App\Models\Category && !Company::isCurrentUserHasAccess($category)) {
|
||||
return false;
|
||||
}
|
||||
// If an admin, they can do all asset related tasks.
|
||||
if ($user->hasAccess('admin')) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Determine whether the user can view the category.
|
||||
*
|
||||
* @param \App\Models\User $user
|
||||
* @param \App\Category $category
|
||||
* @return mixed
|
||||
*/
|
||||
public function view(User $user)
|
||||
{
|
||||
return $user->hasAccess('categories.view');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can create categories.
|
||||
*
|
||||
* @param \App\Models\User $user
|
||||
* @return mixed
|
||||
*/
|
||||
public function create(User $user)
|
||||
{
|
||||
return $user->hasAccess('categories.create');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can update the category.
|
||||
*
|
||||
* @param \App\Models\User $user
|
||||
* @param \App\Category $category
|
||||
* @return mixed
|
||||
*/
|
||||
public function update(User $user)
|
||||
{
|
||||
//
|
||||
return $user->hasAccess('categories.edit');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can delete the category.
|
||||
*
|
||||
* @param \App\Models\User $user
|
||||
* @param \App\Category $category
|
||||
* @return mixed
|
||||
*/
|
||||
public function delete(User $user)
|
||||
{
|
||||
//
|
||||
return $user->hasAccess('categories.delete');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can view the category index.
|
||||
*
|
||||
* @param \App\Models\User $user
|
||||
* @param \App\Models\Category $category
|
||||
* @return mixed
|
||||
*/
|
||||
|
||||
public function index(User $user)
|
||||
{
|
||||
return $user->hasAccess('categories.view');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can manage the category.
|
||||
*
|
||||
* @param \App\Models\User $user
|
||||
* @param \App\Models\Category $category
|
||||
* @return mixed
|
||||
*/
|
||||
public function manage(User $user)
|
||||
{
|
||||
return $user->hasAccess('categories.edit');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
<?php
|
||||
|
||||
namespace App\Policies;
|
||||
|
||||
use App\Models\Company;
|
||||
use App\Models\Location;
|
||||
use App\Models\User;
|
||||
use Illuminate\Auth\Access\HandlesAuthorization;
|
||||
|
||||
class LocationPolicy
|
||||
{
|
||||
use HandlesAuthorization;
|
||||
|
||||
|
||||
public function before(User $user, $location)
|
||||
{
|
||||
// Lets move all company related checks here.
|
||||
if ($location instanceof \App\Models\Location && !Company::isCurrentUserHasAccess($location)) {
|
||||
return false;
|
||||
}
|
||||
// If an admin, they can do all asset related tasks.
|
||||
if ($user->hasAccess('admin')) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Determine whether the user can view the location.
|
||||
*
|
||||
* @param \App\Models\User $user
|
||||
* @param \App\Models\Location $location
|
||||
* @return mixed
|
||||
*/
|
||||
public function view(User $user)
|
||||
{
|
||||
return $user->hasAccess('locations.view');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can create locations.
|
||||
*
|
||||
* @param \App\Models\\User $user
|
||||
* @return mixed
|
||||
*/
|
||||
public function create(User $user)
|
||||
{
|
||||
return $user->hasAccess('locations.create');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can update the location.
|
||||
*
|
||||
* @param \App\Models\User $user
|
||||
* @param \App\Models\Location $location
|
||||
* @return mixed
|
||||
*/
|
||||
public function update(User $user)
|
||||
{
|
||||
//
|
||||
return $user->hasAccess('locations.edit');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can delete the location.
|
||||
*
|
||||
* @param \App\Models\User $user
|
||||
* @param \App\Models\Location $location
|
||||
* @return mixed
|
||||
*/
|
||||
public function delete(User $user)
|
||||
{
|
||||
//
|
||||
return $user->hasAccess('locations.delete');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can view the location index.
|
||||
*
|
||||
* @param \App\Models\User $user
|
||||
* @param \App\Models\Accessory $location
|
||||
* @return mixed
|
||||
*/
|
||||
|
||||
public function index(User $user)
|
||||
{
|
||||
return $user->hasAccess('locations.view');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can manage the location.
|
||||
*
|
||||
* @param \App\Models\User $user
|
||||
* @param \App\Models\Location $location
|
||||
* @return mixed
|
||||
*/
|
||||
public function manage(User $user)
|
||||
{
|
||||
return $user->hasAccess('locations.edit');
|
||||
}
|
||||
}
|
||||
@@ -122,55 +122,6 @@ class AccessoryPresenter extends Presenter
|
||||
return json_encode($layout);
|
||||
}
|
||||
|
||||
/**
|
||||
* JSON representation of Accessory for datatable.
|
||||
* @return array
|
||||
*/
|
||||
public function forDataTable()
|
||||
{
|
||||
|
||||
$actions = '<nobr>';
|
||||
if (Gate::allows('checkout', $this->model)) {
|
||||
$actions .= Helper::generateDatatableButton(
|
||||
'checkout',
|
||||
route('checkout/accessory', $this->id),
|
||||
$this->numRemaining() > 0
|
||||
);
|
||||
}
|
||||
if (Gate::allows('update', $this->model)) {
|
||||
$actions .= Helper::generateDatatableButton('edit', route('accessories.edit', $this->id));
|
||||
}
|
||||
if (Gate::allows('delete', $this->model)) {
|
||||
$actions .= Helper::generateDatatableButton(
|
||||
'delete',
|
||||
route('accessories.destroy', $this->id),
|
||||
true, /*enabled*/
|
||||
trans('admin/accessories/message.delete.confirm'),
|
||||
$this->name
|
||||
);
|
||||
}
|
||||
$actions .= '</nobr>';
|
||||
|
||||
$results = [];
|
||||
$results['name'] = $this->nameUrl();
|
||||
$results['category'] = '';
|
||||
if ($this->model->category) {
|
||||
$results['category'] = $this->model->category->present()->nameUrl();
|
||||
}
|
||||
$results['model_number'] = $this->model_number;
|
||||
$results['qty'] = $this->qty;
|
||||
$results['order_number'] = $this->order_number;
|
||||
$results['min_amt'] = $this->min_amt;
|
||||
$results['location'] = $this->model->location ? $this->model->location->present()->nameUrl() : '';
|
||||
$results['purchase_date'] = $this->purchase_date;
|
||||
$results['purchase_cost'] = Helper::formatCurrencyOutput($this->purchase_cost);
|
||||
$results['numRemaining'] = $this->numRemaining();
|
||||
$results['companyName'] = $this->model->company ? $this->model->company->present()->nameUrl() : '';
|
||||
$results['manufacturer'] = $this->model->manufacturer ? $this->model->manufacturer->present()->nameUrl() : '';
|
||||
$results['actions'] = $actions;
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
/**
|
||||
* Pregenerated link to this accessories view page.
|
||||
|
||||
@@ -63,20 +63,21 @@ class CategoryPresenter extends Presenter
|
||||
"title" => trans('general.components'),
|
||||
"visible" => true
|
||||
], [
|
||||
"field" => "use_default_eula",
|
||||
"field" => "eula",
|
||||
"searchable" => false,
|
||||
"sortable" => false,
|
||||
"title" => trans('admin/categories/table.eula_text'),
|
||||
"visible" => false,
|
||||
"formatter" => 'trueFalseFormatter',
|
||||
], [
|
||||
], [
|
||||
"field" => "require_acceptance",
|
||||
"searchable" => false,
|
||||
"sortable" => false,
|
||||
"title" => trans('admin/categories/table.require_acceptance'),
|
||||
"visible" => true,
|
||||
"formatter" => 'trueFalseFormatter',
|
||||
], [
|
||||
],
|
||||
[
|
||||
"field" => "actions",
|
||||
"searchable" => false,
|
||||
"sortable" => false,
|
||||
|
||||
@@ -120,5 +120,14 @@ class ComponentPresenter extends Presenter
|
||||
return (string) link_to_route('consumables.show', e($this->name), $this->id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Url to view this item.
|
||||
* @return string
|
||||
*/
|
||||
public function viewUrl()
|
||||
{
|
||||
return route('accessories.show', $this->id);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -110,6 +110,12 @@ class LicensePresenter extends Presenter
|
||||
"sortable" => true,
|
||||
"visible" => false,
|
||||
"title" => trans('general.order_number'),
|
||||
], [
|
||||
"field" => "notes",
|
||||
"searchable" => true,
|
||||
"sortable" => true,
|
||||
"visible" => false,
|
||||
"title" => trans('general.notes'),
|
||||
]
|
||||
];
|
||||
|
||||
|
||||
@@ -5,7 +5,9 @@ namespace App\Providers;
|
||||
use App\Models\Accessory;
|
||||
use Carbon\Carbon;
|
||||
use App\Models\Asset;
|
||||
use App\Models\Location;
|
||||
use App\Models\Component;
|
||||
use App\Models\Category;
|
||||
use App\Models\Consumable;
|
||||
use App\Models\License;
|
||||
use App\Models\User;
|
||||
@@ -14,6 +16,8 @@ use App\Policies\AssetPolicy;
|
||||
use App\Policies\ComponentPolicy;
|
||||
use App\Policies\ConsumablePolicy;
|
||||
use App\Policies\LicensePolicy;
|
||||
use App\Policies\LocationPolicy;
|
||||
use App\Policies\CategoryPolicy;
|
||||
use App\Policies\UserPolicy;
|
||||
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
@@ -33,6 +37,8 @@ class AuthServiceProvider extends ServiceProvider
|
||||
Consumable::class => ConsumablePolicy::class,
|
||||
License::class => LicensePolicy::class,
|
||||
User::class => UserPolicy::class,
|
||||
Location::class => LocationPolicy::class,
|
||||
Category::class => CategoryPolicy::class,
|
||||
];
|
||||
|
||||
/**
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
"phpdocumentor/reflection-docblock": "3.2.2",
|
||||
"phpspec/prophecy": "1.6.2",
|
||||
"pragmarx/google2fa": "^1.0",
|
||||
"predis/predis": "^1.1",
|
||||
"schuppo/password-strength": "~1.5",
|
||||
"spatie/laravel-backup": "^3.0.0",
|
||||
"tecnickcom/tc-lib-barcode": "^1.15",
|
||||
|
||||
Generated
+162
-111
@@ -4,7 +4,8 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "0806112cf7a9396f0a7d89649ea7060b",
|
||||
"hash": "abe6a702f2383ae1fd4c9bbfb06c47ee",
|
||||
"content-hash": "7659dd61c86bb042a246c2fa313d79a6",
|
||||
"packages": [
|
||||
{
|
||||
"name": "aws/aws-sdk-php",
|
||||
@@ -84,7 +85,7 @@
|
||||
"s3",
|
||||
"sdk"
|
||||
],
|
||||
"time": "2017-09-29T19:46:41+00:00"
|
||||
"time": "2017-09-29 19:46:41"
|
||||
},
|
||||
{
|
||||
"name": "aws/aws-sdk-php-laravel",
|
||||
@@ -140,7 +141,7 @@
|
||||
"s3",
|
||||
"sdk"
|
||||
],
|
||||
"time": "2016-01-18T06:57:07+00:00"
|
||||
"time": "2016-01-18 06:57:07"
|
||||
},
|
||||
{
|
||||
"name": "barryvdh/laravel-debugbar",
|
||||
@@ -189,7 +190,7 @@
|
||||
"profiler",
|
||||
"webprofiler"
|
||||
],
|
||||
"time": "2017-07-21T11:56:48+00:00"
|
||||
"time": "2017-07-21 11:56:48"
|
||||
},
|
||||
{
|
||||
"name": "christian-riesen/base32",
|
||||
@@ -243,7 +244,7 @@
|
||||
"encode",
|
||||
"rfc4648"
|
||||
],
|
||||
"time": "2016-05-05T11:49:03+00:00"
|
||||
"time": "2016-05-05 11:49:03"
|
||||
},
|
||||
{
|
||||
"name": "defuse/php-encryption",
|
||||
@@ -306,7 +307,7 @@
|
||||
"security",
|
||||
"symmetric key cryptography"
|
||||
],
|
||||
"time": "2017-05-18T21:28:48+00:00"
|
||||
"time": "2017-05-18 21:28:48"
|
||||
},
|
||||
{
|
||||
"name": "dnoegel/php-xdg-base-dir",
|
||||
@@ -339,7 +340,7 @@
|
||||
"MIT"
|
||||
],
|
||||
"description": "implementation of xdg base directory specification for php",
|
||||
"time": "2014-10-24T07:27:01+00:00"
|
||||
"time": "2014-10-24 07:27:01"
|
||||
},
|
||||
{
|
||||
"name": "doctrine/annotations",
|
||||
@@ -407,7 +408,7 @@
|
||||
"docblock",
|
||||
"parser"
|
||||
],
|
||||
"time": "2017-02-24T16:22:25+00:00"
|
||||
"time": "2017-02-24 16:22:25"
|
||||
},
|
||||
{
|
||||
"name": "doctrine/cache",
|
||||
@@ -477,7 +478,7 @@
|
||||
"cache",
|
||||
"caching"
|
||||
],
|
||||
"time": "2017-07-22T12:49:21+00:00"
|
||||
"time": "2017-07-22 12:49:21"
|
||||
},
|
||||
{
|
||||
"name": "doctrine/collections",
|
||||
@@ -544,7 +545,7 @@
|
||||
"collections",
|
||||
"iterator"
|
||||
],
|
||||
"time": "2017-01-03T10:49:41+00:00"
|
||||
"time": "2017-01-03 10:49:41"
|
||||
},
|
||||
{
|
||||
"name": "doctrine/common",
|
||||
@@ -617,7 +618,7 @@
|
||||
"persistence",
|
||||
"spl"
|
||||
],
|
||||
"time": "2017-07-22T08:35:12+00:00"
|
||||
"time": "2017-07-22 08:35:12"
|
||||
},
|
||||
{
|
||||
"name": "doctrine/dbal",
|
||||
@@ -688,7 +689,7 @@
|
||||
"persistence",
|
||||
"queryobject"
|
||||
],
|
||||
"time": "2017-07-22T20:44:48+00:00"
|
||||
"time": "2017-07-22 20:44:48"
|
||||
},
|
||||
{
|
||||
"name": "doctrine/inflector",
|
||||
@@ -755,7 +756,7 @@
|
||||
"singularize",
|
||||
"string"
|
||||
],
|
||||
"time": "2015-11-06T14:35:42+00:00"
|
||||
"time": "2015-11-06 14:35:42"
|
||||
},
|
||||
{
|
||||
"name": "doctrine/instantiator",
|
||||
@@ -809,7 +810,7 @@
|
||||
"constructor",
|
||||
"instantiate"
|
||||
],
|
||||
"time": "2015-06-14T21:17:01+00:00"
|
||||
"time": "2015-06-14 21:17:01"
|
||||
},
|
||||
{
|
||||
"name": "doctrine/lexer",
|
||||
@@ -863,7 +864,7 @@
|
||||
"lexer",
|
||||
"parser"
|
||||
],
|
||||
"time": "2014-09-09T13:34:57+00:00"
|
||||
"time": "2014-09-09 13:34:57"
|
||||
},
|
||||
{
|
||||
"name": "erusev/parsedown",
|
||||
@@ -905,7 +906,7 @@
|
||||
"markdown",
|
||||
"parser"
|
||||
],
|
||||
"time": "2017-05-14T14:47:48+00:00"
|
||||
"time": "2017-05-14 14:47:48"
|
||||
},
|
||||
{
|
||||
"name": "fideloper/proxy",
|
||||
@@ -962,7 +963,7 @@
|
||||
"proxy",
|
||||
"trusted proxy"
|
||||
],
|
||||
"time": "2017-06-15T17:19:42+00:00"
|
||||
"time": "2017-06-15 17:19:42"
|
||||
},
|
||||
{
|
||||
"name": "firebase/php-jwt",
|
||||
@@ -1005,7 +1006,7 @@
|
||||
],
|
||||
"description": "A simple library to encode and decode JSON Web Tokens (JWT) in PHP. Should conform to the current spec.",
|
||||
"homepage": "https://github.com/firebase/php-jwt",
|
||||
"time": "2016-07-18T04:51:16+00:00"
|
||||
"time": "2016-07-18 04:51:16"
|
||||
},
|
||||
{
|
||||
"name": "guzzlehttp/guzzle",
|
||||
@@ -1070,7 +1071,7 @@
|
||||
"rest",
|
||||
"web service"
|
||||
],
|
||||
"time": "2017-06-22T18:50:49+00:00"
|
||||
"time": "2017-06-22 18:50:49"
|
||||
},
|
||||
{
|
||||
"name": "guzzlehttp/promises",
|
||||
@@ -1121,7 +1122,7 @@
|
||||
"keywords": [
|
||||
"promise"
|
||||
],
|
||||
"time": "2016-12-20T10:07:11+00:00"
|
||||
"time": "2016-12-20 10:07:11"
|
||||
},
|
||||
{
|
||||
"name": "guzzlehttp/psr7",
|
||||
@@ -1186,7 +1187,7 @@
|
||||
"uri",
|
||||
"url"
|
||||
],
|
||||
"time": "2017-03-20T17:10:46+00:00"
|
||||
"time": "2017-03-20 17:10:46"
|
||||
},
|
||||
{
|
||||
"name": "intervention/image",
|
||||
@@ -1256,7 +1257,7 @@
|
||||
"thumbnail",
|
||||
"watermark"
|
||||
],
|
||||
"time": "2017-09-21T16:29:17+00:00"
|
||||
"time": "2017-09-21 16:29:17"
|
||||
},
|
||||
{
|
||||
"name": "jakub-onderka/php-console-color",
|
||||
@@ -1299,7 +1300,7 @@
|
||||
"homepage": "http://www.acci.cz"
|
||||
}
|
||||
],
|
||||
"time": "2014-04-08T15:00:19+00:00"
|
||||
"time": "2014-04-08 15:00:19"
|
||||
},
|
||||
{
|
||||
"name": "jakub-onderka/php-console-highlighter",
|
||||
@@ -1343,7 +1344,7 @@
|
||||
"homepage": "http://www.acci.cz/"
|
||||
}
|
||||
],
|
||||
"time": "2015-04-20T18:58:01+00:00"
|
||||
"time": "2015-04-20 18:58:01"
|
||||
},
|
||||
{
|
||||
"name": "javiereguiluz/easyslugger",
|
||||
@@ -1373,7 +1374,7 @@
|
||||
"MIT"
|
||||
],
|
||||
"description": "A fast and easy to use slugger with full UTF-8 support.",
|
||||
"time": "2015-04-12T19:57:10+00:00"
|
||||
"time": "2015-04-12 19:57:10"
|
||||
},
|
||||
{
|
||||
"name": "jenssegers/rollbar",
|
||||
@@ -1425,7 +1426,7 @@
|
||||
"monitoring",
|
||||
"rollbar"
|
||||
],
|
||||
"time": "2017-01-25T08:34:12+00:00"
|
||||
"time": "2017-01-25 08:34:12"
|
||||
},
|
||||
{
|
||||
"name": "laravel/framework",
|
||||
@@ -1554,7 +1555,7 @@
|
||||
"framework",
|
||||
"laravel"
|
||||
],
|
||||
"time": "2017-08-30T09:26:16+00:00"
|
||||
"time": "2017-08-30 09:26:16"
|
||||
},
|
||||
{
|
||||
"name": "laravel/passport",
|
||||
@@ -1618,7 +1619,7 @@
|
||||
"oauth",
|
||||
"passport"
|
||||
],
|
||||
"time": "2017-07-12T20:03:53+00:00"
|
||||
"time": "2017-07-12 20:03:53"
|
||||
},
|
||||
{
|
||||
"name": "laravel/tinker",
|
||||
@@ -1681,7 +1682,7 @@
|
||||
"laravel",
|
||||
"psysh"
|
||||
],
|
||||
"time": "2017-07-13T13:11:05+00:00"
|
||||
"time": "2017-07-13 13:11:05"
|
||||
},
|
||||
{
|
||||
"name": "laravelcollective/html",
|
||||
@@ -1735,7 +1736,7 @@
|
||||
],
|
||||
"description": "HTML and Form Builders for the Laravel Framework",
|
||||
"homepage": "http://laravelcollective.com",
|
||||
"time": "2017-08-12T15:52:38+00:00"
|
||||
"time": "2017-08-12 15:52:38"
|
||||
},
|
||||
{
|
||||
"name": "lcobucci/jwt",
|
||||
@@ -1793,7 +1794,7 @@
|
||||
"JWS",
|
||||
"jwt"
|
||||
],
|
||||
"time": "2017-09-01T08:23:26+00:00"
|
||||
"time": "2017-09-01 08:23:26"
|
||||
},
|
||||
{
|
||||
"name": "league/csv",
|
||||
@@ -1850,7 +1851,7 @@
|
||||
"read",
|
||||
"write"
|
||||
],
|
||||
"time": "2017-07-12T07:18:20+00:00"
|
||||
"time": "2017-07-12 07:18:20"
|
||||
},
|
||||
{
|
||||
"name": "league/event",
|
||||
@@ -1900,7 +1901,7 @@
|
||||
"event",
|
||||
"listener"
|
||||
],
|
||||
"time": "2015-05-21T12:24:47+00:00"
|
||||
"time": "2015-05-21 12:24:47"
|
||||
},
|
||||
{
|
||||
"name": "league/flysystem",
|
||||
@@ -1983,7 +1984,7 @@
|
||||
"sftp",
|
||||
"storage"
|
||||
],
|
||||
"time": "2017-08-06T17:41:04+00:00"
|
||||
"time": "2017-08-06 17:41:04"
|
||||
},
|
||||
{
|
||||
"name": "league/oauth2-server",
|
||||
@@ -2060,7 +2061,7 @@
|
||||
"secure",
|
||||
"server"
|
||||
],
|
||||
"time": "2017-07-11T06:31:36+00:00"
|
||||
"time": "2017-07-11 06:31:36"
|
||||
},
|
||||
{
|
||||
"name": "maknz/slack",
|
||||
@@ -2109,7 +2110,7 @@
|
||||
"laravel",
|
||||
"slack"
|
||||
],
|
||||
"time": "2015-06-03T03:35:16+00:00"
|
||||
"time": "2015-06-03 03:35:16"
|
||||
},
|
||||
{
|
||||
"name": "maximebf/debugbar",
|
||||
@@ -2170,7 +2171,7 @@
|
||||
"debug",
|
||||
"debugbar"
|
||||
],
|
||||
"time": "2017-01-05T08:46:19+00:00"
|
||||
"time": "2017-01-05 08:46:19"
|
||||
},
|
||||
{
|
||||
"name": "monolog/monolog",
|
||||
@@ -2248,7 +2249,7 @@
|
||||
"logging",
|
||||
"psr-3"
|
||||
],
|
||||
"time": "2017-06-19T01:22:40+00:00"
|
||||
"time": "2017-06-19 01:22:40"
|
||||
},
|
||||
{
|
||||
"name": "mtdowling/cron-expression",
|
||||
@@ -2292,7 +2293,7 @@
|
||||
"cron",
|
||||
"schedule"
|
||||
],
|
||||
"time": "2017-01-23T04:29:33+00:00"
|
||||
"time": "2017-01-23 04:29:33"
|
||||
},
|
||||
{
|
||||
"name": "mtdowling/jmespath.php",
|
||||
@@ -2347,7 +2348,7 @@
|
||||
"json",
|
||||
"jsonpath"
|
||||
],
|
||||
"time": "2016-12-03T22:08:25+00:00"
|
||||
"time": "2016-12-03 22:08:25"
|
||||
},
|
||||
{
|
||||
"name": "neitanod/forceutf8",
|
||||
@@ -2381,7 +2382,7 @@
|
||||
],
|
||||
"description": "PHP Class Encoding featuring popular Encoding::toUTF8() function --formerly known as forceUTF8()-- that fixes mixed encoded strings.",
|
||||
"homepage": "https://github.com/neitanod/forceutf8",
|
||||
"time": "2017-05-22T18:50:57+00:00"
|
||||
"time": "2017-05-22 18:50:57"
|
||||
},
|
||||
{
|
||||
"name": "nesbot/carbon",
|
||||
@@ -2434,7 +2435,7 @@
|
||||
"datetime",
|
||||
"time"
|
||||
],
|
||||
"time": "2017-01-16T07:55:07+00:00"
|
||||
"time": "2017-01-16 07:55:07"
|
||||
},
|
||||
{
|
||||
"name": "nikic/php-parser",
|
||||
@@ -2485,7 +2486,7 @@
|
||||
"parser",
|
||||
"php"
|
||||
],
|
||||
"time": "2017-09-02T17:10:46+00:00"
|
||||
"time": "2017-09-02 17:10:46"
|
||||
},
|
||||
{
|
||||
"name": "paragonie/random_compat",
|
||||
@@ -2533,7 +2534,7 @@
|
||||
"pseudorandom",
|
||||
"random"
|
||||
],
|
||||
"time": "2017-09-27T21:40:39+00:00"
|
||||
"time": "2017-09-27 21:40:39"
|
||||
},
|
||||
{
|
||||
"name": "patchwork/utf8",
|
||||
@@ -2592,7 +2593,7 @@
|
||||
"utf-8",
|
||||
"utf8"
|
||||
],
|
||||
"time": "2016-05-18T13:57:10+00:00"
|
||||
"time": "2016-05-18 13:57:10"
|
||||
},
|
||||
{
|
||||
"name": "phpdocumentor/reflection-common",
|
||||
@@ -2646,7 +2647,7 @@
|
||||
"reflection",
|
||||
"static analysis"
|
||||
],
|
||||
"time": "2017-09-11T18:02:19+00:00"
|
||||
"time": "2017-09-11 18:02:19"
|
||||
},
|
||||
{
|
||||
"name": "phpdocumentor/reflection-docblock",
|
||||
@@ -2691,7 +2692,7 @@
|
||||
}
|
||||
],
|
||||
"description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.",
|
||||
"time": "2017-08-08T06:39:58+00:00"
|
||||
"time": "2017-08-08 06:39:58"
|
||||
},
|
||||
{
|
||||
"name": "phpdocumentor/type-resolver",
|
||||
@@ -2738,7 +2739,7 @@
|
||||
"email": "me@mikevanriel.com"
|
||||
}
|
||||
],
|
||||
"time": "2017-06-03T08:32:36+00:00"
|
||||
"time": "2017-06-03 08:32:36"
|
||||
},
|
||||
{
|
||||
"name": "phpseclib/phpseclib",
|
||||
@@ -2830,7 +2831,7 @@
|
||||
"x.509",
|
||||
"x509"
|
||||
],
|
||||
"time": "2017-06-05T06:31:10+00:00"
|
||||
"time": "2017-06-05 06:31:10"
|
||||
},
|
||||
{
|
||||
"name": "phpspec/prophecy",
|
||||
@@ -2893,7 +2894,7 @@
|
||||
"spy",
|
||||
"stub"
|
||||
],
|
||||
"time": "2016-11-21T14:58:47+00:00"
|
||||
"time": "2016-11-21 14:58:47"
|
||||
},
|
||||
{
|
||||
"name": "pragmarx/google2fa",
|
||||
@@ -2954,7 +2955,57 @@
|
||||
"google2fa",
|
||||
"laravel"
|
||||
],
|
||||
"time": "2016-07-18T20:25:04+00:00"
|
||||
"time": "2016-07-18 20:25:04"
|
||||
},
|
||||
{
|
||||
"name": "predis/predis",
|
||||
"version": "v1.1.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/nrk/predis.git",
|
||||
"reference": "f0210e38881631afeafb56ab43405a92cafd9fd1"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/nrk/predis/zipball/f0210e38881631afeafb56ab43405a92cafd9fd1",
|
||||
"reference": "f0210e38881631afeafb56ab43405a92cafd9fd1",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.9"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "~4.8"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-curl": "Allows access to Webdis when paired with phpiredis",
|
||||
"ext-phpiredis": "Allows faster serialization and deserialization of the Redis protocol"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Predis\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Daniele Alessandri",
|
||||
"email": "suppakilla@gmail.com",
|
||||
"homepage": "http://clorophilla.net"
|
||||
}
|
||||
],
|
||||
"description": "Flexible and feature-complete Redis client for PHP and HHVM",
|
||||
"homepage": "http://github.com/nrk/predis",
|
||||
"keywords": [
|
||||
"nosql",
|
||||
"predis",
|
||||
"redis"
|
||||
],
|
||||
"time": "2016-06-16 16:22:20"
|
||||
},
|
||||
{
|
||||
"name": "psr/http-message",
|
||||
@@ -3004,7 +3055,7 @@
|
||||
"request",
|
||||
"response"
|
||||
],
|
||||
"time": "2016-08-06T14:39:51+00:00"
|
||||
"time": "2016-08-06 14:39:51"
|
||||
},
|
||||
{
|
||||
"name": "psr/log",
|
||||
@@ -3051,7 +3102,7 @@
|
||||
"psr",
|
||||
"psr-3"
|
||||
],
|
||||
"time": "2016-10-10T12:19:37+00:00"
|
||||
"time": "2016-10-10 12:19:37"
|
||||
},
|
||||
{
|
||||
"name": "psy/psysh",
|
||||
@@ -3124,7 +3175,7 @@
|
||||
"interactive",
|
||||
"shell"
|
||||
],
|
||||
"time": "2017-07-29T19:30:02+00:00"
|
||||
"time": "2017-07-29 19:30:02"
|
||||
},
|
||||
{
|
||||
"name": "ramsey/uuid",
|
||||
@@ -3206,7 +3257,7 @@
|
||||
"identifier",
|
||||
"uuid"
|
||||
],
|
||||
"time": "2017-09-22T20:46:04+00:00"
|
||||
"time": "2017-09-22 20:46:04"
|
||||
},
|
||||
{
|
||||
"name": "rollbar/rollbar",
|
||||
@@ -3256,7 +3307,7 @@
|
||||
"logging",
|
||||
"monitoring"
|
||||
],
|
||||
"time": "2016-07-05T15:50:29+00:00"
|
||||
"time": "2016-07-05 15:50:29"
|
||||
},
|
||||
{
|
||||
"name": "schuppo/password-strength",
|
||||
@@ -3306,7 +3357,7 @@
|
||||
"password strength",
|
||||
"validation"
|
||||
],
|
||||
"time": "2016-10-05T09:57:59+00:00"
|
||||
"time": "2016-10-05 09:57:59"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/comparator",
|
||||
@@ -3370,7 +3421,7 @@
|
||||
"compare",
|
||||
"equality"
|
||||
],
|
||||
"time": "2017-01-29T09:50:25+00:00"
|
||||
"time": "2017-01-29 09:50:25"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/diff",
|
||||
@@ -3422,7 +3473,7 @@
|
||||
"keywords": [
|
||||
"diff"
|
||||
],
|
||||
"time": "2017-05-22T07:24:03+00:00"
|
||||
"time": "2017-05-22 07:24:03"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/exporter",
|
||||
@@ -3489,7 +3540,7 @@
|
||||
"export",
|
||||
"exporter"
|
||||
],
|
||||
"time": "2016-11-19T08:54:04+00:00"
|
||||
"time": "2016-11-19 08:54:04"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/recursion-context",
|
||||
@@ -3542,7 +3593,7 @@
|
||||
],
|
||||
"description": "Provides functionality to recursively process PHP variables",
|
||||
"homepage": "http://www.github.com/sebastianbergmann/recursion-context",
|
||||
"time": "2016-11-19T07:33:16+00:00"
|
||||
"time": "2016-11-19 07:33:16"
|
||||
},
|
||||
{
|
||||
"name": "spatie/db-dumper",
|
||||
@@ -3592,7 +3643,7 @@
|
||||
"mysqldump",
|
||||
"spatie"
|
||||
],
|
||||
"time": "2016-06-14T13:23:01+00:00"
|
||||
"time": "2016-06-14 13:23:01"
|
||||
},
|
||||
{
|
||||
"name": "spatie/laravel-backup",
|
||||
@@ -3655,7 +3706,7 @@
|
||||
"laravel-backup",
|
||||
"spatie"
|
||||
],
|
||||
"time": "2017-02-18T09:54:12+00:00"
|
||||
"time": "2017-02-18 09:54:12"
|
||||
},
|
||||
{
|
||||
"name": "swiftmailer/swiftmailer",
|
||||
@@ -3709,7 +3760,7 @@
|
||||
"mail",
|
||||
"mailer"
|
||||
],
|
||||
"time": "2017-05-01T15:54:03+00:00"
|
||||
"time": "2017-05-01 15:54:03"
|
||||
},
|
||||
{
|
||||
"name": "symfony/console",
|
||||
@@ -3777,7 +3828,7 @@
|
||||
],
|
||||
"description": "Symfony Console Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2017-09-06T16:40:18+00:00"
|
||||
"time": "2017-09-06 16:40:18"
|
||||
},
|
||||
{
|
||||
"name": "symfony/css-selector",
|
||||
@@ -3830,7 +3881,7 @@
|
||||
],
|
||||
"description": "Symfony CssSelector Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2017-01-02T20:31:54+00:00"
|
||||
"time": "2017-01-02 20:31:54"
|
||||
},
|
||||
{
|
||||
"name": "symfony/debug",
|
||||
@@ -3886,7 +3937,7 @@
|
||||
],
|
||||
"description": "Symfony Debug Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2017-09-01T13:23:39+00:00"
|
||||
"time": "2017-09-01 13:23:39"
|
||||
},
|
||||
{
|
||||
"name": "symfony/event-dispatcher",
|
||||
@@ -3949,7 +4000,7 @@
|
||||
],
|
||||
"description": "Symfony EventDispatcher Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2017-07-29T21:54:42+00:00"
|
||||
"time": "2017-07-29 21:54:42"
|
||||
},
|
||||
{
|
||||
"name": "symfony/finder",
|
||||
@@ -3998,7 +4049,7 @@
|
||||
],
|
||||
"description": "Symfony Finder Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2017-07-29T21:54:42+00:00"
|
||||
"time": "2017-07-29 21:54:42"
|
||||
},
|
||||
{
|
||||
"name": "symfony/http-foundation",
|
||||
@@ -4051,7 +4102,7 @@
|
||||
],
|
||||
"description": "Symfony HttpFoundation Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2017-09-06T17:07:39+00:00"
|
||||
"time": "2017-09-06 17:07:39"
|
||||
},
|
||||
{
|
||||
"name": "symfony/http-kernel",
|
||||
@@ -4137,7 +4188,7 @@
|
||||
],
|
||||
"description": "Symfony HttpKernel Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2017-09-11T16:13:23+00:00"
|
||||
"time": "2017-09-11 16:13:23"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-mbstring",
|
||||
@@ -4196,7 +4247,7 @@
|
||||
"portable",
|
||||
"shim"
|
||||
],
|
||||
"time": "2017-06-14T15:44:48+00:00"
|
||||
"time": "2017-06-14 15:44:48"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-php56",
|
||||
@@ -4252,7 +4303,7 @@
|
||||
"portable",
|
||||
"shim"
|
||||
],
|
||||
"time": "2017-06-14T15:44:48+00:00"
|
||||
"time": "2017-06-14 15:44:48"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-util",
|
||||
@@ -4304,7 +4355,7 @@
|
||||
"polyfill",
|
||||
"shim"
|
||||
],
|
||||
"time": "2017-07-05T15:09:33+00:00"
|
||||
"time": "2017-07-05 15:09:33"
|
||||
},
|
||||
{
|
||||
"name": "symfony/process",
|
||||
@@ -4353,7 +4404,7 @@
|
||||
],
|
||||
"description": "Symfony Process Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2017-07-29T21:54:42+00:00"
|
||||
"time": "2017-07-29 21:54:42"
|
||||
},
|
||||
{
|
||||
"name": "symfony/psr-http-message-bridge",
|
||||
@@ -4413,7 +4464,7 @@
|
||||
"http-message",
|
||||
"psr-7"
|
||||
],
|
||||
"time": "2016-09-14T18:37:20+00:00"
|
||||
"time": "2016-09-14 18:37:20"
|
||||
},
|
||||
{
|
||||
"name": "symfony/routing",
|
||||
@@ -4491,7 +4542,7 @@
|
||||
"uri",
|
||||
"url"
|
||||
],
|
||||
"time": "2017-07-29T21:54:42+00:00"
|
||||
"time": "2017-07-29 21:54:42"
|
||||
},
|
||||
{
|
||||
"name": "symfony/translation",
|
||||
@@ -4556,7 +4607,7 @@
|
||||
],
|
||||
"description": "Symfony Translation Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2017-07-29T21:54:42+00:00"
|
||||
"time": "2017-07-29 21:54:42"
|
||||
},
|
||||
{
|
||||
"name": "symfony/var-dumper",
|
||||
@@ -4624,7 +4675,7 @@
|
||||
"debug",
|
||||
"dump"
|
||||
],
|
||||
"time": "2017-08-27T14:52:21+00:00"
|
||||
"time": "2017-08-27 14:52:21"
|
||||
},
|
||||
{
|
||||
"name": "tecnickcom/tc-lib-barcode",
|
||||
@@ -4714,7 +4765,7 @@
|
||||
"tc-lib-barcode",
|
||||
"upc"
|
||||
],
|
||||
"time": "2017-02-12T13:51:39+00:00"
|
||||
"time": "2017-02-12 13:51:39"
|
||||
},
|
||||
{
|
||||
"name": "tecnickcom/tc-lib-color",
|
||||
@@ -4777,7 +4828,7 @@
|
||||
"tc-lib-color",
|
||||
"web"
|
||||
],
|
||||
"time": "2017-02-12T12:07:38+00:00"
|
||||
"time": "2017-02-12 12:07:38"
|
||||
},
|
||||
{
|
||||
"name": "tightenco/ziggy",
|
||||
@@ -4827,7 +4878,7 @@
|
||||
}
|
||||
],
|
||||
"description": "Generates a Blade directive exporting all of your named Laravel routes. Also provides a nice route() helper function in JavaScript.",
|
||||
"time": "2017-08-23T11:48:08+00:00"
|
||||
"time": "2017-08-23 11:48:08"
|
||||
},
|
||||
{
|
||||
"name": "tijsverkoyen/css-to-inline-styles",
|
||||
@@ -4874,7 +4925,7 @@
|
||||
],
|
||||
"description": "CssToInlineStyles is a class that enables you to convert HTML-pages/files into HTML-pages/files with inline styles. This is very useful when you're sending emails.",
|
||||
"homepage": "https://github.com/tijsverkoyen/CssToInlineStyles",
|
||||
"time": "2016-09-20T12:50:39+00:00"
|
||||
"time": "2016-09-20 12:50:39"
|
||||
},
|
||||
{
|
||||
"name": "unicodeveloper/laravel-password",
|
||||
@@ -4929,7 +4980,7 @@
|
||||
"security",
|
||||
"unicodeveloper"
|
||||
],
|
||||
"time": "2017-04-27T07:35:00+00:00"
|
||||
"time": "2017-04-27 07:35:00"
|
||||
},
|
||||
{
|
||||
"name": "vlucas/phpdotenv",
|
||||
@@ -4979,7 +5030,7 @@
|
||||
"env",
|
||||
"environment"
|
||||
],
|
||||
"time": "2016-09-01T10:05:43+00:00"
|
||||
"time": "2016-09-01 10:05:43"
|
||||
},
|
||||
{
|
||||
"name": "watson/validating",
|
||||
@@ -5029,7 +5080,7 @@
|
||||
"laravel",
|
||||
"validation"
|
||||
],
|
||||
"time": "2017-08-25T02:12:38+00:00"
|
||||
"time": "2017-08-25 02:12:38"
|
||||
},
|
||||
{
|
||||
"name": "webmozart/assert",
|
||||
@@ -5079,7 +5130,7 @@
|
||||
"check",
|
||||
"validate"
|
||||
],
|
||||
"time": "2016-11-23T20:04:58+00:00"
|
||||
"time": "2016-11-23 20:04:58"
|
||||
},
|
||||
{
|
||||
"name": "zendframework/zend-diactoros",
|
||||
@@ -5131,7 +5182,7 @@
|
||||
"psr",
|
||||
"psr-7"
|
||||
],
|
||||
"time": "2017-09-13T14:47:08+00:00"
|
||||
"time": "2017-09-13 14:47:08"
|
||||
}
|
||||
],
|
||||
"packages-dev": [
|
||||
@@ -5192,7 +5243,7 @@
|
||||
"gherkin",
|
||||
"parser"
|
||||
],
|
||||
"time": "2016-10-30T11:50:56+00:00"
|
||||
"time": "2016-10-30 11:50:56"
|
||||
},
|
||||
{
|
||||
"name": "codeception/codeception",
|
||||
@@ -5286,7 +5337,7 @@
|
||||
"functional testing",
|
||||
"unit testing"
|
||||
],
|
||||
"time": "2017-09-28T23:19:49+00:00"
|
||||
"time": "2017-09-28 23:19:49"
|
||||
},
|
||||
{
|
||||
"name": "facebook/webdriver",
|
||||
@@ -5338,7 +5389,7 @@
|
||||
"selenium",
|
||||
"webdriver"
|
||||
],
|
||||
"time": "2017-04-28T14:54:49+00:00"
|
||||
"time": "2017-04-28 14:54:49"
|
||||
},
|
||||
{
|
||||
"name": "fzaninotto/faker",
|
||||
@@ -5388,7 +5439,7 @@
|
||||
"faker",
|
||||
"fixtures"
|
||||
],
|
||||
"time": "2017-08-15T16:48:10+00:00"
|
||||
"time": "2017-08-15 16:48:10"
|
||||
},
|
||||
{
|
||||
"name": "myclabs/deep-copy",
|
||||
@@ -5430,7 +5481,7 @@
|
||||
"object",
|
||||
"object graph"
|
||||
],
|
||||
"time": "2017-04-12T18:52:22+00:00"
|
||||
"time": "2017-04-12 18:52:22"
|
||||
},
|
||||
{
|
||||
"name": "phpunit/php-code-coverage",
|
||||
@@ -5493,7 +5544,7 @@
|
||||
"testing",
|
||||
"xunit"
|
||||
],
|
||||
"time": "2017-04-02T07:44:40+00:00"
|
||||
"time": "2017-04-02 07:44:40"
|
||||
},
|
||||
{
|
||||
"name": "phpunit/php-file-iterator",
|
||||
@@ -5540,7 +5591,7 @@
|
||||
"filesystem",
|
||||
"iterator"
|
||||
],
|
||||
"time": "2016-10-03T07:40:28+00:00"
|
||||
"time": "2016-10-03 07:40:28"
|
||||
},
|
||||
{
|
||||
"name": "phpunit/php-text-template",
|
||||
@@ -5581,7 +5632,7 @@
|
||||
"keywords": [
|
||||
"template"
|
||||
],
|
||||
"time": "2015-06-21T13:50:34+00:00"
|
||||
"time": "2015-06-21 13:50:34"
|
||||
},
|
||||
{
|
||||
"name": "phpunit/php-timer",
|
||||
@@ -5630,7 +5681,7 @@
|
||||
"keywords": [
|
||||
"timer"
|
||||
],
|
||||
"time": "2017-02-26T11:10:40+00:00"
|
||||
"time": "2017-02-26 11:10:40"
|
||||
},
|
||||
{
|
||||
"name": "phpunit/php-token-stream",
|
||||
@@ -5679,7 +5730,7 @@
|
||||
"keywords": [
|
||||
"tokenizer"
|
||||
],
|
||||
"time": "2017-02-27T10:12:30+00:00"
|
||||
"time": "2017-02-27 10:12:30"
|
||||
},
|
||||
{
|
||||
"name": "phpunit/phpunit",
|
||||
@@ -5761,7 +5812,7 @@
|
||||
"testing",
|
||||
"xunit"
|
||||
],
|
||||
"time": "2017-09-24T07:23:38+00:00"
|
||||
"time": "2017-09-24 07:23:38"
|
||||
},
|
||||
{
|
||||
"name": "phpunit/phpunit-mock-objects",
|
||||
@@ -5820,7 +5871,7 @@
|
||||
"mock",
|
||||
"xunit"
|
||||
],
|
||||
"time": "2017-06-30T09:13:00+00:00"
|
||||
"time": "2017-06-30 09:13:00"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/code-unit-reverse-lookup",
|
||||
@@ -5865,7 +5916,7 @@
|
||||
],
|
||||
"description": "Looks up which function or method a line of code belongs to",
|
||||
"homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/",
|
||||
"time": "2017-03-04T06:30:41+00:00"
|
||||
"time": "2017-03-04 06:30:41"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/environment",
|
||||
@@ -5915,7 +5966,7 @@
|
||||
"environment",
|
||||
"hhvm"
|
||||
],
|
||||
"time": "2016-11-26T07:53:53+00:00"
|
||||
"time": "2016-11-26 07:53:53"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/global-state",
|
||||
@@ -5966,7 +6017,7 @@
|
||||
"keywords": [
|
||||
"global state"
|
||||
],
|
||||
"time": "2015-10-12T03:26:01+00:00"
|
||||
"time": "2015-10-12 03:26:01"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/object-enumerator",
|
||||
@@ -6012,7 +6063,7 @@
|
||||
],
|
||||
"description": "Traverses array structures and object graphs to enumerate all referenced objects",
|
||||
"homepage": "https://github.com/sebastianbergmann/object-enumerator/",
|
||||
"time": "2017-02-18T15:18:39+00:00"
|
||||
"time": "2017-02-18 15:18:39"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/resource-operations",
|
||||
@@ -6054,7 +6105,7 @@
|
||||
],
|
||||
"description": "Provides a list of PHP built-in functions that operate on resources",
|
||||
"homepage": "https://www.github.com/sebastianbergmann/resource-operations",
|
||||
"time": "2015-07-28T20:34:47+00:00"
|
||||
"time": "2015-07-28 20:34:47"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/version",
|
||||
@@ -6097,7 +6148,7 @@
|
||||
],
|
||||
"description": "Library that helps with managing the version number of Git-hosted PHP projects",
|
||||
"homepage": "https://github.com/sebastianbergmann/version",
|
||||
"time": "2016-10-03T07:35:21+00:00"
|
||||
"time": "2016-10-03 07:35:21"
|
||||
},
|
||||
{
|
||||
"name": "squizlabs/php_codesniffer",
|
||||
@@ -6148,7 +6199,7 @@
|
||||
"phpcs",
|
||||
"standards"
|
||||
],
|
||||
"time": "2017-09-19T22:47:14+00:00"
|
||||
"time": "2017-09-19 22:47:14"
|
||||
},
|
||||
{
|
||||
"name": "stecman/symfony-console-completion",
|
||||
@@ -6193,7 +6244,7 @@
|
||||
}
|
||||
],
|
||||
"description": "Automatic BASH completion for Symfony Console Component based applications.",
|
||||
"time": "2016-02-24T05:08:54+00:00"
|
||||
"time": "2016-02-24 05:08:54"
|
||||
},
|
||||
{
|
||||
"name": "symfony/browser-kit",
|
||||
@@ -6250,7 +6301,7 @@
|
||||
],
|
||||
"description": "Symfony BrowserKit Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2017-07-29T21:54:42+00:00"
|
||||
"time": "2017-07-29 21:54:42"
|
||||
},
|
||||
{
|
||||
"name": "symfony/dom-crawler",
|
||||
@@ -6306,7 +6357,7 @@
|
||||
],
|
||||
"description": "Symfony DomCrawler Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2017-01-21T17:13:55+00:00"
|
||||
"time": "2017-01-21 17:13:55"
|
||||
},
|
||||
{
|
||||
"name": "symfony/yaml",
|
||||
@@ -6361,7 +6412,7 @@
|
||||
],
|
||||
"description": "Symfony Yaml Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2017-07-29T21:54:42+00:00"
|
||||
"time": "2017-07-29 21:54:42"
|
||||
}
|
||||
],
|
||||
"aliases": [],
|
||||
|
||||
+4
-4
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
return array (
|
||||
'app_version' => 'v4.0.8',
|
||||
'build_version' => '102',
|
||||
'hash_version' => 'gef19bc7',
|
||||
'full_hash' => 'v4.0.8-102-gef19bc7',
|
||||
'app_version' => 'v4.0.10',
|
||||
'build_version' => '235',
|
||||
'hash_version' => 'gcbe008d',
|
||||
'full_hash' => 'v4.0.10-235-gcbe008d',
|
||||
);
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Asset Model Factories
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Factories related exclusively to creating models ..
|
||||
|
|
||||
*/
|
||||
|
||||
$factory->define(App\Models\Accessory::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'user_id' => 1,
|
||||
'model_number' => $faker->numberBetween(1000000, 50000000),
|
||||
'location_id' => rand(1,5),
|
||||
];
|
||||
});
|
||||
|
||||
$factory->state(App\Models\Accessory::class, 'apple-bt-keyboard', function ($faker) {
|
||||
|
||||
return [
|
||||
'name' => 'Bluetooth Keyboard',
|
||||
'category_id' => 8,
|
||||
'manufacturer_id' => 1,
|
||||
'qty' => 10,
|
||||
'min_amt' => 2
|
||||
];
|
||||
|
||||
});
|
||||
|
||||
$factory->state(App\Models\Accessory::class, 'apple-usb-keyboard', function ($faker) {
|
||||
|
||||
return [
|
||||
'name' => 'USB Keyboard',
|
||||
'category_id' => 8,
|
||||
'manufacturer_id' => 1,
|
||||
'qty' => 15,
|
||||
'min_amt' => 2
|
||||
];
|
||||
|
||||
});
|
||||
|
||||
$factory->state(App\Models\Accessory::class, 'apple-mouse', function ($faker) {
|
||||
|
||||
return [
|
||||
'name' => 'Magic Mouse',
|
||||
'category_id' => 9,
|
||||
'manufacturer_id' => 1,
|
||||
'qty' => 13,
|
||||
'min_amt' => 2
|
||||
];
|
||||
|
||||
});
|
||||
|
||||
$factory->state(App\Models\Accessory::class, 'microsoft-mouse', function ($faker) {
|
||||
|
||||
return [
|
||||
'name' => 'Sculpt Comfort Mouse\'',
|
||||
'category_id' => 9,
|
||||
'manufacturer_id' => 2,
|
||||
'qty' => 13,
|
||||
'min_amt' => 2
|
||||
];
|
||||
|
||||
});
|
||||
|
||||
@@ -1,76 +1,101 @@
|
||||
<?php
|
||||
|
||||
use App\Models\Actionlog;
|
||||
use App\Models\Company;
|
||||
use App\Models\User;
|
||||
use App\Models\Location;
|
||||
use App\Models\Asset;
|
||||
|
||||
$factory->defineAs(App\Models\Actionlog::class, 'asset-upload', function ($faker) {
|
||||
$asset = factory(App\Models\Asset::class)->create();
|
||||
|
||||
$factory->define(Actionlog::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'item_type' => get_class($asset),
|
||||
'item_id' => $asset->id,
|
||||
'user_id' => function () {
|
||||
return factory(App\Models\User::class)->create()->id;
|
||||
},
|
||||
'filename' => $faker->word,
|
||||
'action_type' => 'uploaded'
|
||||
'note' => 'Sample checkout from DB seeder!',
|
||||
];
|
||||
});
|
||||
|
||||
$factory->defineAs(Actionlog::class, 'asset-checkout', function (Faker\Generator $faker) {
|
||||
$company = factory(App\Models\Company::class)->create();
|
||||
$user = factory(App\Models\User::class)->create(['company_id' => $company->id]);
|
||||
$target = factory(App\Models\User::class)->create(['company_id' => $company->id]);
|
||||
do {
|
||||
$item = factory(App\Models\Asset::class)->create(['company_id' => $company->id]);
|
||||
} while (!$item->isValid());
|
||||
// dd($item);
|
||||
|
||||
|
||||
$factory->defineAs(Actionlog::class, 'asset-checkout-user', function (Faker\Generator $faker) {
|
||||
$target = User::inRandomOrder()->first();
|
||||
$item = Asset::inRandomOrder()->RTD()->first();
|
||||
$user_id = rand(1,2); // keep it simple - make it one of the two superadmins
|
||||
$asset = App\Models\Asset::where('id', $item->id)
|
||||
->update(
|
||||
[
|
||||
'assigned_to' => $target->id,
|
||||
'assigned_type' => App\Models\User::class
|
||||
]
|
||||
);
|
||||
|
||||
return [
|
||||
'user_id' => $user->id,
|
||||
'created_at' => $faker->dateTimeBetween('-1 years','now', date_default_timezone_get()),
|
||||
'user_id' => $user_id,
|
||||
'action_type' => 'checkout',
|
||||
'item_id' => $item->id,
|
||||
'item_type' => App\Models\Asset::class,
|
||||
'target_id' => $target->id,
|
||||
'target_type' => get_class($target),
|
||||
'created_at' => $faker->dateTime(),
|
||||
'note' => $faker->sentence,
|
||||
'company_id' => $company->id
|
||||
|
||||
|
||||
];
|
||||
});
|
||||
|
||||
$factory->defineAs(Actionlog::class, 'license-checkout-asset', function (Faker\Generator $faker) {
|
||||
$company = factory(App\Models\Company::class)->create();
|
||||
$user = factory(App\Models\User::class)->create(['company_id' => $company->id]);
|
||||
$target = factory(App\Models\Asset::class)->create(['company_id' => $company->id]);
|
||||
$item = factory(App\Models\License::class)->create(['company_id' => $company->id]);
|
||||
$factory->defineAs(Actionlog::class, 'asset-checkout-location', function (Faker\Generator $faker) {
|
||||
$target = Location::inRandomOrder()->first();
|
||||
$item = Asset::inRandomOrder()->RTD()->first();
|
||||
$user_id = rand(1,2); // keep it simple - make it one of the two superadmins
|
||||
$asset = App\Models\Asset::where('id', $item->id)
|
||||
->update(
|
||||
[
|
||||
'assigned_to' => $target->id,
|
||||
'assigned_type' => App\Models\Location::class
|
||||
]
|
||||
);
|
||||
|
||||
return [
|
||||
'user_id' => $user->id,
|
||||
'created_at' => $faker->dateTimeBetween('-1 years','now', date_default_timezone_get()),
|
||||
'user_id' => $user_id,
|
||||
'action_type' => 'checkout',
|
||||
'item_id' => $item->id,
|
||||
'item_type' => App\Models\Asset::class,
|
||||
'target_id' => $target->id,
|
||||
'target_type' => get_class($target),
|
||||
];
|
||||
});
|
||||
|
||||
// This doesn't work - we need to assign a seat
|
||||
$factory->defineAs(Actionlog::class, 'license-checkout-asset', function (Faker\Generator $faker) {
|
||||
$target = Asset::inRandomOrder()->RTD()->first();
|
||||
$item = License::inRandomOrder()->first();
|
||||
$user_id = rand(1,2); // keep it simple - make it one of the two superadmins
|
||||
|
||||
return [
|
||||
'user_id' => $user_id,
|
||||
'action_type' => 'checkout',
|
||||
'item_id' => $item->id,
|
||||
'item_type' => get_class($item),
|
||||
'target_id' => $target->id,
|
||||
'target_type' => get_class($target),
|
||||
'created_at' => $faker->dateTime(),
|
||||
'note' => $faker->sentence,
|
||||
'company_id' => $company->id
|
||||
'note' => $faker->sentence
|
||||
];
|
||||
});
|
||||
|
||||
|
||||
$factory->defineAs(Actionlog::class, 'accessory-checkout', function (Faker\Generator $faker) {
|
||||
$company = factory(App\Models\Company::class)->create();
|
||||
$user = factory(App\Models\User::class)->create(['company_id' => $company->id]);
|
||||
$target = factory(App\Models\User::class)->create(['company_id' => $company->id]);
|
||||
$item = factory(App\Models\Accessory::class)->create(['company_id' => $company->id]);
|
||||
$target = Asset::inRandomOrder()->RTD()->first();
|
||||
$item = Accessory::inRandomOrder()->first();
|
||||
$user_id = rand(1,2); // keep it simple - make it one of the two superadmins
|
||||
|
||||
return [
|
||||
'user_id' => $user->id,
|
||||
'user_id' => $user_id,
|
||||
'action_type' => 'checkout',
|
||||
'item_id' => $item->id,
|
||||
'item_type' => get_class($item),
|
||||
'target_id' => $target->id,
|
||||
'target_type' => get_class($target),
|
||||
'created_at' => $faker->dateTime(),
|
||||
'note' => $faker->sentence,
|
||||
'company_id' => $company->id
|
||||
'note' => $faker->sentence
|
||||
];
|
||||
});
|
||||
|
||||
|
||||
@@ -15,89 +15,186 @@ use App\Models\Category;
|
||||
|
||||
$factory->define(Asset::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'name' => $faker->catchPhrase,
|
||||
'model_id' => function () {
|
||||
return factory(App\Models\AssetModel::class)->create()->id;
|
||||
},
|
||||
'rtd_location_id' => function () {
|
||||
return factory(App\Models\Location::class)->create()->id;
|
||||
},
|
||||
'name' => null,
|
||||
'rtd_location_id' => 1,
|
||||
'serial' => $faker->uuid,
|
||||
'status_id' => function () {
|
||||
return factory(App\Models\Statuslabel::class)->states('rtd')->create()->id;
|
||||
},
|
||||
'user_id' => function () {
|
||||
return factory(App\Models\User::class)->create()->id;
|
||||
},
|
||||
'status_id' => 1,
|
||||
'user_id' => 1,
|
||||
'asset_tag' => $faker->unixTime('now'),
|
||||
'notes' => $faker->sentence,
|
||||
'purchase_date' => $faker->dateTime(),
|
||||
'purchase_cost' => $faker->randomFloat(2),
|
||||
'notes' => 'Created by DB seeder',
|
||||
'purchase_date' => $faker->dateTimeBetween('-1 years','now', date_default_timezone_get()),
|
||||
'purchase_cost' => $faker->randomFloat(2, '299.99', '2999.99'),
|
||||
'order_number' => $faker->numberBetween(1000000, 50000000),
|
||||
'supplier_id' => function () {
|
||||
return factory(App\Models\Supplier::class)->create()->id;
|
||||
},
|
||||
'company_id' => function () {
|
||||
return factory(App\Models\Company::class)->create()->id;
|
||||
},
|
||||
'supplier_id' => 1,
|
||||
'requestable' => $faker->boolean()
|
||||
];
|
||||
});
|
||||
|
||||
$factory->state(Asset::class, 'deleted', function ($faker) {
|
||||
|
||||
|
||||
|
||||
$factory->state(Asset::class, 'laptop-mbp', function ($faker) {
|
||||
return [
|
||||
'deleted_at' => $faker->dateTime(),
|
||||
'model_id' => 1
|
||||
];
|
||||
});
|
||||
|
||||
$factory->state(Asset::class, 'laptop-mbp-pending', function ($faker) {
|
||||
return [
|
||||
'model_id' => 1,
|
||||
'status_id' => 2,
|
||||
];
|
||||
});
|
||||
|
||||
$factory->state(Asset::class, 'laptop-mbp-archived', function ($faker) {
|
||||
return [
|
||||
'model_id' => 1,
|
||||
'status_id' => 3,
|
||||
];
|
||||
});
|
||||
|
||||
$factory->state(Asset::class, 'laptop-air', function ($faker) {
|
||||
return [
|
||||
'model_id' => 2
|
||||
];
|
||||
});
|
||||
|
||||
$factory->state(Asset::class, 'laptop-surface', function ($faker) {
|
||||
return [
|
||||
'model_id' => 3
|
||||
];
|
||||
});
|
||||
|
||||
$factory->state(Asset::class, 'laptop-xps', function ($faker) {
|
||||
return [
|
||||
'model_id' => 4
|
||||
];
|
||||
});
|
||||
|
||||
$factory->state(Asset::class, 'laptop-spectre', function ($faker) {
|
||||
return [
|
||||
'model_id' => 5
|
||||
];
|
||||
});
|
||||
|
||||
$factory->state(Asset::class, 'laptop-zenbook', function ($faker) {
|
||||
return [
|
||||
'model_id' => 6
|
||||
];
|
||||
});
|
||||
|
||||
$factory->state(Asset::class, 'laptop-yoga', function ($faker) {
|
||||
return [
|
||||
'model_id' => 7
|
||||
];
|
||||
});
|
||||
|
||||
$factory->state(Asset::class, 'desktop-macpro', function ($faker) {
|
||||
return [
|
||||
'model_id' => 8
|
||||
];
|
||||
});
|
||||
|
||||
$factory->state(Asset::class, 'desktop-lenovo-i5', function ($faker) {
|
||||
return [
|
||||
'model_id' => 9
|
||||
];
|
||||
});
|
||||
|
||||
$factory->state(Asset::class, 'desktop-optiplex', function ($faker) {
|
||||
return [
|
||||
'model_id' => 10
|
||||
];
|
||||
});
|
||||
|
||||
$factory->state(Asset::class, 'conf-polycom', function ($faker) {
|
||||
return [
|
||||
'model_id' => 11
|
||||
];
|
||||
});
|
||||
|
||||
$factory->state(Asset::class, 'conf-polycomcx', function ($faker) {
|
||||
return [
|
||||
'model_id' => 12
|
||||
];
|
||||
});
|
||||
|
||||
$factory->state(Asset::class, 'tablet-ipad', function ($faker) {
|
||||
return [
|
||||
'model_id' => 13
|
||||
];
|
||||
});
|
||||
|
||||
$factory->state(Asset::class, 'tablet-tab3', function ($faker) {
|
||||
return [
|
||||
'model_id' => 14
|
||||
];
|
||||
});
|
||||
|
||||
$factory->state(Asset::class, 'phone-iphone6s', function ($faker) {
|
||||
return [
|
||||
'model_id' => 15
|
||||
];
|
||||
});
|
||||
|
||||
$factory->state(Asset::class, 'phone-iphone7', function ($faker) {
|
||||
return [
|
||||
'model_id' => 16
|
||||
];
|
||||
});
|
||||
|
||||
$factory->state(Asset::class, 'ultrafine', function ($faker) {
|
||||
return [
|
||||
'model_id' => 17
|
||||
];
|
||||
});
|
||||
|
||||
$factory->state(Asset::class, 'ultrasharp', function ($faker) {
|
||||
return [
|
||||
'model_id' => 18
|
||||
];
|
||||
});
|
||||
|
||||
|
||||
// These are just for unit tests, not to generate data
|
||||
|
||||
$factory->state(Asset::class, 'assigned-to-user', function ($faker) {
|
||||
return [
|
||||
'model_id' => 1,
|
||||
'assigned_to' => factory(App\Models\User::class)->create()->id,
|
||||
'assigned_type' => App\Models\User::class,
|
||||
];
|
||||
});
|
||||
|
||||
$factory->state(Asset::class, 'assigned-to-location', function ($faker) {
|
||||
return [
|
||||
'model_id' => 1,
|
||||
'assigned_to' => factory(App\Models\Location::class)->create()->id,
|
||||
'assigned_type' => App\Models\Location::class,
|
||||
];
|
||||
});
|
||||
|
||||
$factory->state(Asset::class, 'assigned-to-asset', function ($faker) {
|
||||
return [
|
||||
'model_id' => 1,
|
||||
'assigned_to' => factory(App\Models\Asset::class)->create()->id,
|
||||
'assigned_type' => App\Models\Asset::class,
|
||||
];
|
||||
});
|
||||
|
||||
$factory->state(Asset::class, 'requires-acceptance', function ($faker) {
|
||||
$cat = factory(Category::class)->states('asset-category', 'requires-acceptance')->create();
|
||||
$model = factory(AssetModel::class)->create(['category_id' => $cat->id]);
|
||||
return [
|
||||
'model_id' => $model->id
|
||||
'model_id' => 1,
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\AssetModel::class, function (Faker\Generator $faker) {
|
||||
|
||||
$factory->state(Asset::class, 'deleted', function ($faker) {
|
||||
return [
|
||||
'name' => $faker->catchPhrase,
|
||||
'manufacturer_id' => function () {
|
||||
return factory(App\Models\Manufacturer::class)->create()->id;
|
||||
},
|
||||
'category_id' => function () {
|
||||
return factory(App\Models\Category::class)->states('asset-category')->create()->id;
|
||||
},
|
||||
'model_number' => $faker->numberBetween(1000000, 50000000),
|
||||
'eol' => 1,
|
||||
'notes' => $faker->paragraph(),
|
||||
'requestable' => $faker->boolean(),
|
||||
'depreciation_id' => function () {
|
||||
return factory(App\Models\Depreciation::class)->create()->id;
|
||||
},
|
||||
'model_id' => 1,
|
||||
'deleted_at' => $faker->dateTime()
|
||||
];
|
||||
});
|
||||
|
||||
|
||||
$factory->define(App\Models\AssetMaintenance::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'asset_id' => function () {
|
||||
|
||||
@@ -0,0 +1,255 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Asset Model Factories
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Factories related exclusively to creating models ..
|
||||
|
|
||||
*/
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Laptops
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
$factory->define(App\Models\AssetModel::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'user_id' => 1,
|
||||
'model_number' => $faker->creditCardNumber(),
|
||||
'notes' => 'Created by demo seeder',
|
||||
|
||||
];
|
||||
});
|
||||
|
||||
|
||||
// 1
|
||||
$factory->state(App\Models\AssetModel::class, 'mbp-13-model', function ($faker) {
|
||||
return [
|
||||
'name' => 'Macbook Pro 13"',
|
||||
'category_id' => 1,
|
||||
'manufacturer_id' => 1,
|
||||
'eol' => '36',
|
||||
'depreciation_id' => 1,
|
||||
];
|
||||
});
|
||||
|
||||
// 2
|
||||
$factory->state(App\Models\AssetModel::class, 'mbp-air-model', function ($faker) {
|
||||
return [
|
||||
'name' => 'Macbook Air',
|
||||
'category_id' => 1,
|
||||
'manufacturer_id' => 1,
|
||||
'eol' => '36',
|
||||
'depreciation_id' => 1,
|
||||
];
|
||||
});
|
||||
|
||||
// 3
|
||||
$factory->state(App\Models\AssetModel::class, 'surface-model', function ($faker) {
|
||||
return [
|
||||
'name' => 'Surface',
|
||||
'category_id' => 1,
|
||||
'manufacturer_id' => 2,
|
||||
'eol' => '36',
|
||||
'depreciation_id' => 1,
|
||||
];
|
||||
});
|
||||
|
||||
// 4
|
||||
$factory->state(App\Models\AssetModel::class, 'xps13-model', function ($faker) {
|
||||
return [
|
||||
'name' => 'XPS 13',
|
||||
'category_id' => 1,
|
||||
'manufacturer_id' => 3,
|
||||
'eol' => '36',
|
||||
'depreciation_id' => 1,
|
||||
];
|
||||
});
|
||||
|
||||
// 5
|
||||
$factory->state(App\Models\AssetModel::class, 'zenbook-model', function ($faker) {
|
||||
return [
|
||||
'name' => 'ZenBook UX310',
|
||||
'category_id' => 1,
|
||||
'manufacturer_id' => 4,
|
||||
'eol' => '36',
|
||||
'depreciation_id' => 1,
|
||||
];
|
||||
});
|
||||
|
||||
// 6
|
||||
$factory->state(App\Models\AssetModel::class, 'spectre-model', function ($faker) {
|
||||
return [
|
||||
'name' => 'Spectre',
|
||||
'category_id' => 1,
|
||||
'manufacturer_id' => 5,
|
||||
'eol' => '36',
|
||||
'depreciation_id' => 1,
|
||||
];
|
||||
});
|
||||
|
||||
// 7
|
||||
$factory->state(App\Models\AssetModel::class, 'yoga-model', function ($faker) {
|
||||
return [
|
||||
'name' => 'Yoga 910',
|
||||
'category_id' => 1,
|
||||
'manufacturer_id' => 6,
|
||||
'eol' => '36',
|
||||
'depreciation_id' => 1,
|
||||
];
|
||||
});
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Desktops
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
$factory->state(App\Models\AssetModel::class, 'macpro-model', function ($faker) {
|
||||
return [
|
||||
'name' => 'iMac Pro',
|
||||
'category_id' => 2,
|
||||
'manufacturer_id' => 1,
|
||||
'eol' => '24',
|
||||
'depreciation_id' => 1,
|
||||
];
|
||||
});
|
||||
|
||||
$factory->state(App\Models\AssetModel::class, 'lenovo-i5-model', function ($faker) {
|
||||
return [
|
||||
'name' => 'Lenovo Intel Core i5',
|
||||
'category_id' => 2,
|
||||
'manufacturer_id' => 6,
|
||||
'eol' => '24',
|
||||
'depreciation_id' => 1,
|
||||
];
|
||||
});
|
||||
|
||||
$factory->state(App\Models\AssetModel::class, 'optiplex-model', function ($faker) {
|
||||
return [
|
||||
'name' => 'OptiPlex',
|
||||
'category_id' => 2,
|
||||
'manufacturer_id' => 3,
|
||||
'model_number' => '5040 (MRR81)',
|
||||
'eol' => '24',
|
||||
'depreciation_id' => 1,
|
||||
];
|
||||
});
|
||||
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Conference Phones
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
$factory->state(App\Models\AssetModel::class, 'polycom-model', function ($faker) {
|
||||
return [
|
||||
'name' => 'SoundStation 2',
|
||||
'category_id' => 6,
|
||||
'manufacturer_id' => 8,
|
||||
'eol' => '12',
|
||||
'depreciation_id' => 1,
|
||||
];
|
||||
});
|
||||
|
||||
$factory->state(App\Models\AssetModel::class, 'polycomcx-model', function ($faker) {
|
||||
return [
|
||||
'name' => 'Polycom CX3000 IP Conference Phone',
|
||||
'category_id' => 6,
|
||||
'manufacturer_id' => 8,
|
||||
'eol' => '12',
|
||||
'depreciation_id' => 1,
|
||||
];
|
||||
});
|
||||
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Tablets
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
$factory->state(App\Models\AssetModel::class, 'ipad-model', function ($faker) {
|
||||
return [
|
||||
'name' => 'iPad Pro',
|
||||
'category_id' => 3,
|
||||
'manufacturer_id' => 1,
|
||||
'eol' => '12',
|
||||
'depreciation_id' => 1,
|
||||
];
|
||||
});
|
||||
|
||||
|
||||
$factory->state(App\Models\AssetModel::class, 'tab3-model', function ($faker) {
|
||||
return [
|
||||
'name' => 'Tab3',
|
||||
'category_id' => 3,
|
||||
'manufacturer_id' => 6,
|
||||
'eol' => '12',
|
||||
'depreciation_id' => 1,
|
||||
];
|
||||
});
|
||||
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Mobile Phones
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
$factory->state(App\Models\AssetModel::class, 'iphone6s-model', function ($faker) {
|
||||
return [
|
||||
'name' => 'iPhone 6s',
|
||||
'category_id' => 4,
|
||||
'manufacturer_id' => 1,
|
||||
'eol' => '12',
|
||||
'depreciation_id' => 3,
|
||||
];
|
||||
});
|
||||
|
||||
$factory->state(App\Models\AssetModel::class, 'iphone7-model', function ($faker) {
|
||||
return [
|
||||
'name' => 'iPhone 7',
|
||||
'category_id' => 4,
|
||||
'manufacturer_id' => 1,
|
||||
'eol' => '12',
|
||||
'depreciation_id' => 1,
|
||||
];
|
||||
});
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Displays
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
$factory->state(App\Models\AssetModel::class, 'ultrafine', function ($faker) {
|
||||
return [
|
||||
'name' => 'Ultrafine 4k',
|
||||
'category_id' => 5,
|
||||
'manufacturer_id' => 7,
|
||||
'eol' => '12',
|
||||
'depreciation_id' => 2,
|
||||
];
|
||||
});
|
||||
|
||||
$factory->state(App\Models\AssetModel::class, 'ultrasharp', function ($faker) {
|
||||
return [
|
||||
'name' => 'Ultrasharp U2415',
|
||||
'category_id' => 5,
|
||||
'manufacturer_id' => 3,
|
||||
'eol' => '12',
|
||||
'depreciation_id' => 2,
|
||||
];
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -12,41 +12,105 @@
|
||||
|
||||
$factory->define(App\Models\Category::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'name' => $faker->text(20),
|
||||
'category_type' => $faker->randomElement(['asset', 'accessory', 'component', 'consumable']),
|
||||
'eula_text' => $faker->paragraph(),
|
||||
'require_acceptance' => false,
|
||||
'use_default_eula' => $faker->boolean(),
|
||||
'checkin_email' => $faker->boolean()
|
||||
'user_id' => 1,
|
||||
'eula_text' => $faker->paragraph(),
|
||||
'require_acceptance' => false,
|
||||
'use_default_eula' => $faker->boolean(),
|
||||
'checkin_email' => $faker->boolean()
|
||||
];
|
||||
});
|
||||
|
||||
$factory->state(App\Models\Category::class, 'asset-laptop-category', function ($faker) {
|
||||
return [
|
||||
'name' => 'Laptops',
|
||||
'category_type' => 'asset',
|
||||
'require_acceptance' => true,
|
||||
];
|
||||
});
|
||||
|
||||
$factory->state(App\Models\Category::class, 'asset-category', function ($faker) {
|
||||
$factory->state(App\Models\Category::class, 'asset-desktop-category', function ($faker) {
|
||||
return [
|
||||
'name' => 'Desktops',
|
||||
'category_type' => 'asset',
|
||||
];
|
||||
});
|
||||
|
||||
$factory->state(App\Models\Category::class, 'accessory-category', function ($faker) {
|
||||
$factory->state(App\Models\Category::class, 'asset-display-category', function ($faker) {
|
||||
return [
|
||||
'name' => 'Displays',
|
||||
'category_type' => 'asset',
|
||||
];
|
||||
});
|
||||
|
||||
$factory->state(App\Models\Category::class, 'asset-tablet-category', function ($faker) {
|
||||
return [
|
||||
'name' => 'Tablets',
|
||||
'category_type' => 'asset',
|
||||
];
|
||||
});
|
||||
|
||||
$factory->state(App\Models\Category::class, 'asset-mobile-category', function ($faker) {
|
||||
return [
|
||||
'name' => 'Mobile Phones',
|
||||
'category_type' => 'asset',
|
||||
];
|
||||
});
|
||||
|
||||
$factory->state(App\Models\Category::class, 'asset-conference-category', function ($faker) {
|
||||
return [
|
||||
'name' => 'Conference Phones',
|
||||
'category_type' => 'asset',
|
||||
];
|
||||
});
|
||||
|
||||
$factory->state(App\Models\Category::class, 'asset-voip-category', function ($faker) {
|
||||
return [
|
||||
'name' => 'VOIP Phones',
|
||||
'category_type' => 'asset',
|
||||
];
|
||||
});
|
||||
|
||||
|
||||
$factory->state(App\Models\Category::class, 'accessory-keyboard-category', function ($faker) {
|
||||
return [
|
||||
'name' => 'Keyboards',
|
||||
'category_type' => 'accessory',
|
||||
];
|
||||
});
|
||||
|
||||
$factory->state(App\Models\Category::class, 'component-category', function ($faker) {
|
||||
$factory->state(App\Models\Category::class, 'accessory-mouse-category', function ($faker) {
|
||||
return [
|
||||
'name' => 'Mouse',
|
||||
'category_type' => 'accessory',
|
||||
];
|
||||
});
|
||||
|
||||
|
||||
$factory->state(App\Models\Category::class, 'component-hdd-category', function ($faker) {
|
||||
return [
|
||||
'name' => 'HDD/SSD',
|
||||
'category_type' => 'component',
|
||||
];
|
||||
});
|
||||
|
||||
$factory->state(App\Models\Category::class, 'consumable-category', function ($faker) {
|
||||
$factory->state(App\Models\Category::class, 'component-ram-category', function ($faker) {
|
||||
return [
|
||||
'name' => 'RAM',
|
||||
'category_type' => 'component',
|
||||
];
|
||||
});
|
||||
|
||||
$factory->state(App\Models\Category::class, 'consumable-paper-category', function ($faker) {
|
||||
return [
|
||||
'name' => 'Printer Paper',
|
||||
'category_type' => 'consumable',
|
||||
];
|
||||
});
|
||||
|
||||
$factory->state(App\Models\Category::class, 'requires-acceptance', function ($faker) {
|
||||
$factory->state(App\Models\Category::class, 'consumable-ink-category', function ($faker) {
|
||||
return [
|
||||
'require_acceptance' => true,
|
||||
'name' => 'Printer Ink',
|
||||
'category_type' => 'consumable',
|
||||
];
|
||||
});
|
||||
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Components Factories
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Factories related exclusively to creating components ..
|
||||
|
|
||||
*/
|
||||
|
||||
$factory->define(App\Models\Component::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'user_id' => 1,
|
||||
'order_number' => $faker->numberBetween(1000000, 50000000),
|
||||
'purchase_date' => $faker->dateTimeBetween('-1 years','now', date_default_timezone_get()),
|
||||
'purchase_cost' => $faker->randomFloat(2, 1, 50),
|
||||
'qty' => $faker->numberBetween(5, 10),
|
||||
'min_amt' => $faker->numberBetween($min = 1, $max = 2),
|
||||
];
|
||||
});
|
||||
|
||||
$factory->state(App\Models\Component::class, 'ram-crucial4', function ($faker) {
|
||||
|
||||
return [
|
||||
'name' => 'Crucial 4GB DDR3L-1600 SODIMM',
|
||||
'category_id' => 13,
|
||||
'qty' => 10,
|
||||
'min_amt' => 2
|
||||
];
|
||||
});
|
||||
|
||||
$factory->state(App\Models\Component::class, 'ram-crucial8', function ($faker) {
|
||||
|
||||
return [
|
||||
'name' => 'Crucial 8GB DDR3L-1600 SODIMM Memory for Mac',
|
||||
'category_id' => 13,
|
||||
'qty' => 10,
|
||||
'min_amt' => 2
|
||||
];
|
||||
});
|
||||
|
||||
$factory->state(App\Models\Component::class, 'ssd-crucial120', function ($faker) {
|
||||
|
||||
return [
|
||||
'name' => 'Crucial BX300 120GB SATA Internal SSD',
|
||||
'category_id' => 12,
|
||||
'qty' => 10,
|
||||
'min_amt' => 2
|
||||
];
|
||||
});
|
||||
|
||||
$factory->state(App\Models\Component::class, 'ssd-crucial240', function ($faker) {
|
||||
|
||||
return [
|
||||
'name' => 'Crucial BX300 240GB SATA Internal SSD',
|
||||
'category_id' => 12,
|
||||
'qty' => 10,
|
||||
'min_amt' => 2
|
||||
];
|
||||
});
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Consumables Factories
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Factories related exclusively to creating consumables ..
|
||||
|
|
||||
*/
|
||||
|
||||
$factory->define(App\Models\Consumable::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'user_id' => 1,
|
||||
'item_no' => $faker->numberBetween(1000000, 50000000),
|
||||
'order_number' => $faker->numberBetween(1000000, 50000000),
|
||||
'purchase_date' => $faker->dateTimeBetween('-1 years','now', date_default_timezone_get()),
|
||||
'purchase_cost' => $faker->randomFloat(2, 1, 50),
|
||||
'qty' => $faker->numberBetween(5, 10),
|
||||
'min_amt' => $faker->numberBetween($min = 1, $max = 2),
|
||||
];
|
||||
});
|
||||
|
||||
$factory->state(App\Models\Consumable::class, 'cardstock', function ($faker) {
|
||||
|
||||
return [
|
||||
'name' => 'Cardstock (White)',
|
||||
'category_id' => 10,
|
||||
'manufacturer_id' => 10,
|
||||
'qty' => 10,
|
||||
'min_amt' => 2
|
||||
];
|
||||
});
|
||||
|
||||
$factory->state(App\Models\Consumable::class, 'paper', function ($faker) {
|
||||
|
||||
return [
|
||||
'name' => 'Laserjet Paper (Ream)',
|
||||
'category_id' => 10,
|
||||
'manufacturer_id' => 10,
|
||||
'qty' => 20,
|
||||
'min_amt' => 2
|
||||
];
|
||||
});
|
||||
|
||||
$factory->state(App\Models\Consumable::class, 'ink', function ($faker) {
|
||||
|
||||
return [
|
||||
'name' => 'Laserjet Toner (black)',
|
||||
'category_id' => 11,
|
||||
'manufacturer_id' => 5,
|
||||
'qty' => 20,
|
||||
'min_amt' => 2
|
||||
];
|
||||
});
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Asset Model Factories
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Factories related exclusively to creating models ..
|
||||
|
|
||||
*/
|
||||
|
||||
$factory->define(App\Models\Department::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'user_id' => 1,
|
||||
'location_id' => rand(1,5),
|
||||
];
|
||||
});
|
||||
|
||||
$factory->state(App\Models\Department::class, 'hr', function ($faker) {
|
||||
return [
|
||||
'name' => 'Human Resources',
|
||||
];
|
||||
});
|
||||
|
||||
$factory->state(App\Models\Department::class, 'engineering', function ($faker) {
|
||||
return [
|
||||
'name' => 'Engineering',
|
||||
];
|
||||
});
|
||||
|
||||
$factory->state(App\Models\Department::class, 'marketing', function ($faker) {
|
||||
return [
|
||||
'name' => 'Marketing',
|
||||
];
|
||||
});
|
||||
|
||||
$factory->state(App\Models\Department::class, 'client', function ($faker) {
|
||||
return [
|
||||
'name' => 'Client Services',
|
||||
];
|
||||
});
|
||||
|
||||
$factory->state(App\Models\Department::class, 'design', function ($faker) {
|
||||
return [
|
||||
'name' => 'Graphic Design',
|
||||
];
|
||||
});
|
||||
|
||||
$factory->state(App\Models\Department::class, 'product', function ($faker) {
|
||||
return [
|
||||
'name' => 'Product Management',
|
||||
];
|
||||
});
|
||||
|
||||
$factory->state(App\Models\Department::class, 'silly', function ($faker) {
|
||||
return [
|
||||
'name' => 'Dept of Silly Walks',
|
||||
];
|
||||
});
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Asset Model Factories
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Factories related exclusively to creating models ..
|
||||
|
|
||||
*/
|
||||
|
||||
$factory->define(App\Models\Depreciation::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'user_id' => 1,
|
||||
];
|
||||
});
|
||||
|
||||
$factory->state(App\Models\Depreciation::class, 'computer', function ($faker) {
|
||||
return [
|
||||
'name' => 'Computer Depreciation',
|
||||
'months' => 36,
|
||||
];
|
||||
});
|
||||
|
||||
$factory->state(App\Models\Depreciation::class, 'display', function ($faker) {
|
||||
return [
|
||||
'name' => 'Display Depreciation',
|
||||
'months' => 12,
|
||||
];
|
||||
});
|
||||
|
||||
$factory->state(App\Models\Depreciation::class, 'mobile-phones', function ($faker) {
|
||||
return [
|
||||
'name' => 'Mobile Phone Depreciation',
|
||||
'months' => 24,
|
||||
];
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Asset Model Factories
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Factories related exclusively to creating models ..
|
||||
|
|
||||
*/
|
||||
|
||||
$factory->define(App\Models\License::class, function (Faker\Generator $faker) {
|
||||
|
||||
return [
|
||||
'user_id' => 1,
|
||||
'license_name' => $faker->name,
|
||||
'license_email' => $faker->safeEmail,
|
||||
'serial' => $faker->uuid,
|
||||
'notes' => 'Created by DB seeder',
|
||||
'purchase_date' => $faker->dateTimeBetween('-1 years','now', date_default_timezone_get()),
|
||||
'order_number' => $faker->numberBetween(1000000, 50000000),
|
||||
];
|
||||
});
|
||||
|
||||
// 1
|
||||
$factory->state(App\Models\License::class, 'photoshop', function ($faker) {
|
||||
$data = [
|
||||
'name' => 'Photoshop',
|
||||
'manufacturer_id' => 9,
|
||||
'purchase_cost' => '299.99',
|
||||
'seats' => 10,
|
||||
];
|
||||
|
||||
return $data;
|
||||
|
||||
});
|
||||
|
||||
// 2
|
||||
$factory->state(App\Models\License::class, 'acrobat', function ($faker) {
|
||||
|
||||
$data = [
|
||||
'name' => 'Acrobat',
|
||||
'manufacturer_id' => 9,
|
||||
'purchase_cost' => '29.99',
|
||||
'seats' => 10,
|
||||
];
|
||||
|
||||
|
||||
return $data;
|
||||
});
|
||||
|
||||
// 3
|
||||
$factory->state(App\Models\License::class, 'indesign', function ($faker) {
|
||||
$data = [
|
||||
'name' => 'InDesign',
|
||||
'manufacturer_id' => 9,
|
||||
'purchase_cost' => '199.99',
|
||||
'seats' => 10,
|
||||
];
|
||||
|
||||
|
||||
return $data;
|
||||
});
|
||||
|
||||
|
||||
// 4
|
||||
$factory->state(App\Models\License::class, 'office', function ($faker) {
|
||||
$data = [
|
||||
'name' => 'Office',
|
||||
'manufacturer_id' => 2,
|
||||
'purchase_cost' => '49.99',
|
||||
'seats' => 20,
|
||||
];
|
||||
|
||||
|
||||
return $data;
|
||||
});
|
||||
|
||||
|
||||
@@ -0,0 +1,123 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Asset Model Factories
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Factories related exclusively to creating models ..
|
||||
|
|
||||
*/
|
||||
|
||||
$factory->define(App\Models\Manufacturer::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'user_id' => 1,
|
||||
'support_phone' => $faker->phoneNumber(),
|
||||
'url' => $faker->url(),
|
||||
'support_email' => $faker->safeEmail(),
|
||||
];
|
||||
});
|
||||
|
||||
|
||||
// 1
|
||||
$factory->state(App\Models\Manufacturer::class, 'apple', function ($faker) {
|
||||
return [
|
||||
'name' => 'Apple',
|
||||
'url' => 'https://apple.com',
|
||||
'support_url' => 'https://support.apple.com'
|
||||
];
|
||||
});
|
||||
|
||||
// 2
|
||||
$factory->state(App\Models\Manufacturer::class, 'microsoft', function ($faker) {
|
||||
return [
|
||||
'name' => 'Microsoft',
|
||||
'url' => 'https://microsoft.com',
|
||||
'support_url' => 'https://support.microsoft.com'
|
||||
];
|
||||
});
|
||||
|
||||
// 3
|
||||
$factory->state(App\Models\Manufacturer::class, 'dell', function ($faker) {
|
||||
return [
|
||||
'name' => 'Dell',
|
||||
'url' => 'https://dell.com',
|
||||
'support_url' => 'https://support.dell.com'
|
||||
];
|
||||
});
|
||||
|
||||
// 4
|
||||
$factory->state(App\Models\Manufacturer::class, 'asus', function ($faker) {
|
||||
return [
|
||||
'name' => 'Asus',
|
||||
'url' => 'https://asus.com',
|
||||
'support_url' => 'https://support.asus.com'
|
||||
];
|
||||
});
|
||||
|
||||
// 5
|
||||
$factory->state(App\Models\Manufacturer::class, 'hp', function ($faker) {
|
||||
return [
|
||||
'name' => 'HP',
|
||||
'url' => 'https://hp.com',
|
||||
'support_url' => 'https://support.hp.com'
|
||||
];
|
||||
});
|
||||
|
||||
// 6
|
||||
$factory->state(App\Models\Manufacturer::class, 'lenovo', function ($faker) {
|
||||
return [
|
||||
'name' => 'Lenovo',
|
||||
'url' => 'https://lenovo.com',
|
||||
'support_url' => 'https://support.lenovo.com'
|
||||
];
|
||||
});
|
||||
|
||||
// 7
|
||||
$factory->state(App\Models\Manufacturer::class, 'lg', function ($faker) {
|
||||
return [
|
||||
'name' => 'LG',
|
||||
'url' => 'https://lg.com',
|
||||
'support_url' => 'https://support.lg.com'
|
||||
];
|
||||
});
|
||||
|
||||
// 8
|
||||
$factory->state(App\Models\Manufacturer::class, 'polycom', function ($faker) {
|
||||
return [
|
||||
'name' => 'Polycom',
|
||||
'url' => 'https://polycom.com',
|
||||
'support_url' => 'https://support.polycom.com'
|
||||
];
|
||||
});
|
||||
|
||||
// 9
|
||||
$factory->state(App\Models\Manufacturer::class, 'adobe', function ($faker) {
|
||||
return [
|
||||
'name' => 'Adobe',
|
||||
'url' => 'https://adobe.com',
|
||||
'support_url' => 'https://support.adobe.com'
|
||||
];
|
||||
});
|
||||
|
||||
|
||||
// 10
|
||||
$factory->state(App\Models\Manufacturer::class, 'avery', function ($faker) {
|
||||
return [
|
||||
'name' => 'Avery',
|
||||
'url' => 'https://avery.com',
|
||||
'support_url' => 'https://support.avery.com'
|
||||
];
|
||||
});
|
||||
|
||||
// 11
|
||||
$factory->state(App\Models\Manufacturer::class, 'crucial', function ($faker) {
|
||||
return [
|
||||
'name' => 'Crucial',
|
||||
'url' => 'https://crucial.com',
|
||||
'support_url' => 'https://support.crucial.com'
|
||||
];
|
||||
});
|
||||
|
||||
|
||||
|
||||
@@ -19,28 +19,6 @@ use App\Models\Manufacturer;
|
||||
use App\Models\Statuslabel;
|
||||
use App\Models\Supplier;
|
||||
|
||||
$factory->define(App\Models\Accessory::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'company_id' => function () {
|
||||
return factory(App\Models\Company::class)->create()->id;
|
||||
},
|
||||
'name' => $faker->text(20),
|
||||
'category_id' => function () {
|
||||
return factory(App\Models\Category::class)->states('accessory-category')->create()->id;
|
||||
},
|
||||
'manufacturer_id' => function () {
|
||||
return factory(App\Models\Manufacturer::class)->create()->id;
|
||||
},
|
||||
'location_id' => function () {
|
||||
return factory(App\Models\Location::class)->create()->id;
|
||||
},
|
||||
'order_number' => $faker->numberBetween(1000000, 50000000),
|
||||
'purchase_date' => $faker->dateTime(),
|
||||
'purchase_cost' => $faker->randomFloat(2),
|
||||
'qty' => $faker->numberBetween(5, 10),
|
||||
'min_amt' => $faker->numberBetween($min = 1, $max = 2),
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\Company::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
@@ -54,9 +32,7 @@ $factory->define(App\Models\Component::class, function (Faker\Generator $faker)
|
||||
'category_id' => function () {
|
||||
return factory(App\Models\Category::class)->create()->id;
|
||||
},
|
||||
'location_id' => function () {
|
||||
return factory(App\Models\Location::class)->create()->id;
|
||||
},
|
||||
'location_id' => 1,
|
||||
'serial' => $faker->uuid,
|
||||
'qty' => $faker->numberBetween(3, 10),
|
||||
'order_number' => $faker->numberBetween(1000000, 50000000),
|
||||
@@ -69,94 +45,10 @@ $factory->define(App\Models\Component::class, function (Faker\Generator $faker)
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\Consumable::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'name' => $faker->text(20),
|
||||
'company_id' => function () {
|
||||
return factory(App\Models\Company::class)->create()->id;
|
||||
},
|
||||
'category_id' => function () {
|
||||
return factory(App\Models\Category::class)->create()->id;
|
||||
},
|
||||
'location_id' => function () {
|
||||
return factory(App\Models\Location::class)->create()->id;
|
||||
},
|
||||
'manufacturer_id' => function () {
|
||||
return factory(App\Models\Manufacturer::class)->create()->id;
|
||||
},
|
||||
'user_id' => function () {
|
||||
return factory(App\Models\User::class)->create()->id;
|
||||
},
|
||||
'model_number' => $faker->numberBetween(1000000, 50000000),
|
||||
'item_no' => $faker->numberBetween(1000000, 50000000),
|
||||
'order_number' => $faker->numberBetween(1000000, 50000000),
|
||||
'purchase_date' => $faker->dateTime(),
|
||||
'purchase_cost' => $faker->randomFloat(2),
|
||||
'qty' => $faker->numberBetween(5, 10),
|
||||
'min_amt' => $faker->numberBetween($min = 1, $max = 2),
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\Department::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'name' => $faker->catchPhrase,
|
||||
'user_id' => '1',
|
||||
'location_id' => function () {
|
||||
return factory(App\Models\Location::class)->create()->id;
|
||||
},
|
||||
'company_id' => function () {
|
||||
return factory(App\Models\Company::class)->create()->id;
|
||||
},
|
||||
'manager_id' => function () {
|
||||
return factory(App\Models\User::class)->create()->id;
|
||||
},
|
||||
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\Depreciation::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'name' => $faker->text(20),
|
||||
'months' => $faker->numberBetween(1, 10),
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\License::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'name' => $faker->catchPhrase,
|
||||
'serial' => $faker->uuid,
|
||||
'seats' => $faker->numberBetween(1, 10),
|
||||
'license_email' => $faker->safeEmail,
|
||||
'license_name' => $faker->name,
|
||||
'order_number' => $faker->numberBetween(1500, 13250),
|
||||
'purchase_order' => $faker->numberBetween(1500, 13250),
|
||||
'purchase_date' => $faker->dateTime(),
|
||||
'purchase_cost' => $faker->randomFloat(2),
|
||||
'notes' => $faker->sentence,
|
||||
'supplier_id' => function () {
|
||||
return factory(App\Models\Supplier::class)->create()->id;
|
||||
},
|
||||
'company_id' =>function () {
|
||||
return factory(App\Models\Company::class)->create()->id;
|
||||
},
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\LicenseSeat::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'license_id' => function () {
|
||||
return factory(App\Models\License::class)->create()->id;
|
||||
},
|
||||
'created_at' => $faker->dateTime(),
|
||||
'updated_at' => $faker->dateTime(),
|
||||
'notes' => $faker->sentence,
|
||||
'user_id' => '1',
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\Location::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'name' => $faker->catchPhrase,
|
||||
'name' => $faker->city,
|
||||
'address' => $faker->streetAddress,
|
||||
'address2' => $faker->secondaryAddress,
|
||||
'city' => $faker->city,
|
||||
@@ -167,11 +59,6 @@ $factory->define(App\Models\Location::class, function (Faker\Generator $faker) {
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\Manufacturer::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'name' => $faker->company,
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\Supplier::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
|
||||
@@ -2,12 +2,14 @@
|
||||
|
||||
use App\Models\Company;
|
||||
|
||||
|
||||
|
||||
$factory->define(App\Models\User::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'first_name' => $faker->firstName,
|
||||
'last_name' => $faker->lastName,
|
||||
'username' => $faker->username,
|
||||
'password' => $faker->password,
|
||||
'password' => bcrypt('password'),
|
||||
'permissions' => '{"user":"0"}',
|
||||
'email' => $faker->safeEmail,
|
||||
'company_id' => function () {
|
||||
@@ -15,14 +17,36 @@ $factory->define(App\Models\User::class, function (Faker\Generator $faker) {
|
||||
},
|
||||
'locale' => $faker->locale,
|
||||
'employee_num' => $faker->numberBetween(3500, 35050),
|
||||
'jobtitle' => $faker->word,
|
||||
'jobtitle' => $faker->jobTitle,
|
||||
'department_id' => rand(1,6),
|
||||
'phone' => $faker->phoneNumber,
|
||||
'notes' => $faker->sentence,
|
||||
'location_id' => function () {
|
||||
return factory(App\Models\Location::class)->create()->id;
|
||||
},
|
||||
'notes' => 'Created by DB seeder',
|
||||
'location_id' => rand(1,5),
|
||||
'activated' => 1,
|
||||
];
|
||||
});
|
||||
|
||||
|
||||
$factory->state(App\Models\User::class, 'first-admin', function ($faker) {
|
||||
return [
|
||||
'first_name' => 'Admin',
|
||||
'last_name' => 'User',
|
||||
'username' => 'admin',
|
||||
'permissions' => '{"superuser":"1"}',
|
||||
];
|
||||
});
|
||||
|
||||
$factory->state(App\Models\User::class, 'snipe-admin', function ($faker) {
|
||||
return [
|
||||
'first_name' => 'Snipe E.',
|
||||
'last_name' => 'Head',
|
||||
'username' => 'snipe',
|
||||
'email' => 'snipe@snipe.net',
|
||||
'permissions' => '{"superuser":"1"}',
|
||||
];
|
||||
});
|
||||
|
||||
|
||||
// USER GLOBAL PERMISSION STATES
|
||||
$factory->state(App\Models\User::class, 'superuser', function ($faker) {
|
||||
return [
|
||||
@@ -33,6 +57,7 @@ $factory->state(App\Models\User::class, 'superuser', function ($faker) {
|
||||
$factory->state(App\Models\User::class, 'admin', function ($faker) {
|
||||
return [
|
||||
'permissions' => '{"admin":"1"}',
|
||||
'manager_id' => rand(1,2),
|
||||
];
|
||||
});
|
||||
// USER ASSET PERMISSION STATES
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AllowNullableDepreciationIdInModels extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('models', function (Blueprint $table) {
|
||||
$table->integer('depreciation_id')->nullable()->default(null)->change();
|
||||
});
|
||||
Schema::table('licenses', function (Blueprint $table) {
|
||||
$table->integer('depreciation_id')->nullable()->default(null)->change();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -2,11 +2,16 @@
|
||||
use Illuminate\Database\Seeder;
|
||||
use App\Models\Accessory;
|
||||
|
||||
|
||||
class AccessorySeeder extends Seeder
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
Accessory::truncate();
|
||||
factory(Accessory::class,15)->create();
|
||||
Accessory::truncate();
|
||||
DB::table('accessories_users')->truncate();
|
||||
factory(Accessory::class, 1)->states('apple-usb-keyboard')->create();
|
||||
factory(Accessory::class, 1)->states('apple-bt-keyboard')->create();
|
||||
factory(Accessory::class, 1)->states('apple-mouse')->create();
|
||||
factory(Accessory::class, 1)->states('microsoft-mouse')->create();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,10 +7,7 @@ class ActionlogSeeder extends Seeder
|
||||
public function run()
|
||||
{
|
||||
Actionlog::truncate();
|
||||
factory(Actionlog::class, 'asset-checkout',25)->create();
|
||||
// factory(Actionlog::class, 'accessory-checkout',15)->create();
|
||||
// factory(Actionlog::class, 'consumable-checkout', 15)->create();
|
||||
// factory(Actionlog::class, 'component-checkout', 15)->create();
|
||||
// factory(Actionlog::class, 'license-checkout-asset', 15)->create();
|
||||
factory(Actionlog::class, 'asset-checkout-user',5)->create();
|
||||
factory(Actionlog::class, 'asset-checkout-location',5)->create();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,38 @@ class AssetModelSeeder extends Seeder
|
||||
public function run()
|
||||
{
|
||||
AssetModel::truncate();
|
||||
factory(AssetModel::class,5)->create();
|
||||
|
||||
// Laptops
|
||||
factory(AssetModel::class, 1)->states('mbp-13-model')->create(); // 1
|
||||
factory(AssetModel::class, 1)->states('mbp-air-model')->create(); // 2
|
||||
factory(AssetModel::class, 1)->states('surface-model')->create(); // 3
|
||||
factory(AssetModel::class, 1)->states('xps13-model')->create(); // 4
|
||||
factory(AssetModel::class, 1)->states('spectre-model')->create(); // 5
|
||||
factory(AssetModel::class, 1)->states('zenbook-model')->create(); // 6
|
||||
factory(AssetModel::class, 1)->states('yoga-model')->create(); // 7
|
||||
|
||||
// Desktops
|
||||
factory(AssetModel::class, 1)->states('macpro-model')->create(); // 8
|
||||
factory(AssetModel::class, 1)->states('lenovo-i5-model')->create(); // 9
|
||||
factory(AssetModel::class, 1)->states('optiplex-model')->create(); // 10
|
||||
|
||||
// Conference Phones
|
||||
factory(AssetModel::class, 1)->states('polycom-model')->create(); // 11
|
||||
factory(AssetModel::class, 1)->states('polycomcx-model')->create(); // 12
|
||||
|
||||
// Tablets
|
||||
factory(AssetModel::class, 1)->states('ipad-model')->create(); // 13
|
||||
factory(AssetModel::class, 1)->states('tab3-model')->create(); // 14
|
||||
|
||||
// Phones
|
||||
factory(AssetModel::class, 1)->states('iphone6s-model')->create(); // 15
|
||||
factory(AssetModel::class, 1)->states('iphone7-model')->create(); // 16
|
||||
|
||||
// Displays
|
||||
factory(AssetModel::class, 1)->states('ultrafine')->create(); // 17
|
||||
factory(AssetModel::class, 1)->states('ultrasharp')->create(); // 18
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,6 +8,32 @@ class AssetSeeder extends Seeder
|
||||
public function run()
|
||||
{
|
||||
Asset::truncate();
|
||||
factory(Asset::class, 100)->create();
|
||||
factory(Asset::class, 10)->states('laptop-mbp')->create();
|
||||
factory(Asset::class, 5)->states('laptop-mbp-pending')->create();
|
||||
factory(Asset::class, 5)->states('laptop-mbp-archived')->create();
|
||||
factory(Asset::class, 10)->states('laptop-air')->create();
|
||||
factory(Asset::class, 5)->states('laptop-surface')->create();
|
||||
factory(Asset::class, 5)->states('laptop-xps')->create();
|
||||
factory(Asset::class, 5)->states('laptop-spectre')->create();
|
||||
factory(Asset::class, 5)->states('laptop-zenbook')->create();
|
||||
factory(Asset::class, 3)->states('laptop-yoga')->create();
|
||||
|
||||
factory(Asset::class, 3)->states('desktop-macpro')->create();
|
||||
factory(Asset::class, 3)->states('desktop-lenovo-i5')->create();
|
||||
factory(Asset::class, 10)->states('desktop-optiplex')->create();
|
||||
|
||||
factory(Asset::class, 5)->states('conf-polycom')->create();
|
||||
factory(Asset::class, 2)->states('conf-polycomcx')->create();
|
||||
|
||||
factory(Asset::class, 12)->states('tablet-ipad')->create();
|
||||
factory(Asset::class, 4)->states('tablet-tab3')->create();
|
||||
|
||||
factory(Asset::class, 27)->states('phone-iphone6s')->create();
|
||||
factory(Asset::class, 40)->states('phone-iphone7')->create();
|
||||
|
||||
factory(Asset::class, 10)->states('ultrafine')->create();
|
||||
factory(Asset::class, 10)->states('ultrasharp')->create();
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,10 +7,20 @@ class CategorySeeder extends Seeder
|
||||
public function run()
|
||||
{
|
||||
Category::truncate();
|
||||
factory(Category::class, 10)->states('asset-category')->create();
|
||||
factory(Category::class, 10)->states('accessory-category')->create();
|
||||
factory(Category::class, 10)->states('component-category')->create();
|
||||
factory(Category::class, 10)->states('consumable-category')->create();
|
||||
|
||||
factory(Category::class, 1)->states('asset-laptop-category')->create(); // 1
|
||||
factory(Category::class, 1)->states('asset-desktop-category')->create(); // 2
|
||||
factory(Category::class, 1)->states('asset-tablet-category')->create(); // 3
|
||||
factory(Category::class, 1)->states('asset-mobile-category')->create(); // 4
|
||||
factory(Category::class, 1)->states('asset-display-category')->create(); // 5
|
||||
factory(Category::class, 1)->states('asset-voip-category')->create(); // 6
|
||||
factory(Category::class, 1)->states('asset-conference-category')->create(); // 7
|
||||
factory(Category::class, 1)->states('accessory-keyboard-category')->create(); // 8
|
||||
factory(Category::class, 1)->states('accessory-mouse-category')->create(); // 9
|
||||
factory(Category::class, 1)->states('consumable-paper-category')->create(); // 10
|
||||
factory(Category::class, 1)->states('consumable-ink-category')->create(); // 11
|
||||
factory(Category::class, 1)->states('component-hdd-category')->create(); // 12
|
||||
factory(Category::class, 1)->states('component-ram-category')->create(); // 13
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,6 +8,9 @@ class ComponentSeeder extends Seeder
|
||||
{
|
||||
Component::truncate();
|
||||
DB::table('components_assets')->truncate();
|
||||
factory(Component::class, 10)->create();
|
||||
factory(Component::class, 1)->states('ram-crucial4')->create(); // 1
|
||||
factory(Component::class, 1)->states('ram-crucial8')->create(); // 1
|
||||
factory(Component::class, 1)->states('ssd-crucial120')->create(); // 1
|
||||
factory(Component::class, 1)->states('ssd-crucial240')->create(); // 1
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,9 @@ class ConsumableSeeder extends Seeder
|
||||
public function run()
|
||||
{
|
||||
Consumable::truncate();
|
||||
factory(Consumable::class, 25)->create();
|
||||
DB::table('consumables_users')->truncate();
|
||||
factory(Consumable::class, 1)->states('cardstock')->create(); // 1
|
||||
factory(Consumable::class, 1)->states('paper')->create(); // 2
|
||||
factory(Consumable::class, 1)->states('ink')->create(); // 3
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ class DatabaseSeeder extends Seeder
|
||||
$this->call(CategorySeeder::class);
|
||||
$this->call(UserSeeder::class);
|
||||
$this->call(DepreciationSeeder::class);
|
||||
$this->call(DepartmentSeeder::class);
|
||||
$this->call(ManufacturerSeeder::class);
|
||||
$this->call(LocationSeeder::class);
|
||||
$this->call(SupplierSeeder::class);
|
||||
@@ -29,7 +30,6 @@ class DatabaseSeeder extends Seeder
|
||||
$this->call(LicenseSeeder::class);
|
||||
$this->call(ComponentSeeder::class);
|
||||
$this->call(ConsumableSeeder::class);
|
||||
$this->call(LicenseSeeder::class);
|
||||
$this->call(ActionlogSeeder::class);
|
||||
$this->call(CustomFieldSeeder::class);
|
||||
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
use Illuminate\Database\Seeder;
|
||||
use App\Models\Department;
|
||||
|
||||
class DepartmentSeeder extends Seeder
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
Department::truncate();
|
||||
factory(Department::class, 1)->states('hr')->create(); // 1
|
||||
factory(Department::class, 1)->states('engineering')->create(); // 2
|
||||
factory(Department::class, 1)->states('marketing')->create(); // 3
|
||||
factory(Department::class, 1)->states('client')->create(); // 4
|
||||
factory(Department::class, 1)->states('product')->create(); // 5
|
||||
factory(Department::class, 1)->states('silly')->create(); // 6
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,8 @@ class DepreciationSeeder extends Seeder
|
||||
public function run()
|
||||
{
|
||||
Depreciation::truncate();
|
||||
factory(Depreciation::class, 5)->create();
|
||||
factory(Depreciation::class, 1)->states('computer')->create(); // 1
|
||||
factory(Depreciation::class, 1)->states('display')->create(); // 2
|
||||
factory(Depreciation::class, 1)->states('mobile-phones')->create(); // 3
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,9 +8,10 @@ class LicenseSeeder extends Seeder
|
||||
public function run()
|
||||
{
|
||||
License::truncate();
|
||||
factory(License::class, 10)->create();
|
||||
|
||||
LicenseSeat::truncate();
|
||||
factory(LicenseSeat::class, 10)->create();
|
||||
factory(License::class, 1)->states('photoshop')->create();
|
||||
factory(License::class, 1)->states('acrobat')->create();
|
||||
factory(License::class, 1)->states('indesign')->create();
|
||||
factory(License::class, 1)->states('office')->create();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,16 @@ class ManufacturerSeeder extends Seeder
|
||||
public function run()
|
||||
{
|
||||
Manufacturer::truncate();
|
||||
factory(Manufacturer::class, 10)->create();
|
||||
factory(Manufacturer::class, 1)->states('apple')->create(); // 1
|
||||
factory(Manufacturer::class, 1)->states('microsoft')->create(); // 2
|
||||
factory(Manufacturer::class, 1)->states('dell')->create(); // 3
|
||||
factory(Manufacturer::class, 1)->states('asus')->create(); // 4
|
||||
factory(Manufacturer::class, 1)->states('hp')->create(); // 5
|
||||
factory(Manufacturer::class, 1)->states('lenovo')->create(); // 6
|
||||
factory(Manufacturer::class, 1)->states('lg')->create(); // 7
|
||||
factory(Manufacturer::class, 1)->states('polycom')->create(); // 8
|
||||
factory(Manufacturer::class, 1)->states('adobe')->create(); // 9
|
||||
factory(Manufacturer::class, 1)->states('avery')->create(); // 10
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,45 @@ class UserSeeder extends Seeder
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
// Don't truncate the user column, that might suck.
|
||||
factory(User::class, 10)->create();
|
||||
User::truncate();
|
||||
factory(User::class, 1)->states('first-admin')->create();
|
||||
factory(User::class, 1)->states('snipe-admin')->create();
|
||||
factory(User::class, 3)->states('superuser')->create();
|
||||
factory(User::class, 3)->states('admin')->create();
|
||||
factory(User::class, 1)->states('view-assets')->create();
|
||||
// factory(User::class, 1)->states('create-assets')->create();
|
||||
// factory(User::class, 1)->states('edit-assets')->create();
|
||||
// factory(User::class, 1)->states('delete-assets')->create();
|
||||
// factory(User::class, 1)->states('checkin-assets')->create();
|
||||
// factory(User::class, 1)->states('checkout-assets')->create();
|
||||
// factory(User::class, 1)->states('view-requestable-assets')->create();
|
||||
// factory(User::class, 1)->states('view-accessories')->create();
|
||||
// factory(User::class, 1)->states('create-accessories')->create();
|
||||
// factory(User::class, 1)->states('view-accessories')->create();
|
||||
// factory(User::class, 1)->states('delete-accessories')->create();
|
||||
// factory(User::class, 1)->states('edit-accessories')->create();
|
||||
// factory(User::class, 1)->states('checkout-accessories')->create();
|
||||
// factory(User::class, 1)->states('checkin-accessories')->create();
|
||||
// factory(User::class, 1)->states('view-consumables')->create();
|
||||
// factory(User::class, 1)->states('create-consumables')->create();
|
||||
// factory(User::class, 1)->states('edit-consumables')->create();
|
||||
// factory(User::class, 1)->states('delete-consumables')->create();
|
||||
// factory(User::class, 1)->states('checkout-consumables')->create();
|
||||
// factory(User::class, 1)->states('view-licenses')->create();
|
||||
// factory(User::class, 1)->states('edit-licenses')->create();
|
||||
// factory(User::class, 1)->states('delete-licenses')->create();
|
||||
// factory(User::class, 1)->states('create-licenses')->create();
|
||||
// factory(User::class, 1)->states('checkout-licenses')->create();
|
||||
// factory(User::class, 1)->states('view-keys-licenses')->create();
|
||||
// factory(User::class, 1)->states('view-components')->create();
|
||||
// factory(User::class, 1)->states('edit-components')->create();
|
||||
// factory(User::class, 1)->states('create-components')->create();
|
||||
// factory(User::class, 1)->states('delete-components')->create();
|
||||
// factory(User::class, 1)->states('checkout-components')->create();
|
||||
// factory(User::class, 1)->states('checkin-components')->create();
|
||||
// factory(User::class, 1)->states('view-users')->create();
|
||||
// factory(User::class, 1)->states('edit-users')->create();
|
||||
// factory(User::class, 1)->states('delete-users')->create();
|
||||
// factory(User::class, 1)->states('create-users')->create();
|
||||
}
|
||||
}
|
||||
|
||||
+8
-2
@@ -1,7 +1,13 @@
|
||||
# ensure running as root
|
||||
if [ "$(id -u)" != "0" ]; then
|
||||
exec sudo "$0" "$@"
|
||||
#Debian doesnt have sudo if root has a password.
|
||||
if ! hash sudo 2>/dev/null; then
|
||||
exec su -c "$0" "$@"
|
||||
else
|
||||
exec sudo "$0" "$@"
|
||||
fi
|
||||
fi
|
||||
|
||||
wget https://raw.githubusercontent.com/snipe/snipe-it/master/snipeit.sh
|
||||
chmod 744 snipeit.sh
|
||||
sudo ./snipeit.sh 2>&1 | sudo tee -a /var/log/snipeit-install.log
|
||||
./snipeit.sh 2>&1 | tee -a /var/log/snipeit-install.log
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
@@ -167,7 +167,7 @@
|
||||
'settings' => 'Settings',
|
||||
'sign_in' => 'Sign in',
|
||||
'signature' => 'Signature',
|
||||
'some_features_disabled' => 'DEMO MODE: Some features are disabled for this installation.',
|
||||
'some_features_disabled' => 'DEMO MODE: Some features are disabled for this installation and the data in this system will reset daily.',
|
||||
'site_name' => 'Site Name',
|
||||
'state' => 'State',
|
||||
'status_labels' => 'Status Labels',
|
||||
|
||||
@@ -398,31 +398,8 @@ Form::macro('time_display_format', function ($name = "time_display_format", $sel
|
||||
|
||||
/**
|
||||
* Barcode macro
|
||||
* Generates the dropdown menu of available barcodes
|
||||
* Generates the dropdown menu of available 1D barcodes
|
||||
*/
|
||||
Form::macro('barcode_types', function ($name = "barcode_type", $selected = null, $class = null) {
|
||||
|
||||
$barcode_types = array(
|
||||
'QRCODE'=>"QR Code",
|
||||
'PDF417'=>'PDF417',
|
||||
'DATAMATRIX'=>'DATAMATRIX',
|
||||
'C128'=>'Code 128'
|
||||
);
|
||||
|
||||
$select = '<select name="'.$name.'" class="'.$class.'">';
|
||||
|
||||
foreach ($barcode_types as $code => $codename) {
|
||||
$select .= '<option value="'.$code.'"'.($selected == $code ? ' selected="selected"' : '').'>'.$codename.'</option> ';
|
||||
}
|
||||
|
||||
$select .= '</select>';
|
||||
|
||||
return $select;
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
Form::macro('alt_barcode_types', function ($name = "alt_barcode", $selected = null, $class = null) {
|
||||
|
||||
$barcode_types = array(
|
||||
@@ -445,6 +422,10 @@ Form::macro('alt_barcode_types', function ($name = "alt_barcode", $selected = nu
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Barcode macro
|
||||
* Generates the dropdown menu of available 2D barcodes
|
||||
*/
|
||||
Form::macro('barcode_types', function ($name = "barcode_type", $selected = null, $class = null) {
|
||||
|
||||
$barcode_types = array(
|
||||
|
||||
@@ -56,19 +56,10 @@
|
||||
{!! $errors->first('note', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!}
|
||||
</div>
|
||||
</div>
|
||||
<!-- Form actions -->
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label"></label>
|
||||
<div class="col-md-7">
|
||||
<a class="btn btn-link" href="{{ URL::previous() }}">{{ trans('button.cancel') }}</a>
|
||||
<button type="submit" class="btn btn-success"><i class="fa fa-check icon-white"></i>{{ trans('general.checkin') }}</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
<div class="box-footer text-right">
|
||||
<button type="submit" class="btn btn-success"><i class="fa fa-check icon-white"></i> {{ trans('general.save') }}</button>
|
||||
</div>
|
||||
<div class="box-footer">
|
||||
<a class="btn btn-link" href="{{ URL::previous() }}">{{ trans('button.cancel') }}</a>
|
||||
<button type="submit" class="btn btn-success pull-right"><i class="fa fa-check icon-white"></i>{{ trans('general.checkin') }}</button>
|
||||
</div>
|
||||
</div> <!-- .box.box-default -->
|
||||
</form>
|
||||
|
||||
@@ -79,8 +79,9 @@
|
||||
@endif
|
||||
|
||||
</div>
|
||||
<div class="box-footer text-right">
|
||||
<button type="submit" class="btn btn-success"><i class="fa fa-check icon-white"></i> {{ trans('general.save') }}</button>
|
||||
<div class="box-footer">
|
||||
<a class="btn btn-link" href="{{ URL::previous() }}">{{ trans('button.cancel') }}</a>
|
||||
<button type="submit" class="btn btn-success pull-right"><i class="fa fa-check icon-white"></i> {{ trans('general.checkout') }}</button>
|
||||
</div>
|
||||
</div> <!-- .box.box-default -->
|
||||
</form>
|
||||
|
||||
@@ -55,9 +55,10 @@
|
||||
</div>
|
||||
|
||||
</div> <!-- .BOX-BODY-->
|
||||
<div class="box-footer text-right">
|
||||
<button type="submit" class="btn btn-success"><i class="fa fa-check icon-white"></i> {{ trans('general.save') }}</button>
|
||||
</div>
|
||||
<div class="box-footer">
|
||||
<a class="btn btn-link" href="{{ URL::previous() }}">{{ trans('button.cancel') }}</a>
|
||||
<button type="submit" class="btn btn-success pull-right"><i class="fa fa-check icon-white"></i> {{ trans('general.checkout') }}</button>
|
||||
</div>
|
||||
</div> <!-- .box-default-->
|
||||
</form>
|
||||
</div> <!-- .col-md-9-->
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
<tr>
|
||||
<th data-switchable="false" data-searchable="false" data-sortable="false" data-field="name" data-formatter="hardwareLinkFormatter">{{ trans('general.asset') }}</th>
|
||||
<th data-switchable="false" data-searchable="false" data-sortable="false" data-field="qty">{{ trans('general.qty') }}</th>
|
||||
<th data-switchable="false" data-searchable="false" data-sortable="false" data-field="created_at">{{ trans('general.date') }}</th>
|
||||
<th data-switchable="false" data-searchable="false" data-sortable="false" data-field="created_at" data-formatter="dateDisplayFormatter">{{ trans('general.date') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
|
||||
@@ -63,9 +63,10 @@
|
||||
</div>
|
||||
@endif
|
||||
</div> <!-- .box-body -->
|
||||
<div class="box-footer text-right">
|
||||
<button type="submit" class="btn btn-success"><i class="fa fa-check icon-white"></i> {{ trans('general.save') }}</button>
|
||||
</div>
|
||||
<div class="box-footer">
|
||||
<a class="btn btn-link" href="{{ URL::previous() }}">{{ trans('button.cancel') }}</a>
|
||||
<button type="submit" class="btn btn-success pull-right"><i class="fa fa-check icon-white"></i> {{ trans('general.checkout') }}</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
|
||||
@@ -328,7 +328,7 @@
|
||||
});
|
||||
},
|
||||
error: function (data) {
|
||||
window.location.reload(true);
|
||||
// window.location.reload(true);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -91,16 +91,14 @@
|
||||
{!! $errors->first('note', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!}
|
||||
</div>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-success pull-right"><i
|
||||
class="fa fa-check icon-white"></i> {{ trans('general.checkin') }}</button>
|
||||
</form>
|
||||
<div class="box-footer">
|
||||
<a class="btn btn-link" href="{{ URL::previous() }}"> {{ trans('button.cancel') }}</a>
|
||||
<button type="submit" class="btn btn-success pull-right"><i class="fa fa-check icon-white"></i> {{ trans('general.checkin') }}</button>
|
||||
</div>
|
||||
</form>
|
||||
</div> <!--/.col-md-12-->
|
||||
</div> <!--/.box-body-->
|
||||
<div class="box-footer">
|
||||
<a class="btn btn-link" href="{{ URL::previous() }}"> {{ trans('button.cancel') }}</a>
|
||||
</div>
|
||||
|
||||
</div> <!--/.box.box-default-->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -61,7 +61,7 @@
|
||||
@endif
|
||||
|
||||
<p>
|
||||
Upload a CSV that contains asset history. The assets and users MUST already exist in the system, or they will be skipped. Matching assets for history import happens against the asset tag. We will try to find a matching user based on the user's name you provide, and the criteria you select below. If you do not select any criteria below, it will simply try to match on the username format you configured in the Admin < Settings.
|
||||
Upload a CSV that contains asset history. The assets and users MUST already exist in the system, or they will be skipped. Matching assets for history import happens against the asset tag. We will try to find a matching user based on the user's name you provide, and the criteria you select below. If you do not select any criteria below, it will simply try to match on the username format you configured in the Admin > General Settings.
|
||||
</p>
|
||||
|
||||
<p>Fields included in the CSV must match the headers: <strong>Date, Tag, Name</strong>. Any additional fields will be ignored. </p>
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
{{ trans('general.pending') }}
|
||||
@elseif (Input::get('status')=='RTD')
|
||||
{{ trans('general.ready_to_deploy') }}
|
||||
@elseif (Input::get('status')=='Deployed')
|
||||
{{ trans('general.deployed') }}
|
||||
@elseif (Input::get('status')=='Undeployable')
|
||||
{{ trans('general.undeployable') }}
|
||||
@elseif (Input::get('status')=='Deployable')
|
||||
@@ -40,7 +42,7 @@
|
||||
@stop
|
||||
|
||||
@section('header_right')
|
||||
<a href="{{ route('reports/export/assets') }}" style="margin-right: 5px;" class="btn btn-default"><i class="fa fa-download icon-white"></i>
|
||||
<a href="{{ route('reports.export.assets', ['status'=> e(Input::get('status'))]) }}" style="margin-right: 5px;" class="btn btn-default"><i class="fa fa-download icon-white"></i>
|
||||
{{ trans('admin/hardware/table.dl_csv') }}</a>
|
||||
<a href="{{ route('hardware.create') }}" class="btn btn-primary pull-right"></i> {{ trans('general.create') }}</a>
|
||||
@stop
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
<span class="btn btn-info fileinput-button">
|
||||
<span>Select Import File...</span>
|
||||
<!-- The file input field used as target for the file upload widget -->
|
||||
<input id="fileupload" type="file" name="files[]" data-url="/api/v1/imports" accept="text/csv">
|
||||
<input id="fileupload" type="file" name="files[]" data-url="{{ route('api.imports.index') }}" accept="text/csv">
|
||||
</span>
|
||||
</div>
|
||||
<div class="col-md-9" v-show="progress.visible" style="padding-bottom:20px">
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<link rel="stylesheet" href="{{ url(asset('js/plugins/select2/select2.min.css')) }}">
|
||||
|
||||
<link rel="stylesheet" href="{{ url(mix('css/dist/all.css')) }}">
|
||||
<link rel="shortcut icon" type="image/ico" href="{{ asset('favicon.ico') }}">
|
||||
<link rel="shortcut icon" type="image/ico" href="{{ url(asset('favicon.ico')) }}">
|
||||
|
||||
|
||||
@if (($snipeSettings) && ($snipeSettings->header_color))
|
||||
@@ -42,7 +42,7 @@
|
||||
|
||||
@if (($snipeSettings) && ($snipeSettings->logo!=''))
|
||||
<center>
|
||||
<img class="logo" style="padding-top: 20px; padding-bottom: 10px;" src="{{ url('/') }}/uploads/{{ $snipeSettings->logo }}">
|
||||
<img style="padding-top: 20px; padding-bottom: 10px; max-width: 150px" src="{{ url('/') }}/uploads/{{ $snipeSettings->logo }}">
|
||||
</center>
|
||||
@endif
|
||||
<!-- Content -->
|
||||
|
||||
@@ -108,7 +108,7 @@
|
||||
@if ($snipeSettings->brand == '3')
|
||||
<a class="logo navbar-brand no-hover" href="{{ url('/') }}">
|
||||
@if ($snipeSettings->logo!='')
|
||||
<img class="navbar-brand-img" src="{{ url('/') }}/uploads/{{ $snipeSettings->logo }}">
|
||||
<img class="navbar-brand-img" style="max-height: 50px;" src="{{ url('/') }}/uploads/{{ $snipeSettings->logo }}">
|
||||
@endif
|
||||
{{ $snipeSettings->site_name }}
|
||||
</a>
|
||||
@@ -379,18 +379,17 @@
|
||||
|
||||
|
||||
<li{!! (Request::query('status') == 'Deployed' ? ' class="active"' : '') !!}>
|
||||
<a href="{{ url('hardware?status=Deployed') }}"><i class="fa fa-circle-o text-blue"></i>All @lang('general.deployed')
|
||||
<a href="{{ url('hardware?status=Deployed') }}"><i class="fa fa-circle-o text-blue"></i>All @lang('general.deployed')
|
||||
</a>
|
||||
</li>
|
||||
<li{!! (Request::query('status') == 'RTD' ? ' class="active"' : '') !!}>
|
||||
<a href="{{ url('hardware?status=RTD') }}">
|
||||
<i class="fa fa-circle-o text-green"></i>
|
||||
All @lang('general.ready_to_deploy')</a>
|
||||
<i class="fa fa-circle-o text-green"></i>All @lang('general.ready_to_deploy')</a>
|
||||
</li>
|
||||
<li{!! (Request::query('status') == 'Pending' ? ' class="active"' : '') !!}><a href="{{ url('hardware?status=Pending') }}"><i class="fa fa-circle-o text-orange"></i>All @lang('general.pending')</a></li>
|
||||
<li{!! (Request::query('status') == 'Pending' ? ' class="active"' : '') !!}><a href="{{ url('hardware?status=Pending') }}"><i class="fa fa-circle-o text-orange"></i>All @lang('general.pending')</a></li>
|
||||
<li{!! (Request::query('status') == 'Undeployable' ? ' class="active"' : '') !!} ><a href="{{ url('hardware?status=Undeployable') }}"><i class="fa fa-times text-red"></i>All @lang('general.undeployable')</a></li>
|
||||
<li{!! (Request::query('status') == 'Archived' ? ' class="active"' : '') !!}><a href="{{ url('hardware?status=Archived') }}"><i class="fa fa-times text-red"></i>All @lang('admin/hardware/general.archived')</a></li>
|
||||
<li{!! (Request::query('status') == 'Requestable' ? ' class="active"' : '') !!}><a href="{{ url('hardware?status=Requestable') }}"><i class="fa fa-check text-blue"></i> @lang('admin/hardware/general.requestable')</a></li>
|
||||
<li{!! (Request::query('status') == 'Archived' ? ' class="active"' : '') !!}><a href="{{ url('hardware?status=Archived') }}"><i class="fa fa-times text-red"></i>All @lang('admin/hardware/general.archived')</a></li>
|
||||
<li{!! (Request::query('status') == 'Requestable' ? ' class="active"' : '') !!}><a href="{{ url('hardware?status=Requestable') }}"><i class="fa fa-check text-blue"></i>@lang('admin/hardware/general.requestable')</a></li>
|
||||
|
||||
<li class="divider"> </li>
|
||||
@can('checkout', \App\Models\Asset::class)
|
||||
|
||||
@@ -125,7 +125,7 @@
|
||||
@if ($license->manufacturer)
|
||||
<tr>
|
||||
<td>{{ trans('admin/hardware/form.manufacturer') }}</td>
|
||||
<td>
|
||||
<td><p style="line-height: 23px;">
|
||||
@can('view', \App\Models\Manufacturer::class)
|
||||
<a href="{{ route('manufacturers.show', $license->manufacturer->id) }}">
|
||||
{{ $license->manufacturer->name }}
|
||||
@@ -135,20 +135,23 @@
|
||||
@endcan
|
||||
|
||||
@if ($license->manufacturer->url)
|
||||
<br><i class="fa fa-globe"></i> <a href="{{ $license->manufacturer->url }}">{{ $license->manufacturer->url }}</a>
|
||||
<br><i class="fa fa-globe"></i> <a href="{{ $license->manufacturer->url }}" rel="noopener">{{ $license->manufacturer->url }}</a>
|
||||
@endif
|
||||
|
||||
@if ($license->manufacturer->support_url)
|
||||
<br><i class="fa fa-life-ring"></i> <a href="{{ $license->manufacturer->support_url }}">{{ $license->manufacturer->support_url }}</a>
|
||||
<br><i class="fa fa-life-ring"></i>
|
||||
<a href="{{ $license->manufacturer->support_url }}" rel="noopener">{{ $license->manufacturer->support_url }}</a>
|
||||
@endif
|
||||
|
||||
@if ($license->manufacturer->support_phone)
|
||||
<br><i class="fa fa-phone"></i> {{ $license->manufacturer->support_phone }}
|
||||
<br><i class="fa fa-phone"></i>
|
||||
<a href="tel:{{ $license->manufacturer->support_phone }}">{{ $license->manufacturer->support_phone }}</a>
|
||||
@endif
|
||||
|
||||
@if ($license->manufacturer->support_email)
|
||||
<br><i class="fa fa-envelope"></i> <a href="mailto:{{ $license->manufacturer->support_email }}">{{ $license->manufacturer->support_email }}</a>
|
||||
@endif
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
@endif
|
||||
|
||||
@@ -47,11 +47,11 @@
|
||||
|
||||
<!-- LDAP Search OU -->
|
||||
@if ($snipeSettings->ldap_enabled == 1)
|
||||
<div class="form-group {{ $errors->has('currency') ? ' has-error' : '' }}">
|
||||
<div class="form-group {{ $errors->has('ldap_ou') ? ' has-error' : '' }}">
|
||||
<label for="ldap_ou" class="col-md-3 control-label">
|
||||
{{ trans('admin/locations/table.ldap_ou') }}
|
||||
</label>
|
||||
<div class="col-md-7{{ (\App\Helpers\Helper::checkIfRequired($item, 'currency')) ? ' required' : '' }}">
|
||||
<div class="col-md-7{{ (\App\Helpers\Helper::checkIfRequired($item, 'ldap_ou')) ? ' required' : '' }}">
|
||||
{{ Form::text('ldap_ou', Input::old('ldap_ou', $item->ldap_ou), array('class' => 'form-control')) }}
|
||||
{!! $errors->first('ldap_ou', '<span class="alert-msg">:message</span>') !!}
|
||||
</div>
|
||||
|
||||
@@ -2,14 +2,26 @@
|
||||
|
||||
{{-- Page title --}}
|
||||
@section('title')
|
||||
{{ trans('admin/models/table.title') }}
|
||||
|
||||
@if (Input::get('status')=='deleted')
|
||||
{{ trans('admin/models/general.view_deleted') }}
|
||||
{{ trans('admin/models/table.title') }}
|
||||
@else
|
||||
{{ trans('admin/models/general.view_models') }}
|
||||
@endif
|
||||
@parent
|
||||
@stop
|
||||
|
||||
{{-- Page title --}}
|
||||
@section('header_right')
|
||||
<a href="{{ route('models.create') }}" class="btn btn-primary pull-right"></i> {{ trans('general.create') }}</a>
|
||||
<a href="{{ url('hardware/models?status=Deleted') }}" class="btn btn-default pull-right" style="margin-right:5px;"><i class="fa fa-trash"></i> {{ trans('admin/models/general.view_deleted') }}</a>
|
||||
|
||||
@if (Input::get('status')=='deleted')
|
||||
<a class="btn btn-default pull-right" href="{{ route('models.index') }}" style="margin-right: 5px;">{{ trans('admin/models/general.view_models') }}</a>
|
||||
@else
|
||||
<a class="btn btn-default pull-right" href="{{ route('models.index', ['status' => 'deleted']) }}" style="margin-right: 5px;">{{ trans('admin/models/general.view_deleted') }}</a>
|
||||
@endif
|
||||
|
||||
@stop
|
||||
|
||||
|
||||
@@ -28,12 +40,15 @@
|
||||
'id' => 'bulkForm']) }}
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
|
||||
@if (Input::get('status')!='deleted')
|
||||
<div id="toolbar">
|
||||
<select name="bulk_actions" class="form-control select2" style="width: 300px;">
|
||||
<option value="edit">Bulk Edit</option>
|
||||
</select>
|
||||
<button class="btn btn-primary" id="bulkEdit" disabled>Go</button>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
|
||||
|
||||
@@ -41,7 +56,7 @@
|
||||
name="models"
|
||||
class="table table-striped snipe-table"
|
||||
id="table"
|
||||
data-url="{{ route('api.models.index') }}"
|
||||
data-url="{{ route('api.models.index', ['status'=> e(Input::get('status'))]) }}"
|
||||
data-cookie="true"
|
||||
data-click-to-select="true"
|
||||
data-cookie-id-table="modelsTable-{{ config('version.hash_version') }}">
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user