PHP code example of rmitesh / card-stack

1. Go to this page and download the library: Download rmitesh/card-stack library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

rmitesh / card-stack example snippets




return [
	'models' => [
		'card' => Rmitesh\CardStack\Models\Card::class,
	],

	'table_names' => [
		'cards' => 'cards',
	],

	'table_column_names' => [
		/**
		 * "cards" table schema
		 */
		'cards' => [
			'user_id' => 'user_id',

			'name' => 'name',

			'color' => 'color',

			'position' => 'position',
		],

	],

];

public static function getPages(): array
{
    return [
        'view' => Pages\ViewPlan::route('/{record}/view'),
    ];
}

public static function table(Table $table): Table
{
	return $table
		->actions([
			Tables\Actions\Action::make('View')
			    ->icon('heroicon-o-x-eye')
			    ->color('secondary')
			    ->url(fn (Model $record) => route('filament.resources.plans.view', ['record' => $record])),
		])
}

use Rmitesh\CardStack\Resources\Pages\Concerns\CardView;

class ViewPlan extends Page
{
    use CardView;
}



namespace App\Filament\Widgets;

use Rmitesh\CardStack\Pages\Widgets\CardViewList;
use Illuminate\Database\Eloquent\Builder;

class PlanListView extends CardViewList
{
    protected function getTableQuery(): Builder
    {
        // Your eloquest query
    }
}

protected function getHeaderWidgets(): array
{
    return [
        PlanListView::class,
    ];
}

protected function getTableColumns(): array
{
    return [
        Tables\Columns\TextColumn::make('name'),
    ];
}

protected function getTableActions(): array
{
    return [
    	// 
    ];
}

protected function getTableHeaderActions(): array
{
    return [
    	// 
    ];
}

protected function getTableEmptyStateHeading(): ?string
{
    // your message
}

protected function getTableEmptyStateDescription(): ?string
{
    // your message
}
bash
php artisan vendor:publish --tag="card-stack-config"
bash
php artisan vendor:publish --tag="card-stack-migrations"
php artisan migrate
bash
php artisan vendor:publish --tag="card-stack-views"
bash
php artisan make:filament-page ViewPlan --resource=PlanResource
bash
php artisan make:filament-widget PlanListView