# Use

you can generate a new feature by using this command

```
php artisan tomato-feature:generate
```

it will generate a feature for you and you can add it to your plan.

to make some routes guard by our plan feature control:

#### Add Model to config

go to `config/tomato-subscription.php` and add new models like

```
[
    "label" => "Users",
    "id" => \App\Models\User::class
],
```

#### Use the Subscription trait on your model

you need to add this trait to your model

```
use TomatoPHP\TomatoSubscription\Traits\HasPlanSubscription;

class User extends Authenticatable
{
    use HasPlanSubscription;
    ...
```

#### Add Middleware to your routes

you can add the middleware to your routes like

```
\TomatoPHP\TomatoSubscription\Http\Middleware\UserHasBeenSubscribedToPlan::class
```

now, your app is ready to use our package.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.tomatophp.com/plugins/tomato-subscription/use.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
