HopesAreMiracle

HopesAreMiracle

Member Since 1 Year Ago

Experience Points 800
Experience Level 1

4,200 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 0
Lessons
Completed
Best Reply Awards 0
Best Reply
Awards
  • Start Your Engines Achievement

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • First Thousand Achievement

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • One Year Member Achievement

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • Two Year Member Achievement

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • Three Year Member Achievement

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • Four Year Member Achievement

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • Five Year Member Achievement

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • School In Session Achievement

    School In Session

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

  • Welcome To The Community Achievement

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • Full Time Learner Achievement

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • Pay It Forward Achievement

    Pay It Forward

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

  • Subscriber Achievement

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • Lifer Achievement

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • Laracasts Evangelist Achievement

    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 Achievement

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • Laracasts Veteran Achievement

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • Ten Thousand Strong Achievement

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • Laracasts Master Achievement

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • Laracasts Tutor Achievement

    Laracasts Tutor

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

  • Laracasts Sensei Achievement

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • Top 50 Achievement

    Top 50

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

23 Sep
8 months ago

HopesAreMiracle left a reply on How To Generate Csv File And Send Email As Attachment With Cronjob In Laravel?

@Sergiu17 I got it now bro. Thanks for your help . I do appreciate it.

HopesAreMiracle left a reply on How To Generate Csv File And Send Email As Attachment With Cronjob In Laravel?

@Sergiu17 Thanks for your help bro. But i have 1 problems

In FileViewFinder.php line 137:

View [emails.view] not found.

How should i solved that problem?

21 Sep
8 months ago

HopesAreMiracle left a reply on How To Generate Csv File And Send Email As Attachment With Cronjob In Laravel?

@Sergiu17 Currently when i run the cron job command it download. what i want is that i want to use that csv file to send email as an attachment. I try Mail::send() something. I think i wrote wrong. i don't know how to wrote about sending mail.

HopesAreMiracle left a reply on How To Generate Csv File And Send Email As Attachment With Cronjob In Laravel?

How don't know how to send the email. Now i can only download that csv file when i run the command.

"" public function handle() {

    $transfer = Transfer::whereDate('updated_at','=',Carbon::today())->orderBy('from_currency')->orderBy('created_at')->get();



    $filename = "tweets.csv";
$handle = fopen($filename, 'w+');
fputcsv($handle, array('Created Date', 'Transaction Code', 'From Bank', 'From Currency', 'Sent','Fee','Actual Payment ( SGD )','Inter-Co','Updated Date','To Bank','To Currency','To Amount','Received Currency','Received','Rate'));

foreach($transfer as $row) {
    fputcsv($handle, array($row['created_at'], $row['tcode'], $row['bank_id'], $row['from_currency'],$row['sent'],$row['fees'],$row['fees'],$row['fees'],$row['updated_at'],$row['bank_id'],$row['to_currency'],$row['received'],$row['to_currency'],$row['received'],$row['rate']));
}

fclose($handle);

$headers = array(
    'Content-Type' => 'text/csv',
);

return Response::download($filename, 'tweets.csv', $headers);

} ""

HopesAreMiracle left a reply on How To Generate Csv File And Send Email As Attachment With Cronjob In Laravel?

@Sergiu17 How can i generate only and send ? without saving that file to my server? and i don't have that view also. Because i am writing under crobjob schedule function. Thats why bro.

HopesAreMiracle left a reply on How To Generate Csv File And Send Email As Attachment With Cronjob In Laravel?

@Mithrandir The way i want to do is that to use a CRON job that is set to run every day at 6pm which calls the script that then generates the CSV and sends the email with attachment.

20 Sep
8 months ago

HopesAreMiracle left a reply on How To Generate Csv File And Send Email As Attachment With Cronjob In Laravel?

I try but cannot work. Currently i can download the csv format file. But don't know how to send email with that file as an attachment. Because i need to make the report of csv file and send to someone. Thanks

HopesAreMiracle left a reply on How To Generate Csv File And Send Email As Attachment With Cronjob In Laravel?

