This commit is contained in:
2024-04-21 14:42:52 +02:00
parent 4b69674ede
commit 8a25f53c99
10700 changed files with 55767 additions and 14201 deletions

View File

@ -0,0 +1 @@
*.sqlite

View File

@ -0,0 +1,156 @@
<?php
namespace Database\Factories;
use App\Models\Accessory;
use App\Models\Category;
use App\Models\Location;
use App\Models\Manufacturer;
use App\Models\Supplier;
use App\Models\User;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Factories\Factory;
class AccessoryFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = Accessory::class;
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
return [
'name' => sprintf(
'%s %s',
$this->faker->randomElement(['Bluetooth', 'Wired']),
$this->faker->randomElement(['Keyboard', 'Wired'])
),
'user_id' => User::factory()->superuser(),
'category_id' => Category::factory()->forAccessories(),
'model_number' => $this->faker->numberBetween(1000000, 50000000),
'location_id' => Location::factory(),
'qty' => 1,
];
}
public function appleBtKeyboard()
{
return $this->state(function () {
return [
'name' => 'Bluetooth Keyboard',
'image' => 'bluetooth.jpg',
'category_id' => function () {
return Category::where('name', 'Keyboards')->first() ?? Category::factory()->accessoryKeyboardCategory();
},
'manufacturer_id' => function () {
return Manufacturer::where('name', 'Apple')->first() ?? Manufacturer::factory()->apple();
},
'qty' => 10,
'min_amt' => 2,
'supplier_id' => Supplier::factory(),
];
});
}
public function appleUsbKeyboard()
{
return $this->state(function () {
return [
'name' => 'USB Keyboard',
'image' => 'usb-keyboard.jpg',
'category_id' => function () {
return Category::where('name', 'Keyboards')->first() ?? Category::factory()->accessoryKeyboardCategory();
},
'manufacturer_id' => function () {
return Manufacturer::where('name', 'Apple')->first() ?? Manufacturer::factory()->apple();
},
'qty' => 15,
'min_amt' => 2,
'supplier_id' => Supplier::factory(),
];
});
}
public function appleMouse()
{
return $this->state(function () {
return [
'name' => 'Magic Mouse',
'image' => 'magic-mouse.jpg',
'category_id' => function () {
return Category::where('name', 'Mouse')->first() ?? Category::factory()->accessoryMouseCategory();
},
'manufacturer_id' => function () {
return Manufacturer::where('name', 'Apple')->first() ?? Manufacturer::factory()->apple();
},
'qty' => 13,
'min_amt' => 2,
'supplier_id' => Supplier::factory(),
];
});
}
public function microsoftMouse()
{
return $this->state(function () {
return [
'name' => 'Sculpt Comfort Mouse',
'image' => 'comfort-mouse.jpg',
'category_id' => function () {
return Category::where('name', 'Mouse')->first() ?? Category::factory()->accessoryMouseCategory();
},
'manufacturer_id' => function () {
return Manufacturer::where('name', 'Microsoft')->first() ?? Manufacturer::factory()->microsoft();
},
'qty' => 13,
'min_amt' => 2,
];
});
}
public function withoutItemsRemaining()
{
return $this->state(function () {
return [
'qty' => 1,
];
})->afterCreating(function ($accessory) {
$user = User::factory()->create();
$accessory->users()->attach($accessory->id, [
'accessory_id' => $accessory->id,
'created_at' => now(),
'user_id' => $user->id,
'assigned_to' => $user->id,
'note' => '',
]);
});
}
public function requiringAcceptance()
{
return $this->afterCreating(function ($accessory) {
$accessory->category->update(['require_acceptance' => 1]);
});
}
public function checkedOutToUser(User $user = null)
{
return $this->afterCreating(function (Accessory $accessory) use ($user) {
$accessory->users()->attach($accessory->id, [
'accessory_id' => $accessory->id,
'created_at' => Carbon::now(),
'user_id' => 1,
'assigned_to' => $user->id ?? User::factory()->create()->id,
]);
});
}
}

View File

@ -0,0 +1,108 @@
<?php
namespace Database\Factories;
use App\Models\Actionlog;
use App\Models\Asset;
use App\Models\License;
use App\Models\LicenseSeat;
use App\Models\Location;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
class ActionlogFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = Actionlog::class;
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
return [
'item_id' => Asset::factory(),
'item_type' => Asset::class,
'user_id' => User::factory()->superuser(),
'action_type' => 'uploaded',
];
}
public function assetCheckoutToUser()
{
return $this->state(function () {
$target = User::inRandomOrder()->first();
$asset = Asset::inRandomOrder()->RTD()->first();
$asset->update(
[
'assigned_to' => $target->id,
'assigned_type' => User::class,
'location_id' => $target->location_id,
]
);
return [
'created_at' => $this->faker->dateTimeBetween('-1 years', 'now', date_default_timezone_get()),
'action_type' => 'checkout',
'item_id' => $asset->id,
'item_type' => Asset::class,
'target_id' => $target->id,
'target_type' => User::class,
];
});
}
public function assetCheckoutToLocation()
{
return $this->state(function () {
$target = Location::inRandomOrder()->first();
$asset = Asset::inRandomOrder()->RTD()->first();
$asset->update(
[
'assigned_to' => $target->id,
'assigned_type' => Location::class,
'location_id' => $target->id,
]
);
return [
'created_at' => $this->faker->dateTimeBetween('-1 years', 'now', date_default_timezone_get()),
'action_type' => 'checkout',
'item_id' => $asset->id,
'item_type' => Asset::class,
'target_id' => $target->id,
'target_type' => Location::class,
];
});
}
public function licenseCheckoutToUser()
{
return $this->state(function () {
$target = User::inRandomOrder()->first();
$licenseSeat = LicenseSeat::whereNull('assigned_to')->inRandomOrder()->first();
$licenseSeat->update([
'assigned_to' => $target->id,
'user_id' => 1, // not ideal but works
]);
return [
'created_at' => $this->faker->dateTimeBetween('-1 years', 'now', date_default_timezone_get()),
'action_type' => 'checkout',
'item_id' => $licenseSeat->license->id,
'item_type' => License::class,
'target_id' => $target->id,
'target_type' => User::class,
];
});
}
}

View File

