PHPackages                             te7a-houdini/laravel-applicant - 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. [Queues &amp; Workers](/categories/queues)
4. /
5. te7a-houdini/laravel-applicant

ActiveLibrary[Queues &amp; Workers](/categories/queues)

te7a-houdini/laravel-applicant
==============================

Simple package to allow model applies and receives applications from other models

1.1.0(6y ago)31101MITPHPPHP ^7.0

Since Aug 9Pushed 6y ago4 watchersCompare

[ Source](https://github.com/Te7a-Houdini/laravel-applicant)[ Packagist](https://packagist.org/packages/te7a-houdini/laravel-applicant)[ Docs](https://github.com/Te7a-Houdini/laravel-applicant)[ RSS](/packages/te7a-houdini-laravel-applicant/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (2)Dependencies (2)Versions (3)Used By (0)

[![](logo.svg)](logo.svg)

[![Releases](https://camo.githubusercontent.com/3db86b404260ca2dc41bbee127ba40968c3aa42ddd5b0ced0d6c4cb4f506756b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f546537612d486f7564696e692f6c61726176656c2d6170706c6963616e742e7376673f7374796c653d666c61742d737175617265)](https://github.com/Te7a-Houdini/laravel-applicant/releases)[![Build Status](https://camo.githubusercontent.com/ecd83a75218dad513f2d1ba03e883c0c87375f69dae0a992dab6c99d5614457b/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f546537612d486f7564696e692f6c61726176656c2d6170706c6963616e742f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/Te7a-Houdini/laravel-applicant)[![StyleCI](https://camo.githubusercontent.com/531d0f503d2fd979b3f4ce348430f2d9b098d767c02810dfa893ebcf5fe5019b/68747470733a2f2f7374796c6563692e696f2f7265706f732f3230313335363536312f736869656c64)](https://styleci.io/repos/201356561)[![Code Quality](https://camo.githubusercontent.com/b091f30277bba508c25653d51f955d7d72e4fed2f4e2677efe8e4a276318f5dd/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f546537612d486f7564696e692f6c61726176656c2d6170706c6963616e742e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/Te7a-Houdini/laravel-applicant/?branch=master)[![License](https://camo.githubusercontent.com/e136a29f4a0ac0e26aa82d55fb28984c58207abf501138ee8c347df900d7a224/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f546537612d486f7564696e692f6c61726176656c2d6170706c6963616e742e7376673f7374796c653d666c61742d737175617265)](https://github.com/Te7a-Houdini/laravel-applicant/blob/master/LICENSE.md)[![Downloads](https://camo.githubusercontent.com/f5fe6d60e43b41a822969bcb5b7a57e8a5816816691a19ba32e09d88e2943a1b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f546537612d486f7564696e692f6c61726176656c2d6170706c6963616e742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/te7a-houdini/laravel-applicant)

Simple package to allow model applies and receives applications from other models.

for example it will allow you to do something like this:

```
//User model applies for Group model
$user->appliesFor($group);

//Group model process application from User model
$group->processApplicationFrom($user,'accepted');
```

- [Installation](#installation)
- [Usage](#usage)
    - [Using Applicant trait](#using-applicant-trait)
        - [Using model for creating applications](#using-model-for-creating-applications)
        - [Using array for creating applications](#using-array-for-creating-applications)
        - [Using null for creating applications](#using-null-for-creating-applications)
        - [Using hasAppliedFor()](#using-hasappliedfor)
        - [Using appliedApplicationsFor()](#using-appliedapplicationsfor)
        - [Using appliedApplications()](#using-appliedapplications)
        - [Using applicantCriteria Attribute](#using-applicantcriteria-attribute)
        - [Using setApplicantCriteria()](#using-setapplicantcriteria)
    - [Using ReceivesApplications trait](#using-receivesapplications-trait)
        - [Using model for processing applications](#using-model-for-processing-applications)
        - [Using array for processing applications](#using-array-for-processing-applications)
        - [Using hasReceivedApplicationFrom()](#using-hasreceivedapplicationfrom)
        - [Using receivedApplicationsFrom()](#using-receivedapplicationsfrom)
        - [Using receivedApplications()](#using-receivedapplications)
        - [Using receiverCriteria Attribute](#using-receivercriteria-attribute)
        - [Using setReceiverCriteria()](#using-setreceivercriteria)
- [Testing](#testing)

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

[](#installation)

You can install the package via composer:

```
composer require te7a-houdini/laravel-applicant
```

Then publish the configurations and migrations:

```
php artisan vendor:publish --provider="Te7aHoudini\LaravelApplicant\LaravelApplicantServiceProvider"
```

After the migration has been published then run the migrations to create required tables:

```
php artisan migrate
```

Usage
-----

[](#usage)

let's assume we have `User model` &amp; `Group model`.

### Using Applicant trait

[](#using-applicant-trait)

to allow model behaves as applicant add `Te7aHoudini\LaravelApplicant\Traits\Applicant` trait to your model

```
use Illuminate\Foundation\Auth\User as Authenticatable;
use Te7aHoudini\LaravelApplicant\Traits\Applicant;

class User extends Authenticatable
{
    use Applicant;

    // ...
}
```

to make `User` model applies for `Group` model and creates a new `application` record in `applications` table . we can do this by different ways:

### Using model for creating applications

[](#using-model-for-creating-applications)

if you didn't specify any application type or status. by default the `type` will be `applicant` and `status` wil be `created`

```
//create a record with default type of "applicant" and default status of "created"
$user->appliesFor($group);

//create a record with type of "randomAppType" and default status of "created"
$user->appliesFor($group, ['type' => 'randomAppType']);

//create a record with type of "randomAppType" and status of "randomAppStatus"
$user->appliesFor($group, ['type' => 'randomAppType', 'status' => 'randomAppStatus']);
```

### Using array for creating applications

[](#using-array-for-creating-applications)

in some cases you won't have a model object , but want to manually specify the attributes when creating application.

```
$user->appliesFor([
    'receiver_id' => 1,
    'receiver_type' => 'App\Models\Group',
]);

$user->appliesFor([
    'receiver_id' => 1,
    'receiver_type' => 'App\Models\Group',
    'type' => 'randomAppType',
    'status' => 'randomAppStatus',
]);
```

### Using null for creating applications

[](#using-null-for-creating-applications)

if you don't want to specify a model for creating applications then no problem.

```
//create a record with default type of "applicant" and default status of "created"
//and both receiver_id & receiver_type are null
$user->appliesFor();
```

### Using hasAppliedFor()

[](#using-hasappliedfor)

if we want to check if model has made an application for another model. then we can achieve that with different ways.

`note: like appliesFor() the hasAppliedFor() accepts same parameters`

```
$user->hasAppliedFor($group);
$user->hasAppliedFor($group, ['type' => 'randomAppType', 'status' => 'randomAppStatus']);

$user->hasAppliedFor([
    'receiver_id' => 1,
    'receiver_type' => 'App\Models\Group',
]);

//check if $user model has application record with default type and status or not
$user->hasAppliedFor();
```

### Using appliedApplicationsFor()

[](#using-appliedapplicationsfor)

if you want to get current model applied applications you can do like this:

`note: like appliesFor() the appliedApplicationsFor() accepts same parameters`

```
$user->appliedApplicationsFor($group)->get();
$user->appliedApplicationsFor($group, ['type' => 'randomAppType', 'status' => 'randomAppStatus'])->get();

$user->appliedApplicationsFor([
    'receiver_id' => 1,
    'receiver_type' => 'App\Models\Group',
])->get();
```

### Using appliedApplications()

[](#using-appliedapplications)

this is a [morphMany](https://laravel.com/docs/master/eloquent-relationships#one-to-many-polymorphic-relations) relation between current model and `Application` model

```
//returns \Illuminate\Database\Eloquent\Relations\MorphMany
$user->appliedApplications();
```

### Using applicantCriteria Attribute

[](#using-applicantcriteria-attribute)

some models maybe applies for specific application `type` or `status` , so to make it easy for overriding default application `type` and `status` . just define `applicantCriteria` attribute in your model

```
use Illuminate\Foundation\Auth\User as Authenticatable;
use Te7aHoudini\LaravelApplicant\Traits\Applicant;

class User extends Authenticatable
{
    use Applicant;

    //you can define type or status or both
    $this->applicantCriteria = [
        'type' => 'randomAppType',
        'status' => 'randomAppStatus',
    ];
}

//instead of this.
$user->appliesFor($group, ['type' => 'randomAppType', 'status' => 'randomAppStatus']);
$user->hasAppliedFor($group,['type' => 'randomAppType', 'status' => 'randomAppStatus']);
$user->appliedApplicationsFor($group, ['type' => 'randomAppType', 'status' => 'randomAppStatus'])->get();

//you can now just remove the second param.
//and by default this will set the type to "randomAppType" and status to "randomAppStatus"
$user->appliesFor($group);
$user->hasAppliedFor($group);
$user->appliedApplicationsFor($group)->get();
```

### Using setApplicantCriteria()

[](#using-setapplicantcriteria)

if you want to set the applicant criteria dynamically per model. you can do this.

```
//this will create a record with type of "randomAppType" and status of "randomAppStatus"
$user->setApplicantCriteria([
    'type' => 'randomAppType',
    'status' => 'randomAppStatus',
])->appliesFor($group);
```

### Using ReceivesApplications trait

[](#using-receivesapplications-trait)

to allow model behaves as receiver add `Te7aHoudini\LaravelApplicant\Traits\ReceivesApplications` trait to your model

```
use Illuminate\Database\Eloquent\Model;
use Te7aHoudini\LaravelApplicant\Traits\ReceivesApplications;

class Group extends Model
{
    use ReceivesApplications;

    // ...
}
```

to make `Group` model process application from `User` model and update existing `application` record in `applications` table . we can do this by different ways:

### Using model for processing applications

[](#using-model-for-processing-applications)

if you didn't specify any application type or status. by default will query of `type` will `applicant` and `status` of `created`

```
//update existing record with default status of "processed" .
$group->processApplicationFrom($user);

//instead of updating with default status of "processed" then it will get updated by "accepted" status.
$group->processApplicationFrom($user, 'accepted');

//query by type of "randomAppType" and update status to "processed"
$group->processApplicationFrom($user, ['type' => 'randomAppType']);

//query by type of "randomAppType" and update status to "accepted"
$group->processApplicationFrom($user, ['type' => 'randomAppType'], 'accepted');

//query by type of "randomAppType" and status of "randomAppStatus"
$group->processApplicationFrom($user, ['type' => 'randomAppType', 'status' => 'randomAppStatus']);

//query by type of "randomAppType" and status of "randomAppStatus" and update status to "accepted"
$group->processApplicationFrom($user, ['type' => 'randomAppType', 'status' => 'randomAppStatus'], 'accepted');
```

### Using array for processing applications

[](#using-array-for-processing-applications)

in some cases you won't have a model object , but want to manually specify the attributes when processing application.

```
$group->processApplicationFrom([
    'applicant_id' => 1,
    'applicant_type' => 'App\Models\User',
]);

$user->processApplicationFrom([
    'applicant_id' => 1,
    'applicant_type' => 'App\Models\User',
    'type' => 'randomAppType',
    'status' => 'randomAppStatus',
]);

//you can override the default status of "processed" by providing second param.
$group->processApplicationFrom([
    'applicant_id' => 1,
    'applicant_type' => 'App\Models\User',
], 'accepted');
```

### Using hasReceivedApplicationFrom()

[](#using-hasreceivedapplicationfrom)

if we want to check if model has received an application from another model. then we can achieve that with different ways.

`note: like processApplicationFrom() the hasReceivedApplicationFrom() accepts same parameters except the last parameter of newStatus`

```
$group->hasReceivedApplicationFrom($user);
$group->hasReceivedApplicationFrom($user, ['type' => 'randomAppType', 'status' => 'randomAppStatus']);

$group->hasReceivedApplicationFrom([
    'applicant_id' => 1,
    'applicant_type' => 'App\Models\User',
]);
```

### Using receivedApplicationsFrom()

[](#using-receivedapplicationsfrom)

if you want to get current model received applications you can do like this:

`note: like processApplicationFrom() the receivedApplicationsFrom() accepts same parameters except the last parameter of newStatus`

```
$group->receivedApplicationsFrom($user)->get();
$group->receivedApplicationsFrom($user, ['type' => 'randomAppType', 'status' => 'randomAppStatus'])->get();

$group->receivedApplicationsFrom([
    'applicant_id' => 1,
    'applicant_type' => 'App\Models\User',
])->get();
```

### Using receivedApplications()

[](#using-receivedapplications)

this is a [morphMany](https://laravel.com/docs/master/eloquent-relationships#one-to-many-polymorphic-relations) relation between current model and `Application` model

```
//returns \Illuminate\Database\Eloquent\Relations\MorphMany
$user->receivedApplications();
```

### Using receiverCriteria Attribute

[](#using-receivercriteria-attribute)

some models maybe applies for specific application `type` or `status` , so to make it easy for overriding default application `type` and `status` . just define `receiverCriteria` attribute in your model

```
use Illuminate\Database\Eloquent\Model;
use Te7aHoudini\LaravelApplicant\Traits\ReceivesApplications;

class Group extends Model
{
    use ReceivesApplications;

    //you can define type or status or both
    $this->receiverCriteria = [
        'type' => 'randomAppType',
        'status' => 'randomAppStatus',
    ];
}

//instead of this.
$group->processApplicationFrom($user, ['type' => 'randomAppType', 'status' => 'randomAppStatus']);
$group->hasReceivedApplicationFrom($user,['type' => 'randomAppType', 'status' => 'randomAppStatus']);
$group->receivedApplicationsFrom($user, ['type' => 'randomAppType', 'status' => 'randomAppStatus'])->get();

//you can now just remove the second param.
//and by default this will query by type of "randomAppType" and status of "randomAppStatus"
$group->processApplicationFrom($user);
$group->hasReceivedApplicationFrom($user);
$group->receivedApplicationsFrom($user)->get();
```

### Using setReceiverCriteria()

[](#using-setreceivercriteria)

if you want to set the receiverCriteria criteria dynamically per model. you can do this.

```
//this will query by type of "randomAppType" and status of "randomAppStatus"
$user->setReceiverCriteria([
    'type' => 'randomAppType',
    'status' => 'randomAppStatus',
])->processApplicationFrom($group);
```

### Testing

[](#testing)

```
composer test
```

### Changelog

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

### Security

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Ahmed Abd El Ftah](https://github.com/Te7a-Houdini)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 91.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~28 days

Total

2

Last Release

2490d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/ef00b962479d759ffb75fb1f9e8dc02211d0bed49cb26bac0c650b81da0a1001?d=identicon)[Te7a-Houdini](/maintainers/Te7a-Houdini)

---

Top Contributors

[![amaelftah](https://avatars.githubusercontent.com/u/17250137?v=4)](https://github.com/amaelftah "amaelftah (11 commits)")[![EcoinTest](https://avatars.githubusercontent.com/u/153815470?v=4)](https://github.com/EcoinTest "EcoinTest (1 commits)")

---

Tags

joblaravellaravel-applicantphplaraveljobte7a-houdinilaravel-applicant

### Embed Badge

![Health badge](/badges/te7a-houdini-laravel-applicant/health.svg)

```
[![Health](https://phpackages.com/badges/te7a-houdini-laravel-applicant/health.svg)](https://phpackages.com/packages/te7a-houdini-laravel-applicant)
```

###  Alternatives

[anourvalar/eloquent-serialize

Laravel Query Builder (Eloquent) serialization

11223.5M33](/packages/anourvalar-eloquent-serialize)[mxl/laravel-job

Laravel job tools

661.4M](/packages/mxl-laravel-job)[mpbarlow/laravel-queue-debouncer

A wrapper job for debouncing other queue jobs.

63825.7k1](/packages/mpbarlow-laravel-queue-debouncer)[convenia/pigeon

3334.2k](/packages/convenia-pigeon)[tochka-developers/queue-promises

Promises for Laravel queue jobs

1912.3k](/packages/tochka-developers-queue-promises)[pmatseykanets/artisan-beans

Easily manage your Beanstalkd job queues right from the Laravel artisan command

4282.3k](/packages/pmatseykanets-artisan-beans)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
