Jonjie

Jonjie

Back end Developer at Philippines

Member Since 2 Years Ago

Experience Points
20,860
Total
Experience

4,140 experience to go until the next level!

In case you were wondering, you earn Laracasts experience when you:

  • Complete a lesson — 100pts
  • Create a forum thread — 50pts
  • Reply to a thread — 10pts
  • Leave a reply that is liked — 50pts
  • Receive a "Best Reply" award — 500pts
Lessons Completed
145
Lessons
Completed
Best Reply Awards
0
Best Reply
Awards
  • start your engines Created with Sketch.

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • first-thousand Created with Sketch.

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • 1-year Created with Sketch.

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • 2-years Created with Sketch.

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • 3-years Created with Sketch.

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • 4-years Created with Sketch.

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • 5-years Created with Sketch.

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • school-in-session Created with Sketch.

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • welcome-newcomer Created with Sketch.

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • full-time-student Created with Sketch.

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • pay-it-forward Created with Sketch.

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • subscriber Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • evangelist Created with Sketch.

    Laracasts Evangelist

    Earned if you share a link to Laracasts on social media. Please email [email protected] with your username and post URL to be awarded this badge.

  • chatty-cathy Created with Sketch.

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • lara-veteran Created with Sketch.

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • 10k-strong Created with Sketch.

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • lara-master Created with Sketch.

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • laracasts-tutor Created with Sketch.

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • laracasts-sensei Created with Sketch.

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • top-50 Created with Sketch.

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

Level 5
20,860 XP
Sep
16
3 days ago
Activity icon

Started a new Conversation How To Pass Image Path Inside Javascript When Calling With Symlink In Laravel

I'm trying to pass a path inside <img> tag with symlink approach and it works just fine but when I pass it in javascript, it return CORS policy error. Im using laravel 7 so it should automatically give access, and the allowed_origins is also set to *.

This error only occurs when I run php artisan serve but there is no error when I use valet.

JS Code

$options['url'] = "{{ auth()->user()->getCoverPhoto() }}";
$image_crop = $('#imageDemo').croppie($options);

Screenshot

enter image description here

Error

Access to image at 'http://mywebsite.jp/storage/users-images/images/f223444da2d28eec731f7e8f39278c7a.jpeg' from origin 'http://127.0.0.1:8000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

P.S. I've read a lot running php artisan storage:link but I already done that. And it shouldn't be the solution since I already can access the image through <img> tag but it's not working when I access it inside Javascript.

UPDATE

When I try url('/') . '/users-images/images/f223444da2d28eec731f7e8f39278c7a.jpeg', It gives me 404 error.

Sep
14
5 days ago
Activity icon

Replied to How To Fit Image In Canvas Using CropperJS

@thewebartisan7 CroppieJS solves my problem :) Thanks man.

Activity icon

Started a new Conversation How To Fit Image In Canvas Using CropperJS

I am new using cropperjs library. But I'm struggling on how can I configure it.

What I have

https://jsfiddle.net/kaeqxfjL/

What I need

I want to integrate a full image crop where you just need to drag the photo inside the canvas instead of having a bordered square to crop the photo. I also need to make the width of the photo fit to the width of the canvas so you cannot drag it left/right; you could only drag it up/down to crop the photo.

Activity icon

Replied to How To Add Scale In Laravel Image Intervention Package?

@artcore Can we have jsfiddle for that? So I can understand it better

Sep
13
6 days ago
Activity icon

Replied to How To Add Scale In Laravel Image Intervention Package?

@artcore Do you have an example like how you crop your cover photo on facebook? The examples in documentation seems like a photoshop crop.

Activity icon

Started a new Conversation How To Add Scale In Laravel Image Intervention Package?

I'm doing a crop functionality using Laravel Image Intervention and jQuery Guillotine but it crops the different part of the image. Please see the code and screenshot below.

Controller

$data = explode('|', $image_details);

