PHPackages                             emmanuelpcg/laravel-basics - 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. [Framework](/categories/framework)
4. /
5. emmanuelpcg/laravel-basics

ActiveLibrary[Framework](/categories/framework)

emmanuelpcg/laravel-basics
==========================

Pacote de funcionalidades para o Laravel com o básico como fazer o crud de uma entidade, manipular imagens, querys simples e etc

v0.6.3(1y ago)330MPL-2.0PHPPHP ^7.4 || ^8.1 || ^8.2

Since Nov 4Pushed 1y ago1 watchersCompare

[ Source](https://github.com/epcgrs/laravel-basics)[ Packagist](https://packagist.org/packages/emmanuelpcg/laravel-basics)[ RSS](/packages/emmanuelpcg-laravel-basics/feed)WikiDiscussions main Synced 3d ago

READMEChangelog (9)Dependencies (5)Versions (17)Used By (0)

Emmanuelpcg laravel-basics
==========================

[](#emmanuelpcg-laravel-basics)

[![Stars](https://camo.githubusercontent.com/8b491cfd7d0e0d2e875a281b300bad11e814b681d91550e4b22fa3cf530408f4/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f6570636772732f6c61726176656c2d626173696373)](https://camo.githubusercontent.com/8b491cfd7d0e0d2e875a281b300bad11e814b681d91550e4b22fa3cf530408f4/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f6570636772732f6c61726176656c2d626173696373)[![GitHub license](https://camo.githubusercontent.com/c201619eba5a5fff0793e6cef9e7dd99d41d589d2dbb8948deedc22307ded87c/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6570636772732f6c61726176656c2d626173696373)](https://github.com/epcgrs/laravel-basics/blob/main/LICENSE)[![Packagist Downloads](https://camo.githubusercontent.com/60369796e3af81878d08d0298febf45d430b8431aeef230529fedd4336ec0db0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f656d6d616e75656c7063672f6c61726176656c2d626173696373)](https://camo.githubusercontent.com/60369796e3af81878d08d0298febf45d430b8431aeef230529fedd4336ec0db0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f656d6d616e75656c7063672f6c61726176656c2d626173696373)[![Packagist Version](https://camo.githubusercontent.com/ffd91162c9e2ea57c0940e9149221c32f38fc9faf79202d79a8cee1995a81182/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f656d6d616e75656c7063672f6c61726176656c2d626173696373)](https://camo.githubusercontent.com/ffd91162c9e2ea57c0940e9149221c32f38fc9faf79202d79a8cee1995a81182/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f656d6d616e75656c7063672f6c61726176656c2d626173696373)

Description
-----------

[](#description)

---

Package with basic starter features for Laravel.

- [Install](#install)
- [If Builder](#if-builder)
- [Constants](#constants)
- [Query Builder Apply Filters](#query-builder-filters)
- [Model Basics](#model-basics)
- [Image Manipulation](#image-manipulation)

Install
-------

[](#install)

```
composer require emmanuelpcg/laravel-basics
```

If Builder
----------

[](#if-builder)

Creates an eloquent builder that checks a condition to be executed

In `app/providers/AppServiceProvider.php` add:

```
public function register()
{
    BuilderQueries::builderIf();
}
```

without operator param:

```
$cars = Cars::where('color', 'red')
        ->if(auth()->check(), 'color', 'blue')
        ->get();
```

with operator param:

```
$cars = Cars::where('color', 'red')
        ->if(auth()->check(), 'color', '!=', 'red')
        ->get();
```

Constants
---------

[](#constants)

creates an object with extra features of the constants:

```
class CarTypes extends Constants
{
    const MUSCLE = 1;
    const SPORT = 2;
}

CarTypes::getConstants();

/**
[
    "MUSCLE" => 1,
    "SPORT" => 2
 ]
*/

CarTypes::getValues();

/** [1, 2] */

CarTypes::toSelectOptions();

/**
[
    [
        'value' => 1,
        'text' => "MUSCLE"
    ],
    [
        'value' => 2,
        'text' => "SPORT"
    ]
]
*/
```

Query Builder Apply Filters
---------------------------

[](#query-builder-apply-filters)

Add Query filters in Pipelines Requests

For example: I have Car model and want to apply a filter by color attribute

create a class with name of attribute:

```
