Laravel 5 and Angular Getting JSON From Controller
<p>This is more of a concept question, so I apologize if it isn't specific enough.</p>

<p>I am coming from a Jquery/AngularJS background; usually I am doing front-end stuff and only work with a back-end sparingly.</p>

<p>I am trying to learn Laravel 5 to expand my skills, but am having trouble conceptually fitting together what I know from Angular with what Laravel is telling me.</p>

<p>I want CRUD functionality to a database using Angular, but I want Laravel to help me get that database from MySQL to JSON so it can be passed.</p>

<p>What I have done is made the following in Laravel:</p>

<p>~Model:</p>

<pre><code>namespace App;

use Illuminate\Database\Eloquent\Model;

class Pun extends Model
{
    /**
     * The table associated with the model.
     *
     * @var string
     */

     public $timestamps = false;
}
</code></pre>

<p>~Controller:</p>

<pre><code>namespace App\Http\Controllers;

use App\Pun;
use App\Http\Controllers\Controller;

class PunController extends Controller
{
    /**
     * Show a list of all available puns.
     *
     * @return Response
     */
    public function index()
    {
        $puns = Pun::all();

        return Response::json($puns-&gt;toArray());
    }
}
}
</code></pre>

<p>~Route: </p>

<pre><code>Route::get('showpunsfromdatabase', function () {
    return view('???');
});
</code></pre>

<p>The question marks above is where I am having trouble. If I understand it correctly, the controller is supposed to query the database as defined in the model, and output the results as JSON. How do I then direct Angular to this controller so I can get this JSON using the <code>$http</code> service? Does it have to go in a view that then pulls it in? I don't really want it in a "view", I just want the data (JSON) available to Angular. Am I thinking about this correctly?</p>

<p>My angular controller looks like this:</p>

<pre><code>$scope.punGenerate = function(){
    $http.get("???").then(function (response) {$scope.thePunJSON = response.data;});
}
</code></pre>