-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix the graph view, make item fields nullable and make the item card …
…resize correctly
- Loading branch information
Showing
10 changed files
with
185 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
|
||
namespace App\Console\Commands; | ||
|
||
use App\Models\Item; | ||
use Illuminate\Console\Command; | ||
|
||
class fixJsonItems extends Command | ||
{ | ||
/** | ||
* The name and signature of the console command. | ||
* | ||
* @var string | ||
*/ | ||
protected $signature = 'app:fix-json-items'; | ||
|
||
/** | ||
* The console command description. | ||
* | ||
* @var string | ||
*/ | ||
protected $description = 'get all of the items and remove the 0 values from the json_items column.'; | ||
|
||
/** | ||
* Execute the console command. | ||
*/ | ||
public function handle() | ||
{ | ||
$items = Item::query()->without('attributes')->select('id', 'json_items')->get(); | ||
foreach ($items as $item){ | ||
if($item->json_items){ | ||
$new = array_values(array_filter($item->json_items, function ($value){ | ||
return $value!==0; | ||
})); | ||
$item->json_items = $new; | ||
$item->save(); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
database/migrations/2024_06_12_200853_make_item_fields_nullable.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
return new class extends Migration | ||
{ | ||
/** | ||
* Run the migrations. | ||
*/ | ||
public function up(): void | ||
{ | ||
Schema::table('items', function ($table){ | ||
$table->text('description')->nullable()->change(); | ||
$table->text('card_description')->nullable()->change(); | ||
$table->text('pros')->nullable()->change(); | ||
$table->text('cons')->nullable()->change(); | ||
$table->text('hardware_considerations')->nullable()->change(); | ||
$table->text('software_considerations')->nullable()->change(); | ||
$table->text('wiring_instructions')->nullable()->change(); | ||
$table->text('example_code')->nullable()->change(); | ||
}); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
*/ | ||
public function down(): void | ||
{ | ||
//reverse up | ||
Schema::table('items', function ($table){ | ||
$table->text('description')->change(); | ||
$table->text('card_description')->change(); | ||
$table->text('pros')->change(); | ||
$table->text('cons')->change(); | ||
$table->text('hardware_considerations')->change(); | ||
$table->text('software_considerations')->change(); | ||
$table->text('wiring_instructions')->change(); | ||
$table->text('example_code')->change(); | ||
}); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
<script setup lang="ts"> | ||
const props = defineProps<{ | ||
color: string; | ||
disableClasses?:boolean; | ||
}>(); | ||
const standardClasses = "text-xs font-medium px-2.5 py-0.5 m-1 rounded-full h-min" | ||
</script> | ||
<template> | ||
<span class="text-xs font-medium px-2.5 py-0.5 m-1 rounded-full h-min" :class="`bg-${color}-100 text-${color}-800 dark:bg-${color}-900 dark:text-${color}-300`"><slot/></span> | ||
<span :class="[`bg-${color}-100 text-${color}-800 dark:bg-${color}-900 dark:text-${color}-300`, disableClasses?'':standardClasses]"><slot/></span> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters