PHPackages                             raid/core-model - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. raid/core-model

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

raid/core-model
===============

Raid Core Model Package

069PHP

Since Feb 6Pushed 2y ago1 watchersCompare

[ Source](https://github.com/MohamedKhedr700/core-model)[ Packagist](https://packagist.org/packages/raid/core-model)[ RSS](/packages/raid-core-model/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Core Model Package
==================

[](#core-model-package)

This package is responsible for handling all models in the system.

Installation
------------

[](#installation)

```
composer require raid/core-model
```

Configuration
-------------

[](#configuration)

```
php artisan core:publish-model
```

Usage
-----

[](#usage)

```
class PostController extends Controller
{
    /**
     * Invoke the controller method.
     */
    public function __invoke(Request $request): JsonResponse
    {
        $post = new Post();

        // instead of this pattern.
        // $post->title = $request->get('title');
        // $title = $post->title;

        // we can use this pattern.
        $post->fillAttribute('title', $request->get('title'));

        $title = $post->attribute('title', '');

        // this didn't save the model, but we can deal with that later.
    }
}
```

How to work this
================

[](#how-to-work-this)

Let's start with our model class ex:`Post` model, you can use this command to create the model class.

```
php artisan core:make-model Post
```

```