@Mithrandir can u explain me a little more ? Because i am new to laravel. Now i can download the csv file. But don't know how to attach and send the email. Thanks.

19 Sep
8 months ago

HopesAreMiracle started a new conversation How To Generate Csv File And Send Email As Attachment With Cronjob In Laravel?

Hi all , i want to know how to generate csv file and send email to someone as attachment of that csv file every day . How to do with laravel. Thanks all.

12 Jul
10 months ago

HopesAreMiracle left a reply on When I Migrate Files It Only Shows Varchar(191) Instead Of 255

This is my setting for database.

** 'connections' => [

    'sqlite' => [
        'driver' => 'sqlite',
        'database' => env('DB_DATABASE', database_path('database.sqlite')),
        'prefix' => '',
    ],

    'mysql' => [
        'driver' => 'mysql',
        'host' => env('DB_HOST', '127.0.0.1'),
        'port' => env('DB_PORT', '3306'),
        'database' => env('DB_DATABASE', 'forge'),
        'username' => env('DB_USERNAME', 'forge'),
        'password' => env('DB_PASSWORD', ''),
        'unix_socket' => env('DB_SOCKET', ''),
        'charset' => 'utf8mb4',
        'collation' => 'utf8mb4_unicode_ci',
        'prefix' => '',
        'strict' => false,
        'engine' => null,
    ],

    'pgsql' => [
        'driver' => 'pgsql',
        'host' => env('DB_HOST', '127.0.0.1'),
        'port' => env('DB_PORT', '5432'),
        'database' => env('DB_DATABASE', 'forge'),
        'username' => env('DB_USERNAME', 'forge'),
        'password' => env('DB_PASSWORD', ''),
        'charset' => 'utf8',
        'prefix' => '',
        'schema' => 'public',
        'sslmode' => 'prefer',
    ],

    'sqlsrv' => [
        'driver' => 'sqlsrv',
        'host' => env('DB_HOST', 'localhost'),
        'port' => env('DB_PORT', '1433'),
        'database' => env('DB_DATABASE', 'forge'),
        'username' => env('DB_USERNAME', 'forge'),
        'password' => env('DB_PASSWORD', ''),
        'charset' => 'utf8',
        'prefix' => '',
    ],

],

**

HopesAreMiracle started a new conversation When I Migrate Files It Only Shows Varchar(191) Instead Of 255

Hey guys i use mysql and when i migrate files in my laravel , it only shows varchar(191) instead of 255 . Because in my local database it appears as a varchar (191 ) but for my production database it appear as a varchar ( 255 ) Whats wrong? Because of not same mysql version ? Thanks.

26 Jun
10 months ago

HopesAreMiracle left a reply on How Can I Check Minimum Amount Should Be Less Than Maximum Amount At Jquery ?

$minimum_amt = $("#min_amt");
$maximum_amt = $("#max_amt");

$minimum_amt.on("change", function () {
    if ($minimum_amt.val() == '.') {
        alert("You can input only numeric number !");
    }
    if ($minimum_amt.val() > $maximum_amt.val()) {

        $(':input[name="submitDiscount"]').prop('disabled', true);
    }
    else {



        $(':input[name="submitDiscount"]').prop('disabled', false);

    }
});

$maximum_amt.on("change", function () {
    if ($maximum_amt.val() == '.') {
        alert("You can input only numeric number !");
    }
    if ($minimum_amt.val() > $maximum_amt.val()) {
        alert("Minimum Amount should be less than Maximum Amount !");
        $(':input[name="submitDiscount"]').prop('disabled', true);
    }
    else {



        $(':input[name="submitDiscount"]').prop('disabled', false);

    }
});

HopesAreMiracle started a new conversation How Can I Check Minimum Amount Should Be Less Than Maximum Amount At Jquery ?

Hello all ,

               I need to check minimum amount is less than maximum amount from minimum input text and maximum input text in the jquery? How can i check ? Here is the method i check. Thanks.