$data = [
            'angle' => $data[0],
            'h' => $data[1],
            'scale' => $data[2],
            'w' => $data[3],
            'x' => $data[4],
            'y' => $data[5]
        ];

        // Create image instance from source
        $image = Image::make($request_file);

        // we get the image width then multiply it by the scale factor, it will also scale the height automatically
        $image->widen(intval(floatval($image->width()) * floatval($data['scale'])));

        // File details
        $extension = explode('/', mime_content_type($request_file))[1];
        $name = md5(uniqid()) . time() . '.' . $extension; // as6d57a9sd7a5sd67856a9s.jpg

        // Temp details
        $key = md5(uniqid());
        $tmp_file_name = "{$key}.{$extension}"; // et7e98r7t9e79rt9e098g9e0.jpg
        $tmp_file_path = base_path() . "/" . $server_path . '/'. $tmp_file_name; // Server path

        // Image Cropper
        $image->crop(
        	$data['w'],
        	$data['h'],
        	$data['x'],
        	$data['y']
        );
        
        // Upload image to filesystem
        $image->save($tmp_file_path);

Guillotine

picture.on('guillotinechange', function(e, data, action){
                showData(data)
                $('#imageDetails').val(data.angle + '|' + data.h + '|' + data.scale + '|' + data.w + '|' + data.x + '|' + data.y);
              })

Screenshot

[Before Upload] enter image description here

[After Upload] enter image description here

Sep
12
1 week ago
Activity icon

Replied to Coverphoto-like Facebook Package For Laravel

@snapey Just trying to ask some suggestion/help. I just thought maybe you already done this kind of feature with back-end using laravel.

Activity icon

Replied to Coverphoto-like Facebook Package For Laravel

@bobbybouwmann Didn't add any requestContent, this is exactly how the error looks like.

And when you click it, it says the TypeError: Cannot read property 'requestContent' of undefined

Activity icon

Started a new Conversation Coverphoto-like Facebook Package For Laravel

Hi. Do you have any suggestion on how can I integrate a cover photo like the facebook has?

I'm already following this, but I got an error:

Link

https://www.scoopism.com/laravel/add-cover-image-like-facebook-adjust-position-image/

Error

TypeError: Cannot read property 'requestContent' of undefined

UPDATE with Code

Controller

public function saveCoverPhoto(Request $request)
    {
        $file = $request->file('cover_photo');
        $rules = ['cover_photo' => 'required|mimes:png,gif,jpeg,jpg']; //'required|mimes:png,gif,jpeg,txt,pdf,doc'
        $validator = Validator::make(['cover_photo'=> $file], $rules);
        
        if($validator->passes()){
            $user = Auth::user();
            $current_cover_photo = $user->addMediaFromRequest('cover_photo')->toMediaCollection('coverphoto');
            
            $bgSave='<img src="'. Auth::user()->getMedia('coverphoto')->last()->getFullUrl() .'"  id="timelineBGload" class="headerimage ui-corner-all " style="top:0px;width:100%"/>';
            $bgSave .="<div class='btn-save-drag'><p style='background-color:white; font-size: 0.8em;'>Drag and adjust the image</p><button class='bgSave btn btn-info bg-lg'>Save</button></div>";
            $bgSave .= "<script>$('.headerimage').on('mouseover',function()
              {

                var y1 = $('#adjimage').height();
                var y2 =  $('.headerimage').height();

                $(this).draggable({

                  scroll: false,
                  axis: 'y',
                  drag: function(event, ui) {
                    if(ui.position.top >= 0)
                    {
                    ui.position.top = 0;
                    }
                    else if(ui.position.top <= y1 - y2)
                    {
                    ui.position.top = y1 - y2;
                    }
                },
                stop: function(event, ui)
                {
                }
              });
              });
              $('.bgSave').on('click',function ()
                  {
                    var p = $('#timelineBGload').attr('style');
                    var Y =p.split('top:');
                    var Z=Y[1].split(';');
                    var dataString ='position='+Z[0];
                    $.ajax({
                      type: 'POST',
                      url: '";
                     $bgSave .= route('save.position.cover-photo', ['id' => $current_cover_photo->id]);
                     $bgSave .="',
                      data: dataString,
                      cache: false,
                       headers: {
                        'X-CSRF-TOKEN': '". csrf_token() ."'
                        },
                      success: function(html)
                      {
                        if(html)
                        {
                           location.reload(); 
                         
                          return false;
                        }
                      }
                    });
                  return false;
                  });
              

              </script>";
            return $bgSave;
        }
    }

    public function postImgAdjustpostion($id)
    {
      $cover_photo = Media::find($id);
      $cover_photo->custom_properties = '{"position": "' . request('position') . '", "generated_conversions": {"thumb": true}}';
      $cover_photo->save();
      return redirect()->back();
    }

web.php

Route::post('users/settings/cover-photo/save', [
    'as' => 'save.cover-photo',
    'uses' => '[email protected]'
  ]);
  Route::post('users/settings/cover-photo/{id}/position/save', [
    'as' => 'save.position.cover-photo',
    'uses' => '[email protected]'
  ]);

View

<div class="hovercover text-center" id="bgimage">
            @if(Auth::user()->getMedia('coverphoto')->last())
              <img src="{{ Auth::user()->getMedia('coverphoto')->last()->getFullUrl() }}" class="img-responsive" style="margin-top: 0px;">
            @else
              <img src="{{ asset('assets/img/black.jpg') }}" class="img-responsive" style="margin-top: display: none;">
            @endif
            <div class="hover-div">
              <form method="post" id="hoverform" action="{{ route('save.cover-photo') }}" enctype="multipart/form-data">
                @csrf
                <label for="coverPhoto" class="custom-file-upload" title="Change Cover Image">
                    <i class="fa fa-file-image-o"></i>&nbsp; Change Cover
                </label>
                <input id="coverPhoto" name="cover_photo" type="file">
              </form>
            </div>
            <div class="hovercover1 text-center" id="adjimage" style="display: none;"></div>
          </div>

<script type="text/javascript" src="{{asset('assets/js/cover-photo-js/jquery.min.js')}}"></script>
<script type="text/javascript" src="{{asset('assets/js/cover-photo-js/jquery-ui.min.js')}}"></script>
  <script type="text/javascript" src="{{asset('assets/js/cover-photo-js/jquery.wallform.js')}}"></script>
  <script type="text/javascript" src="{{asset('assets/js/cover-photo-js/jwincrop.js')}}"></script>
  <script>
      $(function(){
        
          $('#coverPhoto').on('change',function(){
            $("#hoverform").ajaxForm({
                target: '#adjimage',
                success:function(){
                  $(".hover-div").hide();
                  $("#bgimage").hide();
                  $("#adjimage").show();
                }}).submit();
         });

        $('.hovercove').each(function() {
            //set size
            var th = $(this).height(),//box height
                tw = $(this).width(),//box width
                im = $(this).children('img'),//image
                ih = im.height(),//inital image height
                iw = im.width();//initial image width
            if (ih>iw) {//if portrait
                im.addClass('ww').removeClass('wh');//set width 100%
            } else {//if landscape
                im.addClass('wh').removeClass('ww');//set height 100%
            }
            //set offset
            var nh = im.height(),//new image height
                nw = im.width(),//new image width
                hd = (nh-th)/2,//half dif img/box height
                wd = (nw-tw)/2;//half dif img/box width
            if (nh<nw) {//if portrait
                im.css({marginLeft: '-'+wd+'px', marginTop: 0});//offset left
            } else {//if landscape
                im.css({marginTop: '-'+hd+'px', marginLeft: 0});//offset top
            }
        });

      });
  </script>
Sep
11
1 week ago
Activity icon

Replied to How To Change Image Directory In Spatie Media Library?

@sinnbeck Nope. But it should set to public since it was set in second parameter.

Activity icon

Replied to How To Change Image Directory In Spatie Media Library?

Oh, yes. Im using this path:

'disk_name' => env('MEDIA_DISK', 'public'),
Activity icon

Started a new Conversation How To Change Image Directory In Spatie Media Library?

I'm new to this package since I usually use the image intervention. So the problem is whenever I save an image, it is saving in storage directory instead of in public directory. Please see my code below for saving.

$user->addMediaFromRequest('avatar')->toMediaCollection('avatars');

Package:

https://spatie.be/docs/laravel-medialibrary/v7/introduction

Sep
09
1 week ago
Activity icon

Replied to Laravel 8 Controller Not Found

@snapey I also tried the full namespace after checking the upgrade guide and both works just fine.

Activity icon

Replied to Laravel 8 Controller Not Found

@sergiu17 Didn't noticed that one. Thanks a lot man :)

Activity icon

Started a new Conversation Laravel 8 Controller Not Found

Why laravel 8 needs the full namespace in web.php? When I tried to use only the [email protected], it returns Class does not exists error. But when I do the full name space, it works just fine. Any idea?

Sep
07
1 week ago
Activity icon

