dreamxyz

Experience

2,880

0 Best Reply Awards

  • Member Since 2 Months Ago
  • 1 Lesson Completed
  • 0 Favorites

18th August, 2017

dreamxyz started a new conversation Is There A Function To Lock Column From Being Edited Using Maatwebsite/Laravel-Excel? • 2 days ago

I want to lock certain column to prevent user edit the data of the column. Is Maatwebsite/Laravel-Excel provide this feature?

17th August, 2017

dreamxyz left a reply on How Can I Browse Excel File And Display The Data In Excel To The Table Before Submit And Save To Database? • 3 days ago

@ChristophHarms I have a xls format file, when i browse and choose the file, it will display the data of the file into a html table format. It is just like the link shown http://oss.sheetjs.com/js-xlsx/

dreamxyz started a new conversation How Can I Browse Excel File And Display The Data In Excel To The Table Before Submit And Save To Database? • 3 days ago

I have a question on how can i show a preview of the excel data on the table before i submit the data to be inserted/ updated in the database?

16th August, 2017

dreamxyz started a new conversation How Do Anchor Tag Behave Like A Button Submit And Get The Value In Controller? • 3 days ago

When the user click on the link below the form will submit, but my controller unable to get the value. Is there a way to fix this issue? Thanks.

<li role="presentation"><a role="menuitem" tabindex="-1" href="javascript:{}" onclick="this.form.submit()" name="action" value="auto">CSS</a></li>

dreamxyz started a new conversation How Can I Disable A Certain Column To Be Modified In Xls Format Using Laravel Excel? • 4 days ago

I exported data from database to excel, i want to prevent user to modify certain column in the excel file. Is that possible to do it in my controller?

14th August, 2017

dreamxyz left a reply on Explode A String Into An Array With Assigned Value And Send The Email To Multiple Recipient With Recipient Name • 5 days ago

@tisuchi How can i make it like this ?

$a = array([email protected]'=>'abc',[email protected]'=>'cde');

dreamxyz started a new conversation Explode A String Into An Array With Assigned Value And Send The Email To Multiple Recipient With Recipient Name • 5 days ago

I have a string declared as shown below

var email = [email protected],[email protected]'

I am using explode to make it as an array

$emails = explode(",", $user->email);

With the $emails output like

array:2 [▼
  0 => "[email protected]"
  1 => "[email protected]"
]

What i am expected is

$a = array([email protected]'=>'abc',[email protected]'=>'cde');

Result:

array:2 [▼
  "[email protected]"=> "abc"
  "[email protected]"=> "cde"
]

I want to send email to multiple recipient with the name of recipient.e.g

abc([email protected]);cde([email protected])

It works fine when mail->to a single recipient

