skoobi

Experience

25,660

5 Best Reply Awards

  • Member Since 4 Years Ago
  • 185 Lessons Completed
  • 8 Favorites

11th October, 2018

skoobi left a reply on What To Clear After Doing Git Pull On Server? • 4 days ago

Are you using chrome or firefox? If your using chrome you can go into dev tools and then hard reload and clear cache of the page, I previously had huge issues with the browser caching everything.

skoobi left a reply on How Can I Make Controller For My Multiple Tables • 4 days ago

Im not sure if i got this right or not, i'm sure someone else may have a better way of doing it, but you could use one Controller and use Eloquent relationships to link all the tables.

skoobi started a new conversation 5.7 Improved Error Messages • 4 days ago

Hi. I read on Laravel news that there are improved error messages for Laravel 5.7, but after upgrading I still get the old messages that are a nightmare to debug.

Is there a package i need to add or update to get the same error messages as the link i posted.

10th October, 2018

skoobi left a reply on Search Filters Using Scopes • 5 days ago

Spot on. I was trying to figure out how to find out if a field was there or not but didn't know you could do if(!$interval) return $query; thats perfect... Thank you

skoobi left a reply on Best Laravel Host Server • 5 days ago

Depends on what you use on the current server. I.e. if you need emails etc.

I use DigitalOcean and Laravel forge for my apps. Depending on the size of the server needed DO have some good pricing.

Theres also Amazon AWS and many others to be had, but it depends on the spec your looking for and level of support too.

skoobi started a new conversation Search Filters Using Scopes • 5 days ago

Hi. Im currently trying to add a search feature to a project im working on and having issues with getting the results i want back.

I have 4 different html fields, A text input for the search query (can be null), 3 dropdowns with different options (i.e. account status, region etc.)

When i search using only one of the dropdowns i.e. the status it returns no results.

Heres the code::

// BLADE FORM
<form action="{{ route('admin.dashboard.search') }}" role="form" method="POST">
                    @csrf

                    <div class="g_grid_3">
                        <input type="text" class="" name="searchByKeyword" id="searchByKeyword" placeholder="Search" style="width:100%;" />
                    </div>

                    <div class="g_grid_2">
                        <select name="status">
                            <option value="">All</option>
                            @foreach($statuses as $status)
                            <option value="{{ $status->id }}">{{ $status->title }}</option>
                            @endforeach
                        </select>
                    </div>
                    <div class="g_grid_3">
                        <select name="interval">
                            <option value="">All</option>
                            @foreach($intervals as $interval)
                            <option value="{{ $interval->id }}">{{ $interval->title }}</option>
                            @endforeach
                        </select>
                    </div>

                    <div class="g_grid_2">
                        <select name="zone">
                            <option value="">All</option>
                            <option value="1">UK</option>
                            <option value="2">EU</option>
                            <option value="3">ROW</option>
                            <option value="4">ROW 2</option>
                        </select>
                    </div>
                    <div class="g_grid_2">
                        <a href="{{ route('admin.dashboard') }}" class="button redBorder "><i class="fas fa-redo-alt"></i></a>
                        <button class="button solidBlue"><i class="fas fa-search"></i> Search</button>
                    </div>
                </div>
            </form>
// Controller 
    public function find(Request $request)
    {
    $user = Auth::user();
        $statuses = Status::orderBy('title', 'ASC')->get();
        $intervals = Interval::all();

        $keyword = $request->get('searchByKeyword');
        $status = $request->get('status');
        $interval = $request->get('interval');

        // return $request->all();

        if($user->hasAnyRole('Admin|Support')){

            $customers = User::search($keyword)
            ->getstatus($status)
            ->getinterval($interval)
            ->with('account')
            ->get();

        }
}
// Model with scopes

    public function scopeSearch ($query, $keyword)
    {
        return $query->where('name', 'like', '%' . $keyword . '%')
        ->orWhere('username', 'like', '%' . $keyword . '%')
        ->orWhere('email', 'like', '%' . $keyword . '%')
        ->orWhere('mailbox_id', 'like', '%' . $keyword . '%')
        ->orWhereHas('account', function ($query) use ($keyword) {
            $query->where('comments', 'like', '%' . $keyword . '%');
        })
        ->orWhereHas('verified_users', function ($query) use ($keyword) {
            $query->where('name1', 'like', '%' . $keyword . '%')
            ->orWhere('name2', 'like', '%' . $keyword . '%')
            ->orWhere('name3', 'like', '%' . $keyword . '%')
            ->orWhere('name4', 'like', '%' . $keyword . '%');
        });
    }

    
    public function scopeGetStatus ($query, $status)
    {
        return $query->whereHas('account', function ($query) use ($status) {
            $query->where('status_id', $status);
        });
    }


    
    public function scopeGetInterval ($query, $interval)
    {
        return $query->whereHas('settings', function ($query) use ($interval) {
            $query->where('interval_id', $interval);
        });
    }

Ive tried several different methods but still wont work. Any help would be great.

Cheers

skoobi left a reply on Laravel Cashier Webhook Response From Stripe • 5 days ago

Hi. Thanks for the response...

@shez1983 Ye the site is on a staging server and local but im using the staging server to test. Ive tried without the ,try{} but still nothing.

With the spatie/stripe-webhookspackage it adds the entry into the database to show the webhook has hit the apps route but it doesn't execute the job/code when hitting, which in this case is \Log::info().

@Drfraker Hi. Ive tried to install valet onto my system but something is blocking it for some reason. It installs but there are parts on brew that fail when trying to share.

Ill take a look at Postman and see what i can come up with .

Many thanks

9th October, 2018

skoobi started a new conversation Laravel Cashier Webhook Response From Stripe • 5 days ago

Hi.

I have stripe setup and im having issues with the webhook.

If i test the webhook from Stripe itself i get a Test webhook sent successfully but the Response is none.

Heres my code for the webhook::

<?php

namespace App\Http\Controllers\Webhooks;

use App\Http\Controllers\Controller;
use App\Models\User;
use Carbon\Carbon;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;
use Laravel\Cashier\Http\Controllers\WebhookController as CashierController;
use Symfony\Component\HttpFoundation\Response;

class StripeController extends CashierController
{


    /**
     * Handle a Stripe webhook.
     *
     * @param  array  $payload
     * @return Response
     */
    public function handleChargeSucceeded($payload)
    {
        try{

            Log::info('Webhook Handled - Charge Success - ' . json_encode($payload['data']['object']['id']));
            return new Response('Webhook Handled - Charge Success - ' . json_encode($payload['data']['object']['id'] ), 200);

        } catch (\Exception $e) {


            return new Response('Webhook Handled - Something Went Wrong' , 422);

        }
    }

}

For some reason im not getting any response back for the test webhook charge.succeeded

Any ideas

Cheers

24th September, 2018

skoobi left a reply on Retrieving Image From File Storage Using Db Reference • 2 weeks ago

Cheers for the help on that one. I got it working eventually...

Your right with adding it manually on a mac and found some useful posts once i knew what i was looking for but the one which worked for me and ill explain a little more below on each of them is to log into vagrant and do the artisan storage:link in there.

So there are a few different ways to do this ::

If you are using localhost or something else on your Mac then it should just work by

// Let artisan do it for you when using artisan serve
> php artisan storage:link

// Add the symlink manually 
> ln -s /User/your-user-name/path-to-project/storage/ /User/your-user-name/path-to-project/public/ 


// Vagrant 
> vagrant ssh
> php artisan storage:link // this will set it up for vagrant

// Adding manually to vagrant
> ln -s "/home/vagrant/Code/your-project/storage/app/public" storage 
// make sure your in the public folder

skoobi left a reply on Retrieving Image From File Storage Using Db Reference • 2 weeks ago

Just done a quick test and it works fine on the test server hosted on digital ocean.

