Code Monkey home page Code Monkey logo

eloquent-repository's Introduction

Hi there ๐Ÿ‘‹

My name is Orkhan, currently living in Munich, Germany. I'm an experienced software engineer with a passion for open-source, currently working at AirLST GmbH as Director of Product Development.

You can ask me anything about PHP, Laravel, JavaScript, and Vue, or even better let's collaborate on a project based on these technologies.

From time to time I post about technical articles that I find interesting and useful on my personal blog orkhan.dev ๐Ÿ“ƒ, and also publish open-source PHP libraries/packages, like, Laravel ZIP file content validator, Eloquent Repository for Laravel, Yandex Checkout, GoldenPay PHP library, Laravel Spreadsheet Translations etc. If you like my open-source work and want to support me financially, you can sponsor me on GitHub Sponsors page ๐Ÿ’–.

Outside of coding mostly I spend time with my wife and little son. I'm also a runner ๐Ÿƒ, swimmer ๐ŸŠโ€โ™‚๏ธ and weightlifter ๐Ÿ‹๏ธโ€โ™‚๏ธ. If you like running and maybe want some competition, add me on "Nike Run Club": [email protected]

I'm active on Twitter, so you can always reach me there @orkhanahmadov or you can send me an email: [email protected]

I speak ๐Ÿ‡บ๐Ÿ‡ธ English, ๐Ÿ‡ฉ๐Ÿ‡ช Deutsch, ๐Ÿ‡ท๐Ÿ‡บ ะ ัƒััะบะธะน, ๐Ÿ‡น๐Ÿ‡ท Tรผrkรงe, ๐Ÿ‡ฆ๐Ÿ‡ฟ Azษ™rbaycanca.

eloquent-repository's People

Contributors

absolutezeroo avatar orkhanahmadov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

eloquent-repository's Issues

attempting to use your package

php version: 7.4
laravel version: 7.26.0

Symfony\Component\ErrorHandler\Error\FatalError
Access level to App\Repositories\CategoriesRepository::entity() 
must be public (as in class Orkhanahmadov\EloquentRepository\EloquentRepository)

^ error in browser
and if i made that entity function to public its saying its not compatible with entity() in the EloquentRepository

even if i generated it via the make:repository command i get the same result

<?php

 

namespace App\Repositories;

 

use App\Models\Category;

use Orkhanahmadov\EloquentRepository\EloquentRepository;

 

class CategoriesRepository extends EloquentRepository

{

    /**

     * Defines entity.

     *

     * @return mixed

     */

    protected function entity()

    {

        return Category::class;

    }

How to get user posts using EloquentRepository methods?

I have an issue to use EloquentRepository,

for example, I have many models and I want to apply repository pattern for most of them, some belong to User with regular relation belongsTo(User::class) and some belong to User with polymorphic relations,

If I want to get posts that belong to a user, how can I get them using an instance of EloquentRepository
how to do that?

keep in mind, I don't want to override base methods located in Repository\Concerns in every repository that I create!

Can you please explain or provide a solution to this problem?

Feature request

Are you planning to introduce firstOrCreate in the repository?

Model method bug

Apologies on title, not sure how to title it...

If you had a list of say 10 customers; and you attempted to view any of the customers. It would result in the viewing of one particular customer (customer would not be the first record in the system). The UUID of the customer would change, but the outcome would be the same.

-- High level footnote; You want to view customer A, it will show C, if you tried customer B, it would show C. E to C, F to C.

I caught that a model relationship of

    public static function getCustomerById($id): UuidInterface
    {
        return self::where('id', $id)->first();
    }

And using the relationship in a controller doing firstOrFail() onto the model method.

     $customer = Customer::getCustomerById($id)->firstOrFail()

I'm not sure how you could yield an error from chaining a first() and a firstOrFail() together but this was a weird bug that I thought could be prevented.

Laravel Version

Laravel 8.83.4

PHP 8

Incompatible with PHP8. I don't know whether it's only due to the fact that a PHP version is whitelisted in composer.json.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.