app/Http/Controllers/UsersController.php
/**
     * Show the form for editing the specified resource.
     *
     * @param  \App\Models\Users  $Users
     * @return \Illuminate\Http\Response
     */
Show the form for editing the specified resource.
Show the form for editing the specified resource .
public function edit($id)
    {
        $user = User::findOrFail($id);
        $distributorLists = PriceList::where('role', '=', 'Distribuidor')->get(); 
        $ironmongerLists = PriceList::where('role', '=', 'Ferretero')->get(); 
        $listID = $user->price_list_id;
        if(empty($listID)){
            $list=null;
            return view('users.edit', compact('user','distributorLists','ironmongerLists','list'));
        }else{
            $list = PriceList::findOrFail($listID);
            return view('users.edit', compact('user','distributorLists','ironmongerLists','list'));
        }
    }
public function edit ( $ id ) { $ user = User :: findOrFail ( $ id ) ; $ distributorLists = PriceList :: where ( 'role' , '=' , 'Distribuidor' ) -> get ( ) ; $ ironmongerLists = PriceList :: where ( 'role' , '=' , 'Ferretero' ) -> get ( ) ; $ listID = $ user -> price_list_id ; if ( empty ( $ listID ) ) { $ list = null ; return view ( 'users.edit' , compact ( 'user' , 'distributorLists' , 'ironmongerLists' , 'list' ) ) ; } else { $ list = PriceList :: findOrFail ( $ listID ) ; return view ( 'users.edit' , compact ( 'user' , 'distributorLists' , 'ironmongerLists' , 'list' ) ) ; } }
Show the form for editing the specified resource.
Show the form for editing the specified resource .