Replied to API Vs Web Route When Creating SPA Application

@thewebartisan7 I'm confused. The use of passport is for OAuth and it is different from sanctum right? Please correct me if I'm wrong.

Sep
05
2 weeks ago
Activity icon

Started a new Conversation API Vs Web Route When Creating SPA Application

I'm just wondering what is the best route to use when we use SPA approach with Laravel.

  1. Should I use web routes or api routes?
  2. Considering that it will also have a mobile app, so automatically I also have to create APIs for the mobile, so obviously I should use the api route it?
  3. Will it not look messy if I combine the APIs for my SPA, and the APIs for mobile app?
  4. Regarding authentication, it is automatically a stateless app so I have to also generate a token. Where should I save it, database or localStorage?

P.S. I've already read this blog https://laravel-news.com/using-vue-router-laravel

Sep
01
2 weeks ago
Activity icon

Replied to Get Current Month Data In The User Model!

@snapey Ok. It's clear now. I just thought when you say Carbon::now() it also includes the current year. Anyways, thanks for clearing this up :)

Activity icon

Replied to Get Current Month Data In The User Model!

@snapey I'm just wondering why we still need the ->whereYear() if we already have the Carbon::now()->month?

Aug
31
2 weeks ago
Activity icon

Started a new Conversation How To Add Where Inside DB::raw() In Laravel

I'm want to get the completed orders amount, and the rejected orders count in 1 query. Please see my code below. How can I add where or condition inside the DB::raw()?

return DB::table('restaurants')
->join('orders', 'restaurants.id', 'orders.restaurant_id')
->select([
   DB::raw('SUM(orders.total) WHERE status = 8 as completed_sum'),
   DB::raw('COUNT(DISTINCT(orders.transaction_code)) WHERE status = 3 as rejected_count')
])
->get();

Error

SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax;

Aug
29
3 weeks ago
Activity icon

Replied to How To Authenticate User Using Google Login And Angular

@tisuchi Do you have the rest api/stateless approach?

Aug
27
3 weeks ago
Activity icon

Replied to Tracking Changes Package For Laravel

@alanholmes Alright, cool. Thanks man :)

Activity icon

Started a new Conversation Spatie Activity Log Custom Field In Activity_log Table

Is there anyway I can customize activity_log table. And just by adding the LogsActivity trait inside the model instead of using activity()->log() approach?

I know I can achieve it using the activity()->log() approach. But what I want is just to use the LogsActivity trait so I'm not going to do it manually.

Package

https://github.com/spatie/laravel-activitylog

[SOLVED]

https://spatie.be/docs/laravel-activitylog/v3/advanced-usage/logging-model-events#tap-activity-before-logged-from-event

Activity icon

Replied to Tracking Changes Package For Laravel

@alanholmes Nice :) Can I also change it to save it as a file instead of saving to the database? Or it is better to save on the DB? I'm thinking when my database got down, I still have the log file.

Also, can I add custom column like ip_address?

Activity icon

Started a new Conversation Tracking Changes Package For Laravel

Hi. Just thinking what's the best package I should use to log all the changes made my admin in the database like create, update, delete?

  1. I also see this package, would you recommend this? http://www.laravel-auditing.com/docs/9.0/model-setup
  2. Do you recommend to use a package, or just create my own functionality?

PS Haven't tried this feature before. I'm using laravel 7.

Aug
25
3 weeks ago
Activity icon

Started a new Conversation How To Authenticate User Using Google Login And Angular

I'm currently using laravel for the back-end and angular for the design.

My problem is how can I authenticate user using google login? What uri should I use in google redirect url? the angular or laravel side? And should I also use localstorage for storing the token?

Activity icon

Started a new Conversation How To Get All Weeks In A Month Using Carbon

I want to return all weeks in a current month using carbon. So each week I want to return 2 dates. Please see my code below:

$dt = Carbon::now(); //or initialize it any other way
        
Carbon::setWeekStartsAt(Carbon::MONDAY);
Carbon::setWeekEndsAt(Carbon::SUNDAY);

$weeks += [
    'w1' => $dt->subDays($dt->dayOfWeek - 4)->format('Y-m-d H:i:s') . ' - ' . $dt->subDays($dt->dayOfWeek - 7)->format('Y-m-d H:i:s')
]; 