mail->to([email protected]','abc');

Can anyone tell me how can i make it to send an email to multiple recipient with name as well?

dreamxyz left a reply on How To Send Email To Multiple User At Once With The Same Name? • 6 days ago

@martinbean I mean how can i do like this

[email protected] => 'XXXX'

In gmail there will show as

XXXX([email protected])

I unable to do it for multiple email. It works fine for sending email just i want the 'name' appear beside the email. Is that possible to group the email under same name? e.g.

XXXX([email protected],[email protected])

dreamxyz started a new conversation How To Send Email To Multiple User At Once With The Same Name? • 6 days ago

For example, i want to send email to the same user with multiple email e.g. userA ([email protected],[email protected])

 $m->to(explode(' ', $user->email), $user->name)->subject(...);

I cant get the name display when receive the email, is there a way to achieve that?

11th August, 2017

dreamxyz started a new conversation How To Join The Model Relationship From One Model To Another And Display The Data Of The Model? • 1 week ago

I have 3 model, which is user, item and setting.

This is the item model which consist of function user();

public function user()
    {
        return $this->belongsTo('App\Models\User', 'id_user');
    }

Where i can simple call it in view as

$items->user->id_user

What if i want to get the setting of the user like

$items->user->setting->id_setting

Is it possible to do that?

4th August, 2017

dreamxyz left a reply on Incorrect Result Get From The Query Statement • 2 weeks ago

fixed by removing group by.

dreamxyz started a new conversation Incorrect Result Get From The Query Statement • 2 weeks ago

$id_supplier = Product::whereIn('id_product',$check)->groupBy('id_supplier')->pluck('id_supplier');

This statement will return 2 value.

$supplier1 = Supplier::where('id_supplier', $id_supplier)->pluck('company_name');

But this statement only return 1 value, it should be 2 value.

2nd August, 2017

dreamxyz started a new conversation How To Pass The Value From Controller To View If Using DB::select? • 2 weeks ago

I am using this query

$value = DB::select("select t.prod_id, t.datetime,b.branch_id
from A t
inner join (
    select prod_id, max(datetime) as MaxDate
    from A
    group by prod_id
) tm on t.prod_id = tm.prod_id and t.datetime = tm.MaxDate
inner join B b on b.prod_id = t.prod_id
inner join C c on b.prod_id = c.prod_id
 ");

How can i pass the $value to view if i am using DB::select? The result only return single record only. But i am facing 'Too few arguments' error.

In view i just want to display the value

{{$value}}

dreamxyz left a reply on How Can I Write MySQL Query In Laravel Controller? • 2 weeks ago

@tisuchi May i know, if using DB:: select, e.g.

$value = DB::select("...")

Can i directly pass the value to view without looping?

dreamxyz started a new conversation How Can I Write MySQL Query In Laravel Controller? • 2 weeks ago

I have a query look like this

select t.prod_id, t.datetime,b.branch_id
from A t
inner join (
    select prod_id, max(datetime) as MaxDate
    from A
    group by prod_id
) tm on t.prod_id = tm.prod_id and t.datetime = tm.MaxDate
inner join B b on b.prod_id = t.prod_id
inner join C c on b.prod_id = c.prod_id

I wrote in my controller

DB::select("select t.prod_id, t.datetime,b.branch_id
from A t
inner join (
    select prod_id, max(datetime) as MaxDate
    from A
    group by prod_id
) tm on t.prod_id = tm.prod_id and t.datetime = tm.MaxDate
inner join B b on b.prod_id = t.prod_id
inner join C c on b.prod_id = c.prod_id
 ");

It will caused infinity looping. Is this the correct way to write in this format?

dreamxyz left a reply on How Can I Get The Latest Record In Database Based On Datetime? • 2 weeks ago

@Snapey Yes, i mean latest by branch 1 if login as branch 1.

1st August, 2017

dreamxyz left a reply on Records From Database Do Not Displayed As Latest One Using ->latest() Or OrderBy • 2 weeks ago

@jlrdw But i keep getting the old record

dreamxyz left a reply on Records From Database Do Not Displayed As Latest One Using ->latest() Or OrderBy • 2 weeks ago

@edoc

$lists=  DB::table('A')
            ->leftJoin('B', 'A.prod_id', '=', 'B.prod_id')
            ->leftJoin('C', 'B.branch_id', '=', 'C.branch_id')
            ->where('A.branch_id', Auth::user()->branch_id)
            ->latest('A.created_at')
            ->groupBy('A.prod_id')
            ->get();

This is how me write.

dreamxyz started a new conversation Records From Database Do Not Displayed As Latest One Using ->latest() Or OrderBy • 2 weeks ago

This is how my sample query look like http://sqlfiddle.com/#!9/1a3b50/7

The expected result should be

id  branch_id   prod_id     name    qty     datetime
4   1   2   a   2   2017-07-28T12:26:06Z
1   1   1   a   5   2017-07-28T12:26:03Z

I always get the oldest record instead of latest one. Anyone can tell me what is the problem fpr my query?

dreamxyz left a reply on How Can I Get The Latest Record In Database Based On Datetime? • 2 weeks ago

http://sqlfiddle.com/#!9/71f834/5 , i want to show the latest record but cannot make it.

dreamxyz left a reply on How Can I Get The Latest Record In Database Based On Datetime? • 2 weeks ago

@Snapey Well, it's just a sample,

I want it to be like this Before:

    id  branch_id  name    qty     datetime
    --- ---------  ----    ----    -----------
    1   1           a      5       2017-07-28 12:26:01
    2   2           b      3       2017-07-28 12:26:02
    3   3           c      4       2017-07-28 12:26:03
    4   1           a      2       2017-07-29 12:26:04
    5   2           b      2       2017-07-29 12:26:05
    6   3           c      2       2017-07-29 12:26:06

After

 id  branch_id  name    qty     datetime
    --- ---------  ----    ----    -----------
    4   1           a      2       2017-07-29 12:26:04
    5   2           b      2       2017-07-29 12:26:05
    6   3           c      2       2017-07-29 12:26:06

31st July, 2017

dreamxyz left a reply on How Can I Get The Latest Record In Database Based On Datetime? • 2 weeks ago

i am using

->groupby('name')
->order_by('datetime', 'desc')

But it seem like not displaying the latest record.

dreamxyz left a reply on How Can I Get The Latest Record In Database Based On Datetime? • 2 weeks ago

@Cronix Instead of using ->get() i just changed it to ->latest()?

dreamxyz started a new conversation How Can I Get The Latest Record In Database Based On Datetime? • 2 weeks ago

I have a table with value as shown below

id  branch_id       qty datetime
--- -------------       ----    -----------
1   1           2   2017-07-29 12:26:07
2   1           2   2017-07-29 12:26:07
3   2           3   2017-07-29 12:26:07
4   2           4   2017-07-28 12:26:07
5   2           1   2017-07-28 12:26:07
6   1           2   2017-07-28 12:26:07

And i want to display the latest datetime

id  branch_id       qty datetime
--- -------------       ----    -----------
1   1           2   2017-07-29 12:26:07
2   1           2   2017-07-29 12:26:07

How can i make it? I will select the latest record according to branch in where clause.

24th July, 2017

dreamxyz started a new conversation How Can I Share Whatsapp Message Which Included Hyperlink For Text? • 3 weeks ago

For example, i am using

href="whatsapp://send?text=http://www.example.com"

I am using java script to add on text

link.attr('href',link.attr('href')+'<a href=\'google.com\'>aaaa</a>');

I want to display the aaaa as hyperlink text but it will displayed the html code. Any solution?

23rd July, 2017

dreamxyz started a new conversation How To Clear Sessionstorage Item When User Logout? • 3 weeks ago

In my controller, how do i clear the sessionStorage item?

public function logout()
    {
        Auth::logout();
        Session::flush();
        return redirect('/login');
    }

21st July, 2017

dreamxyz left a reply on How Can I Return Back To Previous Page? • 4 weeks ago

e.g. page 2 is a page to show all product, when i click on create button then will go to page 3.

dreamxyz started a new conversation How Can I Return Back To Previous Page? • 4 weeks ago

e.g.

page 1 > page 2 > page 3

i am currently at page 3, i want back to page 2, how can i make it?

return redirect()->back(); 

This is not working where it will stay at page 3.

dreamxyz left a reply on How To Hide Parameter From Url, When Need To Pass Data From One Page To Another? • 4 weeks ago

I am not using form or any input, it's a breadcrumb.

{!! Breadcrumbs::render('edit',$id) !!}

in breadcrumbs.php

$breadcrumbs->push($name,url('/product/'.$id));

something like this, but i do not want to show the parameter on url.

dreamxyz left a reply on How To Hide Parameter From Url, When Need To Pass Data From One Page To Another? • 4 weeks ago

But then how do i get the value from there?

20th July, 2017

dreamxyz started a new conversation How To Hide Parameter From Url, When Need To Pass Data From One Page To Another? • 4 weeks ago

Instead of showing ../product/1

$breadcrumbs->push($name,url('/product/'.$id));

I want it to be show ../product

Any method can be used to do this?

dreamxyz started a new conversation How To Back To Previous Page Using Breadcrumb? • 1 month ago

I know it can be simply done by using this.

$breadcrumbs->push('Home',url('purchaser/dashboard'));

But i faced a problem when i have 3 different blade view, where the first one is to let user select item from drop down, second is to refresh div content on first blade, and third is totally is a new page.

Home > page 2 > page 3

e.g. user will go to first blade on page load and then div content will be refreshed based on selection by user. User can navigate to other page as well. I want to return back to page 2 with the selection made by user.

19th July, 2017

dreamxyz left a reply on How To Show Name Of Product Id In Breadcrumb? • 1 month ago

Fixed.

dreamxyz started a new conversation How To Show Name Of Product Id In Breadcrumb? • 1 month ago

I am using

   $name = Product::where('id', $id)->pluck('product_name');

I pass $name to view and render it to breadcrumb, but then it will display ["name of product"]. Anything did i made wrong?

18th July, 2017

dreamxyz started a new conversation How To Use Triggers For Logging History Of Database Changes By Which User In Phpmyadmin? • 1 month ago

This is my trigger code to log changes when quantity has been made changes.

CREATE TRIGGER `qty_chgs` AFTER UPDATE ON `cart`
    FOR EACH ROW BEGIN
    IF NEW.QUANTITY != OLD.QUANTITY THEN
    INSERT INTO logs (`action`,`product_id`,`created_at`,`updated_at`) VALUES (1,NEW.PRODUCT_ID,CURRENT_TIMESTAMP,CURRENT_TIMESTAMP);
    END IF;
END

I have a table named 'users'. When the quantity amount in 'cart' table being modified, j want to log the user id and also the product id. How can i track which user modified it?

13th July, 2017

dreamxyz left a reply on How To Compare Date With Today Date To Know Whether The Date Is Greater Or Not? • 1 month ago

I have stored expiry date to the database. I need to notify user when the product is going to expire which one week before.

dreamxyz left a reply on How To Compare Date With Today Date To Know Whether The Date Is Greater Or Not? • 1 month ago

How if i need get to know whether it is less than a week?

dreamxyz started a new conversation How To Compare Date With Today Date To Know Whether The Date Is Greater Or Not? • 1 month ago

I am using the method below to get the difference between day but it always show positive value even if the today date is greater than expiry date. I want to compare the date to know whether the product is expired or not.

var day = "{{(Carbon\Carbon::parse($product->expiry_date)->diffInDays(Carbon::now()))}}";

10th July, 2017

dreamxyz left a reply on Is There Any Method For Wechat Like Whatsapp Sharing Without Using Qrcode? • 1 month ago

Which mean that the only way to share at WeChat is to generate QR code and capture QR by phone only right? So far there is no other way for WeChat like WhatsApp does which allow to open app and share text to chat?

dreamxyz left a reply on Is There Any Method For Wechat Like Whatsapp Sharing Without Using Qrcode? • 1 month ago

Ikr. Not sure which one to refer, is better to know the actual link, By the way, thanks.

dreamxyz left a reply on Is There Any Method For Wechat Like Whatsapp Sharing Without Using Qrcode? • 1 month ago

Is there any link for references?

9th July, 2017

dreamxyz started a new conversation Is There Any Method For Wechat Like Whatsapp Sharing Without Using Qrcode? • 1 month ago

Hi, i am looking for wechat sharing which share text from web to user like whatapps. Is there a way available to do this?

7th July, 2017

dreamxyz left a reply on What Method Can I Use To Display Images Together With Details And Checkbox In Pagination? • 1 month ago

I am using laravel length aware paginator to display my images details where it is troublesome when i need to get all the checkboxes value. During navigate to next pages the value will lost and not save. I am looking for better way to do this.

6th July, 2017

dreamxyz started a new conversation What Method Can I Use To Display Images Together With Details And Checkbox In Pagination? • 1 month ago

Is there a better way to show those images details together with checkboxes in grid view and include pagination? Thanks in advance.

dreamxyz started a new conversation Why POST Request Will Be Called Multiple Times Based On The Array Data Passing To Server? • 1 month ago

I push the id to the array when checkbox is checked.

var items=[];

$("#selection").click(function(e) {
            $(":checkbox").each(function() {
                if(this.checked === false) {
                    this.checked = true;
                    items.push(this.id);
        });
        }); 

When i submit, the item saved to database but at the "network monitor' it displays a lot of POST request which is unusual.

$('#grid').submit(function(e){

            $.ajaxSetup({
                headers: { 'X-CSRF-Token' : $('meta[name=_token]').attr('content') }
            });
            e.preventDefault();

            var formdata = {
                item:items
            };
            $.ajax({
                type: "POST",
                url: "/addItem",
                data: formdata ,
                dataType:'json',
                success: function(data) {
                    swal(
                        'Great!',
                        'Item added!',
                        'success'
                    ) ;
                }
            });

        });

The POST request will based on the number of item in items array. Is there anything wrong with my code?

4th July, 2017

dreamxyz left a reply on How To Persist Checkbox Checked State After Div Content Reload? • 1 month ago

Yes, this is what i am looking for. But if i render all at the same page it will be a lot of data. I am displaying image and checkbox in gridview with laravel paginatior.

dreamxyz left a reply on How To Persist Checkbox Checked State After Div Content Reload? • 1 month ago

But i didnt save it to database yet.

3rd July, 2017

dreamxyz started a new conversation How To Persist Checkbox Checked State After Div Content Reload? • 1 month ago

I have a pagination for div which during go to another pages the previous checkbox state will lost.

 var id;
   $("#list :checkbox").each(function(e){
   id = this.id;
   console.log(this.value);
   });

Code above can get all the value in a div tag if without button click.

If i use the code below, it only shows the data for the page 1.

$("#select-all").click(function(e) {

var id;
   $("#list :checkbox").each(function(e){
   id = this.id;
   console.log(this.value);
   });
                });

I am not using datatable to display data, i am using div tag to display 6 items per page, but i always get the value only where the current page is active. Any solution to solve the issue?

dreamxyz left a reply on Data From Previous Pagination Link Lost After Navigate To Another Page. • 1 month ago

Is it possible to do like DataTables which can retain the data even navigate to new page?

2nd July, 2017

dreamxyz started a new conversation Data From Previous Pagination Link Lost After Navigate To Another Page. • 1 month ago

I am using laravel lengthawarepaginator. I have a checkboxes with it. When i click a button to select all the check boxes it only check for the first page, and when navigate to another pages then the data from previous page will lost.

$("#select-all").click(function(e) {
                e.preventDefault();
            $(':checkbox').each(function() {
                if(this.checked === false) {
                    this.checked = true;
                }
            });
            });

The function above is to select all checkbox.

$( document ).ready(function() { $('.pagination a').on('click', function(event) { event.preventDefault(); if ($(this).attr('href') != '#') { $('#list').load($(this).attr('href')); } }); });

I am using this method to refresh my data.

Any solution can fix this?

Edit Your Profile
Update

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