Customizing models | laravel-mobile-pass | Spatie

 SPATIE

  Laravel Mobile Pass
======================

spatie.be/open-source

  [Docs](https://spatie.be/docs)  [Laravel-mobile-pass](https://spatie.be/docs/laravel-mobile-pass/v1)  Advanced-usage  Customizing models

 Version   v1

 Other versions for crawler [v1](https://spatie.be/docs/laravel-mobile-pass/v1)

- [ Introduction ](https://spatie.be/docs/laravel-mobile-pass/v1/introduction)
- [ Support us ](https://spatie.be/docs/laravel-mobile-pass/v1/support-us)
- [ Requirements ](https://spatie.be/docs/laravel-mobile-pass/v1/requirements)
- [ Installation &amp; setup ](https://spatie.be/docs/laravel-mobile-pass/v1/installation-setup)
- [ Questions and issues ](https://spatie.be/docs/laravel-mobile-pass/v1/questions-issues)
- [ Changelog ](https://spatie.be/docs/laravel-mobile-pass/v1/changelog)
- [ About us ](https://spatie.be/docs/laravel-mobile-pass/v1/about-us)

Basic usage
-----------

- [ Introduction ](https://spatie.be/docs/laravel-mobile-pass/v1/basic-usage/introduction)
- [ Getting credentials from Apple ](https://spatie.be/docs/laravel-mobile-pass/v1/basic-usage/getting-credentials-from-apple)
- [ Generating your first pass ](https://spatie.be/docs/laravel-mobile-pass/v1/basic-usage/generating-your-first-pass)
- [ Associating passes with models ](https://spatie.be/docs/laravel-mobile-pass/v1/basic-usage/associating-passes-with-models)
- [ Updating passes ](https://spatie.be/docs/laravel-mobile-pass/v1/basic-usage/updating-passes)
- [ Storing mobile passes ](https://spatie.be/docs/laravel-mobile-pass/v1/basic-usage/storing-mobile-passes)
- [ Downloading passes ](https://spatie.be/docs/laravel-mobile-pass/v1/basic-usage/downloading-passes)
- [ Using passes as mail attachments ](https://spatie.be/docs/laravel-mobile-pass/v1/basic-usage/using-passes-as-mail-attachments)
- [ Available pass types ](https://spatie.be/docs/laravel-mobile-pass/v1/basic-usage/available-pass-types)

Advanced usage
--------------

- [ Customizing actions ](https://spatie.be/docs/laravel-mobile-pass/v1/advanced-usage/customizing-actions)
- [ Customizing models ](https://spatie.be/docs/laravel-mobile-pass/v1/advanced-usage/customizing-models)
- [ Reading stored passes ](https://spatie.be/docs/laravel-mobile-pass/v1/advanced-usage/reading-stored-passes)

 Customizing models
==================

If you want to customize the behaviour of the models, you can do so by creating a new model that extends the default model. This way you can add new methods, traits, etc..

Here's how you would enable the `SoftDeletes` trait on a model:

```
use Illuminate\Database\Eloquent\SoftDeletes;
use Spatie\LaravelMobilePass\Models\MobilePass;

class CustomMobilePass extends MobilePass
{
    use SoftDeletes;
}
```

You must then update the `mobile-pass` config file to use the new model:

```
// config/mobile-pass.php

return [
    'models' => [
        'mobile_pass' =>  App\Models\CustomMobilePass::class,
    ],
];
```