$weeks += [
    'w2' => $dt->subDays($dt->dayOfWeek - 3)->format('Y-m-d H:i:s') . ' - ' . $dt->subDays($dt->dayOfWeek - 7)->format('Y-m-d H:i:s')
]; 
$weeks += [
    'w3' => $dt->subDays($dt->dayOfWeek - 1)->format('Y-m-d H:i:s') . ' - ' . $dt->subDays($dt->dayOfWeek - 7)->format('Y-m-d H:i:s')
]; 

$weeks += [
    'w4' => $dt->subDays($dt->dayOfWeek - 1)->format('Y-m-d H:i:s') . ' - ' . $dt->subDays($dt->dayOfWeek - 7)->format('Y-m-d H:i:s')
];

return $weeks;

That code returns this:

"data": {
   "w1": "2020-08-27 06:45:01 - 2020-08-30 06:45:01",
   "w2": "2020-09-02 06:45:01 - 2020-09-06 06:45:01",
   "w3": "2020-09-07 06:45:01 - 2020-09-13 06:45:01",
   "w4": "2020-09-14 06:45:01 - 2020-09-20 06:45:01"
}

What output I want

"data": {
   "w1": "2020-08-03 06:09:06 - 2020-08-09 06:09:06",
   "w2": "2020-08-10 06:09:06 - 2020-08-16 06:09:06",
   "w3": "2020-08-17 06:09:06 - 2020-08-23 06:09:06",
   "w4": "2020-08-24 06:09:06 - 2020-08-30 06:09:06",
}
Aug
23
3 weeks ago
Activity icon

Replied to How To Connect Angular 1 With Laravel 7

@sinnbeck Okay, so for #4, how can I use socialite inside Angular for authentication? Should I use Laravel Passport for that?

I just found this one, would you recommend it?

https://medium.com/@eloufirhatim/laravel-angular-authentication-bee4100e5e33

Aug
22
4 weeks ago
Activity icon

Started a new Conversation How To Select Child Column In Laravel Eloquent Using Select

I'm trying to select a column from child table using eloquent and select method but it return a column not found error. Please see my code below.

My Code

return Restaurant::with(['merchant'])->select('name', 'address', 'merchant.email')->findOrFail($id);

Error

Column not found: 1054 Unknown column 'merchant.email' in 'field list'

Aug
13
1 month ago
Activity icon

Replied to How To Connect Angular 1 With Laravel 7

@sinnbeck Okay, but can I just separate it and just use laravel as a back-end?

Activity icon

Replied to How To Connect Angular 1 With Laravel 7

@sinnbeck Sorry for confusion, I mean where I should store the angular project and laravel. Should I put the laravel inside angular folder? Or I Should separate them and can put angular somewhere else?

Aug
12
1 month ago
Activity icon

Replied to How To Connect Angular 1 With Laravel 7

@sinnbeck Both. Should I store them on one folder only? Or anywhere?

Activity icon

Replied to How To Connect Angular 1 With Laravel 7

@sinnbeck Okay, and how about the folder structure?

Activity icon

Replied to How To Connect Angular 1 With Laravel 7

@sinnbeck Okay. So to answer your question, yes it is a SPA version. How can I set this up? Why would I need one view? And should I use the web.php or the api.php?

Activity icon

Replied to How To Connect Angular 1 With Laravel 7

@sinnbeck Is there any angular project that is not SPA? Sorry Im just confused

Activity icon

Replied to How To Connect Angular 1 With Laravel 7

@sinnbeck On #3. What's the difference of sanctum and the JWT?

Activity icon

Replied to How To Connect Angular 1 With Laravel 7

@sinnbeck The angular design is already done by other devs. And it's time for me to add the back-end side.

Activity icon

Started a new Conversation How To Connect Angular 1 With Laravel 7

I'm a bit confused on how can I give connection to the existing Angular 1 project to laravel 7 for the APIs. The scenario is I already have the design and it's already done, but the problem is how can I use laravel 7 for its backend? Any idea or tutorial for this? I couldn't find it on internet.

Things that I'm concern about:

  1. Routes
  2. Views
  3. APIs (how can I connect the APIs from laravel to angular)
  4. Authentication (Also possible to use google login or facebook login)
  5. Folder structure (Local & Developer Server)

P.S. I don't have any background in angular.

Angular Version: 1.6.8 Laravel Version: 7

Aug
09
1 month ago
Activity icon

