vendredi 27 mai 2016

Replace external url route with two variables laravel

I have many ecommerces apps in laravel, and this ecommerce use externals modules from another laravel app (laravel_modules).

I have a route edit product in my ecommerce1:

Route::get('/edit/{article_name}/{article_id}', ['as' => 'edit_product', 'uses' => 'WebController@getEditProduct']);

I want print this route with the cart lines articles, the problem is that I iterate the cart lines in the external app laravel_modules.

To get this, I send the route('edit_product') from my ecommerce1 as variable to the 'cart_widget' from laravel_modules app.

I use empty params(spaces) because I do not have the cart lines in the method controller getCart from the ecommerce1 app:

 public function getCart() {

    $widget_params = array(
        'url_edit'          => route('edit_product',[' ',' ']), #not pass variables, only spaces
        'css_type'          => 'basic', # basic, flex, bootstrap
        'js_ommited'        => 'jquery_fancybox',      # omited scripts
        'css_ommited'       => 'jquery_fancybox',      # omited styles
    );
  // I make a request to http://laravel-modules/cart-widget and send this params

You follow me?, ok, Now we go to the modules laravel app, the method getCartWidget get this $widget_params, I print the $url_edit variable in the widget_cart.blade.php and iterate the cart lines:

@foreach ($cartlines as $line)
<!-- EDIT BTN -->
@if ($line['quantity'] != '-1')
    @if ($is_modifiable)

    <a class="btn_link edit" href="?line_ref=">
       <i class="fa fa-pencil"></i>
    </a>

    @endif
@endif
<!-- //EDIT BTN -->
@endforeach

$url_constructor prints http://ift.tt/1Uhfuv5

I want replace the %20(spaces) with my cart lines variables

Something like this:

<a class="btn_link edit" href="?line_ref=">
           <i class="fa fa-pencil"></i>
        </a>

And finally I want get this result: http://ift.tt/1Vlcb8r #articleid enter image description here



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire