kalesha
Image path is not saving in table column
Section::make("Images")
->collapsible()
->schema([
Repeater::make('images')
->relationship('images')
->schema([
TextInput::make('size')
->required(),
SpatieMediaLibraryFileUpload::make('image_url')
->disk('r2')
->directory('product_images')
->collection('product_images')
->image()
->required(),
])
->addActionLabel('Add Image')
->defaultItems(3)
])
when try to save changes, image is uploading to cloudflare but path is not update rather i get error message
SQLSTATE[HY000]: General error: 1364 Field 'image_url' doesn't have a default value (Connection: mysql, SQL: insert into
SQLSTATE[HY000]: General error: 1364 Field 'image_url' doesn't have a default value (Connection: mysql, SQL: insert into
product_images
(size
, product_id
, updated_at
, created_at
) values (111, 1, 2024-10-01 18:50:33, 2024-10-01 18:50:33))12 replies
fileupload signed url issue
FileUpload::make('image_url')
->disk('r2')
->directory('products')
->visibility('public')
->image()
->required(),
when i try to access the image, i will have to get signed url but how can this be done using file upload ?
1 replies
Could not save other model relation data
I have a product model and productpromotion model, product model will have many promotions, how can we save relation from productmodel resource ?
Group::make()
->relationship('promotion')
->schema([
TextInput::make('promotion_label')
->label('Label'),
TextInput::make('discount_percentage')
->label('Discount Percentage'),
TextInput::make('base_price')
->label('Base Price'),
i ended up getting this error
SQLSTATE[HY000]: General error: 1364 Field 'product_model_id' doesn't have a default value (Connection: mysql, SQL: insert into
product_model_promotions
(promotion_label
, discount_percentage
, base_price
, is_free_pickup
, starts_at
, ends_at
, updated_at
, created_at
) values (?, ?, ?, 0, ?, ?, 2024-09-26 17:34:15, 2024-09-26 17:34:15))4 replies
text input with relation
when i try to access pricing relation with product model, i could not access values in the form text input. can some one help me how to get relation model value with text input ???
TextInput::make('pricing.sell_price')
->label('Price')
->required()
->numeric()
->helperText('Enter price of the product')
->default(fn ($record) => $record?->pricing?->base_price),
product model
public function pricing(): HasOne
{
return $this->hasOne(ProductPricing::class);
}
5 replies