@ -0,0 +1,370 @@
<?php
namespace Database\Factories;
use App\Models\Asset;
use App\Models\AssetModel;
use App\Models\Location;
use App\Models\Statuslabel;
use App\Models\Supplier;
use App\Models\User;
use Carbon\CarbonImmutable;
use Illuminate\Database\Eloquent\Factories\Factory;
class AssetFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = Asset::class;
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
return [
'name' => null,
'model_id' => AssetModel::factory(),
'rtd_location_id' => Location::factory(),
'serial' => $this->faker->uuid(),
'status_id' => function () {
return Statuslabel::where('name', 'Ready to Deploy')->first() ?? Statuslabel::factory()->rtd()->create(['name' => 'Ready to Deploy']);
},
'user_id' => User::factory()->superuser(),
'asset_tag' => $this->faker->unixTime('now'),
'notes' => 'Created by DB seeder',
'purchase_date' => $this->faker->dateTimeBetween('-1 years', 'now', date_default_timezone_get())->format('Y-m-d'),
'purchase_cost' => $this->faker->randomFloat(2, '299.99', '2999.99'),
'order_number' => (string) $this->faker->numberBetween(1000000, 50000000),
'supplier_id' => Supplier::factory(),
'requestable' => $this->faker->boolean(),
'assigned_to' => null,
'assigned_type' => null,
'next_audit_date' => null,
'last_checkout' => null,
];
}
public function configure()
{
return $this->afterMaking(function (Asset $asset) {
// calculates the EOL date most of the time, but sometimes sets a random date so we have some explicits
// the explicit boolean gets set in the saving() method on the observer
$asset->asset_eol_date = $this->faker->boolean(5)
? CarbonImmutable::parse($asset->purchase_date)->addMonths(rand(0, 20))->format('Y-m-d')
: CarbonImmutable::parse($asset->purchase_date)->addMonths($asset->model->eol)->format('Y-m-d');
});
}
public function laptopMbp()
{
return $this->state(function () {
return [
'model_id' => function () {
return AssetModel::where('name', 'Macbook Pro 13"')->first() ?? AssetModel::factory()->mbp13Model();
},
];
});
}
public function laptopMbpPending()
{
return $this->state(function () {
return [
'model_id' => function () {
return AssetModel::where('name', 'Macbook Pro 13"')->first() ?? AssetModel::factory()->mbp13Model();
},
'status_id' => function () {
return Statuslabel::where('name', 'Pending')->first() ?? Statuslabel::factory()->pending()->make(['name' => 'Pending']);
},
];
});
}
public function laptopMbpArchived()
{
return $this->state(function () {
return [
'model_id' => function () {
return AssetModel::where('name', 'Macbook Pro 13"')->first() ?? AssetModel::factory()->mbp13Model();
},
'status_id' => function () {
return Statuslabel::where('name', 'Archived')->first() ?? Statuslabel::factory()->archived()->make(['name' => 'Archived']);
},
];
});
}
public function laptopAir()
{
return $this->state(function () {
return [
'model_id' => function () {
return AssetModel::where('name', 'Macbook Air')->first() ?? AssetModel::factory()->mbpAirModel();
},
];
});
}
public function laptopSurface()
{
return $this->state(function () {
return [
'model_id' => function () {
return AssetModel::where('name', 'Surface')->first() ?? AssetModel::factory()->surfaceModel();
},
];
});
}
public function laptopXps()
{
return $this->state(function () {
return [
'model_id' => function () {
return AssetModel::where('name', 'XPS 13')->first() ?? AssetModel::factory()->xps13Model();
},
];
});
}
public function laptopSpectre()
{
return $this->state(function () {
return [
'model_id' => function () {
return AssetModel::where('name', 'Spectre')->first() ?? AssetModel::factory()->spectreModel();
},
];
});
}
public function laptopZenbook()
{
return $this->state(function () {
return [
'model_id' => function () {
return AssetModel::where('name', 'ZenBook UX310')->first() ?? AssetModel::factory()->zenbookModel();
},
];
});
}
public function laptopYoga()
{
return $this->state(function () {
return [
'model_id' => function () {
return AssetModel::where('name', 'Yoga 910')->first() ?? AssetModel::factory()->yogaModel();
},
];
});
}
public function desktopMacpro()
{
return $this->state(function () {
return [
'model_id' => function () {
return AssetModel::where('name', 'iMac Pro')->first() ?? AssetModel::factory()->macproModel();
},
];
});
}
public function desktopLenovoI5()
{
return $this->state(function () {
return [
'model_id' => function () {
return AssetModel::where('name', 'Lenovo Intel Core i5')->first() ?? AssetModel::factory()->lenovoI5Model();
},
];
});
}
public function desktopOptiplex()
{
return $this->state(function () {
return [
'model_id' => function () {
return AssetModel::where('name', 'OptiPlex')->first() ?? AssetModel::factory()->optiplexModel();
},
];
});
}
public function confPolycom()
{
return $this->state(function () {
return [
'model_id' => function () {
return AssetModel::where('name', 'SoundStation 2')->first() ?? AssetModel::factory()->polycomModel();
},
];
});
}
public function confPolycomcx()
{
return $this->state(function () {
return [
'model_id' => function () {
return AssetModel::where('name', 'Polycom CX3000 IP Conference Phone')->first() ?? AssetModel::factory()->polycomcxModel();
},
];
});
}
public function tabletIpad()
{
return $this->state(function () {
return [
'model_id' => function () {
return AssetModel::where('name', 'iPad Pro')->first() ?? AssetModel::factory()->ipadModel();
},
];
});
}
public function tabletTab3()
{
return $this->state(function () {
return [
'model_id' => function () {
return AssetModel::where('name', 'Tab3')->first() ?? AssetModel::factory()->tab3Model();
},
];
});
}
public function phoneIphone11()
{
return $this->state(function () {
return [
'model_id' => function () {
return AssetModel::where('name', 'iPhone 11')->first() ?? AssetModel::factory()->iphone11Model();
},
];
});
}
public function phoneIphone12()
{
return $this->state(function () {
return [
'model_id' => function () {
return AssetModel::where('name', 'iPhone 12')->first() ?? AssetModel::factory()->iphone12Model();
},
];
});
}
public function ultrafine()
{
return $this->state(function () {
return [
'model_id' => function () {
return AssetModel::where('name', 'Ultrafine 4k')->first() ?? AssetModel::factory()->ultrafine();
},
];
});
}
public function ultrasharp()
{
return $this->state(function () {
return [
'model_id' => function () {
return AssetModel::where('name', 'Ultrasharp U2415')->first() ?? AssetModel::factory()->ultrasharp();
},
];
});
}
public function assignedToUser(User $user = null)
{
return $this->state(function () use ($user) {
return [
'assigned_to' => $user->id ?? User::factory(),
'assigned_type' => User::class,
'last_checkout' => now()->subDay(),
];
});
}
public function assignedToLocation()
{
return $this->state(function () {
return [
'assigned_to' => Location::factory(),
'assigned_type' => Location::class,
];
});
}
public function assignedToAsset()
{
return $this->state(function () {
return [
'model_id' => 1,
'assigned_to' => Asset::factory(),
'assigned_type' => Asset::class,
];
});
}
public function requiresAcceptance()
{
return $this->state(function () {
return [
'model_id' => function () {
return AssetModel::where('name', 'Macbook Pro 13')->first() ?? AssetModel::factory()->mbp13Model();
},
];
});
}
public function deleted()
{
return $this->state(function () {
return [
'model_id' => function () {
return AssetModel::where('name', 'Macbook Pro 13')->first() ?? AssetModel::factory()->mbp13Model();
},
'deleted_at' => $this->faker->dateTime(),
];
});
}
public function requestable()
{
return $this->state(['requestable' => true]);
}
public function nonrequestable()
{
return $this->state(['requestable' => false]);
}
/**
* This allows bypassing model level validation if you want to purposefully
* create an asset in an invalid state. Validation is turned back on
* after the model is created via the factory.
* @return AssetFactory
*/
public function canBeInvalidUponCreation()
{
return $this->afterMaking(function (Asset $asset) {
$asset->setValidating(false);
})->afterCreating(function (Asset $asset) {
$asset->setValidating(true);
});
}
}

View File

@ -0,0 +1,36 @@
<?php
namespace Database\Factories;
use App\Models\Asset;
use App\Models\AssetMaintenance;
use App\Models\Supplier;
use Illuminate\Database\Eloquent\Factories\Factory;
class AssetMaintenanceFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = AssetMaintenance::class;
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
return [
'asset_id' => Asset::factory(),
'supplier_id' => Supplier::factory(),
'asset_maintenance_type' => $this->faker->randomElement(['maintenance', 'repair', 'upgrade']),
'title' => $this->faker->sentence(),
'start_date' => $this->faker->date(),
'is_warranty' => $this->faker->boolean(),
'notes' => $this->faker->paragraph(),
];
}
}

View File

@ -0,0 +1,432 @@
<?php
namespace Database\Factories;
use App\Models\AssetModel;
use App\Models\CustomFieldset;
use App\Models\Depreciation;
use App\Models\Manufacturer;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
use App\Models\Category;
class AssetModelFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = AssetModel::class;
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
return [
'user_id' => User::factory()->superuser(),
'name' => $this->faker->catchPhrase(),
'category_id' => Category::factory(),
'model_number' => $this->faker->creditCardNumber(),
'notes' => 'Created by demo seeder',
];
}
public function mbp13Model()
{
return $this->state(function () {
return [
'name' => 'Macbook Pro 13"',
'category_id' => function () {
return Category::where('name', 'Laptops')->first() ?? Category::factory()->assetLaptopCategory();
},
'eol' => '36',
'depreciation_id' => function () {
return Depreciation::where('name', 'Computer Depreciation')->first() ?? Depreciation::factory()->computer();
},
'image' => 'mbp.jpg',
'fieldset_id' => function () {
return CustomFieldset::where('name', 'Laptops and Desktops')->first() ?? CustomFieldset::factory()->computer();
},
];
});
}
public function mbpAirModel()
{
return $this->state(function () {
return [
'name' => 'Macbook Air',
'category_id' => function () {
return Category::where('name', 'Laptops')->first() ?? Category::factory()->assetLaptopCategory();
},
'manufacturer_id' => function () {
return Manufacturer::where('name', 'Apple')->first() ?? Manufacturer::factory()->apple();
},
'eol' => '36',
'depreciation_id' => function () {
return Depreciation::where('name', 'Computer Depreciation')->first() ?? Depreciation::factory()->computer();
},
'image' => 'macbookair.jpg',
'fieldset_id' => function () {
return CustomFieldset::where('name', 'Laptops and Desktops')->first() ?? CustomFieldset::factory()->computer();
},
];
});
}
public function surfaceModel()
{
return $this->state(function () {
return [
'name' => 'Surface',
'category_id' => function () {
return Category::where('name', 'Laptops')->first() ?? Category::factory()->assetLaptopCategory();
},
'manufacturer_id' => function () {
return Manufacturer::where('name', 'Microsoft')->first() ?? Manufacturer::factory()->microsoft();
},
'eol' => '36',
'depreciation_id' => function () {
return Depreciation::where('name', 'Computer Depreciation')->first() ?? Depreciation::factory()->computer();
},
'image' => 'surface.jpg',
'fieldset_id' => function () {
return CustomFieldset::where('name', 'Laptops and Desktops')->first() ?? CustomFieldset::factory()->computer();
},
];
});
}
public function xps13Model()
{
return $this->state(function () {
return [
'name' => 'XPS 13',
'category_id' => function () {
return Category::where('name', 'Laptops')->first() ?? Category::factory()->assetLaptopCategory();
},
'manufacturer_id' => function () {
return Manufacturer::where('name', 'Dell')->first() ?? Manufacturer::factory()->dell();
},
'eol' => '36',
'depreciation_id' => function () {
return Depreciation::where('name', 'Computer Depreciation')->first() ?? Depreciation::factory()->computer();
},
'image' => 'xps.jpg',
'fieldset_id' => function () {
return CustomFieldset::where('name', 'Laptops and Desktops')->first() ?? CustomFieldset::factory()->computer();
},
];
});
}
public function zenbookModel()
{
return $this->state(function () {
return [
'name' => 'ZenBook UX310',
'category_id' => function () {
return Category::where('name', 'Laptops')->first() ?? Category::factory()->assetLaptopCategory();
},
'manufacturer_id' => function () {
return Manufacturer::where('name', 'Asus')->first() ?? Manufacturer::factory()->asus();
},
'eol' => '36',
'depreciation_id' => function () {
return Depreciation::where('name', 'Computer Depreciation')->first() ?? Depreciation::factory()->computer();
},
'image' => 'zenbook.jpg',
'fieldset_id' => function () {
return CustomFieldset::where('name', 'Laptops and Desktops')->first() ?? CustomFieldset::factory()->computer();
},
];
});
}
public function spectreModel()
{
return $this->state(function () {
return [
'name' => 'Spectre',
'category_id' => function () {
return Category::where('name', 'Laptops')->first() ?? Category::factory()->assetLaptopCategory();
},
'manufacturer_id' => function () {
return Manufacturer::where('name', 'HP')->first() ?? Manufacturer::factory()->hp();
},
'eol' => '36',
'depreciation_id' => function () {
return Depreciation::where('name', 'Computer Depreciation')->first() ?? Depreciation::factory()->computer();
},
'image' => 'spectre.jpg',
'fieldset_id' => function () {
return CustomFieldset::where('name', 'Laptops and Desktops')->first() ?? CustomFieldset::factory()->computer();
},
];
});
}
public function yogaModel()
{
return $this->state(function () {
return [
'name' => 'Yoga 910',
'category_id' => function () {
return Category::where('name', 'Laptops')->first() ?? Category::factory()->assetLaptopCategory();
},
'manufacturer_id' => function () {
return Manufacturer::where('name', 'Lenovo')->first() ?? Manufacturer::factory()->lenovo();
},
'eol' => '36',
'depreciation_id' => function () {
return Depreciation::where('name', 'Computer Depreciation')->first() ?? Depreciation::factory()->computer();
},
'image' => 'yoga.png',
'fieldset_id' => function () {
return CustomFieldset::where('name', 'Laptops and Desktops')->first() ?? CustomFieldset::factory()->computer();
},
];
});
}
public function macproModel()
{
return $this->state(function () {
return [
'name' => 'iMac Pro',
'category_id' => function (){
return Category::where('name', 'Desktops')->first() ?? Category::factory()->assetDesktopCategory();
},
'manufacturer_id' => function () {
return Manufacturer::where('name', 'Apple')->first() ?? Manufacturer::factory()->apple();
},
'eol' => '24',
'depreciation_id' => function () {
return Depreciation::where('name', 'Computer Depreciation')->first() ?? Depreciation::factory()->computer();
},
'image' => 'imacpro.jpg',
'fieldset_id' => function () {
return CustomFieldset::where('name', 'Laptops and Desktops')->first() ?? CustomFieldset::factory()->computer();
},
];
});
}
public function lenovoI5Model()
{
return $this->state(function () {
return [
'name' => 'Lenovo Intel Core i5',
'category_id' => function () {
return Category::where('name', 'Desktops')->first() ?? Category::factory()->assetDesktopCategory();
},
'manufacturer_id' => function () {
return Manufacturer::where('name', 'Lenovo')->first() ?? Manufacturer::factory()->lenovo();
},
'eol' => '24',
'depreciation_id' => function () {
return Depreciation::where('name', 'Computer Depreciation')->first() ?? Depreciation::factory()->computer();
},
'image' => 'lenovoi5.png',
'fieldset_id' => function () {
return CustomFieldset::where('name', 'Laptops and Desktops')->first() ?? CustomFieldset::factory()->computer();
},
];
});
}
public function optiplexModel()
{
return $this->state(function () {
return [
'name' => 'OptiPlex',
'category_id' => function (){
return Category::where('name', 'Desktops')->first() ?? Category::factory()->assetDesktopCategory();
},
'manufacturer_id' => function () {
return Manufacturer::where('name', 'Dell')->first() ?? Manufacturer::factory()->dell();
},
'model_number' => '5040 (MRR81)',
'eol' => '24',
'depreciation_id' => function () {
return Depreciation::where('name', 'Computer Depreciation')->first() ?? Depreciation::factory()->computer();
},
'image' => 'optiplex.jpg',
'fieldset_id' => function () {
return CustomFieldset::where('name', 'Laptops and Desktops')->first() ?? CustomFieldset::factory()->computer();
},
];
});
}
public function polycomModel()
{
return $this->state(function () {
return [
'name' => 'SoundStation 2',
'category_id' => function () {
return Category::where('name', 'VOIP Phones')->first() ?? Category::factory()->assetVoipCategory();
},
'manufacturer_id' => function () {
return Manufacturer::where('name', 'Polycom')->first() ?? Manufacturer::factory()->polycom();
},
'eol' => '12',
'depreciation_id' => function () {
return Depreciation::where('name', 'Computer Depreciation')->first() ?? Depreciation::factory()->computer();
},
'image' => 'soundstation.jpg',
];
});
}
public function polycomcxModel()
{
return $this->state(function () {
return [
'name' => 'Polycom CX3000 IP Conference Phone',
'category_id' => function () {
return Category::where('name', 'VOIP Phones')->first() ?? Category::factory()->assetVoipCategory();
},
'manufacturer_id' => function () {
return Manufacturer::where('name', 'Polycom')->first() ?? Manufacturer::factory()->polycom();
},
'eol' => '12',
'depreciation_id' => function () {
return Depreciation::where('name', 'Computer Depreciation')->first() ?? Depreciation::factory()->computer();
},
'image' => 'cx3000.png',
];
});
}
public function ipadModel()
{
return $this->state(function () {
return [
'name' => 'iPad Pro',
'category_id' => function () {
return Category::where('name', 'Tablets')->first() ?? Category::factory()->assetTabletCategory();
},
'manufacturer_id' => function () {
return Manufacturer::where('name', 'Apple')->first() ?? Manufacturer::factory()->apple();
},
'eol' => '12',
'depreciation_id' => function () {
return Depreciation::where('name', 'Computer Depreciation')->first() ?? Depreciation::factory()->computer();
},
'image' => 'ipad.jpg',
];
});
}
public function tab3Model()
{
return $this->state(function () {
return [
'name' => 'Tab3',
'category_id' => function () {
return Category::where('name', 'Tablets')->first() ?? Category::factory()->assetTabletCategory();
},
'manufacturer_id' => function () {
return Manufacturer::where('name', 'Lenovo')->first() ?? Manufacturer::factory()->lenovo();
},
'eol' => '12',
'depreciation_id' => function () {
return Depreciation::where('name', 'Computer Depreciation')->first() ?? Depreciation::factory()->computer();
},
'image' => 'tab3.png',
];
});
}
public function iphone11Model()
{
return $this->state(function () {
return [
'name' => 'iPhone 11',
'category_id' => function () {
return Category::where('name', 'Mobile Phones')->first() ?? Category::factory()->assetMobileCategory();
},
'manufacturer_id' => function () {
return Manufacturer::where('name', 'Apple')->first() ?? Manufacturer::factory()->apple();
},
'eol' => '12',
'depreciation_id' => function () {
return Depreciation::where('name', 'Mobile Phone Depreciation')->first() ?? Depreciation::factory()->mobilePhones();
},
'image' => 'iphone11.jpeg',
'fieldset_id' => function () {
return CustomFieldset::where('name', 'Mobile Devices')->first() ?? CustomFieldset::factory()->mobile();
},
];
});
}
public function iphone12Model()
{
return $this->state(function () {
return [
'name' => 'iPhone 12',
'category_id' => function () {
return Category::where('name', 'Mobile Phones')->first() ?? Category::factory()->assetMobileCategory();
},
'manufacturer_id' => function () {
return Manufacturer::where('name', 'Apple')->first() ?? Manufacturer::factory()->apple();
},
'eol' => '12',
'depreciation_id' => function () {
return Depreciation::where('name', 'Computer Depreciation')->first() ?? Depreciation::factory()->computer();
},
'image' => 'iphone12.jpeg',
'fieldset_id' => function () {
return CustomFieldset::where('name', 'Mobile Devices')->first() ?? CustomFieldset::factory()->mobile();
},
];
});
}
public function ultrafine()
{
return $this->state(function () {
return [
'name' => 'Ultrafine 4k',
'category_id' => function () {
return Category::where('name', 'Displays')->first() ?? Category::factory()->assetDisplayCategory();
},
'manufacturer_id' => function () {
return Manufacturer::where('name', 'LG')->first() ?? Manufacturer::factory()->lg();
},
'eol' => '12',
'depreciation_id' => function () {
return Depreciation::where('name', 'Display Depreciation')->first() ?? Depreciation::factory()->display();
},
'image' => 'ultrafine.jpg',
];
});
}
public function ultrasharp()
{
return $this->state(function () {
return [
'name' => 'Ultrasharp U2415',
'category_id' => function () {
return Category::where('name', 'Displays')->first() ?? Category::factory()->assetDisplayCategory();
},
'manufacturer_id' => function () {
return Manufacturer::where('name', 'Dell')->first() ?? Manufacturer::factory()->dell();
},
'eol' => '12',
'depreciation_id' => function () {
return Depreciation::where('name', 'Display Depreciation')->first() ?? Depreciation::factory()->display();
},
'image' => 'ultrasharp.jpg',
];
});
}
}

View File

@ -0,0 +1,181 @@
<?php
namespace Database\Factories;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
use App\Models\Category;
class CategoryFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = Category::class;
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
return [
'name' => $this->faker->catchPhrase(),
'category_type' => 'asset',
'checkin_email' => $this->faker->boolean(),
'eula_text' => $this->faker->paragraph(),
'require_acceptance' => false,
'use_default_eula' => $this->faker->boolean(),
'user_id' => User::factory()->superuser(),
];
}
// usage: Category::factory()->assetLaptopCategory();
public function assetLaptopCategory()
{
return $this->state([
'name' => 'Laptops',
'category_type' => 'asset',
'require_acceptance' => true,
]);
}
// usage: Category::factory()->assetDesktopCategory();
public function assetDesktopCategory()
{
return $this->state([
'name' => 'Desktops',
'category_type' => 'asset',
'require_acceptance' => true,
]);
}
// usage: Category::factory()->assetDisplayCategory();
public function assetDisplayCategory()
{
return $this->state([
'name' => 'Displays',
'category_type' => 'asset',
]);
}
// usage: Category::factory()->assetTabletCategory();
public function assetTabletCategory()
{
return $this->state([
'name' => 'Tablets',
'category_type' => 'asset',
]);
}
// usage: Category::factory()->assetMobileCategory();
public function assetMobileCategory()
{
return $this->state([
'name' => 'Mobile Phones',
'category_type' => 'asset',
]);
}
// usage: Category::factory()->assetConferenceCategory();
public function assetConferenceCategory()
{
return $this->state([
'name' => 'Conference Phones',
'category_type' => 'asset',
]);
}
// usage: Category::factory()->assetVoipCategory();
public function assetVoipCategory()
{
return $this->state([
'name' => 'VOIP Phones',
'category_type' => 'asset',
]);
}
// usage: Category::factory()->accessoryKeyboardCategory();
public function accessoryKeyboardCategory()
{
return $this->state([
'name' => 'Keyboards',
'category_type' => 'accessory',
]);
}
// usage: Category::factory()->accessoryMouseCategory();
public function accessoryMouseCategory()
{
return $this->state([
'name' => 'Mouse',
'category_type' => 'accessory',
]);
}
// usage: Category::factory()->componentHddCategory();
public function componentHddCategory()
{
return $this->state([
'name' => 'HDD/SSD',
'category_type' => 'component',
]);
}
// usage: Category::factory()->componentRamCategory();
public function componentRamCategory()
{
return $this->state([
'name' => 'RAM',
'category_type' => 'component',
]);
}
// usage: Category::factory()->consumablePaperCategory();
public function consumablePaperCategory()
{
return $this->state([
'name' => 'Printer Paper',
'category_type' => 'consumable',
]);
}
// usage: Category::factory()->consumableInkCategory();
public function consumableInkCategory()
{
return $this->state([
'name' => 'Printer Ink',
'category_type' => 'consumable',
]);
}
// usage: Category::factory()->licenseGraphicsCategory();
public function licenseGraphicsCategory()
{
return $this->state([
'name' => 'Graphics Software',
'category_type' => 'license',
]);
}
// usage: Category::factory()->licenseGraphicsCategory();
public function licenseOfficeCategory()
{
return $this->state([
'name' => 'Office Software',
'category_type' => 'license',
]);
}
public function forAccessories()
{
return $this->state([
'category_type' => 'accessory',
]);
}
}

View File

@ -0,0 +1,41 @@
<?php
namespace Database\Factories;
use App\Models\Accessory;
use App\Models\Asset;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
class CheckoutAcceptanceFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
return [
'checkoutable_type' => Asset::class,
'checkoutable_id' => Asset::factory(),
'assigned_to_id' => User::factory(),
];
}
public function forAccessory()
{
return $this->state([
'checkoutable_type' => Accessory::class,
'checkoutable_id' => Accessory::factory(),
]);
}
public function pending()
{
return $this->state([
'accepted_at' => null,
'declined_at' => null,
]);
}
}

View File

@ -0,0 +1,28 @@
<?php
namespace Database\Factories;
use App\Models\Company;
use Illuminate\Database\Eloquent\Factories\Factory;
class CompanyFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = Company::class;
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
return [
'name' => $this->faker->unique()->company(),
];
}
}

View File

@ -0,0 +1,101 @@
<?php
namespace Database\Factories;
use App\Models\Category;
use App\Models\Company;
use App\Models\Component;
use App\Models\Location;
use Illuminate\Database\Eloquent\Factories\Factory;
use App\Models\Supplier;
class ComponentFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = Component::class;
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
return [
'name' => $this->faker->text(20),
'category_id' => Category::factory(),
'location_id' => Location::factory(),
'serial' => $this->faker->uuid(),
'qty' => $this->faker->numberBetween(3, 10),
'order_number' => $this->faker->numberBetween(1000000, 50000000),
'purchase_date' => $this->faker->dateTime()->format('Y-m-d'),
'purchase_cost' => $this->faker->randomFloat(2),
'min_amt' => $this->faker->numberBetween($min = 1, $max = 2),
'company_id' => Company::factory(),
'supplier_id' => Supplier::factory(),
];
}
public function ramCrucial4()
{
return $this->state(function () {
return [
'name' => 'Crucial 4GB DDR3L-1600 SODIMM',
'category_id' => function () {
return Category::where('name', 'RAM')->first() ?? Category::factory()->componentRamCategory();
},
'qty' => 10,
'min_amt' => 2,
'location_id' => Location::factory(),
];
});
}
public function ramCrucial8()
{
return $this->state(function () {
return [
'name' => 'Crucial 8GB DDR3L-1600 SODIMM Memory for Mac',
'category_id' => function () {
return Category::where('name', 'RAM')->first() ?? Category::factory()->componentRamCategory();
},
'qty' => 10,
'min_amt' => 2,
];
});
}
public function ssdCrucial120()
{
return $this->state(function () {
return [
'name' => 'Crucial BX300 120GB SATA Internal SSD',
'category_id' => function () {
return Category::where('name', 'HDD/SSD')->first() ?? Category::factory()->componentHddCategory();
},
'qty' => 10,
'min_amt' => 2,
];
});
}
public function ssdCrucial240()
{
return $this->state(function () {
return [
'name' => 'Crucial BX300 240GB SATA Internal SSD',
'category_id' => function () {
return Category::where('name', 'HDD/SSD')->first() ?? Category::factory()->componentHddCategory();
},
'qty' => 10,
'min_amt' => 2,
];
});
}
}

View File

@ -0,0 +1,119 @@
<?php
namespace Database\Factories;
use App\Models\Category;
use App\Models\Company;
use App\Models\Consumable;
use App\Models\Manufacturer;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
use App\Models\Supplier;
class ConsumableFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = Consumable::class;
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
return [
'name' => $this->faker->words(3, true),
'category_id' => Category::factory(),
'user_id' => User::factory()->superuser(),
'item_no' => $this->faker->numberBetween(1000000, 50000000),
'order_number' => $this->faker->numberBetween(1000000, 50000000),
'purchase_date' => $this->faker->dateTimeBetween('-1 years', 'now', date_default_timezone_get())->format('Y-m-d'),
'purchase_cost' => $this->faker->randomFloat(2, 1, 50),
'qty' => $this->faker->numberBetween(5, 10),
'min_amt' => $this->faker->numberBetween($min = 1, $max = 2),
'company_id' => Company::factory(),
'supplier_id' => Supplier::factory(),
];
}
public function cardstock()
{
return $this->state(function () {
return [
'name' => 'Cardstock (White)',
'category_id' => function () {
return Category::where('name', 'Printer Paper')->first() ?? Category::factory()->consumablePaperCategory();
},
'manufacturer_id' => function () {
return Manufacturer::where('name', 'Avery')->first() ?? Manufacturer::factory()->avery();
},
'qty' => 10,
'min_amt' => 2,
];
});
}
public function paper()
{
return $this->state(function () {
return [
'name' => 'Laserjet Paper (Ream)',
'category_id' => function () {
return Category::where('name', 'Printer Paper')->first() ?? Category::factory()->consumablePaperCategory();
},
'manufacturer_id' => function () {
return Manufacturer::where('name', 'Avery')->first() ?? Manufacturer::factory()->avery();
},
'qty' => 20,
'min_amt' => 2,
];
});
}
public function ink()
{
return $this->state(function () {
return [
'name' => 'Laserjet Toner (black)',
'category_id' => function () {
return Category::where('name', 'Printer Ink')->first() ?? Category::factory()->consumableInkCategory();
},
'manufacturer_id' => function () {
return Manufacturer::where('name', 'HP')->first() ?? Manufacturer::factory()->hp();
},
'qty' => 20,
'min_amt' => 2,
];
});
}
public function withoutItemsRemaining()
{
return $this->state(function () {
return [
'qty' => 1,
];
})->afterCreating(function (Consumable $consumable) {
$user = User::factory()->create();
$consumable->users()->attach($consumable->id, [
'consumable_id' => $consumable->id,
'user_id' => $user->id,
'assigned_to' => $user->id,
'note' => '',
]);
});
}
public function requiringAcceptance()
{
return $this->afterCreating(function (Consumable $consumable) {
$consumable->category->update(['require_acceptance' => 1]);
});
}
}

View File

@ -0,0 +1,120 @@
<?php
namespace Database\Factories;
use App\Models\CustomField;
use Illuminate\Database\Eloquent\Factories\Factory;
class CustomFieldFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = CustomField::class;
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
return [
'name' => $this->faker->unique()->catchPhrase(),
'format' => '',
'element' => 'text',
'auto_add_to_fieldsets' => '0',
'show_in_requestable_list' => '0',
];
}
public function imei()
{
return $this->state(function () {
return [
'name' => 'IMEI',
'help_text' => 'The IMEI number for this device.',
'format' => 'regex:/^[0-9]{15}$/',
];
});
}
public function phone()
{
return $this->state(function () {
return [
'name' => 'Phone Number',
'help_text' => 'Enter the phone number for this device.',
];
});
}
public function ram()
{
return $this->state(function () {
return [
'name' => 'RAM',
'help_text' => 'The amount of RAM this device has.',
];
});
}
public function cpu()
{
return $this->state(function () {
return [
'name' => 'CPU',
'help_text' => 'The speed of the processor on this device.',
'show_in_requestable_list' => '1',
];
});
}
public function macAddress()
{
return $this->state(function () {
return [
'name' => 'MAC Address',
'format' => 'regex:/^([0-9a-fA-F]{2}[:-]){5}[0-9a-fA-F]{2}$/',
];
});
}
public function testEncrypted()
{
return $this->state(function () {
return [
'name' => 'Test Encrypted',
'field_encrypted' => '1',
'help_text' => 'This is a sample encrypted field.',
];
});
}
public function testCheckbox()
{
return $this->state(function () {
return [
'name' => 'Test Checkbox',
'help_text' => 'This is a sample checkbox.',
'field_values' => "One\r\nTwo\r\nThree",
'element' => 'checkbox',
];
});
}
public function testRadio()
{
return $this->state(function () {
return [
'name' => 'Test Radio',
'help_text' => 'This is a sample radio.',
'field_values' => "One\r\nTwo\r\nThree",
'element' => 'radio',
];
});
}
}

View File

@ -0,0 +1,46 @@
<?php
namespace Database\Factories;
use App\Models\CustomFieldset;
use Illuminate\Database\Eloquent\Factories\Factory;
class CustomFieldsetFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = CustomFieldset::class;
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
return [
'name' => $this->faker->unique()->catchPhrase(),
];
}
public function mobile()
{
return $this->state(function () {
return [
'name' => 'Mobile Devices',
];
});
}
public function computer()
{
return $this->state(function () {
return [
'name' => 'Laptops and Desktops',
];
});
}
}

View File

@ -0,0 +1,95 @@
<?php
namespace Database\Factories;
use App\Models\Department;
use App\Models\Location;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
class DepartmentFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = Department::class;
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
return [
'name' => $this->faker->unique()->word() . ' Department',
'user_id' => User::factory()->superuser(),
'location_id' => Location::factory(),
];
}
public function hr()
{
return $this->state(function () {
return [
'name' => 'Human Resources',
];
});
}
public function engineering()
{
return $this->state(function () {
return [
'name' => 'Engineering',
];
});
}
public function marketing()
{
return $this->state(function () {
return [
'name' => 'Marketing',
];
});
}
public function client()
{
return $this->state(function () {
return [
'name' => 'Client Services',
];
});
}
public function design()
{
return $this->state(function () {
return [
'name' => 'Graphic Design',
];
});
}
public function product()
{
return $this->state(function () {
return [
'name' => 'Product Management',
];
});
}
public function silly()
{
return $this->state(function () {
return [
'name' => 'Dept of Silly Walks',
];
});
}
}

View File

@ -0,0 +1,61 @@
<?php
namespace Database\Factories;
use App\Models\Depreciation;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
class DepreciationFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = Depreciation::class;
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
return [
'name' => $this->faker->unique()->catchPhrase(),
'user_id' => User::factory()->superuser(),
'months' => 36,
];
}
public function computer()
{
return $this->state(function () {
return [
'name' => 'Computer Depreciation',
'months' => 36,
];
});
}
public function display()
{
return $this->state(function () {
return [
'name' => 'Display Depreciation',
'months' => 12,
];
});
}
public function mobilePhones()
{
return $this->state(function () {
return [
'name' => 'Mobile Phone Depreciation',
'months' => 24,
];
});
}
}

View File

@ -0,0 +1,28 @@
<?php
namespace Database\Factories;
use App\Models\Group;
use Illuminate\Database\Eloquent\Factories\Factory;
class GroupFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = Group::class;
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
return [
'name' => $this->faker->name(),
];
}
}

View File

@ -0,0 +1,122 @@
<?php
namespace Database\Factories;
use App\Models\Category;
use App\Models\License;
use App\Models\Manufacturer;
use App\Models\Supplier;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
class LicenseFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = License::class;
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
return [
'user_id' => User::factory()->superuser(),
'name' => $this->faker->name(),
'license_email' => $this->faker->safeEmail(),
'serial' => $this->faker->uuid(),
'notes' => 'Created by DB seeder',
'seats' => $this->faker->numberBetween(1, 10),
'purchase_date' => $this->faker->dateTimeBetween('-1 years', 'now', date_default_timezone_get())->format('Y-m-d'),
'order_number' => $this->faker->numberBetween(1000000, 50000000),
'expiration_date' => $this->faker->dateTimeBetween('now', '+3 years', date_default_timezone_get())->format('Y-m-d H:i:s'),
'reassignable' => $this->faker->boolean(),
'termination_date' => $this->faker->dateTimeBetween('-1 years', 'now', date_default_timezone_get())->format('Y-m-d H:i:s'),
'supplier_id' => Supplier::factory(),
'category_id' => Category::factory(),
];
}
public function photoshop()
{
return $this->state(function () {
$data = [
'name' => 'Photoshop',
'manufacturer_id' => function () {
return Manufacturer::where('name', 'Adobe')->first() ?? Manufacturer::factory()->adobe();
},
'purchase_cost' => '299.99',
'seats' => 10,
'purchase_order' => '13503Q',
'maintained' => true,
'category_id' => function () {
return Category::where('name', 'Graphics Software')->first() ?? Category::factory()->licenseGraphicsCategory();
},
];
return $data;
});
}
public function acrobat()
{
return $this->state(function () {
$data = [
'name' => 'Acrobat',
'manufacturer_id' => function () {
return Manufacturer::where('name', 'Adobe')->first() ?? Manufacturer::factory()->adobe();
},
'purchase_cost' => '29.99',
'seats' => 10,
'category_id' => function () {
return Category::where('name', 'Graphics Software')->first() ?? Category::factory()->licenseGraphicsCategory();
},
];
return $data;
});
}
public function indesign()
{
return $this->state(function () {
$data = [
'name' => 'InDesign',
'manufacturer_id' => function () {
return Manufacturer::where('name', 'Adobe')->first() ?? Manufacturer::factory()->adobe();
},
'purchase_cost' => '199.99',
'seats' => 10,
'category_id' => function () {
return Category::where('name', 'Graphics Software')->first() ?? Category::factory()->licenseGraphicsCategory();
},
];
return $data;
});
}
public function office()
{
return $this->state(function () {
$data = [
'name' => 'Office',
'manufacturer_id' => function () {
return Manufacturer::where('name', 'Microsoft')->first() ?? Manufacturer::factory()->microsoft();
},
'purchase_cost' => '49.99',
'seats' => 20,
'category_id' => function () {
return Category::where('name', 'Office Software')->first() ?? Category::factory()->licenseOfficeCategory();
},
];
return $data;
});
}
}

View File

@ -0,0 +1,26 @@
<?php
namespace Database\Factories;
use App\Models\License;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
class LicenseSeatFactory extends Factory
{
public function definition()
{
return [
'license_id' => License::factory(),
];
}
public function assignedToUser(User $user = null)
{
return $this->state(function () use ($user) {
return [
'assigned_to' => $user->id ?? User::factory(),
];
});
}
}

View File

@ -0,0 +1,28 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
class LocationFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
return [
'name' => $this->faker->city(),
'address' => $this->faker->streetAddress(),
'address2' => $this->faker->secondaryAddress(),
'city' => $this->faker->city(),
'state' => $this->faker->stateAbbr(),
'country' => $this->faker->countryCode(),
'currency' => $this->faker->currencyCode(),
'zip' => $this->faker->postcode(),
'image' => rand(1, 9).'.jpg',
];
}
}

View File

@ -0,0 +1,168 @@
<?php
namespace Database\Factories;
use App\Models\Manufacturer;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
class ManufacturerFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = Manufacturer::class;
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
return [
'name' => $this->faker->unique()->company(),
'user_id' => User::factory()->superuser(),
'support_phone' => $this->faker->phoneNumber(),
'url' => $this->faker->url(),
'support_email' => $this->faker->safeEmail(),
];
}
public function apple()
{
return $this->state(function () {
return [
'name' => 'Apple',
'url' => 'https://apple.com',
'support_url' => 'https://support.apple.com',
'warranty_lookup_url' => 'https://checkcoverage.apple.com',
'image' => 'apple.jpg',
];
});
}
public function microsoft()
{
return $this->state(function () {
return [
'name' => 'Microsoft',
'url' => 'https://microsoft.com',
'support_url' => 'https://support.microsoft.com',
'warranty_lookup_url' => 'https://account.microsoft.com/devices',
'image' => 'microsoft.png',
];
});
}
public function dell()
{
return $this->state(function () {
return [
'name' => 'Dell',
'url' => 'https://dell.com',
'support_url' => 'https://support.dell.com',
'warranty_lookup_url' => 'https://www.dell.com/support/home/en-us/Products/?app=warranty',
'image' => 'dell.png',
];
});
}
public function asus()
{
return $this->state(function () {
return [
'name' => 'Asus',
'url' => 'https://asus.com',
'support_url' => 'https://support.asus.com',
'image' => 'asus.png',
];
});
}
public function hp()
{
return $this->state(function () {
return [
'name' => 'HP',
'url' => 'https://hp.com',
'support_url' => 'https://support.hp.com',
'image' => 'hp.png',
];
});
}
public function lenovo()
{
return $this->state(function () {
return [
'name' => 'Lenovo',
'url' => 'https://lenovo.com',
'support_url' => 'https://support.lenovo.com',
'image' => 'lenovo.jpg',
];
});
}
public function lg()
{
return $this->state(function () {
return [
'name' => 'LG',
'url' => 'https://lg.com',
'support_url' => 'https://support.lg.com',
'image' => 'lg.jpg',
];
});
}
public function polycom()
{
return $this->state(function () {
return [
'name' => 'Polycom',
'url' => 'https://polycom.com',
'support_url' => 'https://support.polycom.com',
'image' => 'polycom.png',
];
});
}
public function adobe()
{
return $this->state(function () {
return [
'name' => 'Adobe',
'url' => 'https://adobe.com',
'support_url' => 'https://support.adobe.com',
'image' => 'adobe.jpg',
];
});
}
public function avery()
{
return $this->state(function () {
return [
'name' => 'Avery',
'url' => 'https://avery.com',
'support_url' => 'https://support.avery.com',
'image' => 'avery.png',
];
});
}
public function crucial()
{
return $this->state(function () {
return [
'name' => 'Crucial',
'url' => 'https://crucial.com',
'support_url' => 'https://support.crucial.com',
'image' => 'crucial.jpg',
];
});
}
}

View File

@ -0,0 +1,37 @@
<?php
namespace Database\Factories;
use App\Models\Setting;
use Illuminate\Database\Eloquent\Factories\Factory;
class SettingFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = Setting::class;
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
return [
'per_page' => 20,
'site_name' => $this->faker->sentence(),
'auto_increment_assets' => false,
'alert_email' => $this->faker->safeEmail(),
'alerts_enabled' => true,
'brand' => 1,
'default_currency' => $this->faker->currencyCode(),
'locale' => 'en-US',
'pwd_secure_min' => 10, // Match web setup
'email_domain' => 'example.org',
];
}
}

View File

@ -0,0 +1,110 @@
<?php
namespace Database\Factories;
use App\Models\Statuslabel;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
class StatuslabelFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = Statuslabel::class;
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
return [
'name' => $this->faker->sentence(),
'created_at' => $this->faker->dateTime(),
'updated_at' => $this->faker->dateTime(),
'user_id' => User::factory()->superuser(),
'deleted_at' => null,
'deployable' => 0,
'pending' => 0,
'archived' => 0,
'notes' => '',
];
}
public function rtd()
{
return $this->state(function () {
return [
'notes' => $this->faker->sentence(),
'deployable' => 1,
'default_label' => 1,
];
});
}
public function pending()
{
return $this->state(function () {
return [
'notes' => $this->faker->sentence(),
'pending' => 1,
'default_label' => 1,
];
});
}
public function archived()
{
return $this->state(function () {
return [
'notes' => 'These assets are permanently undeployable',
'archived' => 1,
'default_label' => 0,
];
});
}
public function outForDiagnostics()
{
return $this->state(function () {
return [
'name' => 'Out for Diagnostics',
'default_label' => 0,
];
});
}
public function outForRepair()
{
return $this->state(function () {
return [
'name' => 'Out for Repair',
'default_label' => 0,
];
});
}
public function broken()
{
return $this->state(function () {
return [
'name' => 'Broken - Not Fixable',
'default_label' => 0,
];
});
}
public function lost()
{
return $this->state(function () {
return [
'name' => 'Lost/Stolen',
'default_label' => 0,
];
});
}
}

View File