Replied to My GroupBy Is Not Grouping The Data With 2 Columns

@marianomoreyra please see my update. Sorry, I accidentally remove the part of DB::raw(COUNT(DISTINCT(transaction_id)) as orders_count) when I pasted the code. Maybe this is the reason?

Activity icon

Replied to My GroupBy Is Not Grouping The Data With 2 Columns

@marianomoreyra It only returns 2 rows now.

select `store_id`, `transaction_id`, `currency`, `store_name`, `SUM(ord_grant_total) as total` where date(`order_date`) >= ? and date(`order_date`) <= ? group by `store_id`, `transaction_id`
array:2 [
  0 => "2020-01-01"
  1 => "2020-08-07"
]
Activity icon

Replied to My GroupBy Is Not Grouping The Data With 2 Columns

@marianomoreyra When I switch the 2 columns, it returns this result:

0	Object { store_id: 32, transaction_id: "COD1000145148", … }
1	Object { store_id: 32, transaction_id: "COD1000145149", … }
2	Object { store_id: 33, transaction_id: "COD1000145150", … }
3	Object { store_id: 34, transaction_id: "COD1000145151", … }
4	Object { store_id: 34, transaction_id: "COD1000145152", … }
5	Object { store_id: 35, transaction_id: "COD1000145153", … }
Activity icon

Replied to My GroupBy Is Not Grouping The Data With 2 Columns

@marianomoreyra I want it to group by the transaction_id and store_id as well, but it returns with duplicate store_ids. I also tried to switch between those 2 columns but still the same result.

Activity icon

Started a new Conversation My GroupBy Is Not Grouping The Data With 2 Columns

I'm trying to get some answers from other devs but in my situation, it's a bit weird that this is not working. I just want to group the record using 2 columns (transaction_id and store_id). Please see my code below:

$transactions = DB::table('orders')
		->join('store', 'order.store_id', 'store.id')
            	->whereDate('order_date', '>=', $from)
            	->whereDate('order_date', '<=', $to)
            	->select(
                [
                	'store_id',
                	'transaction_id',
                	'currency',
                	'store_name',
			DB::raw('SUM(grand_total) as total'),
			DB::raw(COUNT(DISTINCT(`transaction_id`)) as orders_count)
                ]
            )
            ->groupBy('transaction_id')
            ->groupBy('store_id')
            ->get();

		return json_encode($transactions);

That code returns this:

0	Object { store_id: 32, transaction_id: "COD1000145148", … }
1	Object { store_id: 32, transaction_id: "COD1000145149", … }
2	Object { store_id: 34, transaction_id: "COD1000145151", … }
3	Object { store_id: 33, transaction_id: "COD1000145150", … }
4	Object { store_id: 34, transaction_id: "COD1000145152", … }
5	Object { store_id: 35, transaction_id: "COD1000145153", … }

So, these data only grouping by transaction_id and not the store_id. Any idea?

P.S. I also tried groupBy('transaction_id', 'store_id'). Also, I tried it to make an array but it still returns the same data.

Laravel version: 7

Aug
08
1 month ago
Activity icon

Replied to Alternative For Valet .test Domain

@ejdelmonico Thanks for sharing man.

Aug
05
1 month ago
Activity icon

Started a new Conversation How To Get Daily Record And Sum Up

How to get the daily record and sum them up, plus group it by date? Please see my code below.

$sales = DB::table("orders")
	->where('status', 8)
	->select(
		'grand_total',
		'order_date',
		DB::raw("SUM(grand_total) as total_sales")
	)
	->groupBy('order_date')
	->get();

dd($sales);

It returns the right dates, but wrong sales. How can I sum sales each day?

Aug
03
1 month ago
Activity icon

Commented on Building The Layout

hahaha thanks. still works today

Jul
31
1 month ago
Activity icon

Replied to How To Use MariaDB In Sequel Ace

@tray2 But when I try to install both using brew, it returns an error.

Activity icon

Started a new Conversation How To Use MariaDB In Sequel Ace

How can I use MariaDB in Sequel Ace? Whenever I try to use MariaDB, It says that I'm using MySQL.

I also tried to install both using brew but it returns an error.

Error: Cannot install mysql because conflicting formulae are installed. mariadb: because mysql, mariadb, and percona install the same binaries Please brew unlink mariadb before continuing.