dreamxyz

Experience

1,000

0 Best Reply Awards

  • Member Since 3 Weeks Ago
  • 0 Lessons Completed
  • 0 Favorites

23rd June, 2017

dreamxyz started a new conversation How To Refresh A Pagination Link Without Loss Of Css Style • 3 days ago

I have some custom filter to filter the data, when user select then the div content will be refreshed, but if i refresh the content together with {{$lists->links()}} then during pagination the content will displayed without style. Any solution to fix it?

{{$lists->links()}}

dreamxyz left a reply on How To Change The Paginator Arrow Button To String "next" And "previous" • 3 days ago

Ok, i changed wrong template file for the view ;) It works fine right now. Thanks a lot.

dreamxyz left a reply on How To Change The Paginator Arrow Button To String "next" And "previous" • 3 days ago

It's not related to the file in below blade template?

Illuminate\Pagination\LengthAwarePaginator

dreamxyz started a new conversation How To Change The Paginator Arrow Button To String "next" And "previous" • 3 days ago

I am using this Illuminate\Pagination\LengthAwarePaginator to do pagination

// Get current page form url e.x. &page=1
        $currentPage = LengthAwarePaginator::resolveCurrentPage();
        // Create a new Laravel collection from the array data
        $itemCollection = collect($items);
        // Define how many items we want to be visible in each page
        $perPage = 1;
        // Slice the collection to get the items to display in current page
        $currentPageItems = $itemCollection->slice(($currentPage * $perPage) - $perPage, $perPage)->all();
        // Create our paginator and pass it to the view
        $paginatedItems= new LengthAwarePaginator($currentPageItems , count($itemCollection), $perPage);
 
        // set url path for generted links
        $paginatedItems->setPath($request->url());
        return view('items_view', ['items' => $paginatedItems]);
    }

During view the next and previous button show as << and >>. How can i change it to Next and Previous?

dreamxyz left a reply on Call To A Member Function Paginate() On Array Error Message • 3 days ago

I am using Illuminate\Pagination\LengthAwarePaginator to do it, maybe this cannot be applied?

dreamxyz left a reply on Call To A Member Function Paginate() On Array Error Message • 3 days ago

I solved my problem by just removing the paginate() in db table. Can i know how to change the next and previous button from arrow to string?

22nd June, 2017

dreamxyz started a new conversation Call To A Member Function Paginate() On Array Error Message • 3 days ago

This is my controller.

 $default= DB::table('products')
             ........
              ->get()->toArray()->paginate(5);

    $notDefault= DB::table('products')
               .......
                ->get()->toArray()->paginate(5);

    $productLists = array_merge($default, $notDefault);

return View::make('listing',compact('lists'));

This is my route.

