diff --git a/sidebar.ts b/sidebar.ts index 27c26be..dc2392d 100644 --- a/sidebar.ts +++ b/sidebar.ts @@ -50,6 +50,23 @@ module.exports = { ], collapsed: false, }, + { + type: 'category', + link: { + type: 'generated-index', + title: 'Usage - Laravel Like Package', + description: 'This section will guide you on how to use the Laravel Like Package. Let\'s get started with your first interaction in Laravel project!', + }, + label: 'Usage', + items: [ + { + type: 'doc', + id: 'usage/change_default_interaction', + label: '🔄 Change Default Interaction', + }, + ], + collapsed: false, + }, { type: 'category', link: { diff --git a/usage/change_default_interaction.md b/usage/change_default_interaction.md new file mode 100644 index 0000000..84eda10 --- /dev/null +++ b/usage/change_default_interaction.md @@ -0,0 +1,45 @@ +--- +title: Change the default interaction model | Laravel Like +description: Change the default interaction model for Laravel Like package. Change the default interaction model for Laravel Like package to customize the interactions as per your requirements. +keywords: ['laravel like', 'change default interaction model', 'interaction model', 'default interaction model', 'customize interactions', 'Laravel Like interaction model'] +tags: ['Change Default Interaction Model', 'Interaction Model', 'Customize Interactions', 'Laravel Like Interaction Model', 'Laravel Like Package', 'Update Interaction Model', 'Usage', 'Laravel Like Usage'] +--- + +
+ + + + +# 🛠Change Default Interaction Model + +Here is the default interaction model for Laravel Like package. You can customize the interaction model as per your requirements. + +Path: `config/like.php` + +```php +'interaction_model' => \CSlant\LaravelLike\Models\Like::class, +``` + +Sometimes, you may want to change the default interaction model to customize the interactions as per your requirements. You can change the default interaction model by updating the `interaction_model` key in the `config/like.php` file. + +**Here is how you can change the default interaction model:** + +```php +'interaction_model' => \App\Models\CustomInteraction::class, +``` + +And in the `CustomInteraction` model, you need to extend the `CSlant\LaravelLike\Models\Like` model. + +```php +namespace App\Models; + +use Illuminate\Database\Eloquent\Model; +use CSlant\LaravelLike\Models\Like; + +class CustomInteraction extends Like +{ + // Define your custom interactions here +} +``` + +In the above example, we have changed the default interaction model to `CustomInteraction` model. You can replace `CustomInteraction` with your custom interaction model.