L!am
L!am
FFilament
Created by L!am on 6/10/2024 in #❓┊help
Return Table will not show morphtoselect
someone pls help 😄
24 replies
FFilament
Created by L!am on 6/10/2024 in #❓┊help
Return Table will not show morphtoselect
i have no clue why that error is there
24 replies
FFilament
Created by L!am on 6/10/2024 in #❓┊help
Return Table will not show morphtoselect
No description
24 replies
FFilament
Created by L!am on 6/10/2024 in #❓┊help
Return Table will not show morphtoselect
do you know how i could fix this?
24 replies
FFilament
Created by L!am on 6/10/2024 in #❓┊help
Return Table will not show morphtoselect
that line is infact not good btw
24 replies
FFilament
Created by L!am on 6/10/2024 in #❓┊help
Return Table will not show morphtoselect
i don't know if the productRevision.product_id line is good i just found something on the internet and was trying it but before that it was just product_id but the same problem not showing up on the website
24 replies
FFilament
Created by L!am on 6/10/2024 in #❓┊help
Return Table will not show morphtoselect
but everything i try it will just not show up under the header Product revision and Item list on the website
24 replies
FFilament
Created by L!am on 6/10/2024 in #❓┊help
Return Table will not show morphtoselect
yes i do want that i want to call up the 'product_id' from the productrevision model same with itemlist there it is the 'name'
24 replies
FFilament
Created by L!am on 6/10/2024 in #❓┊help
Return Table will not show morphtoselect
No description
24 replies
FFilament
Created by L!am on 6/10/2024 in #❓┊help
Return Table will not show morphtoselect
in my OrderRelationManager i am trying to show these 2 lines on the website
MorphToSelect::make('itemable')->label('Create item')
->types([
MorphToSelect\Type::make(ProductRevision::class)->titleAttribute('product_id'),
MorphToSelect\Type::make(ItemList::class)->titleAttribute('name'),
]),
MorphToSelect::make('itemable')->label('Create item')
->types([
MorphToSelect\Type::make(ProductRevision::class)->titleAttribute('product_id'),
MorphToSelect\Type::make(ItemList::class)->titleAttribute('name'),
]),
24 replies
FFilament
Created by L!am on 6/10/2024 in #❓┊help
Return Table will not show morphtoselect
<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\Relations\HasOne;

class ItemList extends Model
{
use HasFactory;

protected $fillable = [
'name',
'product_revision_id'
];

/**
* Get the product items for the product item list.
*
* @return HasMany
*/
public function items(): HasMany
{
return $this->hasMany(Item::class);
}

public function getProductIdAttribute()
{
return $this->productRevision->product_id ?? null;
}

/**
* Get the product revision for the product item list.
*
* @return BelongsTo
*/
public function productRevision(): BelongsTo
{
return $this->belongsTo(ProductRevision::class);
}

public function getLabelAttribute()
{
return $this->name;
}

public function getTypeLabelAttribute()
{
return "Item list";
}
}
<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\Relations\HasOne;

class ItemList extends Model
{
use HasFactory;

protected $fillable = [
'name',
'product_revision_id'
];

/**
* Get the product items for the product item list.
*
* @return HasMany
*/
public function items(): HasMany
{
return $this->hasMany(Item::class);
}

public function getProductIdAttribute()
{
return $this->productRevision->product_id ?? null;
}

/**
* Get the product revision for the product item list.
*
* @return BelongsTo
*/
public function productRevision(): BelongsTo
{
return $this->belongsTo(ProductRevision::class);
}

public function getLabelAttribute()
{
return $this->name;
}

public function getTypeLabelAttribute()
{
return "Item list";
}
}
and this is my ItemList model
24 replies
FFilament
Created by L!am on 6/10/2024 in #❓┊help
Return Table will not show morphtoselect
<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\SoftDeletes;

class ProductRevision extends Model
{
use HasFactory, SoftDeletes;

protected $fillable = [
'revision_number',
'needs_documents',
'product_id',
];

protected $searchableFields = ['*'];

protected $table = 'product_revisions';

protected $casts = [
'needs_documents' => 'boolean',
];

/**
* Get the product of the product revision
*
* @return BelongsTo
*/
public function product(): BelongsTo
{
return $this->belongsTo(Product::class);
}

/**
* Get the order lines of the product revision
*
* @return HasMany
*/
public function orderLines(): HasMany
{
return $this->hasMany(OrderLine::class);
}

/**
* Get the product prices of the product revision
*
* @return HasMany
*/
public function productPrices(): HasMany
{
return $this->hasMany(ProductPrice::class);
}

public function getLabelAttribute()
{
return "{$this->product->code} - {$this->product->name}";
}

public function getTypeLabelAttribute()
{
return "Product";
}
}
<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\SoftDeletes;

class ProductRevision extends Model
{
use HasFactory, SoftDeletes;

protected $fillable = [
'revision_number',
'needs_documents',
'product_id',
];

protected $searchableFields = ['*'];

protected $table = 'product_revisions';

protected $casts = [
'needs_documents' => 'boolean',
];

/**
* Get the product of the product revision
*
* @return BelongsTo
*/
public function product(): BelongsTo
{
return $this->belongsTo(Product::class);
}

/**
* Get the order lines of the product revision
*
* @return HasMany
*/
public function orderLines(): HasMany
{
return $this->hasMany(OrderLine::class);
}

/**
* Get the product prices of the product revision
*
* @return HasMany
*/
public function productPrices(): HasMany
{
return $this->hasMany(ProductPrice::class);
}

public function getLabelAttribute()
{
return "{$this->product->code} - {$this->product->name}";
}

public function getTypeLabelAttribute()
{
return "Product";
}
}
this is my ProductRevision model
24 replies
FFilament
Created by L!am on 6/10/2024 in #❓┊help
Return Table will not show morphtoselect
This is the Resource, the thing that needs to show is my 'product_id' (from ProductRevision model) and my 'name' (from ItemList model)
24 replies
FFilament
Created by L!am on 6/10/2024 in #❓┊help
Return Table will not show morphtoselect
?? anyone
24 replies
FFilament
Created by L!am on 6/10/2024 in #❓┊help
Return Table will not show morphtoselect
if more detail is needed just tell me
24 replies
FFilament
Created by L!am on 6/10/2024 in #❓┊help
Return Table will not show morphtoselect
i know i have to use GitHub Gist for longer scripts but i use gitlab so idk how to use that
24 replies