@ -0,0 +1,40 @@
<?php
namespace Database\Factories;
use App\Models\Supplier;
use Illuminate\Database\Eloquent\Factories\Factory;
class SupplierFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = Supplier::class;
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
return [
'name' => $this->faker->company(),
'address' => $this->faker->streetAddress(),
'address2' => $this->faker->secondaryAddress(),
'city' => $this->faker->city(),
'state' => $this->faker->stateAbbr(),
'zip' => $this->faker->postCode(),
'country' => $this->faker->countryCode(),
'contact' => $this->faker->name(),
'phone' => $this->faker->phoneNumber(),
'fax' => $this->faker->phoneNumber(),
'email' => $this->faker->safeEmail(),
'url' => $this->faker->url(),
'notes' => $this->faker->text(191), // Supplier notes can be a max of 255 characters.
];
}
}

View File

@ -0,0 +1,302 @@
<?php
namespace Database\Factories;
use App\Models\Company;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
use \Auth;
class UserFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
return [
'activated' => 1,
'address' => $this->faker->address(),
'city' => $this->faker->city(),
'company_id' => Company::factory(),
'country' => $this->faker->country(),
'email' => $this->faker->safeEmail(),
'employee_num' => $this->faker->numberBetween(3500, 35050),
'first_name' => $this->faker->firstName(),
'jobtitle' => $this->faker->jobTitle(),
'last_name' => $this->faker->lastName(),
'locale' => 'en-US',
'notes' => 'Created by DB seeder',
'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password
'permissions' => '{}',
'phone' => $this->faker->phoneNumber(),
'state' => $this->faker->stateAbbr(),
'username' => $this->faker->unique()->username(),
'zip' => $this->faker->postcode(),
];
}
public function firstAdmin()
{
return $this->state(function () {
return [
'first_name' => 'Admin',
'last_name' => 'User',
'username' => 'admin',
'avatar' => '1.jpg',
'permissions' => '{"superuser":"1"}',
];
});
}
public function snipeAdmin()
{
return $this->state(function () {
return [
'first_name' => 'Snipe E.',
'last_name' => 'Head',
'username' => 'snipe',
'avatar' => '2.jpg',
'email' => 'snipe@snipe.net',
'permissions' => '{"superuser":"1"}',
];
});
}
public function testAdmin()
{
return $this->state(function () {
return [
'first_name' => 'Alison',
'last_name' => 'Gianotto',
'username' => 'agianotto@grokability.com',
'avatar' => '2.jpg',
'email' => 'agianotto@grokability.com',
'permissions' => '{"superuser":"1"}',
];
});
}
public function superuser()
{
return $this->appendPermission(['superuser' => '1']);
}
public function admin()
{
return $this->state(function () {
return [
'permissions' => '{"admin":"1"}',
'manager_id' => function () {
return User::where('permissions->superuser', '1')->first() ?? User::factory()->firstAdmin();
},
];
});
}
public function viewAssets()
{
return $this->appendPermission(['assets.view' => '1']);
}
public function createAssets()
{
return $this->appendPermission(['assets.create' => '1']);
}
public function editAssets()
{
return $this->appendPermission(['assets.edit' => '1']);
}
public function deleteAssets()
{
return $this->appendPermission(['assets.delete' => '1']);
}
public function checkinAssets()
{
return $this->appendPermission(['assets.checkin' => '1']);
}
public function checkoutAssets()
{
return $this->appendPermission(['assets.checkout' => '1']);
}
public function viewRequestableAssets()
{
return $this->appendPermission(['assets.view.requestable' => '1']);
}
public function viewAccessories()
{
return $this->appendPermission(['accessories.view' => '1']);
}
public function createAccessories()
{
return $this->appendPermission(['accessories.create' => '1']);
}
public function editAccessories()
{
return $this->appendPermission(['accessories.edit' => '1']);
}
public function deleteAccessories()
{
return $this->appendPermission(['accessories.delete' => '1']);
}
public function checkinAccessories()
{
return $this->appendPermission(['accessories.checkin' => '1']);
}
public function checkoutAccessories()
{
return $this->appendPermission(['accessories.checkout' => '1']);
}
public function viewConsumables()
{
return $this->appendPermission(['consumables.view' => '1']);
}
public function createConsumables()
{
return $this->appendPermission(['consumables.create' => '1']);
}
public function editConsumables()
{
return $this->appendPermission(['consumables.edit' => '1']);
}
public function deleteConsumables()
{
return $this->appendPermission(['consumables.delete' => '1']);
}
public function checkinConsumables()
{
return $this->appendPermission(['consumables.checkin' => '1']);
}
public function checkoutConsumables()
{
return $this->appendPermission(['consumables.checkout' => '1']);
}
public function viewDepartments()
{
return $this->appendPermission(['departments.view' => '1']);
}
public function viewLicenses()
{
return $this->appendPermission(['licenses.view' => '1']);
}
public function createLicenses()
{
return $this->appendPermission(['licenses.create' => '1']);
}
public function editLicenses()
{
return $this->appendPermission(['licenses.edit' => '1']);
}
public function deleteLicenses()
{
return $this->appendPermission(['licenses.delete' => '1']);
}
public function checkoutLicenses()
{
return $this->appendPermission(['licenses.checkout' => '1']);
}
public function viewKeysLicenses()
{
return $this->appendPermission(['licenses.keys' => '1']);
}
public function viewComponents()
{
return $this->appendPermission(['components.view' => '1']);
}
public function createComponents()
{
return $this->appendPermission(['components.create' => '1']);
}
public function editComponents()
{
return $this->appendPermission(['components.edit' => '1']);
}
public function deleteComponents()
{
return $this->appendPermission(['components.delete' => '1']);
}
public function checkinComponents()
{
return $this->appendPermission(['components.checkin' => '1']);
}
public function checkoutComponents()
{
return $this->appendPermission(['components.checkout' => '1']);
}
public function viewUsers()
{
return $this->appendPermission(['users.view' => '1']);
}
public function createUsers()
{
return $this->appendPermission(['users.create' => '1']);
}
public function editUsers()
{
return $this->appendPermission(['users.edit' => '1']);
}
public function deleteUsers()
{
return $this->appendPermission(['users.delete' => '1']);
}
public function canEditOwnLocation()
{
return $this->appendPermission(['self.edit_location' => '1']);
}
public function canViewReports()
{
return $this->appendPermission(['reports.view' => '1']);
}
private function appendPermission(array $permission)
{
return $this->state(function ($currentState) use ($permission) {
return [
'permissions' => json_encode(
array_merge(
json_decode($currentState['permissions'], true),
$permission
)
),
];
});
}
}

View File

@ -0,0 +1,64 @@
<?php
/**
* Part of the Sentry package.
*
* NOTICE OF LICENSE
*
* Licensed under the 3-clause BSD License.
*
* This source file is subject to the 3-clause BSD License that is
* bundled with this package in the LICENSE file. It is also available at
* the following URL: http://www.opensource.org/licenses/BSD-3-Clause
*
* @version 2.0.0
* @author Cartalyst LLC
* @license BSD License (3-clause)
* @copyright (c) 2011 - 2013, Cartalyst LLC
* @link http://cartalyst.com
*/
use Illuminate\Database\Migrations\Migration;
class MigrationCartalystSentryInstallUsers extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('users', function ($table) {
$table->increments('id');
$table->string('email');
$table->string('password');
$table->text('permissions')->nullable();
$table->boolean('activated')->default(0);
$table->string('activation_code')->nullable();
$table->timestamp('activated_at')->nullable();
$table->timestamp('last_login')->nullable();
$table->string('persist_code')->nullable();
$table->string('reset_password_code')->nullable();
$table->string('first_name')->nullable();
$table->string('last_name')->nullable();
$table->timestamps();
// We'll need to ensure that MySQL uses the InnoDB engine to
// support the indexes, other engines aren't affected.
$table->engine = 'InnoDB';
$table->unique('email');
$table->index('activation_code');
$table->index('reset_password_code');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('users');
}
}

View File

@ -0,0 +1,51 @@
<?php
/**
* Part of the Sentry package.
*
* NOTICE OF LICENSE
*
* Licensed under the 3-clause BSD License.
*
* This source file is subject to the 3-clause BSD License that is
* bundled with this package in the LICENSE file. It is also available at
* the following URL: http://www.opensource.org/licenses/BSD-3-Clause
*
* @version 2.0.0
* @author Cartalyst LLC
* @license BSD License (3-clause)
* @copyright (c) 2011 - 2013, Cartalyst LLC
* @link http://cartalyst.com
*/
use Illuminate\Database\Migrations\Migration;
class MigrationCartalystSentryInstallGroups extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('permission_groups', function ($table) {
$table->increments('id');
$table->string('name');
$table->text('permissions')->nullable();
$table->timestamps();
$table->engine = 'InnoDB';
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
// See 2014_11_04_231416_update_group_field_for_reporting.php and 2019_06_12_184327_rename_groups_table.php
Schema::dropIfExists('permission_groups');
Schema::dropIfExists('groups');
}
}

View File

@ -0,0 +1,51 @@
<?php
/**
* Part of the Sentry package.
*
* NOTICE OF LICENSE
*
* Licensed under the 3-clause BSD License.
*
* This source file is subject to the 3-clause BSD License that is
* bundled with this package in the LICENSE file. It is also available at
* the following URL: http://www.opensource.org/licenses/BSD-3-Clause
*
* @version 2.0.0
* @author Cartalyst LLC
* @license BSD License (3-clause)
* @copyright (c) 2011 - 2013, Cartalyst LLC
* @link http://cartalyst.com
*/
use Illuminate\Database\Migrations\Migration;
class MigrationCartalystSentryInstallUsersGroupsPivot extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('users_groups', function ($table) {
$table->integer('user_id')->unsigned();
$table->integer('group_id')->unsigned();
// We'll need to ensure that MySQL uses the InnoDB engine to
// support the indexes, other engines aren't affected.
$table->engine = 'InnoDB';
$table->primary(['user_id', 'group_id']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('users_groups');
}
}

View File

@ -0,0 +1,58 @@
<?php
/**
* Part of the Sentry package.
*
* NOTICE OF LICENSE
*
* Licensed under the 3-clause BSD License.
*
* This source file is subject to the 3-clause BSD License that is
* bundled with this package in the LICENSE file. It is also available at
* the following URL: http://www.opensource.org/licenses/BSD-3-Clause
*
* @version 2.0.0
* @author Cartalyst LLC
* @license BSD License (3-clause)
* @copyright (c) 2011 - 2013, Cartalyst LLC
* @link http://cartalyst.com
*/
use Illuminate\Database\Migrations\Migration;
class MigrationCartalystSentryInstallThrottle extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('throttle', function ($table) {
$table->increments('id');
$table->integer('user_id')->unsigned()->nullable();
$table->string('ip_address')->nullable();
$table->integer('attempts')->default(0);
$table->boolean('suspended')->default(0);
$table->boolean('banned')->default(0);
$table->timestamp('last_attempt_at')->nullable();
$table->timestamp('suspended_at')->nullable();
$table->timestamp('banned_at')->nullable();
// We'll need to ensure that MySQL uses the InnoDB engine to
// support the indexes, other engines aren't affected.
$table->engine = 'InnoDB';
$table->index('user_id');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('throttle');
}
}

View File

@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
class UpdateUsersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
// Update the users table
Schema::table('users', function ($table) {
$table->softDeletes();
$table->string('website')->nullable();
$table->string('country')->nullable();
$table->string('gravatar')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
// Update the users table
Schema::table('users', function ($table) {
$table->dropColumn('deleted_at', 'website', 'country', 'gravatar');
});
}
}

View File

@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
class CreateModelsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('models', function ($table) {
$table->increments('id');
$table->string('name');
$table->string('modelno')->nullable();
$table->integer('manufacturer_id')->nullable();
$table->integer('category_id')->nullable();
$table->timestamps();
$table->engine = 'InnoDB';
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('models');
}
}

View File

@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
class CreateCategoriesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('categories', function ($table) {
$table->increments('id');
$table->string('name');
$table->integer('parent')->default(0);
$table->timestamps();
$table->engine = 'InnoDB';
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('categories');
}
}

View File

@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Migrations\Migration;
class CreateManufacturersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('manufacturers', function ($table) {
$table->increments('id');
$table->string('name');
$table->timestamps();
$table->engine = 'InnoDB';
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('manufacturers');
}
}

View File

@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
class AddUserIdToCategories extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('categories', function ($table) {
$table->integer('user_id')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}

View File

@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
class AddUserIdToManufacturers extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('manufacturers', function ($table) {
$table->integer('user_id')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}

View File

@ -0,0 +1,41 @@
<?php
use Illuminate\Database\Migrations\Migration;
class CreateAssetsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('assets', function ($table) {
$table->increments('id');
$table->string('name')->nullable();
$table->string('asset_tag')->nullable();
$table->integer('model_id')->nullable();
$table->string('serial')->nullable();
$table->date('purchase_date')->nullable();
$table->decimal('purchase_cost', 8, 2)->nullable();
$table->string('order_number')->nullable();
$table->integer('assigned_to')->nullable();
$table->text('notes')->nullable();
$table->integer('user_id')->nullable();
$table->timestamps();
$table->boolean('physical')->default(1);
$table->engine = 'InnoDB';
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('assets');
}
}

View File

@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Migrations\Migration;
class CreateTempLicensesTable extends Migration
{
/**
* Run the migrations.
*
* This migration is overwritten by a later migration - 2013_11_25_recreate_licenses_table.php
*
* @return void
*/
public function up()
{
//
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
// Schema::dropIfExists('licenses');
}
}

View File

@ -0,0 +1,25 @@
<?php
use Illuminate\Database\Migrations\Migration;
class AddLicenseNameToLicenses extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}

View File

@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
class CreateDepreciationsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('depreciations', function ($table) {
$table->increments('id');
$table->string('name');
$table->integer('months');
$table->timestamps();
$table->integer('user_id')->nullable();
$table->engine = 'InnoDB';
//$table->foreign('user_id')->references('id')->on('users');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('depreciations');
}
}

View File

@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
class AddDepreciationIdToModels extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('models', function ($table) {
$table->integer('depreciation_id')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}

View File

@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
class AddUserIdToModels extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('models', function ($table) {
$table->integer('user_id')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}

View File

@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
class CreateLocationsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('locations', function ($table) {
$table->increments('id');
$table->string('name')->nullable();
$table->string('city')->nullable();
$table->string('state', 2)->nullable();
$table->string('country', 2)->nullable();
$table->timestamps();
$table->integer('user_id')->nullable();
$table->engine = 'InnoDB';
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('locations');
}
}

View File

@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
class AddLocationIdToAssets extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('assets', function ($table) {
$table->integer('location_id')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}

View File

@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
class AddCheckedoutToToAssets extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('assets', function ($table) {
$table->integer('checkedout_to')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}

View File

@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Migrations\Migration;
class CreateHistoryTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
// Schema::create('history', function ($table) {
// $table->increments('id');
// $table->integer('checkedout_to')->nullable;
// $table->integer('location_id')->nullable;
// $table->timestamps();
// $table->integer('user_id')->nullable();
// $table->engine = 'InnoDB';
// });
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//Schema::drop('history');
}
}

View File

@ -0,0 +1,26 @@
<?php
use Illuminate\Database\Migrations\Migration;
class DropLicensesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::dropIfExists('licenses');
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}

View File

@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class AddPhysicalToAssets extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
//
Schema::table('assets', function ($table) {
//$table->boolean('physical')->default(1);
$table->dropColumn('checkedout_to');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
// $table->dropColumn('physical');
}
}

View File

@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
class CreateSettingsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
//
Schema::create('settings', function ($table) {
$table->increments('id');
$table->string('option_name');
$table->string('option_value');
$table->timestamps();
$table->integer('user_id')->nullable();
$table->engine = 'InnoDB';
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('settings');
}
}

View File

@ -0,0 +1,29 @@
<?php
use Illuminate\Database\Migrations\Migration;
class AddLicenseToAssets extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
// Schema::table('assets', function ($table) {
// $table->string('license_name')->nullable();
// $table->string('license_email')->nullable();
// });
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}

View File

@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
class AddContactsToUsers extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('users', function ($table) {
$table->integer('location_id')->nullable();
$table->string('phone')->nullable();
$table->string('jobtitle')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('users', function ($table) {
$table->dropColumn('location_id');
$table->dropColumn('phone');
$table->dropColumn('jobtitle');
});
}
}

View File

@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
class AddInfoToLocations extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('locations', function ($table) {
$table->string('address', 80)->nullable();
$table->string('address2', 80)->nullable();
$table->string('zip', 10)->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('locations', function ($table) {
$table->dropColumn('address');
$table->dropColumn('address2');
$table->dropColumn('zip');
});
}
}

View File

@ -0,0 +1,30 @@
<?php
use Illuminate\Database\Migrations\Migration;
class RemoveLocationIdFromAsset extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('assets', function ($table) {
$table->dropColumn('location_id');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('assets', function ($table) {
$table->integer('location_id')->nullable();
});
}
}

View File

@ -0,0 +1,29 @@
<?php
use Illuminate\Database\Migrations\Migration;
class SetNullvaluesForUser extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
//
// $prefix = DB::getTablePrefix();
// DB::statement('ALTER TABLE '.$prefix.'users MODIFY phone varchar(20) null');
// DB::statement('ALTER TABLE '.$prefix.'users MODIFY jobtitle varchar(50) null');
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}

View File

@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
class CreateAssetLogsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('asset_logs', function ($table) {
$table->increments('id');
$table->integer('user_id')->nullable();
$table->string('action_type');
$table->integer('asset_id');
$table->integer('checkedout_to')->nullable();
$table->integer('location_id')->nullable();
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('asset_logs');
}
}

View File

@ -0,0 +1,26 @@
<?php
use Illuminate\Database\Migrations\Migration;
class EditAddedOnAssetLogsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
// DB::statement('ALTER TABLE ' . DB::getTablePrefix() . 'asset_logs MODIFY added_on timestamp null');
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}

View File

@ -0,0 +1,30 @@
<?php
use Illuminate\Database\Migrations\Migration;
class EditLocationIdAssetLogsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
// Schema::table('asset_logs', function ($table) {
// $table->string('location_id')->nullable()->change();
// $table->dateTime('added_on',11)->nullable()->default(DB::raw('CURRENT_TIMESTAMP(0)'))->change();
// });
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}

View File