So it seems theres an issue with the sym link on the imac! Where would i find any settings that would be set when doing a sym link in artisan? Does it set something in composer or anything like that?

skoobi left a reply on Retrieving Image From File Storage Using Db Reference • 2 weeks ago

Heres the output::

customers/SA410/id-verification/SA410_file_1.JPG

skoobi left a reply on Retrieving Image From File Storage Using Db Reference • 2 weeks ago

Nope still nothing!!!

The one thing im not sure if it will affect it or not, but is the routes i have.

Im using subdomains like so ::

// Redirect trailing / to dashboard
if (App::environment('local')) {
    $tld = 'local';
} else {
    $tld = 'uk';
}

Route::domain('backend.my-project.' . $tld)->group(function () {

});

skoobi left a reply on Retrieving Image From File Storage Using Db Reference • 2 weeks ago

Hi @Snapey.

Its on my local machine at moment but is at /my-app-project/public/storage/customers/SA410/id-verification/SA410_file_1.JPG

thats where its being stored which i was expecting as its sym linked.

I have validation on for the images so they can only upload jpg and png files. Is there anything else i need to do to secure it or is validation enough?

Heres my validation for the form ::

$request->validate([
            'day' => 'required',
            'month' => 'required',
            'year' => 'required',
            'gender' => 'required',
            'house_name' => 'required',
            'postcode' => 'required',
            'file_1' => 'required|file|image|mimes:jpeg,png|max:2048',
        ]);

Cheers

skoobi left a reply on Retrieving Image From File Storage Using Db Reference • 2 weeks ago

Hi @jorpedito.

Yep tried that but nothing.

I noticed the path is all ok. Its saving as public and its got a sym link to myapp/public/storage/{myfiles}

But it just wont show. I cant see the reason for it!

Heres the full link from the console:: GET http://backend.my-app.local/storage/customers/SA410/id-verification/SA410_file_1.JPG 404 (Not Found)

Checked the file structure and all is correct. Would it be because its on localhost?

skoobi started a new conversation Retrieving Image From File Storage Using Db Reference • 2 weeks ago

Hi. I've searched several posts on this but cant find one which fixes my issue.

I have a form that uploads the images and then saves the path to the db. This all works perfect but the issue i'm getting is trying to display it on the page.

The path that gets saved is a public path which ive done the storage:link

heres the code i have for the controller to save the form ::

$destination = 'images/customers/' . Auth::user()->username . '/id-verification';

        // Store Files
        $file_1 = $request->file('file_1');
        if($file_1 != ''){
            $file_1_name = Auth::user()->username . '_file_1.' . $file_1->getClientOriginalExtension();
            $path_1 = $file_1->storeAs($destination, $file_1_name, 'public');
        } else {
            $path_1 = null;
        }

And then it saves the path to the db as images/customers/SA410/id-verification/SA410_file_1.JPG which is what i want.

But if i add that straight into the img tag then it cant find it and theres a few ways ive tried including Storage::get() and <img src="{{ asset('public/' . $customer->id_verification->file_path_1) }}" alt=""> But they dont seem to show.

Its a bog standard setup where nothing has been changed in the settings.

13th September, 2018

skoobi left a reply on Seeding In Laravel Dusk Issue • 1 month ago

Ok so not quite there...

Its still using .env for the database connection and not .env.dusk.testing

@martinbean Im using Vagrant for the localhost. It was working fine but after the update its stopped working.

Cheers

skoobi left a reply on Seeding In Laravel Dusk Issue • 1 month ago

Never-mind. Figured it out after some searching...

Had to create new database connection with the dusk mysql details.

And then under tests\CreatesApplication.php I added $app['config']->set('database.default','dusk'); to force it to use that connection.

The issue i was having was even though the .env.dusk.local was setup correctly, It wasn't even getting close to trying to use it, but was just grabbing the .env file straight away.

public function createApplication()
    {
        $app = require __DIR__.'/../bootstrap/app.php';

        $app->make(Kernel::class)->bootstrap();
        $app['config']->set('database.default','dusk');

        Hash::driver('bcrypt')->setRounds(4);

        return $app;
    }

skoobi started a new conversation Seeding In Laravel Dusk Issue • 1 month ago

Hi. Im trying to seed the dusk database when running Page tests but even though i've set the .env.dusk.testing file up to use a different sql database it still defaults back to the .env file and wipes the main database and re-seeds that one. any ideas??

.env file ::

APP_NAME="Propost"
APP_ENV=local
APP_KEY=base64
APP_DEBUG=true
DEBUGBAR_ENABLED=true
APP_URL=http://localhost


LOG_CHANNEL=stack

DB_CONNECTION=mysql
DB_HOST=111.11.11.11
DB_PORT=3306
DB_DATABASE=db_testing
DB_USERNAME=user
DB_PASSWORD=mypass

The .env.dusk.testing file::

APP_NAME="Propost"
APP_ENV=testing
APP_KEY=base64
APP_DEBUG=true
DEBUGBAR_ENABLED=true
APP_URL=http://localhost


LOG_CHANNEL=stack

DB_CONNECTION=mysql
DB_HOST=111.11.11.11
DB_PORT=3306
DB_DATABASE=db_dusk
DB_USERNAME=user
DB_PASSWORD=mypass

