Asset Stock Management

Filament 3
Also available in Filament 4/5 version

Stock management application, with export/import the items and log the transactions on the change of the stock numbers.

Screenshot 2023-10-17 at 07.22.58

Get the Source Code:

Only This Example

$9

One-time payment

Full source code for Asset Stock Management
Downloadable ZIP file with the source code
Lifetime access to this example
GitHub Sign in with GitHub to buy

Sign in first, then complete your $9 checkout.

Best value — all 174 examples

FilamentExamples Membership

$99 /year
or
$199 lifetime
Access to code of all 174 examples
Future new examples and updates included
FilaCheck Pro package licence included
MCP server included
View membership plans

30-day money-back guarantee

How it works

We have a simple resource to manage categories where the create and edit form opens in a modal. For category, we only have one field, name. Here is the code for CategoryResource:

class CategoryResource extends Resource
{
protected static ?string $model = Category::class;
 
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
 
public static function form(Form $form): Form
{
return $form
->schema([
Forms\Components\TextInput::make('name'),
]);
}
 
public static function table(Table $table): Table
{
return $table
->columns([
Tables\Columns\TextColumn::make('name'),
])
->filters([
//
])
->actions([
Tables\Actions\EditAction::make(),
Tables\Actions\DeleteAction::make(),
])
->bulkActions([
Tables\Actions\BulkActionGroup::make([
Tables\Actions\DeleteBulkAction::make(),
]),
]);
}
 
public static function getPages(): array
{
return [
'index' => Pages\ManageCategories::route('/'),
];
}
}

Transactions resource manages transactions for an item. We can only create a new transaction.

The form of transaction is reused in the relation manager for ItemResource. We don't need a select input in the relation manager, so the hiddenOn() method is used where the Relation Manager class is passed as a parameter.

The amount text input has a column span of full only in the Relation Manager. Here is the code for the form in the TransactionResource:

public static function form(Form $form): Form
{
return $form
->schema([
Forms\Components\Select::make('item_id')
->preload()
->required()
->searchable()
->label('Item')
->native(false)
->relationship('item', 'name')
->hiddenOn(TransactionsRelationManager::class),
Forms\Components\TextInput::make('amount')
->numeric()
->required()
->columnSpan(fn(HasForms $livewire) => $livewire instanceof TransactionsRelationManager ? 'full' : null),
Forms\Components\Textarea::make('comment')
->columnSpanFull(),
]);
}

The transactions create() method is overwritten to use DB transaction. After successfully creating the transaction and updating the item's stock, the user is redirected...

The FULL tutorial is available after the purchase: in the Readme file of the official repository you would get invited to.