SQLSTATE[42S22]: Column not found: 1054 Unknown column 'shipment_items.organization_id' in 'where cl
i have made a shipmentItem migratino, model and a resource when i was finished with the resource the shipmentItem page turned up in my panel but when i click on it i get that error i will add my script in the chat of the migration
20 Replies
<?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::create('shipment_items', function (Blueprint $table) {
$table->id();
$table->foreignId('organization_id');
$table->foreign('organization_id')->references('id')->on('organizations');
$table->foreignId('quotation_orders_id');
$table->foreign('quotation_order_id')->references('id')->on('quotation_orders');
$table->foreignId('order_line_id');
$table->foreign('order_line_id')->references('id')->on('order_lines');
$table->unsignedBigInteger('number')->index();
$table->string('code')->nullable()->index();
$table->unsignedInteger('quantity')->default(0)->nullable();
$table->string('Destination_item');
$table->timestamps();
});
}
/
* Reverse the migrations.
*/
public function down(): void { Schema::dropIfExists('shipment_items'); } }; this is my shipment items migration if you need any other scripts just tell me and ill send it
public function down(): void { Schema::dropIfExists('shipment_items'); } }; this is my shipment items migration if you need any other scripts just tell me and ill send it
Did you check on the table schema column exists?
kinda new with laravel and filament where can i check that?
open the db on phpMyAdmin etc
im using a localhost db mysql inside vs code the database client extension
do you have mysql workbench?
no
the database is on another pc i just got it trough gittyup
okay, did you run
artisan migrate
?yes, there was nothing to migrate
As mentioned by Umar: Get a DB tool of your choice and check the actual state of that DB
mysql workbench is good right?
yes
I don't know it. But there are numerous tools out there. Find one that feels good to you. DBeaver, Beestudio, Table Plus, Sequel Ace, ...
oke then ill need to look at yt vid or internet on how i add my database in there
there is no way to fix it without mysql workbench?
It's important that you know what you DB looks like. Always. Because otherwise we can't tell whether it's in the state you expect.
Also: When debugging it's good to start with a smaller problem. Filament is a complex tool because it's based on Laravel and Livewire. So you need understanding of those too and of PHP and Databases.
why is mysql so weird
I don't know the VSCode extension you're using but can you access mysql from your command line? If so
DESCRIBE <your_table>
will show your table definitioni tried some commands and searching on internet but i don't think thats possible
huh i have no clue what i just did but it works
i don't get the error anymore and the shipment items panel is working
the only thing i did was php artisan tinker
now onto fixing this error
slowly but surely im starting to understand it more and more
Laravel - The PHP Framework For Web Artisans
Laravel is a PHP web application framework with expressive, elegant syntax. We’ve already laid the foundation — freeing you to create without sweating the small things.
thanks ill look into that