The Test `test/Browser/UserCanLogin.php

 public function testCustomerCanLogin()
    {
        $this->artisan('db:seed', ['--class' => 'DatabaseSeeder']);

        $this->browse(function (Browser $browser) {
            $browser->visit('/')
            ->assertSee('Log into your mailbox')
            ->press('Log into your mailbox')
            ->on(new LoginCustomer)
            ->on(new LogoutCustomer);
        });
    }

skoobi left a reply on Search Db Using Scope And Relationships • 1 month ago

As simple as that hahaha.

Yep your correct, I don't know how i missed that.

Many thanks

skoobi started a new conversation Search Db Using Scope And Relationships • 1 month ago

Hi. Im struggling to get the search query to return the data I'm looking for.

I know theres a user which should come back to me when searching the verified_users->name1

Heres the controller::

if($user->hasAnyRole('Admin|Support')){

                $customers = User::with('account')
                ->search($keyword)
                ->with('account')
                ->paginate(40);

            } else {

                $mail_centre_id = MailCentreHelper::get_mail_centre_id();

                $customers = User::mailcentre($mail_centre_id)
                ->search($keyword)
                ->allButDeletedStatus()
                ->with('account')
                ->paginate(20);

            }

            if($customers){

                return view('admin.dashboard.index')->with([
                    'customers' => $customers,
                    'statuses' => $statuses,
                ]);

            } else {

                return redirect()->back();

            }

And my scope in User.php::

// Dashboard search
        public function scopeSearch($query, $keyword)
        {
            return $query->where('name', 'like', '%' . $keyword . '%' )
            ->orWhere('username', 'like', '%' . $keyword . '%' )
            ->orWhere('email', 'like', '%' . $keyword . '%' )
            ->orWhere('mailbox_id', 'like', '%' . $keyword . '%' )
            ->whereHas('account', function ($query) use ($keyword){
                $query->where('comments', 'like', '%' . $keyword . '%');
            })
            ->whereHas('verified_users', function ($query) use ($keyword) {
                $query->where('name1', 'like', '%' . $keyword . '%')
                ->orWhere('name2', 'like', '%' . $keyword . '%')
                ->orWhere('name3', 'like', '%' . $keyword . '%')
                ->orWhere('name4', 'like', '%' . $keyword . '%');
            });
        }

If i search "Frank" for example, i know there is a Frank in name3 on the verified users but its not showing on the dashboard.

Any help would be grateful.

Cheers

10th September, 2018

skoobi left a reply on Laravel Errors Page • 1 month ago

Oh yes that is definetly working and looks alot nicer lol/..

skoobi left a reply on Laravel Errors Page • 1 month ago

Sorry for the late reply back.

Unfortunately, I still get the old whoops page after upgrading.

Ok, so it's mainly because last night there was a foreach() error where it didn't tell me where the error was and an unfortunately it wasn't from anything I was currently working on. I eventually found the error today from something I was working on a few days ago but was triggered due to Carbon and the query being for something today.

Mainly it's me being lazy or, as I like to call it, more productive with my time lol :)

Cheers

9th September, 2018

skoobi started a new conversation Laravel Errors Page • 1 month ago

Hi. I was reading a post on Twitter earlier and saw that Laravel 5.7 comes with new error pages. I cant find anything on the docs about it though. Is there anything i need to update i.e. whoops or add something.

Cheers

7th September, 2018

skoobi left a reply on Refactoring Scopes From Users Model • 1 month ago

Ah bugger ye. Awesome thank you for your quick responce :)

skoobi started a new conversation Refactoring Scopes From Users Model • 1 month ago

Hi. I was wondering if there was a way to take some of the scopes i have in the User Model and put them into a seperate Model or Helper of some sort as theres things like :: active(1)which can be used on several different models. I saw that i can extend BaseModel but the User already extends Authenticatable.

Cheers Chris

30th August, 2018

skoobi started a new conversation Seperate Log Files • 1 month ago

Hi. Sorry for the stupid question but!!

Is it possible to have separate log files for different things, i.e.:

For my localhost, I have the mail set to log but if there's an error somewhere I have to search through the log file to see if the email is there. Is there a way to save the logged emails to its own file?

29th August, 2018

skoobi left a reply on Getting Sum Of Relationship From Collection • 1 month ago

Ah, brilliant thank you that worked a treat.

Many thanks

skoobi started a new conversation Getting Sum Of Relationship From Collection • 1 month ago

Hi. I'm trying to get the sum of a column in a relationship but I keep getting an error Property [credit_balance] does not exist on this collection instance. which is correct as I'm calling it wrong, but how do I call it correctly and get the sum I need?

Heres my code so far:

$users = User::role('Customer')->with('credit_balance')->active()->get();
$balance = $users->credit_balance->sum('current');

return $balance;

The relationship is in the User.php model and is a hasOne relationship.

Many thanks

skoobi left a reply on Batch Mail Advice • 1 month ago

Ah, awesome. Thanks for your reply.

So essentially i don't need to do a foreach loop. Just pass the eloquent $query into Mail

skoobi started a new conversation Batch Mail Advice • 1 month ago

Hi. What I'm trying to do is, get all the users whose account balance is under x amount and send an email to each saying their account credit is low. There are no more than 1000 users on the system and the likelihoods are, that it will only need to send to 200 users max per time.

What would be the best way to approach this? Is it ok to dispatch an event, and the event to do a foreach loop and Mail::to($user->email)->send(new BalanceLow($event->user)); and queue it?

cheers Chris

27th August, 2018

skoobi left a reply on Laravel 5.6 And Bootstrap 4 Glyphicons • 1 month ago

I don't think that bootstrap 4 has any icons anymore. Bootstrap icons

You could remove bootstrap 4 and then install 3 but its probably easier to use Feather or something like that.

22nd August, 2018

skoobi left a reply on How Can I Send A Blank Email? • 1 month ago

Are you getting any errors when sending with no content?

skoobi left a reply on Difference Results Between Eloquent And DB Builder Queries ! • 1 month ago

Can you post your code up here on the query you are using. Use ``` backticks before and after the code to put it into a code block

skoobi left a reply on Laravel 5.6 Fresh Install. Logout, This Site Cant Provide Secure Connection • 1 month ago

Check the routes are correct php artisan route:list or create your own Logout method and see if that works

21st August, 2018

skoobi left a reply on Mail Markdown Templates From Database • 1 month ago

Hi, sorry for the later response.

That didn't work sorry @Cronix.

It's sending the emails perfectly and it's showing the correct template from the database but not parsing any blade directives from the database value, I just get :