$minimum_amt = $("#min_amt"); $maximum_amt = $("#max_amt");

$minimum_amt.on("change", function () { if ($minimum_amt.val() == '.') { alert("You can input only numeric number !"); } if ( $minimum_amt.val() > $maximum_amt.val() ) {

    $(':input[name="submitDiscount"]').prop('disabled', true);
}
else {



    $(':input[name="submitDiscount"]').prop('disabled', false);

}

});

$maximum_amt.on("change", function () { if ($maximum_amt.val() == '.') { alert("You can input only numeric number !"); } if ($minimum_amt.val() > $maximum_amt.val()) { alert("Minimum Amount should be less than Maximum Amount !"); $(':input[name="submitDiscount"]').prop('disabled', true); } else {

    $(':input[name="submitDiscount"]').prop('disabled', false);

}

});

04 Jun
11 months ago

HopesAreMiracle left a reply on How Can I Advoid This Kind Of Problem Cannot Reinitialise DataTable .

I got the answer because of this line of code. $("#tbl-treport").dataTable().fnDestroy();

so need to change $("#tbl-treport").dataTable().Destroy();

So it works now.

HopesAreMiracle started a new conversation How Can I Advoid This Kind Of Problem Cannot Reinitialise DataTable .

I have a error with this kind of problem Cannot reinitialise DataTable . Whenever i click to open my report. Its says like

DataTables warning: table id=tbl-treport - Cannot reinitialise DataTable. For more information about this error, please see http://datatables.net/tn/3

So , how can i solved that one. Thanks.

HopesAreMiracle left a reply on How Can I Sum Total Value Of Current Page Using Footercallback.

@ilahuber what i realized is that my amount is calculated only for last page for example if there is 5 pages It only calculated for page 5. So how should i fixed it.

HopesAreMiracle left a reply on How Can I Sum Total Value Of Current Page Using Footercallback.

@ilahuber Thanks for your help. But for me its still cannot work. My Amount calculation is wrong and does not change.

HopesAreMiracle started a new conversation How Can I Sum Total Value Of Current Page Using Footercallback.

Hello All , I have a problem with my footercallback funtion. I cannot sum the total value of current page. I also use the page:'current' . But the actual total amount is total amount from all over the page. When i change page 1 to 2 the total amount still the same . Should be change right? How can i do it for that error. My code is below.

$(document).ready(function() {

$('#tbl-treport').dataTable({
    
  
    "footerCallback": function ( row, data, start, end, display ) {
        var api = this.api();

        // converting to interger to find total
        var intVal = function ( i ) {
            return typeof i === 'string' ?
                i.replace(/[$,]/g, '')*1 :
                typeof i === 'number' ?
                    i : 0;
        };

        // computing column Total of the complete result 
       
            
        var from_amount_in_sgd = api
        .column( 8, { page: 'current'} )
        .data()
        .reduce( function (a, b) {
            return intVal(a) + intVal(b);
        } );

var numFormat = $.fn.dataTable.render.number( ',', '.', 3).display;

        $( api.column( 6 ).footer() ).html("Total Amount");
      
        $( api.column( 8 ).footer() ).html(numFormat(from_amount_in_sgd));

},

} );

});

14 May
1 year ago

HopesAreMiracle left a reply on How Do I Combine Three Foreach Loops Into One ?

@tarunchoudhary I already got it sir. I have another issue for retrieving data from another table that connected with foreign key. I explained above. Thanks.

HopesAreMiracle left a reply on How Do I Combine Three Foreach Loops Into One ?

