Aronaman

Aronaman

Member Since 1 Year Ago

Experience Points
6,940
Total
Experience

3,060 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
6
Lessons
Completed
Best Reply Awards
1
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 2
6,940 XP
Jun
25
2 weeks ago
Activity icon

Replied to Css And Js Mix

@sergiu17 ok. in my package.json i have already

"@popperjs/core": "^2.0.6",
"bootstrap": "^4.4.1",
"datatables.net": "^1.10.20",

and in my layout , template js and css

 <link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet" />
//js
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/2.4.2/cjs/popper-base.min.js"></script>

my question is should i keep both or remove from package and only clone from cdn ? b/c the template library version also different.

Jun
24
2 weeks ago
Activity icon

Started a new Conversation Css And Js Mix

which one prefers more?

clone my CSS and js file from cdn or install via npm and compile in my laravel mix?

 <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> 
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.22.2/moment.min.js"></script> 
<script src="https://cdnjs.cloudflare.com/ajax/libs/dropzone/5.5.1/min/dropzone.min.js"></script> 
Activity icon

Awarded Best Reply on How To Force Date Format To Dd/mm/yyyy

@noblemfd it should work

<?php

return [



    /*
    |--------------------------------------------------------------------------
    | Application Environment
    |--------------------------------------------------------------------------
    |
    | This value determines the "environment" your application is currently
    | running in. This may determine how you prefer to configure various
    | services the application utilizes. Set this in your ".env" file.
    |
    */

    'env' => env('APP_ENV', 'production'),

    /*
    |--------------------------------------------------------------------------
    | Application Debug Mode
    |--------------------------------------------------------------------------
    |
    | When your application is in debug mode, detailed error messages with
    | stack traces will be shown on every error that occurs within your
    | application. If disabled, a simple generic error page is shown.
    |
    */

    'debug' => env('APP_DEBUG', false),

    /*
     Date Format 
    */
        'date_format' => 'd/m/Y',
        'date_format_javascript' => 'DD/MM/YYYY',

it is not working, try mutators

in your model

protected $dates = [
        'created_at',
    ];

    public function getCreatedFormatAttribute()
    {  
        return $this->created_at->format('d-m-Y');
    }
  protected $appends = ['created_format'];

then in view blade do this

{{$anyVarible->created_format}}
Activity icon

Replied to How To Force Date Format To Dd/mm/yyyy

@noblemfd it should work

<?php

return [



    /*
    |--------------------------------------------------------------------------
    | Application Environment
    |--------------------------------------------------------------------------
    |
    | This value determines the "environment" your application is currently
    | running in. This may determine how you prefer to configure various
    | services the application utilizes. Set this in your ".env" file.
    |
    */

    'env' => env('APP_ENV', 'production'),

    /*
    |--------------------------------------------------------------------------
    | Application Debug Mode
    |--------------------------------------------------------------------------
    |
    | When your application is in debug mode, detailed error messages with
    | stack traces will be shown on every error that occurs within your
    | application. If disabled, a simple generic error page is shown.
    |
    */

    'debug' => env('APP_DEBUG', false),

    /*
     Date Format 
    */
        'date_format' => 'd/m/Y',
        'date_format_javascript' => 'DD/MM/YYYY',

it is not working, try mutators

in your model

protected $dates = [
        'created_at',
    ];

    public function getCreatedFormatAttribute()
    {  
        return $this->created_at->format('d-m-Y');
    }
  protected $appends = ['created_format'];

then in view blade do this

{{$anyVarible->created_format}}
Activity icon

Replied to How To Force Date Format To Dd/mm/yyyy

i dont see the full blade, i think it is datepicker , if so you should do this

if you are using a data picker or any js date.

$('.date').datepicker({
    format: '{{ config('date_format_javascript') }}'
});

or may be you just fill the date manually in your input. do this in your controller

(Carbon::parse($request->start_date)->format('j F, Y') )

in blade

<td>{{ date( config('date_format'),  strtotime($expenses->date)) }}</td>
Activity icon

Replied to Compile Css And Js

@ahmeddabak ok After i finish compile , sould i extract it ?

mix.js('resources/js/app.js', 'public/js')
   .sass('resources/sass/app.scss', 'public/css')
   .extract(['jquery', 'lodash']); 

and how to I pull it view ? using cdn ?

Activity icon

Replied to Compile Css And Js

@ahmeddabak instade of npm i used copy all css, js, image, plugin to public and test it its working, but i think it has disadvantage on fastloading right? if ur ans yes that mean i have to remove all and install via npm and import to my app.js and scss ?

Activity icon

Replied to How To Force Date Format To Dd/mm/yyyy

@noblemfd use accesor in your model or in your app.config add some code like this 'date_format' => 'd/m/Y', 'date_format_javascript' => 'DD/MM/YYYY', then pull it in all view or controller . are u from Ethiopia?

Activity icon

Started a new Conversation Compile Css And Js

hey everybody, for my front end I download template adds I copy CSS and js code to my public folder. then I access it as {{asset()}}.

my question is what is the best way to better performance (page-load). and how to use can for my template css and js.

//instead of just copy my CSS and js and compressed, I prefer using laravel mix like this

mix.js('resources/js/app.js', 'public/js')
	js('resources/js/jquery-3.3.1.min.js', 'public/js')
	js('resources/js/jquery-ui.js')
	js('resources/js/popper.min.js', 'public/js')
	js('resources/js/aos.js', 'public/js')

 .sass('resources/sass/app.scss', 'public/css')
   .sass('resources/sass/bootstrap.min.css', 'public/css')
   .sass('resources/sass/magnific-popup.css', 'public/css')

most of css and js code are static, so how can I use cdn for template driven css and js.

thanks in advance

Jun
22
3 weeks ago
Activity icon

Replied to Conver To Database Query Builder

@michaloravec thanks very much it help full the documentation.

I am not using laravel mix rather I minified manually and added it to the public directorate. for this case how to use cache

Activity icon

Replied to Conver To Database Query Builder

3-4 sec is very slow? right how to cache js and css

Activity icon

Started a new Conversation Conver To Database Query Builder

any help, change a given eloquent query to database query

$exchangeRate = Currency::where('currencyType', 'USD')->firstOrFail()->exchangeRate;

// change $organizations to database query 
$organizations = Organization::withCount(['rooms','confrences'])->with(['typeOfOrganization','user'])
->where('approved', 1)->when(request('type_of_organization'), function($query){ return $query->where('organizations.type_of_organization_id', 	request('type_of_organization')); })

->when($request->has(['start_price', 'end_price']), function ($query) use ($request, $exchangeRate) {
    return $query->where(function ($query) use ($request) {
      $query->whereBetween('avg_price', [
      $request->start_price, $request->end_price
     ])->where('currency_id', 1);
      })->orWhere(function ($query) use ($request, $exchangeRate) {
        $query->whereBetween('avg_price', [
        $request->start_price * $exchangeRate, $request->end_price * $exchangeRate
      ])->where('currency_id', 2);
   });
 })->get();

thanks in advance

Jun
20
3 weeks ago
Activity icon

Replied to How Do I Short This

@michaloravec the first is where('currency_id', 1) and the second where('currency_id',2) and the return $query where value also different. .. please see the question again.

Activity icon

Started a new Conversation How Do I Short This

it is working, but how can i short it with out using merge?

   $exchangeRateToDollar=Currency::where('currencyType','ETB')->firstOrFail()->exchangeRate;
   $startPriceDollar =$request->start_price*$exchangeRateToDollar;
   $endPriceDollar =$request->end_price*$exchangeRateToDollar;


 $organizationsETB = Organization::where('approved', 1)->where('currency_id',1)
 ->when(request(['start_price', 'end_price']), function($query) {
    return $query->where('organizations.avg_price', '>=', request('start_price'))->where('organizations.avg_price', '<=', request('end_price'));
     })->get();



 $organizationsUSD = Organization::where('approved', 1)->where('currency_id',2)
 ->when(request(['start_price', 'end_price']), function($query) use ($startPriceDollar, $endPriceDollar) {
    return $query->where('organizations.avg_price', '>=', $startPriceDollar)->where('organizations.avg_price', '<=', $endPriceDollar);
    })->get();


$organizations= $organizationsETB->merge($organizationsUSD)->paginate(21);  

Activity icon

Replied to How Can I Shorten This Code

@walidabou thanks very much. it work add use() on second function also. thanks for your help

Jun
19
3 weeks ago
Activity icon

Started a new Conversation How Can I Shorten This Code

it is working, but the only change is the start, end price value, how can I shorten this code without using merge

 $exchangeRateToDollar=Currency::where('currencyType','ETB')->firstOrFail()->exchangeRate;
 $startPriceDollar =$request->start_price*$exchangeRateToDollar;
 $endPriceDollar =$request->end_price*$exchangeRateToDollar;

 $organizationBirr= Organization::withCount(['rooms','confrences'])
        ->with(['typeOfOrganization','user'])->where('approved',1)
        ->when(request(['start_price','end_price']), function($query){
              return $query->where('organizations.avg_price','>=', request('start_price'))
                           ->where('organizations.avg_price','<=',request('end_price'));
            })})->get();