Dear {{ $user->name }},

An item of your mail requires a fee .... etc...

In the email template itself, it shows the email_body from the $template variable perfect but the content inside that email_body, if it is blade then its just parsing it out as is like how it is saved in the database.

@component('mail::message')

{!! $template->email_body !!}

@endcomponent

skoobi started a new conversation Mail Markdown Templates From Database • 1 month ago

Hi. I've saved a few templates for several different emails in the database and I have it displaying on the mail without any issues, but I'm wanting to add a name and key from the database which is related to the user etc.

So in the email template I have:

Dear {{ $name }}, 

Which id like it to grab the variable from the Mailable and use, but it seems as I'm calling it from a database and already parsed a variable it doesn't do anything.

Heres the mailable NotifyUser.php

protected $user;
    protected $template;

    /**
     * Create a new message instance.
     *
     * @return void
     */
    public function __construct(User $user, MessageTemplate $template)
    {
        $this->user = $user;
        $this->template = $template;
    }

    /**
     * Build the message.
     *
     * @return $this
     */
    public function build()
    {
        $subject = $this->user->username . ' ' . $this->template->email_subject;

        return $this->markdown('emails.admin.notify-user')->subject($subject)->with([

            'template' => $this->template,'name' => $this->user->name,
        ]);
    }

And the template:

@component('mail::message')

{!! $template->email_body !!}

@endcomponent

Any help or advise would be greaful

Thank you

15th August, 2018

skoobi left a reply on Validation Requests • 1 month ago

Ah ye your right. Just found the Adding After Hooks To Form Requests

Many thanks

skoobi started a new conversation Validation Requests • 1 month ago

Hi.

I want to move a piece of validation code I have into the Form Request Validation but was wondering how id get the same result as I already have currently. I.e. when the validation fails!

Heres what I have at the moment::

public function update(Request $request)
    {
        $rules = [
            'name1' => 'required|min:3',
            'name2' => 'nullable|min:3',
            'name3' => 'nullable|min:3',
            'name4' => 'nullable|min:3',
            'name5' => 'nullable|min:3',
            'redirection' => 'nullable|min:3|numeric',
        ];

        $messages = [
            'min' => ':min or more characters are required',
        ];

        $validator = Validator::make($request->all(), $rules, $messages);

        if ($validator->fails()) {
            Toaster::danger("Something went wrong. Please check and try again...");
            return redirect()->route('customer.dashboard', '#names')->withErrors($validator, 'validate_user')->withInput();
        }
}

Cheers

12th August, 2018

skoobi left a reply on Getting Dates For Each Friday In Date Range • 2 months ago

Just figured it out. :)

$fromDate = new Carbon($request->get('dateTime'));
$toDate = new Carbon($request->get('reoccurrance_ends_at'));

$dates = [];

for($date = $fromDate; $date->lte($toDate); $date->addWeek()) {
    $dates[] = $date->format('Y-m-d');
}

return $dates;

skoobi left a reply on Getting Dates For Each Friday In Date Range • 2 months ago

Ah brilliant that works a treat. Been looking through the Carbon docs for a while trying to figure that one out.

How would I do it so it grabs the day of the date instead of manually specifying the Friday?

i.e. if the date is 2018-08-09 which is a Thursday, get Carbon to get the day of the week from that and then get the first Thursday etc

Many thanks

11th August, 2018

skoobi started a new conversation Getting Dates For Each Friday In Date Range • 2 months ago

Hi. I'm trying to use carbon to get the date of a given weekday (i.e. Friday) and then depending on the date range, return the list of dates of those given days.

So for example, if my date range was this month and I wanted the dates for each Friday of this month, id want it to come back with::

2018-08-03, 
2018-08-10, 
2018-08-17, 
2018-08-24, 
2018-08-31

What I'm trying to do is once someone creates a booking and they select reoccurring it then drops down to choose weekly or monthly along with an end date.

I was then wanting it to get the number of weeks in that range and add a booking in the database for each week up until that range with the correct date.