@Vilfago @biishmar @jenky @jlrdw Thanks for your help. I found my solution what i expected. Here is my solution . But 1 more thing is that , how to show another table value connected with a foriegn key. For example i connected other table name wallets with a foriegn key wallet_id . So in here how to show the name from wallets table corresponding of wallet id ? wallets['name'] ?

            @foreach($internals->groupBy('t_code') as $code => $report)
                   
                            <td>{{ $report->get(0)->updated_at }}</td>
                            <td>{{ $report->get(0)->t_code }}</td>
                            <td>{{ $report->get(0)->wallet_id }}</td>
                            <td>{{ $report->get(0)->currency_id }}</td>
                            <td>{{ $report->where('transfer_type','-')->max('amount') }} </td>
                            <td>{{ $report->get(1)->wallet_id }}</td>
                            <td>{{ $report->get(1)->currency_id }}</td>
                            <td> {{ $report->where('transfer_type','+')->max('amount') }}</td>
                            <td>{{ $report->where('transfer_type','-')->min('amount') }}</td>  
                           
                       
                        </tr>
                        @endforeach 

HopesAreMiracle left a reply on How Do I Combine Three Foreach Loops Into One ?

I found my solution what i expected. Here is my solution . But 1 more thing is that , how to show another table value connected with a foriegn key. For example i connected other table name wallets with a foriegn key wallet_id . So in here how to show the name from wallets table corresponding of wallet id ? wallets['name'] ?

            @foreach($internals->groupBy('t_code') as $code => $report)
                   
                            <td>{{ $report->get(0)->updated_at }}</td>
                            <td>{{ $report->get(0)->t_code }}</td>
                            <td>{{ $report->get(0)->wallet_id }}</td>
                            <td>{{ $report->get(0)->currency_id }}</td>
                            <td>{{ $report->where('transfer_type','-')->max('amount') }} </td>
                            <td>{{ $report->get(1)->wallet_id }}</td>
                            <td>{{ $report->get(1)->currency_id }}</td>
                            <td> {{ $report->where('transfer_type','+')->max('amount') }}</td>
                            <td>{{ $report->where('transfer_type','-')->min('amount') }}</td>  
                           
                       
                        </tr>
                        @endforeach 

HopesAreMiracle left a reply on How Do I Combine Three Foreach Loops Into One ?

                    @foreach($internals->groupBy('t_code') as $code => $report)
                   
                            <td>{{ $report->get(0)->updated_at }}</td>
                            <td>{{ $report->get(0)->t_code }}</td>
                            <td>{{ $report->get(0)->wallet_id }}</td>
                            <td>{{ $report->get(0)->currency_id }}</td>
                            <td>{{ $report->where('transfer_type','-')->max('amount') }} </td>
                            <td>{{ $report->get(1)->wallet_id }}</td>
                            <td>{{ $report->get(1)->currency_id }}</td>
                            <td> {{ $report->where('transfer_type','+')->max('amount') }}</td>
                            <td>{{ $report->where('transfer_type','-')->min('amount') }}</td>  
                           
                       
                        </tr>
                        @endforeach

HopesAreMiracle left a reply on How Do I Combine Three Foreach Loops Into One ?

@foreach($internals->groupBy('t_code') as $code => $report)

                            <td>{{ $report->get(0)->updated_at }}</td>
                            <td>{{ $report->get(0)->t_code }}</td>
                            <td>{{ $report->get(0)->wallet_id }}</td>
                            <td>{{ $report->get(0)->currency_id }}</td>
                            <td>{{ $report->where('transfer_type','-')->max('amount') }} </td>
                            <td>{{ $report->get(1)->wallet_id }}</td>
                            <td>{{ $report->get(1)->currency_id }}</td>
                            <td> {{ $report->where('transfer_type','+')->max('amount') }}</td>
                            <td>{{ $report->where('transfer_type','-')->min('amount') }}</td>  
                           
                       
                        </tr>
                        @endforeach reach

HopesAreMiracle left a reply on How Do I Combine Three Foreach Loops Into One ?

