GithubHelp home page GithubHelp logo

laracraft-tech / laravel-date-scopes Goto Github PK

View Code? Open in Web Editor NEW
453.0 453.0 22.0 84 KB

Some useful date scopes for your Laravel Eloquent models!

Home Page: https://laracraft.tech/blog/laravel-date-scopes-a-package-to-filter-eloquent-models-by-common-date-ranges-conveniently

License: MIT License

PHP 100.00%
analytics date eloquent fincance laravel scopes statistics

laravel-date-scopes's People

Contributors

denniseilander avatar dependabot[bot] avatar github-actions[bot] avatar imanghafoori1 avatar javierpomachagua avatar sairahcaz 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  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  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  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  avatar  avatar  avatar

laravel-date-scopes's Issues

How to apply timezone with query ?

I need to to fetch records for diffrent user , those having diffrent timezones , How can I pass timezone with an query to fetch correct results?

With Laravel And MongoDB not working date range

Model Code

class SalesOrder extends BaseModel
{
    use DateScopes;

    protected $collection = 'sales_orders';
    
}

Model Usage

public function getSalesOrderFilterWise(Request $request): JsonResponse
    {
        $response = SalesOrder::ofLastMonths();
            //->get();

        return jsonData([
            'message' => 'Data Found',
            'data' => $response,
        ]);
    }

Given Response

{
    "message": "Data Found",
    "data": {}
}

With the below code it gives me a data

$range = [
            now()->subWeeks(2),
            now(),
        ];
        $response = SalesOrder::whereBetween('created_at', $range)
            ->get();

I already created last month sales orders and using this trait i'm not be able to found any data if you have any suggestion or my mistake please correct me.

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.