@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
class AddSoftDeleteOnAssets extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('assets', function ($table) {
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}

View File

@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
class AddSoftDeleteOnLocations extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('locations', function ($table) {
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}

View File

@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
class AddSoftDeleteOnManufacturers extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('manufacturers', function ($table) {
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}

View File

@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
class AddSoftDeleteOnCategories extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('categories', function ($table) {
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}

View File

@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Migrations\Migration;
class CreateStatusLabels extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('status_labels', function ($table) {
$table->increments('id');
$table->string('name', 100)->nullable();
$table->integer('user_id')->nullable();
$table->timestamps();
$table->softDeletes();
$table->engine = 'InnoDB';
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('status_labels');
}
}

View File

@ -0,0 +1,30 @@
<?php
use Illuminate\Database\Migrations\Migration;
class AddStatusIdOnAssetsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('assets', function ($table) {
$table->integer('status_id')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('assets', function ($table) {
$table->dropColumn('status_id');
});
}
}

View File

@ -0,0 +1,30 @@
<?php
use Illuminate\Database\Migrations\Migration;
class AddStatusTypeOnStatusLabels extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('status_labels', function ($table) {
$table->boolean('deployable')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('status_labels', function ($table) {
$table->dropColumn('deployable');
});
}
}

View File

@ -0,0 +1,30 @@
<?php
use Illuminate\Database\Migrations\Migration;
class AddArchivedToAssets extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('assets', function ($table) {
$table->boolean('archived')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('assets', function ($table) {
$table->dropColumn('archived');
});
}
}

View File

@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
class AddUploadsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('asset_uploads', function ($table) {
$table->increments('id');
$table->integer('user_id')->nullable();
$table->string('filename');
$table->integer('asset_id');
$table->string('filenotes')->nullable();
$table->timestamps();
$table->softDeletes();
$table->engine = 'InnoDB';
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('asset_uploads');
}
}

View File

@ -0,0 +1,30 @@
<?php
use Illuminate\Database\Migrations\Migration;
class RemoveDeployableBooleanFromStatusLabels extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('status_labels', function ($table) {
$table->dropColumn('deployable');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('status_labels', function ($table) {
$table->boolean('deployable');
});
}
}

View File

@ -0,0 +1,30 @@
<?php
use Illuminate\Database\Migrations\Migration;
class AddOptionLabelToSettingsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
// Schema::table('settings', function ($table) {
// // $table->string('option_label','80')->nullable();
// });
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
// Schema::table('settings', function ($table) {
// $table->dropColumn('option_label');
// });
}
}

View File

@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
class EditsToSettingsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('settings', function ($table) {
// $table->dropColumn('option_label');
//$table->dropColumn('option_name');
// $table->dropColumn('option_value');
$table->integer('per_page')->default(20);
$table->string('site_name', '100')->default('Snipe IT Asset Management');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}

View File

@ -0,0 +1,43 @@
<?php
use Illuminate\Database\Migrations\Migration;
class ReCreateLicensesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
if (!Schema::hasTable('licenses')) {
Schema::create('licenses', function ($table) {
$table->increments('id');
$table->string('name');
$table->string('serial');
$table->date('purchase_date')->nullable();
$table->decimal('purchase_cost', 8, 2)->nullable();
$table->string('order_number');
$table->integer('seats');
$table->text('notes');
$table->integer('user_id')->nullable();
$table->integer('depreciation_id');
$table->timestamps();
$table->softDeletes();
$table->engine = 'InnoDB';
});
}
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
// This was most likely handled in 2013_11_17_054359_drop_licenses_table.php
Schema::dropIfExists('licenses');
}
}

View File

@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
class CreateLicenseSeatsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
//
Schema::create('license_seats', function ($table) {
$table->increments('id');
$table->integer('license_id')->nullable();
$table->integer('assigned_to')->nullable();
$table->text('notes')->nullable();
$table->integer('user_id')->nullable();
$table->timestamps();
$table->softDeletes();
$table->engine = 'InnoDB';
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('license_seats');
}
}

View File

@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
class AddTypeToActionlogTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
//
Schema::table('asset_logs', function ($table) {
$table->string('asset_type')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
Schema::table('asset_logs', function ($table) {
$table->dropColumn('asset_type');
});
}
}

View File

@ -0,0 +1,26 @@
<?php
use Illuminate\Database\Migrations\Migration;
class DeleteBadLicensesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::drop('licenses');
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}

View File

@ -0,0 +1,42 @@
<?php
use Illuminate\Database\Migrations\Migration;
class CreateNewLicensesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
//
Schema::create('licenses', function ($table) {
$table->increments('id');
$table->string('name')->nullable();
$table->string('serial')->nullable();
$table->date('purchase_date')->nullable();
$table->decimal('purchase_cost', 8, 2)->nullable();
$table->string('order_number');
$table->integer('seats')->default(1);
$table->text('notes')->nullable();
$table->integer('user_id')->nullable();
$table->integer('depreciation_id')->nullable();
$table->timestamps();
$table->softDeletes();
$table->engine = 'InnoDB';
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
Schema::drop('licenses');
}
}

View File

@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
class AddLicensedToLicensesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
//
Schema::table('licenses', function ($table) {
$table->string('license_name')->nullable();
$table->string('license_email')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
Schema::table('licenses', function ($table) {
$table->dropColumn('license_name');
$table->dropColumn('license_email');
});
}
}

View File

@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
class AddWarranteeToAssetsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
//
Schema::table('assets', function ($table) {
$table->integer('warrantee_months')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
Schema::table('assets', function ($table) {
$table->dropColumn('warrantee_months');
});
}
}

View File

@ -0,0 +1,30 @@
<?php
use Illuminate\Database\Migrations\Migration;
class AlterWarrantyColumnOnAssets extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('assets', function ($table) {
$table->renameColumn('warrantee_months', 'warranty_months');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('assets', function ($table) {
$table->renameColumn('warranty_months', 'warrantee_months');
});
}
}

View File

@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
class DropParentFromCategories extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('categories', function ($table) {
$table->dropColumn('parent');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}

View File

@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Migrations\Migration;
class AddDepreciateToAssets extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
//
Schema::table('assets', function ($table) {
$table->boolean('depreciate')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('assets', function ($table) {
$table->dropColumn('depreciate');
});
}
}

View File

@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Migrations\Migration;
class AddDepreciateToLicensesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
//
Schema::table('licenses', function ($table) {
$table->boolean('depreciate')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('licenses', function ($table) {
$table->dropColumn('depreciate');
});
}
}

View File

@ -0,0 +1,29 @@
<?php
use Illuminate\Database\Migrations\Migration;
class DropLicenseFromAssetsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
// Schema::table('assets', function ($table) {
// $table->dropColumn('license_name');
// $table->dropColumn('license_email');
// });
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}

View File

@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
class AddNoteToAssetLogsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
//
Schema::table('asset_logs', function ($table) {
$table->text('note')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
Schema::table('asset_logs', function ($table) {
$table->dropColumn('note');
});
}
}

View File

@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
class AddFilenameToAssetLog extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
//
Schema::table('asset_logs', function ($table) {
$table->text('filename')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
Schema::table('asset_logs', function ($table) {
$table->dropColumn('filename');
});
}
}

View File

@ -0,0 +1,30 @@
<?php
use Illuminate\Database\Migrations\Migration;
class AddNullableToLicensesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('licenses', function ($table) {
$table->string('order_number', 50)->nullable()->change();
$table->string('notes', 255)->nullable()->change();
$table->string('license_name', 120)->nullable()->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}

View File

@ -0,0 +1,30 @@
<?php
use Illuminate\Database\Migrations\Migration;
class AddEolOnModelsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('models', function ($table) {
$table->integer('eol')->nullable()->default(null);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('models', function ($table) {
$table->dropColumn('eol');
});
}
}

View File

@ -0,0 +1,30 @@
<?php
use Illuminate\Database\Migrations\Migration;
class AddManagerToUsersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('users', function ($table) {
$table->integer('manager_id')->nullable()->default(null);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('users', function ($table) {
$table->dropColumn('manager_id');
});
}
}

View File

@ -0,0 +1,30 @@
<?php
use Illuminate\Database\Migrations\Migration;
class AddQrCodeToSettingsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('settings', function ($table) {
$table->integer('qr_code')->nullable()->default(null);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('settings', function ($table) {
$table->dropColumn('qr_code');
});
}
}

View File

@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class AddQrTextToSettingsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('settings', function (Blueprint $table) {
$table->string('qr_text', 32)->nullable()->default(null);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('settings', function (Blueprint $table) {
$table->dropColumn('qr_text');
});
}
}

View File

@ -0,0 +1,30 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class AlterDefaultLicenseDepreciationId extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
//
// Schema::table('licenses', function ($table) {
// $table->integer('depreciation_id')->nullable();
// });
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}

View File

@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class AlterDefaultValuesLicenses extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
//
// DB::statement('ALTER TABLE ' . DB::getTablePrefix() . 'license_seats MODIFY column notes text NULL');
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}

View File

@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class AddAssetNameToSettings extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('settings', function ($table) {
$table->integer('display_asset_name')->nullable()->default(null);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('settings', function ($table) {
$table->dropColumn('display_asset_name');
});
}
}

View File

@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class MakeAssetLogCheckedoutToNullable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
//
// DB::statement('ALTER TABLE ' . DB::getTablePrefix() . 'asset_logs MODIFY column checkedout_to int(11) NULL');
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}

View File

@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class MakeAssetLogPurchasedateToNullable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
//
// DB::statement('ALTER TABLE ' . DB::getTablePrefix() . 'licenses MODIFY column purchase_date date NULL');
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}

View File

@ -0,0 +1,45 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class AddSuppliers extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('suppliers', function ($table) {
$table->increments('id');
$table->string('name');
$table->string('address', 50)->nullable()->default(null);
$table->string('address2', 50)->nullable()->default(null);
$table->string('city')->nullable()->default(null);
$table->string('state', 2)->nullable()->default(null);
$table->string('country', 2)->nullable()->default(null);
$table->string('phone', 20)->nullable()->default(null);
$table->string('fax', 20)->nullable()->default(null);
$table->string('email', 150)->nullable()->default(null);
$table->string('contact', 100)->nullable()->default(null);
$table->string('notes')->nullable()->default(null);
$table->timestamps();
$table->integer('user_id')->nullable();
$table->softDeletes();
$table->engine = 'InnoDB';
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
Schema::drop('suppliers');
}
}

View File

@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class AddSupplierIdToAsset extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('assets', function ($table) {
$table->integer('supplier_id')->nullable()->default(null);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('assets', function ($table) {
$table->dropColumn('supplier_id');
});
}
}

View File

@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class AddZipToSupplier extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('suppliers', function ($table) {
$table->string('zip', 10)->nullable()->default(null);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('suppliers', function ($table) {
$table->dropColumn('zip');
});
}
}

View File

@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class AddUrlToSupplier extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('suppliers', function ($table) {
$table->string('url', 250)->nullable()->default(null);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('suppliers', function ($table) {
$table->dropColumn('url');
});
}
}

View File

@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class AddEmployeeIdToUsers extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
//
Schema::table('users', function ($table) {
$table->text('employee_num', '50')->nullable()->default(null);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
Schema::table('users', function ($table) {
$table->dropColumn('employee_num');
});
}
}

View File

@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class AddRequestableToAssets extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
//
Schema::table('assets', function ($table) {
$table->tinyInteger('requestable')->default(0);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
Schema::table('assets', function ($table) {
$table->dropColumn('requestable');
});
}
}

View File

@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class AddAssetToSoftware extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
//
Schema::table('license_seats', function ($table) {
$table->integer('asset_id')->nullable()->default(null);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
Schema::table('license_seats', function ($table) {
$table->dropColumn('asset_id');
});
}
}

View File

@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class MakeAssetIdInLogsNullable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
//
// DB::statement('ALTER TABLE ' . DB::getTablePrefix() . 'asset_logs MODIFY column asset_id int NULL');
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}

Some files were not shown because too many files have changed in this diff Show More