@foreach($internals->groupBy('t_code') as $code => $report)

                            <td>{{ $report->get(0)->updated_at }}</td>
                            <td>{{ $report->get(0)->t_code }}</td>
                            <td>{{ $report->get(0)->wallet_id }}</td>
                            <td>{{ $report->get(0)->currency_id }}</td>
                            <td>{{ $report->where('transfer_type','-')->max('amount') }} </td>
                            <td>{{ $report->get(1)->wallet_id }}</td>
                            <td>{{ $report->get(1)->currency_id }}</td>
                            <td> {{ $report->where('transfer_type','+')->max('amount') }}</td>
                            <td>{{ $report->where('transfer_type','-')->min('amount') }}</td>  
                           
                       
                        </tr>
                        @endforeach 

HopesAreMiracle left a reply on How Do I Combine Three Foreach Loops Into One ?

                                                                                @foreach($internals->groupBy('t_code') as $code => $report)
                   
                            <td>{{ $report->get(0)->updated_at }}</td>
                            <td>{{ $report->get(0)->t_code }}</td>
                            <td>{{ $report->get(0)->wallet_id }}</td>
                            <td>{{ $report->get(0)->currency_id }}</td>
                            <td>{{ $report->where('transfer_type','-')->max('amount') }} </td>
                            <td>{{ $report->get(1)->wallet_id }}</td>
                            <td>{{ $report->get(1)->currency_id }}</td>
                            <td> {{ $report->where('transfer_type','+')->max('amount') }}</td>
                            <td>{{ $report->where('transfer_type','-')->min('amount') }}</td>  
                           
                       
                        </tr>
                        @endforeach 

HopesAreMiracle left a reply on How Do I Combine Three Foreach Loops Into One ?

            @foreach($internals->groupBy('t_code') as $code => $report)
                   
                            <td>{{ $report->get(0)->updated_at }}</td>
                            <td>{{ $report->get(0)->t_code }}</td>
                            <td>{{ $report->get(0)->wallet_id }}</td>
                            <td>{{ $report->get(0)->currency_id }}</td>
                            <td>{{ $report->where('transfer_type','-')->max('amount') }} </td>
                            <td>{{ $report->get(1)->wallet_id }}</td>
                            <td>{{ $report->get(1)->currency_id }}</td>
                            <td> {{ $report->where('transfer_type','+')->max('amount') }}</td>
                            <td>{{ $report->where('transfer_type','-')->min('amount') }}</td>  
                           
                       
                        </tr>
                        @endforeach 

HopesAreMiracle left a reply on How Do I Combine Three Foreach Loops Into One ?

@foreach($internals->groupBy('t_code') as $code => $report)

                            <td>{{ $report->get(0)->updated_at }}</td>
                            <td>{{ $report->get(0)->t_code }}</td>
                            <td>{{ $report->get(0)->wallet_id }}</td>
                            <td>{{ $report->get(0)->currency_id }}</td>
                            <td>{{ $report->where('transfer_type','-')->max('amount') }} </td>
                            <td>{{ $report->get(1)->wallet_id }}</td>
                            <td>{{ $report->get(1)->currency_id }}</td>
                            <td> {{ $report->where('transfer_type','+')->max('amount') }}</td>
                            <td>{{ $report->where('transfer_type','-')->min('amount') }}</td>  
                           
                       
                        </tr>
                        @endforeach 
11 May
1 year ago

HopesAreMiracle left a reply on How Do I Combine Three Foreach Loops Into One ?

@jenky Thanks for your help , i can retrieve amount now. But what i need is i need to retrieve other columns too. Because in my database i have currency id column beside of amount column. So how can i retrieve for currency id? I tried $report->('currency_id') & $report['currency_id'] are not working. Thanks.

10 May
1 year ago

HopesAreMiracle started a new conversation How To Format To Decimal Number That Include Comma And Dot ?

Hi all ,

I would like to know that how can i format my number including comma and dot to decimal.

Thanks. In my database , my amount column is decimal type with (16,8) . after i formatting i want to save to database my number .

For example my input number 10,000.1111 and want to save as a 10000.1111 to my database and 111,111,111.1234 as a 111111111.1234 . Thanks all.

08 May
1 year ago

HopesAreMiracle started a new conversation How To Write The Query For Updating From Same Table Every Night?