$organizationDollar=Organization::withCount(['rooms','confrences'])
            ->with(['typeOfOrganization','user'])->where('approved',1)
	    ->when(request(['start_price','end_price']), function($query) use ($startPriceDollar,$endPriceDollar){
                  return $query->where('organizations.avg_price','>=', $startPriceDollar)
                               ->where('organizations.avg_price','<=',$endPriceDollar);
                })->get();


 $organizations=$organizationBirr->merge($organizationDollar)->paginate(21);
Jun
15
4 weeks ago
Activity icon

Replied to Retrieve Value Using Helping Method Config()

it is b/c i used event and listener for fire the email? or i used the boot() method for initiating config() helper??

Activity icon

Started a new Conversation Retrieve Value Using Helping Method Config()

i register setting service provider and retrieve value from settings table using helping method config() , it's working on other blade files, but when I try on email.blade not showing up??

SettingServiceProvider

class SettingServiceProvider extends ServiceProvider
{
    /**
     * Register services.
     *
     * @return void
     */
    public function register()
    {
        $this->app->bind('settings', function ($app) {
        return new Setting();
    });
    $loader = \Illuminate\Foundation\AliasLoader::getInstance();
    $loader->alias('Setting', Setting::class);

    }

    /**
     * Bootstrap services.
     *
     * @return void
     */
    public function boot()
    {
         // only use the Settings package if the Settings table is present in the database
    if (!\App::runningInConsole() && count(Schema::getColumnListing('settings'))) {
        $settings = Setting::all();
        foreach ($settings as $key => $setting)
        {
            Config::set('settings.'.$setting->key, $setting->value);
            Config::set('settingsImg.'.$setting->key, $setting->multi_img);
        }
    }

    }
}

