I am trying (and failing!) to generate a list of factsheets from the database that have been tagged according to language (English or Vietnamese). I have a route in which the variable can be either "en" or "vn" being passed to the index function in my controller
Route::get('/pest/{id}', 'api\FactsheetsController@index');
My controller is currently as...
namespace App\Http\Controllers\Api;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use App\Http\Controllers\Controller;
class FactsheetsController extends Controller
{
public function index($lang)
{
$factsheets = DB::table("factsheetcontents as fsc")
->where('fsc.lang',$lang)
->select('fsc.title', 'fsc.id', 'fsc.shortimg')
->get();
return $factsheets;
}
I receive an empty response ([]) for my efforts. What am I doing wrong here?
Thanks, Tom
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2Rwnpc6
via IFTTT
Aucun commentaire:
Enregistrer un commentaire