title: laravel, display data on a drop down from another table
body: <p>Hello guys I have a table <strong>manufacturers</strong> (columns <strong><em>'manufacturer_id'</em></strong>, <strong><em>'manufacturer'</em></strong>) and want display a "select" list based by this table dynamically in a different but linked view <strong>'asset.blade.php'</strong>. </p>
  
  <p><strong><em>Model - Asset.php</em></strong></p>
  
  <pre><code>namespace App;
  
  class Asset extends Model
  {
      protected $primaryKey = 'asset_id';
  
  }
  </code></pre>
  
  <p><strong><em>Controller - AssetController</em></strong></p>
  
  <pre><code>namespace App\Http\Controllers;
  
  use App\Asset;
  use App\Manufacturer;
  
  use Illuminate\Http\Request;
  
  class AssetController extends Controller
  {
      public function asset(){
  
          $assets = Asset::all();
          return view('viewAsset', ['assets' =&gt; $assets]);
      }
  
      public function getmanufacturerlist() {
          $Manufacturer = Manafacturers::all();
          return view('manufacturer')-&gt;with('data', $Manufacturer);
      }
  
      public function add(Request $request){
          $this-&gt;validate($request, [
              'asset_id' =&gt; '',
              'asset_category_id' =&gt; 'required',
              'manufacturer_id' =&gt; 'required',
              'department_id' =&gt; 'required',
          ]);
          $assets =  new Asset;
          $assets  -&gt;asset_id  = $request-&gt;input('asset_id');
          $assets  -&gt;asset_category_id = $request-&gt;input('asset_category_id');
          $assets  -&gt;manufacturer_id = $request-&gt;input('manufacturer_id');
          $assets  -&gt;department_id = $request-&gt;input('department_id');
          $assets  -&gt;save();
          return redirect('/viewAsset') -&gt;with('info', 'New Asset Saved Successfully!');
      }
  }
  </code></pre>
  
  <p><strong><em>manufacturer.blade.php</em></strong></p>
  
  <pre><code>&lt;select name="manufacturer_id"&gt;
  &lt;option&gt;Select a Manufacturer&lt;/option&gt;
  @foreach( $manufacturer as $manufacturers )
  &lt;option value=" &lt;?php echo $manufacturers-&gt;manufacturer_id; ?&gt;" &gt; &lt;?php echo $manufacturer-&gt;manufacturer?&gt; &lt;/option&gt;
   @endforeach
  &lt;/select&gt;
  </code></pre>
  
  <p>when i execute my project - it works just fine, i see the dropdown list. But if I include my <code>manufacturer.blade.php</code> in the form:</p>
  
  <pre><code> @include('forms.manufacturer')
  </code></pre>
  
  <p>I get the error</p>
  
  <pre><code>Undefined variable: manufacturer.
  </code></pre>
  
  <p>How do i fix the error? My Laravel version is 5.4.</p>