diff --git a/.travis.yml b/.travis.yml index 83db93506..6caf0ca7f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -41,6 +41,7 @@ script: # - ./vendor/bin/codecept run acceptance --env=testing-ci - ./vendor/bin/codecept run functional --env=functional-travis #script: ./vendor/bin/codecept run + - ./vendor/bin/codecept run api --env=testing-ci after_success: - codecov diff --git a/Dockerfile b/Dockerfile index 712b29217..8edb3f0ce 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:trusty +FROM debian:jessie-slim MAINTAINER Brady Wetherington RUN apt-get update && apt-get install -y \ @@ -13,7 +13,9 @@ patch \ curl \ vim \ git \ -mysql-client +mysql-client \ +&& apt-get clean \ +&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* RUN php5enmod mcrypt RUN php5enmod gd @@ -55,7 +57,6 @@ RUN chown -R docker /var/www/html RUN \ rm -r "/var/www/html/storage/private_uploads" && ln -fs "/var/lib/snipeit/data/private_uploads" "/var/www/html/storage/private_uploads" \ - && mkdir -p "/var/lib/snipeit/data/uploads/{assets,avatars,barcodes,models,suppliers}" \ && rm -rf "/var/www/html/public/uploads" && ln -fs "/var/lib/snipeit/data/uploads" "/var/www/html/public/uploads" \ && rm -r "/var/www/html/storage/app/backups" && ln -fs "/var/lib/snipeit/dumps" "/var/www/html/storage/app/backups" diff --git a/app/Console/Commands/PaveIt.php b/app/Console/Commands/PaveIt.php index 185f6b4ef..c7a3954db 100644 --- a/app/Console/Commands/PaveIt.php +++ b/app/Console/Commands/PaveIt.php @@ -117,6 +117,11 @@ class PaveIt extends Command \DB::statement('drop table IF EXISTS manufacturers'); \DB::statement('drop table IF EXISTS models'); \DB::statement('drop table IF EXISTS migrations'); + \DB::statement('drop table IF EXISTS oauth_access_tokens'); + \DB::statement('drop table IF EXISTS oauth_auth_codes'); + \DB::statement('drop table IF EXISTS oauth_clients'); + \DB::statement('drop table IF EXISTS oauth_personal_access_clients'); + \DB::statement('drop table IF EXISTS oauth_refresh_tokens'); \DB::statement('drop table IF EXISTS password_resets'); \DB::statement('drop table IF EXISTS requested_assets'); \DB::statement('drop table IF EXISTS requests'); diff --git a/app/Http/Controllers/Api/AssetsController.php b/app/Http/Controllers/Api/AssetsController.php index 7a8b212e2..b79030d2f 100644 --- a/app/Http/Controllers/Api/AssetsController.php +++ b/app/Http/Controllers/Api/AssetsController.php @@ -287,23 +287,36 @@ class AssetsController extends Controller if ($asset = Asset::find($id)) { ($request->has('model_id')) ? $asset->model()->associate(AssetModel::find($request->get('model_id'))) : ''; - ($request->has('name')) ? $asset->name = $request->get('name') : ''; - ($request->has('serial')) ? $asset->serial = $request->get('serial') : ''; - ($request->has('model_id')) ? $asset->model_id = $request->get('model_id') : ''; - ($request->has('order_number')) ? $asset->order_number = $request->get('order_number') : ''; - ($request->has('notes')) ? $asset->notes = $request->get('notes') : ''; - ($request->has('asset_tag')) ? $asset->asset_tag = $request->input('asset_tag') : ''; - ($request->has('archived')) ? $asset->archived = $request->get('archived') : ''; - ($request->has('status_id')) ? $asset->status_id = $request->get('status_id') : ''; - ($request->has('warranty_months')) ? $asset->warranty_months = $request->get('warranty_months') : ''; + ($request->has('name')) ? + $asset->name = $request->get('name') : ''; + ($request->has('serial')) ? + $asset->serial = $request->get('serial') : ''; + ($request->has('model_id')) ? + $asset->model_id = $request->get('model_id') : ''; + ($request->has('order_number')) ? + $asset->order_number = $request->get('order_number') : ''; + ($request->has('notes')) ? + $asset->notes = $request->get('notes') : ''; + ($request->has('asset_tag')) ? + $asset->asset_tag = $request->get('asset_tag') : ''; + ($request->has('archived')) ? + $asset->archived = $request->get('archived') : ''; + ($request->has('status_id')) ? + $asset->status_id = $request->get('status_id') : ''; + ($request->has('warranty_months')) ? + $asset->warranty_months = $request->get('warranty_months') : ''; ($request->has('purchase_cost')) ? $asset->purchase_cost = Helper::ParseFloat($request->get('purchase_cost')) : ''; - ($request->has('purchase_date')) ? $asset->purchase_date = $request->get('purchase_date') : ''; - ($request->has('assigned_to')) ? $asset->assigned_to = $request->get('assigned_to') : ''; - ($request->has('supplier_id')) ? $asset->supplier_id = $request->get('supplier_id') : ''; - ($request->has('requestable')) ? $asset->name = $request->get('requestable') : ''; - ($request->has('archived')) ? $asset->name = $request->get('archived') : ''; - ($request->has('rtd_location_id')) ? $asset->name = $request->get('rtd_location_id') : ''; + ($request->has('purchase_date')) ? + $asset->purchase_date = $request->get('purchase_date') : ''; + ($request->has('assigned_to')) ? + $asset->assigned_to = $request->get('assigned_to') : ''; + ($request->has('supplier_id')) ? + $asset->supplier_id = $request->get('supplier_id') : ''; + ($request->has('requestable')) ? + $asset->requestable = $request->get('requestable') : ''; + ($request->has('rtd_location_id')) ? + $asset->rtd_location_id = $request->get('rtd_location_id') : ''; ($request->has('company_id')) ? $asset->company_id = Company::getIdForCurrentUser($request->get('company_id')) : ''; @@ -335,8 +348,6 @@ class AssetsController extends Controller } return response()->json(Helper::formatStandardApiResponse('error', null, $asset->getErrors()), 200); } - - return response()->json(Helper::formatStandardApiResponse('error', null, trans('admin/hardware/message.does_not_exist')), 200); } diff --git a/app/Http/Controllers/Api/ComponentsController.php b/app/Http/Controllers/Api/ComponentsController.php index bd02ed720..1ffb3d4e0 100644 --- a/app/Http/Controllers/Api/ComponentsController.php +++ b/app/Http/Controllers/Api/ComponentsController.php @@ -135,7 +135,7 @@ class ComponentsController extends Controller $component = Component::findOrFail($id); $this->authorize('delete', $component); $component->delete(); - return response()->json(Helper::formatStandardApiResponse('success', null, trans('admin/components/message.delete.success'))); + return response()->json(Helper::formatStandardApiResponse('success', null, trans('admin/components/message.delete.success'))); } /** diff --git a/app/Http/Controllers/ViewAssetsController.php b/app/Http/Controllers/ViewAssetsController.php index 8372ab7e0..eaa555833 100755 --- a/app/Http/Controllers/ViewAssetsController.php +++ b/app/Http/Controllers/ViewAssetsController.php @@ -41,7 +41,7 @@ class ViewAssetsController extends Controller { $user = User::with( - 'assignedAssets.model', + 'assets.model', 'consumables', 'accessories', 'licenses', diff --git a/app/Models/Asset.php b/app/Models/Asset.php index ecedaba35..619a41b13 100644 --- a/app/Models/Asset.php +++ b/app/Models/Asset.php @@ -54,18 +54,18 @@ class Asset extends Depreciable use ValidatingTrait, UniqueUndeletedTrait; protected $rules = [ - 'name' => 'max:255|nullable', - 'model_id' => 'required|integer|exists:models,id', - 'status_id' => 'required|integer|exists:status_labels,id', - 'company_id' => 'integer|nullable', - 'warranty_months' => 'numeric|nullable', - 'physical' => 'numeric|max:1|nullable', - 'checkout_date' => 'date|max:10|min:10|nullable', - 'checkin_date' => 'date|max:10|min:10|nullable', - 'supplier_id' => 'numeric|nullable', - 'asset_tag' => 'required|min:1|max:255|unique_undeleted', - 'status' => 'integer', - 'purchase_cost' => 'numeric|nullable', + 'name' => 'max:255|nullable', + 'model_id' => 'required|integer|exists:models,id', + 'status_id' => 'required|integer|exists:status_labels,id', + 'company_id' => 'integer|nullable', + 'warranty_months' => 'numeric|nullable', + 'physical' => 'numeric|max:1|nullable', + 'checkout_date' => 'date|max:10|min:10|nullable', + 'checkin_date' => 'date|max:10|min:10|nullable', + 'supplier_id' => 'numeric|nullable', + 'asset_tag' => 'required|min:1|max:255|unique_undeleted', + 'status' => 'integer', + 'purchase_cost' => 'numeric|nullable', ]; /** diff --git a/composer.json b/composer.json index e94f7c228..0411d2686 100644 --- a/composer.json +++ b/composer.json @@ -34,7 +34,8 @@ "symfony/css-selector": "3.1.*", "symfony/dom-crawler": "3.1.*", "codeception/codeception": "2.2.9", - "squizlabs/php_codesniffer": "*" + "squizlabs/php_codesniffer": "*", + "laravel/tinker": "^1.0" }, "autoload": { "classmap": [ diff --git a/composer.lock b/composer.lock index a73859da5..ff22e06ef 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +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" ], - "hash": "c083ff96bd4f38110f66aa5d92da21c5", - "content-hash": "e59a7dbb0757b4c418fca159cfb22fac", + "hash": "01797ce4699addd08573664ba2e040f7", + "content-hash": "5c3055e9052b11b2adc3204a2a81a935", "packages": [ { "name": "aws/aws-sdk-php", @@ -4074,6 +4074,39 @@ ], "time": "2017-02-04 02:04:21" }, + { + "name": "dnoegel/php-xdg-base-dir", + "version": "0.1", + "source": { + "type": "git", + "url": "https://github.com/dnoegel/php-xdg-base-dir.git", + "reference": "265b8593498b997dc2d31e75b89f053b5cc9621a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/dnoegel/php-xdg-base-dir/zipball/265b8593498b997dc2d31e75b89f053b5cc9621a", + "reference": "265b8593498b997dc2d31e75b89f053b5cc9621a", + "shasum": "" + }, + "require": { + "php": ">=5.3.2" + }, + "require-dev": { + "phpunit/phpunit": "@stable" + }, + "type": "project", + "autoload": { + "psr-4": { + "XdgBaseDir\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "implementation of xdg base directory specification for php", + "time": "2014-10-24 07:27:01" + }, { "name": "doctrine/instantiator", "version": "1.0.5", @@ -4225,6 +4258,151 @@ ], "time": "2016-04-29 12:21:54" }, + { + "name": "jakub-onderka/php-console-color", + "version": "0.1", + "source": { + "type": "git", + "url": "https://github.com/JakubOnderka/PHP-Console-Color.git", + "reference": "e0b393dacf7703fc36a4efc3df1435485197e6c1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/JakubOnderka/PHP-Console-Color/zipball/e0b393dacf7703fc36a4efc3df1435485197e6c1", + "reference": "e0b393dacf7703fc36a4efc3df1435485197e6c1", + "shasum": "" + }, + "require": { + "php": ">=5.3.2" + }, + "require-dev": { + "jakub-onderka/php-code-style": "1.0", + "jakub-onderka/php-parallel-lint": "0.*", + "jakub-onderka/php-var-dump-check": "0.*", + "phpunit/phpunit": "3.7.*", + "squizlabs/php_codesniffer": "1.*" + }, + "type": "library", + "autoload": { + "psr-0": { + "JakubOnderka\\PhpConsoleColor": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-2-Clause" + ], + "authors": [ + { + "name": "Jakub Onderka", + "email": "jakub.onderka@gmail.com", + "homepage": "http://www.acci.cz" + } + ], + "time": "2014-04-08 15:00:19" + }, + { + "name": "jakub-onderka/php-console-highlighter", + "version": "v0.3.2", + "source": { + "type": "git", + "url": "https://github.com/JakubOnderka/PHP-Console-Highlighter.git", + "reference": "7daa75df45242c8d5b75a22c00a201e7954e4fb5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/JakubOnderka/PHP-Console-Highlighter/zipball/7daa75df45242c8d5b75a22c00a201e7954e4fb5", + "reference": "7daa75df45242c8d5b75a22c00a201e7954e4fb5", + "shasum": "" + }, + "require": { + "jakub-onderka/php-console-color": "~0.1", + "php": ">=5.3.0" + }, + "require-dev": { + "jakub-onderka/php-code-style": "~1.0", + "jakub-onderka/php-parallel-lint": "~0.5", + "jakub-onderka/php-var-dump-check": "~0.1", + "phpunit/phpunit": "~4.0", + "squizlabs/php_codesniffer": "~1.5" + }, + "type": "library", + "autoload": { + "psr-0": { + "JakubOnderka\\PhpConsoleHighlighter": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jakub Onderka", + "email": "acci@acci.cz", + "homepage": "http://www.acci.cz/" + } + ], + "time": "2015-04-20 18:58:01" + }, + { + "name": "laravel/tinker", + "version": "v1.0.0", + "source": { + "type": "git", + "url": "https://github.com/laravel/tinker.git", + "reference": "3d5b675b55b24ccbf86395964042dbe061d5a965" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/laravel/tinker/zipball/3d5b675b55b24ccbf86395964042dbe061d5a965", + "reference": "3d5b675b55b24ccbf86395964042dbe061d5a965", + "shasum": "" + }, + "require": { + "illuminate/console": "~5.1", + "illuminate/contracts": "~5.1", + "illuminate/support": "~5.1", + "php": ">=5.5.9", + "psy/psysh": "0.7.*|0.8.*", + "symfony/var-dumper": "~3.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.0|~5.0" + }, + "suggest": { + "illuminate/database": "The Illuminate Database package (~5.1)." + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "psr-4": { + "Laravel\\Tinker\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "description": "Powerful REPL for the Laravel framework.", + "keywords": [ + "REPL", + "Tinker", + "laravel", + "psysh" + ], + "time": "2016-12-30 18:13:17" + }, { "name": "myclabs/deep-copy", "version": "1.6.0", @@ -4267,6 +4445,57 @@ ], "time": "2017-01-26 22:05:40" }, + { + "name": "nikic/php-parser", + "version": "v3.0.5", + "source": { + "type": "git", + "url": "https://github.com/nikic/PHP-Parser.git", + "reference": "2b9e2f71b722f7c53918ab0c25f7646c2013f17d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/2b9e2f71b722f7c53918ab0c25f7646c2013f17d", + "reference": "2b9e2f71b722f7c53918ab0c25f7646c2013f17d", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": ">=5.5" + }, + "require-dev": { + "phpunit/phpunit": "~4.0|~5.0" + }, + "bin": [ + "bin/php-parse" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "psr-4": { + "PhpParser\\": "lib/PhpParser" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Nikita Popov" + } + ], + "description": "A PHP parser written in PHP", + "keywords": [ + "parser", + "php" + ], + "time": "2017-03-05 18:23:57" + }, { "name": "phpdocumentor/reflection-common", "version": "1.0", @@ -4866,6 +5095,79 @@ ], "time": "2016-12-08 20:27:08" }, + { + "name": "psy/psysh", + "version": "v0.8.2", + "source": { + "type": "git", + "url": "https://github.com/bobthecow/psysh.git", + "reference": "97113db4107a4126bef933b60fea6dbc9f615d41" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/bobthecow/psysh/zipball/97113db4107a4126bef933b60fea6dbc9f615d41", + "reference": "97113db4107a4126bef933b60fea6dbc9f615d41", + "shasum": "" + }, + "require": { + "dnoegel/php-xdg-base-dir": "0.1", + "jakub-onderka/php-console-highlighter": "0.3.*", + "nikic/php-parser": "~1.3|~2.0|~3.0", + "php": ">=5.3.9", + "symfony/console": "~2.3.10|^2.4.2|~3.0", + "symfony/var-dumper": "~2.7|~3.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "~1.11", + "hoa/console": "~3.16|~1.14", + "phpunit/phpunit": "~4.4|~5.0", + "symfony/finder": "~2.1|~3.0" + }, + "suggest": { + "ext-pcntl": "Enabling the PCNTL extension makes PsySH a lot happier :)", + "ext-pdo-sqlite": "The doc command requires SQLite to work.", + "ext-posix": "If you have PCNTL, you'll want the POSIX extension as well.", + "ext-readline": "Enables support for arrow-key history navigation, and showing and manipulating command history.", + "hoa/console": "A pure PHP readline implementation. You'll want this if your PHP install doesn't already support readline or libedit." + }, + "bin": [ + "bin/psysh" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-develop": "0.9.x-dev" + } + }, + "autoload": { + "files": [ + "src/Psy/functions.php" + ], + "psr-4": { + "Psy\\": "src/Psy/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Justin Hileman", + "email": "justin@justinhileman.info", + "homepage": "http://justinhileman.com" + } + ], + "description": "An interactive shell for modern PHP.", + "homepage": "http://psysh.org", + "keywords": [ + "REPL", + "console", + "interactive", + "shell" + ], + "time": "2017-03-01 00:13:29" + }, { "name": "sebastian/code-unit-reverse-lookup", "version": "1.0.1", diff --git a/config/app.php b/config/app.php index bd3354306..58f5d9f05 100755 --- a/config/app.php +++ b/config/app.php @@ -219,6 +219,7 @@ return [ Fideloper\Proxy\TrustedProxyServiceProvider::class, PragmaRX\Google2FA\Vendor\Laravel\ServiceProvider::class, Laravel\Passport\PassportServiceProvider::class, + Laravel\Tinker\TinkerServiceProvider::class, /* diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index 7ea4e01d2..d43f37aa6 100644 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -18,7 +18,7 @@ else fi # create data directories -for dir in 'data/private_uploads' 'data/uploads' 'data/uploads/avatars' 'data/uploads/models' 'data/uploads/suppliers' 'dumps'; do +for dir in 'data/private_uploads' 'data/uploads' 'data/uploads/avatars' 'data/uploads/barcodes' 'data/uploads/models' 'data/uploads/suppliers' 'dumps'; do mkdir -p "/var/lib/snipeit/$dir" done diff --git a/tests/_data/dump.sql b/tests/_data/dump.sql index 6d6e8580c..4ecc94ba9 100644 --- a/tests/_data/dump.sql +++ b/tests/_data/dump.sql @@ -1,8 +1,8 @@ --- MySQL dump 10.13 Distrib 5.7.9, for Linux (x86_64) +-- MySQL dump 10.13 Distrib 5.7.17, for Linux (x86_64) -- -- Host: localhost Database: snipeittests -- ------------------------------------------------------ --- Server version 5.7.9 +-- Server version 5.7.17-0ubuntu0.16.10.1 /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -541,6 +541,8 @@ CREATE TABLE `custom_fields` ( `user_id` int(11) DEFAULT NULL, `field_values` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `field_encrypted` tinyint(1) NOT NULL DEFAULT '0', + `db_column` varchar(191) COLLATE utf8_unicode_ci DEFAULT NULL, + `help_text` text COLLATE utf8_unicode_ci, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -635,6 +637,34 @@ LOCK TABLES `groups` WRITE; /*!40000 ALTER TABLE `groups` ENABLE KEYS */; UNLOCK TABLES; +-- +-- Table structure for table `imports` +-- + +DROP TABLE IF EXISTS `imports`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `imports` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `file_path` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, + `filesize` int(11) NOT NULL, + `import_type` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `imports` +-- + +LOCK TABLES `imports` WRITE; +/*!40000 ALTER TABLE `imports` DISABLE KEYS */; +/*!40000 ALTER TABLE `imports` ENABLE KEYS */; +UNLOCK TABLES; + -- -- Table structure for table `license_seats` -- @@ -734,6 +764,7 @@ CREATE TABLE `locations` ( `deleted_at` timestamp NULL DEFAULT NULL, `parent_id` int(11) DEFAULT NULL, `currency` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL, + `ldap_ou` varchar(191) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -744,7 +775,7 @@ CREATE TABLE `locations` ( LOCK TABLES `locations` WRITE; /*!40000 ALTER TABLE `locations` DISABLE KEYS */; -INSERT INTO `locations` VALUES (1,'Multi-lateral 24hour hub','North Llewellyn','IN','BJ','2016-12-19 21:50:31','2016-12-19 21:50:31',NULL,'13212 Schmidt Extensions Suite 682','Apt. 456','67559',NULL,NULL,'TWD'),(2,'Streamlined value-added firmware','East Johnathonville','IL','BS','2016-12-19 21:50:31','2016-12-19 21:50:31',NULL,'9429 Koch Village','Suite 789','51112-9226',NULL,NULL,'TTD'),(3,'Persistent asynchronous frame','New Delphaside','AK','LR','2016-12-19 21:50:31','2016-12-19 21:50:31',NULL,'7600 Howell Valleys Apt. 730','Suite 939','26693',NULL,NULL,'JPY'),(4,'Inverse optimal array','Port Laura','DE','SC','2016-12-19 21:50:31','2016-12-19 21:50:31',NULL,'9542 Cronin Crescent Apt. 550','Suite 792','56208-6621',NULL,NULL,'SYP'),(5,'Networked zeroadministration standardization','Paucekfort','FL','MZ','2016-12-19 21:50:31','2016-12-19 21:50:31',NULL,'187 Gerhold Harbor Suite 314','Suite 620','68500',NULL,NULL,'CLF'); +INSERT INTO `locations` VALUES (1,'Multi-lateral 24hour hub','North Llewellyn','IN','BJ','2016-12-19 21:50:31','2016-12-19 21:50:31',NULL,'13212 Schmidt Extensions Suite 682','Apt. 456','67559',NULL,NULL,'TWD',NULL),(2,'Streamlined value-added firmware','East Johnathonville','IL','BS','2016-12-19 21:50:31','2016-12-19 21:50:31',NULL,'9429 Koch Village','Suite 789','51112-9226',NULL,NULL,'TTD',NULL),(3,'Persistent asynchronous frame','New Delphaside','AK','LR','2016-12-19 21:50:31','2016-12-19 21:50:31',NULL,'7600 Howell Valleys Apt. 730','Suite 939','26693',NULL,NULL,'JPY',NULL),(4,'Inverse optimal array','Port Laura','DE','SC','2016-12-19 21:50:31','2016-12-19 21:50:31',NULL,'9542 Cronin Crescent Apt. 550','Suite 792','56208-6621',NULL,NULL,'SYP',NULL),(5,'Networked zeroadministration standardization','Paucekfort','FL','MZ','2016-12-19 21:50:31','2016-12-19 21:50:31',NULL,'187 Gerhold Harbor Suite 314','Suite 620','68500',NULL,NULL,'CLF',NULL); /*!40000 ALTER TABLE `locations` ENABLE KEYS */; UNLOCK TABLES; @@ -762,6 +793,10 @@ CREATE TABLE `manufacturers` ( `updated_at` timestamp NULL DEFAULT NULL, `user_id` int(11) DEFAULT NULL, `deleted_at` timestamp NULL DEFAULT NULL, + `url` varchar(191) COLLATE utf8_unicode_ci DEFAULT NULL, + `support_url` varchar(191) COLLATE utf8_unicode_ci DEFAULT NULL, + `support_phone` varchar(191) COLLATE utf8_unicode_ci DEFAULT NULL, + `support_email` varchar(191) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -772,7 +807,7 @@ CREATE TABLE `manufacturers` ( LOCK TABLES `manufacturers` WRITE; /*!40000 ALTER TABLE `manufacturers` DISABLE KEYS */; -INSERT INTO `manufacturers` VALUES (1,'Hansen and Sons','2016-12-19 21:50:31','2016-12-19 21:50:31',NULL,NULL),(2,'Walker-Kiehn','2016-12-19 21:50:31','2016-12-19 21:50:31',NULL,NULL),(3,'Crooks, Mante and Cruickshank','2016-12-19 21:50:31','2016-12-19 21:50:31',NULL,NULL),(4,'Larson and Sons','2016-12-19 21:50:31','2016-12-19 21:50:31',NULL,NULL),(5,'Koss Ltd','2016-12-19 21:50:31','2016-12-19 21:50:31',NULL,NULL),(6,'Bruen-Adams','2016-12-19 21:50:31','2016-12-19 21:50:31',NULL,NULL),(7,'Smith LLC','2016-12-19 21:50:31','2016-12-19 21:50:31',NULL,NULL),(8,'Johnston, Cummings and Blanda','2016-12-19 21:50:31','2016-12-19 21:50:31',NULL,NULL),(9,'Welch and Sons','2016-12-19 21:50:31','2016-12-19 21:50:31',NULL,NULL),(10,'Raynor Ltd','2016-12-19 21:50:31','2016-12-19 21:50:31',NULL,NULL); +INSERT INTO `manufacturers` VALUES (1,'Hansen and Sons','2016-12-19 21:50:31','2016-12-19 21:50:31',NULL,NULL,NULL,NULL,NULL,NULL),(2,'Walker-Kiehn','2016-12-19 21:50:31','2016-12-19 21:50:31',NULL,NULL,NULL,NULL,NULL,NULL),(3,'Crooks, Mante and Cruickshank','2016-12-19 21:50:31','2016-12-19 21:50:31',NULL,NULL,NULL,NULL,NULL,NULL),(4,'Larson and Sons','2016-12-19 21:50:31','2016-12-19 21:50:31',NULL,NULL,NULL,NULL,NULL,NULL),(5,'Koss Ltd','2016-12-19 21:50:31','2016-12-19 21:50:31',NULL,NULL,NULL,NULL,NULL,NULL),(6,'Bruen-Adams','2016-12-19 21:50:31','2016-12-19 21:50:31',NULL,NULL,NULL,NULL,NULL,NULL),(7,'Smith LLC','2016-12-19 21:50:31','2016-12-19 21:50:31',NULL,NULL,NULL,NULL,NULL,NULL),(8,'Johnston, Cummings and Blanda','2016-12-19 21:50:31','2016-12-19 21:50:31',NULL,NULL,NULL,NULL,NULL,NULL),(9,'Welch and Sons','2016-12-19 21:50:31','2016-12-19 21:50:31',NULL,NULL,NULL,NULL,NULL,NULL),(10,'Raynor Ltd','2016-12-19 21:50:31','2016-12-19 21:50:31',NULL,NULL,NULL,NULL,NULL,NULL); /*!40000 ALTER TABLE `manufacturers` ENABLE KEYS */; UNLOCK TABLES; @@ -788,7 +823,7 @@ CREATE TABLE `migrations` ( `migration` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `batch` int(11) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=216 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=221 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -797,7 +832,7 @@ CREATE TABLE `migrations` ( LOCK TABLES `migrations` WRITE; /*!40000 ALTER TABLE `migrations` DISABLE KEYS */; -INSERT INTO `migrations` VALUES (1,'2012_12_06_225921_migration_cartalyst_sentry_install_users',1),(2,'2012_12_06_225929_migration_cartalyst_sentry_install_groups',1),(3,'2012_12_06_225945_migration_cartalyst_sentry_install_users_groups_pivot',1),(4,'2012_12_06_225988_migration_cartalyst_sentry_install_throttle',1),(5,'2013_03_23_193214_update_users_table',1),(6,'2013_11_13_075318_create_models_table',1),(7,'2013_11_13_075335_create_categories_table',1),(8,'2013_11_13_075347_create_manufacturers_table',1),(9,'2013_11_15_015858_add_user_id_to_categories',1),(10,'2013_11_15_112701_add_user_id_to_manufacturers',1),(11,'2013_11_15_190327_create_assets_table',1),(12,'2013_11_15_190357_create_licenses_table',1),(13,'2013_11_15_201848_add_license_name_to_licenses',1),(14,'2013_11_16_040323_create_depreciations_table',1),(15,'2013_11_16_042851_add_depreciation_id_to_models',1),(16,'2013_11_16_084923_add_user_id_to_models',1),(17,'2013_11_16_103258_create_locations_table',1),(18,'2013_11_16_103336_add_location_id_to_assets',1),(19,'2013_11_16_103407_add_checkedout_to_to_assets',1),(20,'2013_11_16_103425_create_history_table',1),(21,'2013_11_17_054359_drop_licenses_table',1),(22,'2013_11_17_054526_add_physical_to_assets',1),(23,'2013_11_17_055126_create_settings_table',1),(24,'2013_11_17_062634_add_license_to_assets',1),(25,'2013_11_18_134332_add_contacts_to_users',1),(26,'2013_11_18_142847_add_info_to_locations',1),(27,'2013_11_18_152942_remove_location_id_from_asset',1),(28,'2013_11_18_164423_set_nullvalues_for_user',1),(29,'2013_11_19_013337_create_asset_logs_table',1),(30,'2013_11_19_061409_edit_added_on_asset_logs_table',1),(31,'2013_11_19_062250_edit_location_id_asset_logs_table',1),(32,'2013_11_20_055822_add_soft_delete_on_assets',1),(33,'2013_11_20_121404_add_soft_delete_on_locations',1),(34,'2013_11_20_123137_add_soft_delete_on_manufacturers',1),(35,'2013_11_20_123725_add_soft_delete_on_categories',1),(36,'2013_11_20_130248_create_status_labels',1),(37,'2013_11_20_130830_add_status_id_on_assets_table',1),(38,'2013_11_20_131544_add_status_type_on_status_labels',1),(39,'2013_11_20_134103_add_archived_to_assets',1),(40,'2013_11_21_002321_add_uploads_table',1),(41,'2013_11_21_024531_remove_deployable_boolean_from_status_labels',1),(42,'2013_11_22_075308_add_option_label_to_settings_table',1),(43,'2013_11_22_213400_edits_to_settings_table',1),(44,'2013_11_25_013244_create_licenses_table',1),(45,'2013_11_25_031458_create_license_seats_table',1),(46,'2013_11_25_032022_add_type_to_actionlog_table',1),(47,'2013_11_25_033008_delete_bad_licenses_table',1),(48,'2013_11_25_033131_create_new_licenses_table',1),(49,'2013_11_25_033534_add_licensed_to_licenses_table',1),(50,'2013_11_25_101308_add_warrantee_to_assets_table',1),(51,'2013_11_25_104343_alter_warranty_column_on_assets',1),(52,'2013_11_25_150450_drop_parent_from_categories',1),(53,'2013_11_25_151920_add_depreciate_to_assets',1),(54,'2013_11_25_152903_add_depreciate_to_licenses_table',1),(55,'2013_11_26_211820_drop_license_from_assets_table',1),(56,'2013_11_27_062510_add_note_to_asset_logs_table',1),(57,'2013_12_01_113426_add_filename_to_asset_log',1),(58,'2013_12_06_094618_add_nullable_to_licenses_table',1),(59,'2013_12_10_084038_add_eol_on_models_table',1),(60,'2013_12_12_055218_add_manager_to_users_table',1),(61,'2014_01_28_031200_add_qr_code_to_settings_table',1),(62,'2014_02_13_183016_add_qr_text_to_settings_table',1),(63,'2014_05_24_093839_alter_default_license_depreciation_id',1),(64,'2014_05_27_231658_alter_default_values_licenses',1),(65,'2014_06_19_191508_add_asset_name_to_settings',1),(66,'2014_06_20_004847_make_asset_log_checkedout_to_nullable',1),(67,'2014_06_20_005050_make_asset_log_purchasedate_to_nullable',1),(68,'2014_06_24_003011_add_suppliers',1),(69,'2014_06_24_010742_add_supplier_id_to_asset',1),(70,'2014_06_24_012839_add_zip_to_supplier',1),(71,'2014_06_24_033908_add_url_to_supplier',1),(72,'2014_07_08_054116_add_employee_id_to_users',1),(73,'2014_07_09_134316_add_requestable_to_assets',1),(74,'2014_07_17_085822_add_asset_to_software',1),(75,'2014_07_17_161625_make_asset_id_in_logs_nullable',1),(76,'2014_08_12_053504_alpha_0_4_2_release',1),(77,'2014_08_17_083523_make_location_id_nullable',1),(78,'2014_10_16_200626_add_rtd_location_to_assets',1),(79,'2014_10_24_000417_alter_supplier_state_to_32',1),(80,'2014_10_24_015641_add_display_checkout_date',1),(81,'2014_10_28_222654_add_avatar_field_to_users_table',1),(82,'2014_10_29_045924_add_image_field_to_models_table',1),(83,'2014_11_01_214955_add_eol_display_to_settings',1),(84,'2014_11_04_231416_update_group_field_for_reporting',1),(85,'2014_11_05_212408_add_fields_to_licenses',1),(86,'2014_11_07_021042_add_image_to_supplier',1),(87,'2014_11_20_203007_add_username_to_user',1),(88,'2014_11_20_223947_add_auto_to_settings',1),(89,'2014_11_20_224421_add_prefix_to_settings',1),(90,'2014_11_21_104401_change_licence_type',1),(91,'2014_12_09_082500_add_fields_maintained_term_to_licenses',1),(92,'2015_02_04_155757_increase_user_field_lengths',1),(93,'2015_02_07_013537_add_soft_deleted_to_log',1),(94,'2015_02_10_040958_fix_bad_assigned_to_ids',1),(95,'2015_02_10_053310_migrate_data_to_new_statuses',1),(96,'2015_02_11_044104_migrate_make_license_assigned_null',1),(97,'2015_02_11_104406_migrate_create_requests_table',1),(98,'2015_02_12_001312_add_mac_address_to_asset',1),(99,'2015_02_12_024100_change_license_notes_type',1),(100,'2015_02_17_231020_add_localonly_to_settings',1),(101,'2015_02_19_222322_add_logo_and_colors_to_settings',1),(102,'2015_02_24_072043_add_alerts_to_settings',1),(103,'2015_02_25_022931_add_eula_fields',1),(104,'2015_02_25_204513_add_accessories_table',1),(105,'2015_02_26_091228_add_accessories_user_table',1),(106,'2015_02_26_115128_add_deleted_at_models',1),(107,'2015_02_26_233005_add_category_type',1),(108,'2015_03_01_231912_update_accepted_at_to_acceptance_id',1),(109,'2015_03_05_011929_add_qr_type_to_settings',1),(110,'2015_03_18_055327_add_note_to_user',1),(111,'2015_04_29_234704_add_slack_to_settings',1),(112,'2015_05_04_085151_add_parent_id_to_locations_table',1),(113,'2015_05_22_124421_add_reassignable_to_licenses',1),(114,'2015_06_10_003314_fix_default_for_user_notes',1),(115,'2015_06_10_003554_create_consumables',1),(116,'2015_06_15_183253_move_email_to_username',1),(117,'2015_06_23_070346_make_email_nullable',1),(118,'2015_06_26_213716_create_asset_maintenances_table',1),(119,'2015_07_04_212443_create_custom_fields_table',1),(120,'2015_07_09_014359_add_currency_to_settings_and_locations',1),(121,'2015_07_21_122022_add_expected_checkin_date_to_asset_logs',1),(122,'2015_07_24_093845_add_checkin_email_to_category_table',1),(123,'2015_07_25_055415_remove_email_unique_constraint',1),(124,'2015_07_29_230054_add_thread_id_to_asset_logs_table',1),(125,'2015_07_31_015430_add_accepted_to_assets',1),(126,'2015_09_09_195301_add_custom_css_to_settings',1),(127,'2015_09_21_235926_create_custom_field_custom_fieldset',1),(128,'2015_09_22_000104_create_custom_fieldsets',1),(129,'2015_09_22_003321_add_fieldset_id_to_assets',1),(130,'2015_09_22_003413_migrate_mac_address',1),(131,'2015_09_28_003314_fix_default_purchase_order',1),(132,'2015_10_01_024551_add_accessory_consumable_price_info',1),(133,'2015_10_12_192706_add_brand_to_settings',1),(134,'2015_10_22_003314_fix_defaults_accessories',1),(135,'2015_10_23_182625_add_checkout_time_and_expected_checkout_date_to_assets',1),(136,'2015_11_05_061015_create_companies_table',1),(137,'2015_11_05_061115_add_company_id_to_consumables_table',1),(138,'2015_11_05_183749_image',1),(139,'2015_11_06_092038_add_company_id_to_accessories_table',1),(140,'2015_11_06_100045_add_company_id_to_users_table',1),(141,'2015_11_06_134742_add_company_id_to_licenses_table',1),(142,'2015_11_08_035832_add_company_id_to_assets_table',1),(143,'2015_11_08_222305_add_ldap_fields_to_settings',1),(144,'2015_11_15_151803_add_full_multiple_companies_support_to_settings_table',1),(145,'2015_11_26_195528_import_ldap_settings',1),(146,'2015_11_30_191504_remove_fk_company_id',1),(147,'2015_12_21_193006_add_ldap_server_cert_ignore_to_settings_table',1),(148,'2015_12_30_233509_add_timestamp_and_userId_to_custom_fields',1),(149,'2015_12_30_233658_add_timestamp_and_userId_to_custom_fieldsets',1),(150,'2016_01_28_041048_add_notes_to_models',1),(151,'2016_02_19_070119_add_remember_token_to_users_table',1),(152,'2016_02_19_073625_create_password_resets_table',1),(153,'2016_03_02_193043_add_ldap_flag_to_users',1),(154,'2016_03_02_220517_update_ldap_filter_to_longer_field',1),(155,'2016_03_08_225351_create_components_table',1),(156,'2016_03_09_024038_add_min_stock_to_tables',1),(157,'2016_03_10_133849_add_locale_to_users',1),(158,'2016_03_10_135519_add_locale_to_settings',1),(159,'2016_03_11_185621_add_label_settings_to_settings',1),(160,'2016_03_22_125911_fix_custom_fields_regexes',1),(161,'2016_04_28_141554_add_show_to_users',1),(162,'2016_05_16_164733_add_model_mfg_to_consumable',1),(163,'2016_05_19_180351_add_alt_barcode_settings',1),(164,'2016_05_19_191146_add_alter_interval',1),(165,'2016_05_19_192226_add_inventory_threshold',1),(166,'2016_05_20_024859_remove_option_keys_from_settings_table',1),(167,'2016_05_20_143758_remove_option_value_from_settings_table',1),(168,'2016_06_01_000001_create_oauth_auth_codes_table',1),(169,'2016_06_01_000002_create_oauth_access_tokens_table',1),(170,'2016_06_01_000003_create_oauth_refresh_tokens_table',1),(171,'2016_06_01_000004_create_oauth_clients_table',1),(172,'2016_06_01_000005_create_oauth_personal_access_clients_table',1),(173,'2016_06_01_140218_add_email_domain_and_format_to_settings',1),(174,'2016_06_22_160725_add_user_id_to_maintenances',1),(175,'2016_07_13_150015_add_is_ad_to_settings',1),(176,'2016_07_14_153609_add_ad_domain_to_settings',1),(177,'2016_07_22_003348_fix_custom_fields_regex_stuff',1),(178,'2016_07_22_054850_one_more_mac_addr_fix',1),(179,'2016_07_22_143045_add_port_to_ldap_settings',1),(180,'2016_07_22_153432_add_tls_to_ldap_settings',1),(181,'2016_07_27_211034_add_zerofill_to_settings',1),(182,'2016_08_02_124944_add_color_to_statuslabel',1),(183,'2016_08_04_134500_add_disallow_ldap_pw_sync_to_settings',1),(184,'2016_08_09_002225_add_manufacturer_to_licenses',1),(185,'2016_08_12_121613_add_manufacturer_to_accessories_table',1),(186,'2016_08_23_143353_add_new_fields_to_custom_fields',1),(187,'2016_08_23_145619_add_show_in_nav_to_status_labels',1),(188,'2016_08_30_084634_make_purchase_cost_nullable',1),(189,'2016_09_01_141051_add_requestable_to_asset_model',1),(190,'2016_09_02_001448_create_checkout_requests_table',1),(191,'2016_09_04_180400_create_actionlog_table',1),(192,'2016_09_04_182149_migrate_asset_log_to_action_log',1),(193,'2016_09_19_235935_fix_fieldtype_for_target_type',1),(194,'2016_09_23_140722_fix_modelno_in_consumables_to_string',1),(195,'2016_09_28_231359_add_company_to_logs',1),(196,'2016_10_14_130709_fix_order_number_to_varchar',1),(197,'2016_10_16_015024_rename_modelno_to_model_number',1),(198,'2016_10_16_015211_rename_consumable_modelno_to_model_number',1),(199,'2016_10_16_143235_rename_model_note_to_notes',1),(200,'2016_10_16_165052_rename_component_total_qty_to_qty',1),(201,'2016_10_19_145520_fix_order_number_in_components_to_string',1),(202,'2016_10_27_151715_add_serial_to_components',1),(203,'2016_10_27_213251_increase_serial_field_capacity',1),(204,'2016_10_29_002724_enable_2fa_fields',1),(205,'2016_10_29_082408_add_signature_to_acceptance',1),(206,'2016_11_01_030818_fix_forgotten_filename_in_action_logs',1),(207,'2016_11_13_020954_rename_component_serial_number_to_serial',1),(208,'2016_11_16_172119_increase_purchase_cost_size',1),(209,'2016_11_17_161317_longer_state_field_in_location',1),(210,'2016_11_17_193706_add_model_number_to_accessories',1),(211,'2016_11_24_160405_add_missing_target_type_to_logs_table',1),(212,'2016_12_07_173720_increase_size_of_state_in_suppliers',1),(213,'2016_12_19_004212_adjust_locale_length_to_10',1),(214,'2016_12_19_133936_extend_phone_lengths_in_supplier_and_elsewhere',1),(215,'2016_12_27_212631_make_asset_assigned_to_polymorphic',2); +INSERT INTO `migrations` VALUES (1,'2012_12_06_225921_migration_cartalyst_sentry_install_users',1),(2,'2012_12_06_225929_migration_cartalyst_sentry_install_groups',1),(3,'2012_12_06_225945_migration_cartalyst_sentry_install_users_groups_pivot',1),(4,'2012_12_06_225988_migration_cartalyst_sentry_install_throttle',1),(5,'2013_03_23_193214_update_users_table',1),(6,'2013_11_13_075318_create_models_table',1),(7,'2013_11_13_075335_create_categories_table',1),(8,'2013_11_13_075347_create_manufacturers_table',1),(9,'2013_11_15_015858_add_user_id_to_categories',1),(10,'2013_11_15_112701_add_user_id_to_manufacturers',1),(11,'2013_11_15_190327_create_assets_table',1),(12,'2013_11_15_190357_create_licenses_table',1),(13,'2013_11_15_201848_add_license_name_to_licenses',1),(14,'2013_11_16_040323_create_depreciations_table',1),(15,'2013_11_16_042851_add_depreciation_id_to_models',1),(16,'2013_11_16_084923_add_user_id_to_models',1),(17,'2013_11_16_103258_create_locations_table',1),(18,'2013_11_16_103336_add_location_id_to_assets',1),(19,'2013_11_16_103407_add_checkedout_to_to_assets',1),(20,'2013_11_16_103425_create_history_table',1),(21,'2013_11_17_054359_drop_licenses_table',1),(22,'2013_11_17_054526_add_physical_to_assets',1),(23,'2013_11_17_055126_create_settings_table',1),(24,'2013_11_17_062634_add_license_to_assets',1),(25,'2013_11_18_134332_add_contacts_to_users',1),(26,'2013_11_18_142847_add_info_to_locations',1),(27,'2013_11_18_152942_remove_location_id_from_asset',1),(28,'2013_11_18_164423_set_nullvalues_for_user',1),(29,'2013_11_19_013337_create_asset_logs_table',1),(30,'2013_11_19_061409_edit_added_on_asset_logs_table',1),(31,'2013_11_19_062250_edit_location_id_asset_logs_table',1),(32,'2013_11_20_055822_add_soft_delete_on_assets',1),(33,'2013_11_20_121404_add_soft_delete_on_locations',1),(34,'2013_11_20_123137_add_soft_delete_on_manufacturers',1),(35,'2013_11_20_123725_add_soft_delete_on_categories',1),(36,'2013_11_20_130248_create_status_labels',1),(37,'2013_11_20_130830_add_status_id_on_assets_table',1),(38,'2013_11_20_131544_add_status_type_on_status_labels',1),(39,'2013_11_20_134103_add_archived_to_assets',1),(40,'2013_11_21_002321_add_uploads_table',1),(41,'2013_11_21_024531_remove_deployable_boolean_from_status_labels',1),(42,'2013_11_22_075308_add_option_label_to_settings_table',1),(43,'2013_11_22_213400_edits_to_settings_table',1),(44,'2013_11_25_013244_create_licenses_table',1),(45,'2013_11_25_031458_create_license_seats_table',1),(46,'2013_11_25_032022_add_type_to_actionlog_table',1),(47,'2013_11_25_033008_delete_bad_licenses_table',1),(48,'2013_11_25_033131_create_new_licenses_table',1),(49,'2013_11_25_033534_add_licensed_to_licenses_table',1),(50,'2013_11_25_101308_add_warrantee_to_assets_table',1),(51,'2013_11_25_104343_alter_warranty_column_on_assets',1),(52,'2013_11_25_150450_drop_parent_from_categories',1),(53,'2013_11_25_151920_add_depreciate_to_assets',1),(54,'2013_11_25_152903_add_depreciate_to_licenses_table',1),(55,'2013_11_26_211820_drop_license_from_assets_table',1),(56,'2013_11_27_062510_add_note_to_asset_logs_table',1),(57,'2013_12_01_113426_add_filename_to_asset_log',1),(58,'2013_12_06_094618_add_nullable_to_licenses_table',1),(59,'2013_12_10_084038_add_eol_on_models_table',1),(60,'2013_12_12_055218_add_manager_to_users_table',1),(61,'2014_01_28_031200_add_qr_code_to_settings_table',1),(62,'2014_02_13_183016_add_qr_text_to_settings_table',1),(63,'2014_05_24_093839_alter_default_license_depreciation_id',1),(64,'2014_05_27_231658_alter_default_values_licenses',1),(65,'2014_06_19_191508_add_asset_name_to_settings',1),(66,'2014_06_20_004847_make_asset_log_checkedout_to_nullable',1),(67,'2014_06_20_005050_make_asset_log_purchasedate_to_nullable',1),(68,'2014_06_24_003011_add_suppliers',1),(69,'2014_06_24_010742_add_supplier_id_to_asset',1),(70,'2014_06_24_012839_add_zip_to_supplier',1),(71,'2014_06_24_033908_add_url_to_supplier',1),(72,'2014_07_08_054116_add_employee_id_to_users',1),(73,'2014_07_09_134316_add_requestable_to_assets',1),(74,'2014_07_17_085822_add_asset_to_software',1),(75,'2014_07_17_161625_make_asset_id_in_logs_nullable',1),(76,'2014_08_12_053504_alpha_0_4_2_release',1),(77,'2014_08_17_083523_make_location_id_nullable',1),(78,'2014_10_16_200626_add_rtd_location_to_assets',1),(79,'2014_10_24_000417_alter_supplier_state_to_32',1),(80,'2014_10_24_015641_add_display_checkout_date',1),(81,'2014_10_28_222654_add_avatar_field_to_users_table',1),(82,'2014_10_29_045924_add_image_field_to_models_table',1),(83,'2014_11_01_214955_add_eol_display_to_settings',1),(84,'2014_11_04_231416_update_group_field_for_reporting',1),(85,'2014_11_05_212408_add_fields_to_licenses',1),(86,'2014_11_07_021042_add_image_to_supplier',1),(87,'2014_11_20_203007_add_username_to_user',1),(88,'2014_11_20_223947_add_auto_to_settings',1),(89,'2014_11_20_224421_add_prefix_to_settings',1),(90,'2014_11_21_104401_change_licence_type',1),(91,'2014_12_09_082500_add_fields_maintained_term_to_licenses',1),(92,'2015_02_04_155757_increase_user_field_lengths',1),(93,'2015_02_07_013537_add_soft_deleted_to_log',1),(94,'2015_02_10_040958_fix_bad_assigned_to_ids',1),(95,'2015_02_10_053310_migrate_data_to_new_statuses',1),(96,'2015_02_11_044104_migrate_make_license_assigned_null',1),(97,'2015_02_11_104406_migrate_create_requests_table',1),(98,'2015_02_12_001312_add_mac_address_to_asset',1),(99,'2015_02_12_024100_change_license_notes_type',1),(100,'2015_02_17_231020_add_localonly_to_settings',1),(101,'2015_02_19_222322_add_logo_and_colors_to_settings',1),(102,'2015_02_24_072043_add_alerts_to_settings',1),(103,'2015_02_25_022931_add_eula_fields',1),(104,'2015_02_25_204513_add_accessories_table',1),(105,'2015_02_26_091228_add_accessories_user_table',1),(106,'2015_02_26_115128_add_deleted_at_models',1),(107,'2015_02_26_233005_add_category_type',1),(108,'2015_03_01_231912_update_accepted_at_to_acceptance_id',1),(109,'2015_03_05_011929_add_qr_type_to_settings',1),(110,'2015_03_18_055327_add_note_to_user',1),(111,'2015_04_29_234704_add_slack_to_settings',1),(112,'2015_05_04_085151_add_parent_id_to_locations_table',1),(113,'2015_05_22_124421_add_reassignable_to_licenses',1),(114,'2015_06_10_003314_fix_default_for_user_notes',1),(115,'2015_06_10_003554_create_consumables',1),(116,'2015_06_15_183253_move_email_to_username',1),(117,'2015_06_23_070346_make_email_nullable',1),(118,'2015_06_26_213716_create_asset_maintenances_table',1),(119,'2015_07_04_212443_create_custom_fields_table',1),(120,'2015_07_09_014359_add_currency_to_settings_and_locations',1),(121,'2015_07_21_122022_add_expected_checkin_date_to_asset_logs',1),(122,'2015_07_24_093845_add_checkin_email_to_category_table',1),(123,'2015_07_25_055415_remove_email_unique_constraint',1),(124,'2015_07_29_230054_add_thread_id_to_asset_logs_table',1),(125,'2015_07_31_015430_add_accepted_to_assets',1),(126,'2015_09_09_195301_add_custom_css_to_settings',1),(127,'2015_09_21_235926_create_custom_field_custom_fieldset',1),(128,'2015_09_22_000104_create_custom_fieldsets',1),(129,'2015_09_22_003321_add_fieldset_id_to_assets',1),(130,'2015_09_22_003413_migrate_mac_address',1),(131,'2015_09_28_003314_fix_default_purchase_order',1),(132,'2015_10_01_024551_add_accessory_consumable_price_info',1),(133,'2015_10_12_192706_add_brand_to_settings',1),(134,'2015_10_22_003314_fix_defaults_accessories',1),(135,'2015_10_23_182625_add_checkout_time_and_expected_checkout_date_to_assets',1),(136,'2015_11_05_061015_create_companies_table',1),(137,'2015_11_05_061115_add_company_id_to_consumables_table',1),(138,'2015_11_05_183749_image',1),(139,'2015_11_06_092038_add_company_id_to_accessories_table',1),(140,'2015_11_06_100045_add_company_id_to_users_table',1),(141,'2015_11_06_134742_add_company_id_to_licenses_table',1),(142,'2015_11_08_035832_add_company_id_to_assets_table',1),(143,'2015_11_08_222305_add_ldap_fields_to_settings',1),(144,'2015_11_15_151803_add_full_multiple_companies_support_to_settings_table',1),(145,'2015_11_26_195528_import_ldap_settings',1),(146,'2015_11_30_191504_remove_fk_company_id',1),(147,'2015_12_21_193006_add_ldap_server_cert_ignore_to_settings_table',1),(148,'2015_12_30_233509_add_timestamp_and_userId_to_custom_fields',1),(149,'2015_12_30_233658_add_timestamp_and_userId_to_custom_fieldsets',1),(150,'2016_01_28_041048_add_notes_to_models',1),(151,'2016_02_19_070119_add_remember_token_to_users_table',1),(152,'2016_02_19_073625_create_password_resets_table',1),(153,'2016_03_02_193043_add_ldap_flag_to_users',1),(154,'2016_03_02_220517_update_ldap_filter_to_longer_field',1),(155,'2016_03_08_225351_create_components_table',1),(156,'2016_03_09_024038_add_min_stock_to_tables',1),(157,'2016_03_10_133849_add_locale_to_users',1),(158,'2016_03_10_135519_add_locale_to_settings',1),(159,'2016_03_11_185621_add_label_settings_to_settings',1),(160,'2016_03_22_125911_fix_custom_fields_regexes',1),(161,'2016_04_28_141554_add_show_to_users',1),(162,'2016_05_16_164733_add_model_mfg_to_consumable',1),(163,'2016_05_19_180351_add_alt_barcode_settings',1),(164,'2016_05_19_191146_add_alter_interval',1),(165,'2016_05_19_192226_add_inventory_threshold',1),(166,'2016_05_20_024859_remove_option_keys_from_settings_table',1),(167,'2016_05_20_143758_remove_option_value_from_settings_table',1),(168,'2016_06_01_000001_create_oauth_auth_codes_table',1),(169,'2016_06_01_000002_create_oauth_access_tokens_table',1),(170,'2016_06_01_000003_create_oauth_refresh_tokens_table',1),(171,'2016_06_01_000004_create_oauth_clients_table',1),(172,'2016_06_01_000005_create_oauth_personal_access_clients_table',1),(173,'2016_06_01_140218_add_email_domain_and_format_to_settings',1),(174,'2016_06_22_160725_add_user_id_to_maintenances',1),(175,'2016_07_13_150015_add_is_ad_to_settings',1),(176,'2016_07_14_153609_add_ad_domain_to_settings',1),(177,'2016_07_22_003348_fix_custom_fields_regex_stuff',1),(178,'2016_07_22_054850_one_more_mac_addr_fix',1),(179,'2016_07_22_143045_add_port_to_ldap_settings',1),(180,'2016_07_22_153432_add_tls_to_ldap_settings',1),(181,'2016_07_27_211034_add_zerofill_to_settings',1),(182,'2016_08_02_124944_add_color_to_statuslabel',1),(183,'2016_08_04_134500_add_disallow_ldap_pw_sync_to_settings',1),(184,'2016_08_09_002225_add_manufacturer_to_licenses',1),(185,'2016_08_12_121613_add_manufacturer_to_accessories_table',1),(186,'2016_08_23_143353_add_new_fields_to_custom_fields',1),(187,'2016_08_23_145619_add_show_in_nav_to_status_labels',1),(188,'2016_08_30_084634_make_purchase_cost_nullable',1),(189,'2016_09_01_141051_add_requestable_to_asset_model',1),(190,'2016_09_02_001448_create_checkout_requests_table',1),(191,'2016_09_04_180400_create_actionlog_table',1),(192,'2016_09_04_182149_migrate_asset_log_to_action_log',1),(193,'2016_09_19_235935_fix_fieldtype_for_target_type',1),(194,'2016_09_23_140722_fix_modelno_in_consumables_to_string',1),(195,'2016_09_28_231359_add_company_to_logs',1),(196,'2016_10_14_130709_fix_order_number_to_varchar',1),(197,'2016_10_16_015024_rename_modelno_to_model_number',1),(198,'2016_10_16_015211_rename_consumable_modelno_to_model_number',1),(199,'2016_10_16_143235_rename_model_note_to_notes',1),(200,'2016_10_16_165052_rename_component_total_qty_to_qty',1),(201,'2016_10_19_145520_fix_order_number_in_components_to_string',1),(202,'2016_10_27_151715_add_serial_to_components',1),(203,'2016_10_27_213251_increase_serial_field_capacity',1),(204,'2016_10_29_002724_enable_2fa_fields',1),(205,'2016_10_29_082408_add_signature_to_acceptance',1),(206,'2016_11_01_030818_fix_forgotten_filename_in_action_logs',1),(207,'2016_11_13_020954_rename_component_serial_number_to_serial',1),(208,'2016_11_16_172119_increase_purchase_cost_size',1),(209,'2016_11_17_161317_longer_state_field_in_location',1),(210,'2016_11_17_193706_add_model_number_to_accessories',1),(211,'2016_11_24_160405_add_missing_target_type_to_logs_table',1),(212,'2016_12_07_173720_increase_size_of_state_in_suppliers',1),(213,'2016_12_19_004212_adjust_locale_length_to_10',1),(214,'2016_12_19_133936_extend_phone_lengths_in_supplier_and_elsewhere',1),(215,'2016_12_27_212631_make_asset_assigned_to_polymorphic',2),(216,'2017_01_09_040429_create_locations_ldap_query_field',3),(217,'2017_01_14_002418_create_imports_table',3),(218,'2017_01_25_063357_fix_utf8_custom_field_column_names',3),(219,'2017_03_03_154632_add_time_date_display_to_settings',3),(220,'2017_03_10_210807_add_fields_to_manufacturer',3); /*!40000 ALTER TABLE `migrations` ENABLE KEYS */; UNLOCK TABLES; @@ -1144,6 +1179,8 @@ CREATE TABLE `settings` ( `ldap_pw_sync` tinyint(1) NOT NULL DEFAULT '1', `two_factor_enabled` tinyint(4) DEFAULT NULL, `require_accept_signature` tinyint(1) NOT NULL DEFAULT '0', + `date_display_format` varchar(191) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'Y-m-d', + `time_display_format` varchar(191) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'h:i A', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -1154,7 +1191,7 @@ CREATE TABLE `settings` ( LOCK TABLES `settings` WRITE; /*!40000 ALTER TABLE `settings` DISABLE KEYS */; -INSERT INTO `settings` VALUES (1,'2016-12-19 21:48:55','2016-12-19 21:48:55',1,20,'Test',NULL,NULL,NULL,NULL,NULL,0,'0',1,NULL,NULL,'d@example.com',1,NULL,'QRCODE',NULL,NULL,NULL,'USD',NULL,1,NULL,NULL,NULL,NULL,NULL,NULL,'samaccountname','sn','givenname','uid=samaccountname',3,NULL,NULL,NULL,0,0,'en',30,2.62500,1.00000,0.21975,0.21975,0.50000,0.50000,0.07000,0.05000,9,8.50000,11.00000,0,1,1,'C128',1,30,5,'342d','filastname','filastname',0,NULL,'389',0,5,1,NULL,0); +INSERT INTO `settings` VALUES (1,'2016-12-19 21:48:55','2016-12-19 21:48:55',1,20,'Test',NULL,NULL,NULL,NULL,NULL,0,'0',1,NULL,NULL,'d@example.com',1,NULL,'QRCODE',NULL,NULL,NULL,'USD',NULL,1,NULL,NULL,NULL,NULL,NULL,NULL,'samaccountname','sn','givenname','uid=samaccountname',3,NULL,NULL,NULL,0,0,'en',30,2.62500,1.00000,0.21975,0.21975,0.50000,0.50000,0.07000,0.05000,9,8.50000,11.00000,0,1,1,'C128',1,30,5,'342d','filastname','filastname',0,NULL,'389',0,5,1,NULL,0,'Y-m-d','h:i A'); /*!40000 ALTER TABLE `settings` ENABLE KEYS */; UNLOCK TABLES; @@ -1309,7 +1346,7 @@ CREATE TABLE `users` ( PRIMARY KEY (`id`), KEY `users_activation_code_index` (`activation_code`), KEY `users_reset_password_code_index` (`reset_password_code`) -) ENGINE=InnoDB AUTO_INCREMENT=33 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=34 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -1354,4 +1391,4 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2016-12-29 17:04:05 +-- Dump completed on 2017-03-19 11:47:41 diff --git a/tests/api/ApiAssetsCest.php b/tests/api/ApiAssetsCest.php index e51ed7ad7..47233c427 100644 --- a/tests/api/ApiAssetsCest.php +++ b/tests/api/ApiAssetsCest.php @@ -121,7 +121,7 @@ class ApiAssetsCest // setup $data = [ - 'asset_tag' => $temp_asset->tag, + 'asset_tag' => $temp_asset->asset_tag, 'assigned_to' => $temp_asset->assigned_to, 'company_id' => $temp_asset->company->id, 'image' => $temp_asset->image, @@ -148,14 +148,14 @@ class ApiAssetsCest { $I->wantTo('Update an asset with PATCH'); - // create and store an asset + // create $asset = factory(\App\Models\Asset::class, 'asset')->create(); $I->assertInstanceOf(\App\Models\Asset::class, $asset); - // create a temporary asset to grab new data $temp_asset = factory(\App\Models\Asset::class, 'asset')->make(); + $data = [ - 'asset_tag' => $temp_asset->tag, + 'asset_tag' => $temp_asset->asset_tag, 'assigned_to' => $temp_asset->assigned_to, 'company_id' => $temp_asset->company->id, 'image' => $temp_asset->image, @@ -171,7 +171,6 @@ class ApiAssetsCest 'warranty_months' => $temp_asset->warranty_months, ]; - // the asset name should be different $I->assertNotEquals($asset->name, $data['name']); // update @@ -182,24 +181,19 @@ class ApiAssetsCest $response = json_decode($I->grabResponse()); $I->assertEquals('success', $response->status); $I->assertEquals(trans('admin/hardware/message.update.success'), $response->messages); - - $I->assertEquals($asset->id, $response->payload->id); - $I->assertEquals($data['name'], $response->payload->name); - $I->assertEquals($data['asset_tag'], $response->payload->asset_tag); - $I->assertEquals($data['model_id'], $response->payload->model_id); - - // dd($response, $asset->getAttributes()); + $I->assertEquals($asset->id, $response->payload->id); // asset id does not change + $I->assertEquals($temp_asset->asset_tag, $response->payload->asset_tag); // asset tag updated + $I->assertEquals($temp_asset->name, $response->payload->name); // asset name updated + $I->assertEquals($temp_asset->rtd_location_id, $response->payload->rtd_location_id); // asset rtd_location_id updated // verify - // $scenario->incomplete('[BadMethodCallException] Call to undefined method Illuminate\Database\Query\Builder::detail() 🤔'); $I->sendGET('/hardware/' . $asset->id); - $I->seeResponseIsJson(); $I->seeResponseCodeIs(200); $I->seeResponseContainsJson([ 'id' => (int) $asset->id, - 'name' => e($temp_asset->name), // TODO: name should change - 'asset_tag' => e($temp_asset->asset_tag), // TODO: asset_tag should change + 'name' => e($temp_asset->name), + 'asset_tag' => e($temp_asset->asset_tag), 'serial' => e($temp_asset->serial), 'model' => ($temp_asset->model) ? [ 'id' => (int) $temp_asset->model->id, @@ -220,17 +214,17 @@ class ApiAssetsCest ] : null, 'notes' => e($temp_asset->notes), 'order_number' => e($asset->order_number), - 'company' => ($temp_asset->company) ? [ + 'company' => ($asset->company) ? [ 'id' => (int) $temp_asset->company->id, 'name'=> e($temp_asset->company->name) ] : null, - 'location' => ($asset->assetLoc) ? [ - 'id' => (int) $asset->assetLoc->id, - 'name'=> e($asset->assetLoc->name) + 'location' => ($temp_asset->assetLoc) ? [ + 'id' => (int) $temp_asset->assetLoc->id, + 'name'=> e($temp_asset->assetLoc->name) ] : null, - 'rtd_location' => ($asset->defaultLoc) ? [ - 'id' => (int) $asset->defaultLoc->id, - 'name'=> e($asset->defaultLoc->name) + 'rtd_location' => ($temp_asset->defaultLoc) ? [ + 'id' => (int) $temp_asset->defaultLoc->id, + 'name'=> e($temp_asset->defaultLoc->name) ] : null, 'image' => ($asset->getImageUrl()) ? $asset->getImageUrl() : null, 'assigned_to' => ($temp_asset->assigneduser) ? [ @@ -284,11 +278,29 @@ class ApiAssetsCest $asset = factory(\App\Models\Asset::class, 'asset')->create(); $I->assertInstanceOf(\App\Models\Asset::class, $asset); - $company = \App\Models\Company::inRandomOrder()->first(); + $temp_asset_tag = $this->faker->uuid; + $temp_asset = factory(\App\Models\Asset::class, 'asset')->make([ + 'asset_tag' => $temp_asset_tag, + ]); + + $I->assertNotNull($temp_asset->asset_tag); + $I->assertEquals($temp_asset_tag, $temp_asset->asset_tag); $data = [ - 'name' => $this->faker->sentence(3), - 'company_id' => $company->id, + 'asset_tag' => $temp_asset->asset_tag, + 'assigned_to' => $temp_asset->assigned_to, + 'company_id' => $temp_asset->company->id, + 'image' => $temp_asset->image, + 'model_id' => $temp_asset->model_id, + 'name' => $temp_asset->name, + 'notes' => $temp_asset->notes, + 'purchase_cost' => $temp_asset->purchase_cost, + 'purchase_date' => $temp_asset->purchase_date->format('Y-m-d'), + 'rtd_location_id' => $temp_asset->rtd_location_id, + 'serial' => $temp_asset->serial, + 'status_id' => $temp_asset->status_id, + 'supplier_id' => $temp_asset->supplier_id, + 'warranty_months' => $temp_asset->warranty_months, ]; $I->assertNotEquals($asset->name, $data['name']); @@ -301,7 +313,10 @@ class ApiAssetsCest $response = json_decode($I->grabResponse()); $I->assertEquals('success', $response->status); $I->assertEquals(trans('admin/hardware/message.update.success'), $response->messages); - $I->assertEquals($asset->id, $response->payload->id); + $I->assertEquals($asset->id, $response->payload->id); // asset id does not change + $I->assertEquals($temp_asset->asset_tag, $response->payload->asset_tag); // asset tag updated + $I->assertEquals($temp_asset->name, $response->payload->name); // asset name updated + $I->assertEquals($temp_asset->rtd_location_id, $response->payload->rtd_location_id); // asset rtd_location_id updated // verify $I->sendGET('/hardware/' . $asset->id); @@ -309,46 +324,46 @@ class ApiAssetsCest $I->seeResponseCodeIs(200); $I->seeResponseContainsJson([ 'id' => (int) $asset->id, - 'name' => e($data['name']), - 'asset_tag' => e($asset->asset_tag), - 'serial' => e($asset->serial), - 'model' => ($asset->model) ? [ - 'id' => (int) $asset->model->id, - 'name'=> e($asset->model->name) + 'name' => e($temp_asset->name), + 'asset_tag' => e($temp_asset->asset_tag), + 'serial' => e($temp_asset->serial), + 'model' => ($temp_asset->model) ? [ + 'id' => (int) $temp_asset->model->id, + 'name'=> e($temp_asset->model->name) ] : null, - 'model_number' => ($asset->model) ? e($asset->model->model_number) : null, - 'status_label' => ($asset->assetstatus) ? [ - 'id' => (int) $asset->assetstatus->id, - 'name'=> e($asset->assetstatus->name) + 'model_number' => ($temp_asset->model) ? e($temp_asset->model->model_number) : null, + 'status_label' => ($temp_asset->assetstatus) ? [ + 'id' => (int) $temp_asset->assetstatus->id, + 'name'=> e($temp_asset->assetstatus->name) ] : null, - 'category' => ($asset->model->category) ? [ - 'id' => (int) $asset->model->category->id, - 'name'=> e($asset->model->category->name) + 'category' => ($temp_asset->model->category) ? [ + 'id' => (int) $temp_asset->model->category->id, + 'name'=> e($temp_asset->model->category->name) ] : null, - 'manufacturer' => ($asset->model->manufacturer) ? [ - 'id' => (int) $asset->model->manufacturer->id, - 'name'=> e($asset->model->manufacturer->name) + 'manufacturer' => ($temp_asset->model->manufacturer) ? [ + 'id' => (int) $temp_asset->model->manufacturer->id, + 'name'=> e($temp_asset->model->manufacturer->name) ] : null, - 'notes' => e($asset->notes), + 'notes' => e($temp_asset->notes), 'order_number' => e($asset->order_number), 'company' => ($asset->company) ? [ - 'id' => (int) $data['company_id'], - 'name'=> e($company->name) + 'id' => (int) $temp_asset->company->id, + 'name'=> e($temp_asset->company->name) ] : null, - 'location' => ($asset->assetLoc) ? [ - 'id' => (int) $asset->assetLoc->id, - 'name'=> e($asset->assetLoc->name) + 'location' => ($temp_asset->assetLoc) ? [ + 'id' => (int) $temp_asset->assetLoc->id, + 'name'=> e($temp_asset->assetLoc->name) ] : null, - 'rtd_location' => ($asset->defaultLoc) ? [ - 'id' => (int) $asset->defaultLoc->id, - 'name'=> e($asset->defaultLoc->name) + 'rtd_location' => ($temp_asset->defaultLoc) ? [ + 'id' => (int) $temp_asset->defaultLoc->id, + 'name'=> e($temp_asset->defaultLoc->name) ] : null, 'image' => ($asset->getImageUrl()) ? $asset->getImageUrl() : null, - 'assigned_to' => ($asset->assigneduser) ? [ - 'id' => (int) $asset->assigneduser->id, - 'name' => e($asset->assigneduser->getFullNameAttribute()), - 'first_name'=> e($asset->assigneduser->first_name), - 'last_name'=> e($asset->assigneduser->last_name) + 'assigned_to' => ($temp_asset->assigneduser) ? [ + 'id' => (int) $temp_asset->assigneduser->id, + 'name' => e($temp_asset->assigneduser->getFullNameAttribute()), + 'first_name'=> e($temp_asset->assigneduser->first_name), + 'last_name'=> e($temp_asset->assigneduser->last_name) ] : null, 'warranty' => ($asset->warranty_months > 0) ? e($asset->warranty_months . ' ' . trans('admin/hardware/form.months')) : null, 'warranty_expires' => ($asset->warranty_months > 0) ? [ @@ -376,7 +391,7 @@ class ApiAssetsCest // 'formatted' => $asset->created_at->format('Y-m-d'), // ] : null, // 'purchase_cost' => (float) $asset->purchase_cost, - 'user_can_checkout' => (bool) $asset->availableForCheckout(), + 'user_can_checkout' => (bool) $temp_asset->availableForCheckout(), 'available_actions' => [ 'checkout' => (bool) Gate::allows('checkout', Asset::class), 'checkin' => (bool) Gate::allows('checkin', Asset::class),