on my config.app.php

'providers' => [
 App\Providers\SettingServiceProvider::class,

    ],

then on my email blade, why settings not working and app.name working?

Thanks,<br>{{config('settings.seo_meta_description')}} // null 
{{ config('app.name') }}// it is working 
Jun
11
1 month ago
Activity icon

Replied to Event And Listener

@sorry i just on wrong controller :)

Activity icon

Replied to Event And Listener

i alrady connect them in my event serviceprovider..? it this related with ajax

Activity icon

Started a new Conversation Event And Listener

my event is not triggering ??

public function store(Request $request, $blog)
{
    if($request->ajax())
     {
       $input['blog_post_id'] = $blog;
        Comment::create($input);
        event(new BlogNewCommentNotificationEvent($input));
        return response()->json(['success'=>'Successfull, Wait Untile Approve!!']);
          
     }
}

successful store the record, but not trigger the event then I tryPHP artisan queue:worknoting happen! it is b/c ajax function??

Jun
01
1 month ago
Activity icon

Started a new Conversation Merging Two Object

// two object 
$individual ={33 : "203"};
$random={11: "760", 32: "102"}
$result=$individual->merge($random);
//my result response
0 : "760"
1 : "102"
2 : "203"

how can I achieve this ??? is there another method? beside merge

$result={11:"760", 32:"102", 33: "203"};
May
11
2 months ago
Activity icon

Started a new Conversation Maximum Execution Time Of 60 Seconds Exceeded

Room.php

 protected $appends = [
        'room_gallery',
        'room_feature_image', 
        'dollar_room_price',
        'birr_room_price', 
    ];


  public function getDollarRoomPriceAttribute()
        {
            if($this->organization->currency->symbol=='ETB'){
                $dollarRate=Currency::where('currencyType','ETB')->first()->exchangeRate;//0.029
                $fromEtbToUsd=$this->room_price *$dollarRate;
                return $fromEtbToUsd;       
            }

        }


        public function getBirrRoomPriceAttribute()
        {
            if($this->organization->currency->symbol=='USD'){

                $etbRate=Currency::where('currencyType','USD')->first()->exchangeRate; //33.38
                $fromUsdToEtb=$this->room_price *$etbRate;
                return $fromEtbToUsd;
            }
        } 

conroller

public function roomIndex()
   {
   	
   	 $listRooms =Room::withCount('individualRooms')->paginate(30);
          dd($listRooms); // noting dollar_room_price or birr_room_price
   	 return view('list_rooms', compact('listRooms'));
   }

what is wrong?? any help, thanks

Apr
25
2 months ago
Activity icon

Started a new Conversation Package Remove

i install package via composer and now i would like to remove

i do

composer remove bjuppa/laravel-blog

then my blog page and my controller confused, so I go to vendor directory there is bjuppa folder, then i delete the folder from the vendor.

now i have this "c/BlogServiceProvider.php): failed to open stream: No such file or directory" error.

in laravel 6: service providers automatically attached. i don't know where it locates. i try config/app

any help please

Apr
17
2 months ago
Activity icon

Started a new Conversation Authentication

hello everybody

I want extra protection for setting Page in Admin.

#1: All sensitive information is on the setting page. I am thinking of setting a static email inside the code.

After the admin login, then try to access the setting page send a link to email(static), then after if the admin login to email then click the link redirect to setting page, but I don't have any idea how can I make this ??

I know what you think :) I need this b/c accidentally if another person get admin password can destroy the web, so all setting (sensitive information can be change after email login ).

any suggestion or help, thanks

Activity icon

Started a new Conversation Setting Page

hello guys, I was reading this article "https://www.larashout.com/settings-section-part-2"

and I have one question save sensitive information into db is not advisable right? , so how can I save my sensitive information from setting field forms to config and .env?

any help, thanks

Apr
15
2 months ago
Activity icon

Awarded Best Reply on Number_format

for though of you! face similar problem

first, make sure your response is number not string

//for example 
"<td>"+row.price+"</td>" // 1000.00
// if it response string make sure change to number 
"<td>"+Number(row.price)+"</td>"

the second using jquery format the number

"<td>"+row.price.toFixed(2).replace(/\d(?=(\d{3})+\.)/g, '$&,')+"</td>" // 1,000.00

i hope it help some one:)

Activity icon

Replied to Number_format

for though of you! face similar problem

first, make sure your response is number not string

//for example 
"<td>"+row.price+"</td>" // 1000.00
// if it response string make sure change to number 
"<td>"+Number(row.price)+"</td>"

the second using jquery format the number

"<td>"+row.price.toFixed(2).replace(/\d(?=(\d{3})+\.)/g, '$&,')+"</td>" // 1,000.00

i hope it help some one:)

Apr
13
3 months ago
Activity icon

Started a new Conversation Sum Ajax

html

<tbody id="tBody"></tbody>
 <tfoot>
   <tr>
     <th class="text-center" colspan="9">Grand Total Payment Price</th>
     <th id="grand_total"></th>
   </tr>
