dimanche 13 mars 2022

How can I redirect html codes to controller in Laravel?

This is my code

<?php

namespace App\Http\ViewComposers;

use Illuminate\View\View;
use Auth;

class SideNavDeliGroceryComposer
{
    /**
     * Bind data to the view.
     *
     * @param  View  $view
     * @return void
     */
    public function compose(View $view)
    {
        $navigations = [
            'dashboard' => [
                'title' => 'Dashboard',
                'url' => 'deligrocery.dashboard.view',
                'icon' => 'delirush-am-dashboard',
                'permission_for' => 'dashboard'
            ],
            'customers' => [
                [
                    'title' => 'Customers',
                    'url' => 'deligrocery.customer.view',
                    'icon' => 'delirush-am-customers',
                    'permission_for' => 'customer'
                ], [
                    'title' => 'Orders',
                    'url' => 'deligrocery.customer.order-management.view',
                    'icon' => 'delirush-am-orders',
                    'permission_for' => 'order'
                ]
            ],
            'delivery' => [
                [
                    'title' => 'Rushers',
                    'url' => 'deligrocery.delivery.rusher.view',
                    'icon' => 'delirush-am-rushers',
                    'permission_for' => 'rusher'
                ], [
                    'title' => 'Job Order Management',
                    'url' => 'deligrocery.delivery.job-order.view',
                    'icon' => 'delirush-am-delivery',
                    'permission_for' => 'job-order'
                ]
            ],
            'grocery_partner' => [
                [
                    'title' => 'Partner Management',
                    'url' => 'deligrocery.grocery-partner.partner-manager.view',
                    'icon' => 'fa-solid fa-store',
                    // 'icon' => 'delirush-am-food-partners',
                    'permission_for' => 'rusher'
                    
                ]
            ],
            'service_settings' => [
                [
                    'title' => 'Delivery Service Configuration',
                    'url' => 'deligrocery.delivery_service_settings.view',
                    'icon' => 'delirush-am-delivery-fee',
                    'permission_for' => 'delivery-service-configuration'
                ]
            ],
            'finance' => [
                [
                    'title' => 'Finance Management',
                    'url' => 'deligrocery.finance.merchant-partner-commission-report.view',
                    'icon' => 'delirush-am-finance',
                    'permission_for' => 'finance'
                ]
            ],
            'Tools' => [
                [
                    'title' => 'Category Type Management',
                    'url' => 'deligrocery.tools.category-type.view',
                    'icon' => 'delirush-am-finance',
                    'permission_for' => 'finance'
                ]
            ],
        ];
        
        // $navs = ['customers' => [],'delivery' => []];
        // $permissions = Auth::guard('admin')->user()->getAllPermissions()->groupBy('permission_for');
        // foreach ($permissions as $permissionKey => $permission) {
        //     foreach($navigations as $navKey => $navigation) {
        //         $permissionFors = array_column($navigation, 'permission_for');
        //         $check = array_search($permissionKey, $permissionFors);
        //         if($check !== false) {
        //             array_push($navs[$navKey], $navigation[$check]);
        //         }
        //     }
        // }
        
        $view->with([
            'navs' => $navigations,
            'current' => request()->route()->getName()
        ]);
    }
}

I want to put this code <i class="fa-solid fa-store"></i> inside array in 'icon' label



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire