title: Laravel: How to dynamically create and name views?
body: <p>I am making a website for college administration where professors log in and assign marks to the students they are teaching.</p>
  
  <p>There's a table, called <strong><em>"IA_Marks"</em></strong> in my database:</p>
  
  <pre><code>|Student_ID|Subject_Code|Name|Marks1|Marks2|Marks3|Semester|Division|
  </code></pre>
  
  <p>There's also a table called <strong><em>"Classroom_Mapper"</em></strong> in my database, that helps map a professor to a classroom, with a subject:</p>
  
  <pre><code>|Prof_ID|Subject_Code|Semester|Division|
  </code></pre>
  
  <p>This is a method in my controller:</p>
  
  <pre><code>public function showTable(){
      $sem = DB::table('classroom_mappers')-&gt;where('Prof_ID', auth()-&gt;user()-&gt;PID)-&gt;pluck('semester');
      $division = DB::table('classroom_mappers')-&gt;where('Prof_ID', auth()-&gt;user()-&gt;PID)-&gt;pluck('division');
      $data = DB::table('iamarks')-&gt;where([['semester','=',$sem],['division','=',$division]])-&gt;get();
      return view('ia',compact('data'));
  }
  </code></pre>
  
  <p>Using this, I can fetch rows that belong to the professor who has logged in.</p>
  
  <hr>
  
  <p>But, there's a problem.</p>
  
  <p>Say the professor teaches two subjects, in two semesters. Then, the <code>where</code> clause will return multiple results from the mapper table. 
  For example:</p>
  
  <pre><code>select semester from classroom_mapper where Prof_ID=auth()-&gt;user()-&gt;Prof_ID
  </code></pre>
  
  <p>output:</p>
  
  <blockquote>
    <p>8</p>
    
    <p>5</p>
  </blockquote>
  
  <p>Then the students from both 5th and 8th semester will be shown on his dashboard. Our target semester was, say 5th. Then it'll be a problem.</p>
  
  <p>Registering for a subject, is done as shown here: 
  <a href="https://i.stack.imgur.com/IABcj.png" rel="nofollow noreferrer">form screenshot</a></p>
  
  <p>Let's call the subject being registered in the screenshot "SUBJECT 4".
  It is a subject for the 5th semester, division A.</p>
  
  <p>I want to dynamically make a button(SUBJECT 4) on the dashboard, which when clicked, sends the semester(5) and division(A) of choice to the controller. 
  <a href="https://i.stack.imgur.com/JlCOV.png" rel="nofollow noreferrer">Dashboard Screenshot</a></p>
  
  <p>This button should open a newly made page with name of the subject(subject4.blade.php), where the database table contents for target semester and division(5 and A) will be shown.</p>
  
  <p>How do I make this dynamic view creating button which sends specific info to controller? Is it even possible?</p>