</tfoot>

ajax

success:function(res){ 
var bodyData = '';
 var i=1;
 var=grandTotal=0;
 $.each(res,function(index,row){ 
bodyData+='<tr id="row_'+rowCount+'" >'
.......
+'<td id="sum_'+row.id+'">'+row.discount_price_on_web+"</td><td>"
...
bodyData+="</tr>";
}

 $("#tBody").append(bodyData);

my question is all the list working fine, but how can i sum the "list discount_price_on_web" and save in html id="grand_total"?

i try this after bodyData+=""

 $("[id*=sum]").each(function(){
    grandTotal=grandTotal+parseFloat($(this).html());
         });
   $("[id*=grand_total]").html(grandTotal.toString());

Not Working !! any help

Apr
11
3 months ago
Activity icon

Replied to Number_format

@nakov noting change I was expecting like this "1,204.25"

Activity icon

Started a new Conversation Number_format

hello guys, how to format a number in number format in ajax response?

controller

<td>{{number_format($booking->group_fund,2)}}</td>

on ajax response How ??

"<td>"+row.unpay+"</td><td>"+row.fund+"</td>"
Apr
05
3 months ago
Activity icon

Replied to Notification

easy to make it mark as read !! how can i make mark as read in controller.

and how to add count number in the top of the bell button !

Activity icon

Replied to Notification

header blade

 <!-- Notification for Admin Panel  -->
         <div class="an-notifications" id="notify">
            <div class="btn-group an-notifications-dropown notifications" >

                @if (count(auth()->user()->unreadNotifications) > 0 ) 

                <button type="button"  class="an-btn an-btn-icon dropdown-toggle js-has-new-notification" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" id="notif">
                    <i class="fas fa-bell"></i>
                </button>

                @elseif (count(auth()->user()->unreadNotifications) === 0 ) 

                <button type="button"  class="an-btn an-btn-icon dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" id="notif">
                    <i class="fas fa-bell"></i>
                </button>

                @endif

            <div class="dropdown-menu">
                <p class="an-info-count">Notifications <span>{{count(auth()->user()->unreadNotifications)}}</span></p>
                <div class="an-info-content notifications-info notifications-content">

                <ul class="nav">
                    <li>
                        @forelse(auth()->user()->unreadNotifications as $notification)

                            <div class="an-info-single unread" id="notif">
                                <a href="{{url('iaccs-hook-list')}}">
                                    <span class="icon-container important">
                                        <i class="icon-setting"></i>
                                    </span>
                                    <div class="info-content">
                                       <a class="user-name">Funding Request</a>
                                       <p class="content"><i class="icon-clock"></i> {{$notification->data["amount"]}}-Amount</p>
                                    </div>
                                </a>
                            </div>
                            @empty
                            <a href="">No Unread Notification</a>

                        @endforelse
                     </li>
                </ul>

            </div> <!-- end .AN-INFO-CONTENT -->
        <div class="an-info-show-all-btn">
             <a class="an-btn an-btn-transparent fluid rounded uppercase small-font" href="#">Show all</a>
        </div>
    </div>
  </div>
</div> <!-- end .AN-NOTIFICATION -->

it is working but i dont know to related with my controller

Controller

 public function sendAdminNotification()
    {
    	$notification=tab(auth()->user()->unreadNotifications()->limit(5)->get()->toArray())->markAsRead();
    	
    }

any ???

Activity icon

Replied to Notification

its better if it is change dynamic /change by its own, but it also ok change by page load , i dont need pusher for that!

Activity icon

Started a new Conversation Notification

hello, guys i want to implement life time notification using pusher on bell icon on my dashboard. i save my notification on my database.

my question is all tutorial i found in internet is using vue or react js library, but my project is only laravel and some jquery , so how can i achieve ??

#2 i am lost how i connect my controller with the bell icon on the dashboard.

any recommendation tutorial (not using vue or react ).

thanks

Apr
01
3 months ago
Activity icon

Started a new Conversation Load Chart

Controller

 $apiDay = url('admin/ajax-day-statics');        
        $apiMonth = url('admin/ajax-month-statics');
        $apiYear = url('admin/ajax-year-statics');

 $toDayStatics = new GoogleAnalytics;
         if(route('ajax.day.statics')){
             $toDayStatics->labels(['Today'])->load($apiDay);
         }elseif(route('ajax.month.statics')){
             $toDayStatics->labels(['This Month'])->load($apiMonth);
         }elseif(route('ajax.year.statics')){
            $toDayStatics->labels(['This Year'])->load($apiYear);
         }

// google Analytics Daily
    public function ajaxDayStatics(Request $request)
    {
        $day = Analytics::performQuery(Period::days(1),
        'ga:',
        [
            'metrics' => 'ga:users,ga:newUsers,ga:sessions,ga:sessionsPerUser,ga:pageviews,ga:pageviewsPerSession,ga:avgSessionDuration,ga:bounceRate',

        ]);

        $todayUsersVisits=$day->totalsForAllResults['ga:users'];
        $todaySessisons=$day->totalsForAllResults['ga:sessions'];

    // dd($thisMonth->totalsForAllResults['ga:bounceRate']);
   

         $toDayStatics = new GoogleAnalytics;
         // $toDayStatics->labels(['Today']);
         $toDayStatics->dataset('Visits', 'bar',[$todayUsersVisits])->color('#7cbd1e')->backgroundcolor("#7cbd1e");


          return $toDayStatics->apiDay();

    }

Html

 <div class="btn-group btn-group-toggle float-right mr-3" data-toggle="buttons">
     <label class="btn btn-outline-secondary active">
       <input id="day" type="radio" name="options" autocomplete="off" checked=""> Day
    </label>
    <label class="btn btn-outline-secondary ">
       <input id="month" type="radio" name="options" autocomplete="off" > Month
    </label>
    <label class="btn btn-outline-secondary">
      <input id="year" type="radio" name="options" autocomplete="off"> Year
    </label>
     </div>

<div class="c-chart-wrapper" style="height:300px;margin-top:40px;">

    {!! $toDayStatics->container() !!}
 </div>

Ajax

@if($toDayStatics)
       {!! $toDayStatics->script() !!}
 @endif


     <script type="text/javascript">
        
        $("#day").change(function(){
          var original_apiDay_url = {{ $toDayStatics->id }}_api_url;
            
            {{ $toDayStatics->id }}_refresh(original_apiDay_url );
        });

        $("#month").change(function(){
          var original_apiMonth_url = {{ route('ajax.month.statics') }};
            
            {{ $toDayStatics->id }}_refresh(original_apiMonth_url );
        });
        $("#year").change(function(){
          var original_apiYear_url = {{ route('ajax.year.statics') }};
            
            {{ $toDayStatics->id }}_refresh(original_apiYear_url);
        });
    </script>

i am using ConsoleTvs Charts package i am try to load chart based on month, year and day. how can i do this??

i am new to this i dont know how to load ajax in console tvs chart pakage

any help thanks

Mar
30
3 months ago
Activity icon

Replied to Special Character In Query Builder

i try 3 slash \ \ \working @tykus thanks

Activity icon

Replied to Special Character In Query Builder

@tykus it is not working, same result

Activity icon

Started a new Conversation Special Character In Query Builder

in my database i have 10 bookings row from 10 i have 8 Bookable_type="App\Room", but i get zero, i think this is b/c the special character "/" . how can i solve this problem

         DB::raw("SUM(CASE WHEN bookings.bookable_type ='App\Room' THEN 1 ELSE 0 END) AS countBookedRoomMontly"),

i also try count , but give all not what i nedd

            DB::raw("COUNT(CASE WHEN bookings.bookable_type ='App\Room' THEN 1 ELSE 0 END) AS countBookedRoomMontly"),

Any Help

Mar
25
3 months ago
Activity icon

Started a new Conversation Invoice No Increment

my problem #1expNum +1 remove all zero and make 2 instade of 0002

	   $now=Carbon::now();
            $firstDateYear=$now->startOfYear();

            $record = Invoice::latest()->first();
            if(!is_null($record)){
                $expNum = explode('-', $record->recp_no);
                    //check first day in a year
                if ($firstDateYear->isToday() ){
                    $nextInvoiceNumber = date('Y').'-0001';
                } else {
                    //increase 1 with last invoice number
                    $nextInvoiceNumber = $expNum[0].'-'. $expNum[1]+1;

//error  dd($nextInvoiceNumber)  "A non well formed numeric value encountered"
                }

            }else{
            $nextInvoiceNumber =date('Y').'-0000';
            }

any one please better way to do this !!!

Mar
22
3 months ago
Activity icon

Replied to Eloquent

any help please!

Activity icon

Started a new Conversation Eloquent

this working in db query building I want work in eloquent

DB::table('bookings')
->select([
 DB::raw('(select pay AS payment)- (select commision_i_get AS commission) as net'),
])

Eloquent

Booking::where('organization_id',$orgId)
		->whereRaw('pay -commision_i_get ')// I don't know how to subtract the value and assign to net variable 

Mar
18
3 months ago
Activity icon

Started a new Conversation DB Query Relationship

query

Activity icon

Replied to Count And Sum Db Query

@rodrigo.pedra one more thing we select db builder org_id , how can I access the relationship and get org name from org tables

booking and org has 1 to many relationship

->select([ 'org.org_name', 
...

it is possible or is there any method ??

Mar
17
3 months ago
Activity icon

Replied to Count And Sum Db Query

@rodrigo.pedra thanks very much !! the total commission add localbook and selfbook every date ?

any recommendation for reading Db query tutorial pdf or site

Activity icon

Replied to Count And Sum Db Query

@rodrigo.pedra

Do you still want to group it? No sir

i want

-org_id, 
-date,
- nobooking by localbook,
- total commision by localbooking,
- noboking by selfBook,
- total commison by selfbook and 
*totalBook(sum both total).

yes i love if you did for me !

Activity icon

Replied to Count And Sum Db Query

@rodrigo.pedra

thanks very much it works, i want to not repeat org_id

instade of this

0 => {#789 ▼
    +"org_id": 1
    +"payment_gateway": "LocalBook"
    +"day": "2020-03-16"
    +"bookings_per_day": 5
    +"comission_per_day": 560.0
  }
  1 => {#794 ▼
    +"org_id": 1
    +"payment_gateway": "selfBook"
    +"day": "2020-03-16"
    +"bookings_per_day": 1
    +"comission_per_day": 120.0
  }

i want this

0 => {#789 ▼
    +"org_id": 1
    +"payment_gateway": "LocalBook"
    +"day": "2020-03-16"
    +"bookings_localBook_per_day": 5
    +"comission_localbook_per_day": 560.0

    +"payment_gateway": "selfBook"
    +"bookings_selfbook_per_day": 1
    +"comission_selfbook_per_day": 120.0
  }
Activity icon

Started a new Conversation Count And Sum Db Query

Booking Table

id |org_id | local_id| check_in| Checkout| commision| Pay| Payment_gateway|book_status_id| create_at| update_at|

controller

        $bookedStatus_id=BookStatus::where('name','Booked')->first()->id;
    	$booking=DB::table('bookings')->where('book_status_id',$bookedStatus_id)
			->where('pay','>',0)
								  
			// ->selectRaw("*,SUM(commison) as sum")
			->get()
			->groupBy(['org_id','payment_gateway',function($q){
			return Carbon::parse($q->created_at)->format('d-M-yy');
			}])				  
			->toArray();

my question #1 how to count each each day booking #2 sum each day commison Column

Activity icon

Replied to DB Query Grouping Sum Each

@bobbybouwmann

I am new to db builder ,,,what i am wanting is grouping bookings table by the" org_id", "payment_gateway" and "update_at". and on each date count all array and sum commissions column value for every date.

i hope now is clear. can you give me any code example?