What i want is how can i update amount from each ID everynight. For example Today date is 8 - 5 - 18 and if goes to 9 - 5 - 18 , i want like to update wallet date to be 9 - 5 - 18 date and amount should be previous date amount. Need query first and i can do it on task scheduling.

ID Amount Wallet Date

1 1000 8 - 5 - 18 2 2000 8 - 5 - 18 3 3000 8 - 5 - 18 4 4000 8 - 5 - 18 . . .

After Next Date

ID Amount Wallet Date

1 1000 9 - 5 - 18 2 2000 9 - 5 - 18 3 3000 9 - 5 - 18 4 4000 9 - 5 - 18 . . .

Thanks you all.

06 May
1 year ago

HopesAreMiracle started a new conversation How Do I Combine Three Foreach Loops Into One ?

Hello all , I have a problems with my report. In my database , i have columns and data like this

id , code , amount , type 1 123 100 - 2 123 200 + 3 456 400 - 4 456 500 +

retrieve from the database is ok . i have 2 objects to store. but what i having problems right now is looping , i want to show in my blade.php as a 1 record for same code like this.

i want my report format like this

Code From Amount To Amount 123 100 200 456 400 500

i tried many ways. but actual outcome don't come out with my expected one. Thanks . I really need help.

Thanks all.

30 Apr
1 year ago

HopesAreMiracle left a reply on Want To Keep Showing Old Date For Date Field !!

Oh I got it now . Thanks @Vilfago .

I need to change like this

return view('wallets.ledger' , [ 'from_date' => $from_date] );

Its work now. Thanks.

HopesAreMiracle left a reply on Want To Keep Showing Old Date For Date Field !!

This is a little confusing , i add action event on my blade.

< a class = "btn btn-primary" onclick="window.location.href='/wallets/ledger?to_date='+to_date.value"> Go

In the controller ,

return view('wallets.ledger') ;

HopesAreMiracle left a reply on Want To Keep Showing Old Date For Date Field !!

Sorry here is my code.

< input type= " date " id = " to_date " name = " to_date " value = " {{ old ( 'to_date' ) }} " >

HopesAreMiracle started a new conversation Want To Keep Showing Old Date For Date Field !!

I want to have my date field remember my old input after reloading or going to next page.

Is there any way i can do this?

I already tried this way !!

27 Apr
1 year ago

HopesAreMiracle started a new conversation How To Stay Unchanged Selected Value After Onchange Event !

Hi all , i have my code like this

-- Select Banks --

@foreach($wallet_name as $wallet_names)

{{ $wallet_names->wallet_name }} ( $ {{ $wallet_names -> currencies['name'] }} )

@endforeach

whenever i choose option value , at next page select box is go back to -- Select Banks -- always. How can i stay remain the option is that i selected index value . For Example when i use A Bank , after reloading the select box should be A Bank . Thanks. Sorry for my english.

09 Apr
1 year ago

HopesAreMiracle started a new conversation How To Use Old Method For Populate Old Value That Have 2 Values In Option Value?

How to use old method for populate old value that have 2 values in option value? Previously i can use old method when i have 1 value in option value . Like this

-- Choose Float Account -- @foreach($walletname as $walletnames) <option value="{{ $walletnames->wallet_name }}" @if(old('to_bank_name') == $walletnames->wallet_name) {{ 'selected' }} @endif> {{ $walletnames->wallet_name}} ( $ {{ $walletnames ->currencies['name'] }} ) @endforeach

But when i use 2 value in option value for explode of purpose , i cannot use old method anymore.

-- Choose Float Account -- @foreach($walletname as $walletnames) <option value="{{ $walletnames->wallet_name }}|{{ $walletnames->currencies['id'] }}" @if(old('from_bank_name') == $walletnames->wallet_name|$walletnames->currencies['id'])) selected @endif >{{ $walletnames['wallet_name'] }} ( $ {{ $walletnames ->currencies['name'] }} ) @endforeach

Thanks you all. Peace . My head is almost burning. Thanks for the help.