I've managed to get the difference between the range, but am struggling to get to the next level.

if($request->get('reoccuring') == 1){

            // Get the date range from x to y
            // get the dates of each of the reoccuring days
            // save to database as seperate bookings with the new date on that day

            // Get the date range
            $fromDate = new Carbon($request->get('dateTime'));
            $toDate = new Carbon($request->get('reoccurance_ends_at'));

            // Get Frequency
            if($request->get('reoccuring_frequency') == 'weekly'){
                $date = $fromDate->diffInWeeks($toDate);
                return $date;
            }

        } else {

            $booking = new Booking;
            $booking->name = $request->get('name');
            $booking->email = $request->get('email');
            $booking->phone = $request->get('phone');
            $booking->dateTime = $request->get('dateTime');
            $booking->reoccuring = $request->get('reoccuring');
            $booking->event_type = $request->get('event_type');
            $booking->data_consent = 0;
            $booking->paid = $request->get('paid');
            $booking->price = $request->get('price');
            $booking->approved = $request->get('approved');
            $booking->status = 1;
            $booking->save();

        }

Any help or info would be great.

Thank you

9th August, 2018

skoobi left a reply on Jobs And Queues Issue • 2 months ago

Nevermind. I just found out I can set a timeout on it. Set the timeout and it works perfectly.

skoobi started a new conversation Jobs And Queues Issue • 2 months ago

Hi.

I'm having issues where a large job is being dispatched which are added to the jobs queue, but I keep getting a timeout error

Illuminate\Queue\MaxAttemptsExceededException: App\Jobs\Customers\Ledgers\ProcessUsersBalance has been attempted too many times or run too long. The job may have previously timed out. in /home/forge/my-app/vendor/laravel/framework/src/Illuminate/Queue/Worker.php:396

Th Job ProcessUsersBAlance.php

        User::chunk(100, function ($users) {
            foreach ($users as $user) {
                $credited = Ledger::where('user_id', $user->id)->where('transaction_type', 'CR')->sum('transaction_amount');
                $debited = Ledger::where('user_id', $user->id)->where('transaction_type', 'DB')->sum('transaction_amount');
                $balance = $credited - $debited;

                // save daily
                $todays_balance = Balance::where('user_id', $user->id)->first();
                $todays_balance->today = $balance;
                $todays_balance->save();
            }
        });

It has to go through 70,000 records to find the transaction types twice from the Ledgers and do the maths on it, but this is from an old database from an old app, which I'm in the process of transferring it over to a new system.

2nd August, 2018

skoobi left a reply on How Can I Have Homestead As Well As Local PHP Environment Working Together At The Same Time On My Mac. • 2 months ago

The next thing i suppose to check is the magento files are ok and downloaded correctly.

skoobi left a reply on I Cant Seem To Install A New Laravel On My System • 2 months ago

Strange. Normally composer.json is in the zip when downloaded. Is composer.json there?

skoobi left a reply on How Can I Have Homestead As Well As Local PHP Environment Working Together At The Same Time On My Mac. • 2 months ago

Possibly. It does show on the spec that 7.1.* that it should work but it doesnt take long to upgrade or downgrade php versions just to test it out.

skoobi left a reply on I Cant Seem To Install A New Laravel On My System • 2 months ago

If you goto Laravel Github and download the source code you can then extract it into the project folder and then you can run composer install to see if its composer thats the issue or not.

skoobi left a reply on How Can I Have Homestead As Well As Local PHP Environment Working Together At The Same Time On My Mac. • 2 months ago

What PHP version are you running?

I know i have php 7.2 running and magento is ok on that. It may be a case of just upgrading/downgrading the php versions to suit.

Heres the php version list for magento Magento Spec

skoobi left a reply on Route MethodNotAllowedHttpException • 2 months ago

As @Tray2 said we'd need to see the routes, but check its a post request and not a get request

Edit Your Profile
Update

Want to change your profile photo? We pull from gravatar.com.