Route::get('listing/{id}', ['uses' => [email protected]', 'as' => 'prod_listing']);

This is my view

 @foreach($lists as $list)
........
                @endforeach
        {{$lists ->link()}}

Anyone can tell me what is the problem? How can i do pagination with array? Thanks.

dreamxyz started a new conversation How To Select All Checkbox From Datatable By One Click • 4 days ago

<th>{{ Form::checkbox('select_all' ,'1',false,array('id' => 'select-all')) }}</th>
<td>{{ Form::checkbox('item[]', $id->id, false) }}</td>

<script>
var table = $('#table').DataTable({
            "responsive": true,
  });

$('#select-all').on('click', function(){

            var rows = table.rows({ 'search': 'applied' }).nodes();
            $('input[type="checkbox"]', rows).prop('checked', this.checked);
        });

        $('#table tbody').on('change', 'input[type="checkbox"]', function(){
      
            if(!this.checked){
                var el = $('#select-all').get(0);           
                if(el && el.checked && ('indeterminate' in el)){
                    el.indeterminate = true;
                }
            }
        });
</script>

I tried above method but not working, any solution to fix it?

dreamxyz started a new conversation How Can I Get The Form Name Which Use Of Laravel Receipe • 4 days ago

{{ Form::checkbox('select_all' ,1,false) }}

How can i get the attribute name of this form using js?

21st June, 2017

dreamxyz started a new conversation I Am Using Data Toggle Check Box To Refresh Div Content, But It Will Refresh Again After Ajax Refresh And Lost Of The Div Content • 4 days ago

    <input id="view" data-toggle="toggle" data-on="List" data-off="Grid" type="checkbox">

I use to switch the view of div content. The default view is grid view, after i click on the check box and change to list view, the content will refresh back to grid view itself after ajax refresh. Any solution to fix it?

 $('#view').change(function() {
            var result = jQuery('#view').is(':checked')?'List':'Grid';
            if(result=="List"){
                $('#search').hide();
                $.ajax({
                    type:'GET',
                    url:'/List/',
                    dataType: 'HTML',
                    success:function(html){
                        $('#body').html(html);
                    },
                    error:function(){
                    }
                });
     
            }
            else{
                $('#search').show();
                $.ajax({
                    type:'GET',
                    url:'/Grid/',
                    dataType: 'HTML',
                    success:function(html){
                        $('body').html(html);
                    },
                    error:function(){
                    }
                });
            }
        });

20th June, 2017

dreamxyz left a reply on Why It Will Still Return True When There Is An Alert From Other Function? • 6 days ago

Ok, thanks.

Can i know is that possible to use SweetAlert code like below in Controller?

swal({
  title: "Are you sure?",
  text: "You will not be able to recover this imaginary file!",
  type: "warning",
  showCancelButton: true,
  confirmButtonColor: "#DD6B55",
  confirmButtonText: "Yes, delete it!",
  cancelButtonText: "No, cancel plx!",
  closeOnConfirm: false,
  closeOnCancel: false
},
function(isConfirm){
  if (isConfirm) {
    swal("Deleted!", "Your imaginary file has been deleted.", "success");
  } else {
        swal("Cancelled", "Your imaginary file is safe :)", "error");
  }
});

dreamxyz left a reply on Why It Will Still Return True When There Is An Alert From Other Function? • 6 days ago

But there's some condition to alert the user, it will pass through and back to process()?

dreamxyz left a reply on Why It Will Still Return True When There Is An Alert From Other Function? • 6 days ago

if checkProcess() run fine, then it will show successfully message.

dreamxyz left a reply on Why It Will Still Return True When There Is An Alert From Other Function? • 6 days ago

Here the result

RedirectResponse {#649 ▼
  #request: Request {#40 ▶}
  #session: Store {#570 ▶}
  #targetUrl: "http://localhost:8000/purchaser/Porder"
  +headers: ResponseHeaderBag {#651 ▶}
  #content: """
    <!DOCTYPE html>\n
    <html>\n
        <head>\n
            <meta charset="UTF-8" />\n
            <meta http-equiv="refresh" content="1;url=http://localhost:8000/purchaser/Porder" />\n
    \n
            <title>Redirecting to http://localhost:8000/purchaser/Porder</title>\n
        </head>\n
        <body>\n
            Redirecting to <a href="http://localhost:8000/purchaser/Porder">http://localhost:8000/purchaser/Porder</a>.\n
        </body>\n
    </html>
    """
  #version: "1.0"
  #statusCode: 302
  #statusText: "Found"
  #charset: null
  +exception: null
}

dreamxyz started a new conversation Why It Will Still Return True When There Is An Alert From Other Function? • 6 days ago

I have 2 function.

 public function process(){
$bool = $this->checkProcess();
if ($bool) {
 Alert::success('Successfully', 'Done')->persistent('Close');
        return Redirect::to('process');
      } else {
        Alert::warning('Something went wrong', 'Ooops')->persistent('Close');
        return Redirect::to('process');
      }
}

public function checkProcess()
  {
.........
}

I have a condition for checking purpose in checkProcess function and will alert when fail to proceed. But the problem is, it always return successfully. Anything wrong about my code? Thanks in advance.

19th June, 2017

dreamxyz left a reply on Can I Change The Text Colour In Sweet Alert Box When Call Alert Inside A Controller? • 6 days ago

So this is the way how to render html in message.

 Alert::error(....', '.....')->html()->persistent('Close');

dreamxyz left a reply on Can I Change The Text Colour In Sweet Alert Box When Call Alert Inside A Controller? • 6 days ago

Well, i am doing it in controller not blade.

dreamxyz left a reply on Can I Change The Text Colour In Sweet Alert Box When Call Alert Inside A Controller? • 1 week ago

Well i am using

sweetAlert("Sorry, please......", "Something went wrong!", "error");

I want to change "Sorry" to red colour, what method i can use?

dreamxyz left a reply on Can I Change The Text Colour In Sweet Alert Box When Call Alert Inside A Controller? • 1 week ago

What if i am using as Alert::error()......

dreamxyz started a new conversation Can I Change The Text Colour In Sweet Alert Box When Call Alert Inside A Controller? • 1 week ago

I am using the code above but seem like not working, it will be displayed as string. I am doing it in controller, how can i change the text font of the text during alert? Thanks in advance.

dreamxyz left a reply on How To Use @foreach Loop To Check Condition With If Else Statement • 1 week ago

Thanks, it works as what actually i want. Can i ask is that possible to change the text color in Sweet Alert box?

dreamxyz left a reply on How To Use @foreach Loop To Check Condition With If Else Statement • 1 week ago

Is it necessary to use loop if i want to get some value from the database for checking purpose with 2 different id?

dreamxyz left a reply on How To Use @foreach Loop To Check Condition With If Else Statement • 1 week ago

I use dd() for tracking purpose only.

dreamxyz left a reply on How To Use @foreach Loop To Check Condition With If Else Statement • 1 week ago

This is not the problem..The main problem is I only able to loop 1 time when their is 2 id retrieved.

dreamxyz left a reply on How To Use @foreach Loop To Check Condition With If Else Statement • 1 week ago

I want to get the total sales and do comparison, anyhow i only able to show 1 record of supplier, i will not able to compare the second supplier.

foreach($id_supplier as $id ) {
        $result = DB::table('cart_items')
        ->leftJoin('products', 'cart_items.id_product', '=', 'products.id_product')
        ->leftJoin('suppliers', 'products.id_supplier', '=', 'suppliers.id_supplier')
            ->select(DB::raw('sum(cart_items.quantity*cart_items.unit_price) AS total_sales'))
        ->where('cart_items.id_cart', $id_cart)
        ->where('products.id_supplier', $id)
        ->get();

        dd($result);

dreamxyz left a reply on How To Use @foreach Loop To Check Condition With If Else Statement • 1 week ago

yes i did it, it shows 2 id, but when put inside loop, it only shows the first id.

dreamxyz left a reply on How To Use @foreach Loop To Check Condition With If Else Statement • 1 week ago

I have 2 supplier which is with id - 2 and id - 3, but it only show id - 2. I tried to see what is actually being retrieved, i have no idea about it. i have to check some condition inside controller, but i unable to do that.

dreamxyz started a new conversation How To Use @foreach Loop To Check Condition With If Else Statement • 1 week ago

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

How can i loop this supplier to check with some condition during looping?

I tried this but it only loop the first item.

   foreach($id_supplier as $key => $val)

15th June, 2017

dreamxyz left a reply on Is There Any Package For Country, State And City Dependent Drop Down? • 1 week ago

I am new to laravel, just want get to know more about it. Is ok i think i just stick to this by calling it with {!!Html::script('...') !!}

dreamxyz started a new conversation Is There Any Package For Country, State And City Dependent Drop Down? • 1 week ago

I am looking for way as the link shown http://www.geodata.solutions/?chronoform=listbuilder&event=submit. Is there possible to do it using laravel?

14th June, 2017

dreamxyz started a new conversation Can I Manually Change Route Resource Function Method Like Edit,update, Etc? • 1 week ago

Route::resource('product', 'productController', array('except' => ['show'], 'names' => array('update' => 'product.update',  'destroy' => 'product.destroy')));

How can i manually change the function method? E.g. i already have another function called update in my controller, i need to create another function "update" to update my other data.

I want something like

 public function updateProduct(){}
public function updateStore(){}

How i can call the function in route resource?

12th June, 2017

dreamxyz started a new conversation Value From Data Table Only Can Be Stored When At The Active Page • 1 week ago

View

{!! Form::open(array('url'=>'storeID/'.$id)) !!}`

     @foreach($itemlist as $items)
    <tr>
        <td>{!! Form::text('max_' . $items->id,  old('max', $items->max_qty) !!}</td>
    </tr>
    @endforeach

    <button type="submit" class="btn btn-complete">Save</button>

Controller

public function storeItem(Request $request, $id_b)
  {
    $id = Prod::where('id_b', $id_b)->pluck('id_p')->toArray();
    foreach($id as $key => $val)
    {
        $max_qty = 'max_'.$val;

        $p = Prod::where('id_b', $id_b)->where('id_p', $val)->first();
        $p->max_qty = Input::get($max);
        $p->save();
      }
  }
}

I want to store the value of input field from data table into database, but it only allows to save the page where is active only, the other field value will became null. For example, there are 2 pages of data, i only allow to save the data on current active page, other pages value will get null. Any solution to solve this issue?

11th June, 2017

dreamxyz started a new conversation Value Will Became Null When Datatable Pagination • 2 weeks ago

I want to save all the value edited by the user. E.g. Value only saved where the pagination is active only, other pages will became null value. How can i ensure value from all pages will be saved.

I am using below code to store the value get from datatable.

{!! Form::open(array('url'=>'storeID/'.$id)) !!}

8th June, 2017

dreamxyz left a reply on How To Delete Data From Many To Many Relationship Table If There Is No Any Primary Key. • 2 weeks ago

What i mean is only delete the 1 of the record inside supplier_product table without delete exisiting data in either supplier or product. Eg.

    Supplier | supplier_id, name.....

    Supplier_Product | supplier_id, product_id........

    Product | product_id, name.....

Data in Supplier_Product table:

supplier1 - product2
supplier1 - product 1

dreamxyz left a reply on How To Delete Data From Many To Many Relationship Table If There Is No Any Primary Key. • 2 weeks ago

For example, maybe 1 supplier have many product in supplierproduct table but i just want to remove 1 of it, i not sure how to deal with it. Any suggestion?

dreamxyz started a new conversation How To Delete Data From Many To Many Relationship Table If There Is No Any Primary Key. • 2 weeks ago

I have suppliers, supplierproduct, and product table, how can i delete the data in supplierproduct table? What is the best practice to doing it so? Thanks in advance.

5th June, 2017

dreamxyz left a reply on How Do I Hide A Module Function According To The User Selection • 2 weeks ago

What if i am going to hide completely the module for the user? It means that the particular user will not see the module. E.g. there are 2 user, 1 of them might need the module and the other user might no need for the module.

dreamxyz left a reply on How Do I Hide A Module Function According To The User Selection • 3 weeks ago

I am not sure how it works, is there any example related to it? I am currently using this method in controller to restrict user access to the particular module.

$allow = Group::find(Auth::user()->id)->value('status');
        if($allow != 1)
        {
          Alert::warning('Your account does not include this module', 'Sorry')->persistent('Close');
          return redirect()->back();

dreamxyz started a new conversation How Do I Hide A Module Function According To The User Selection • 3 weeks ago

As an example, i have 2 module which is report and product management, i will set a value to store the selection of user into database. If user no want to show report module in the menu, they can select 'NO' and then the module will not able to be showed in menu list and accessed by the user.

Edit Your Profile
Update

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