Here I have been using json to be sent to the view but all the time around I am getting Variable Undefined error where print_r() inb the controller gives the variable value correctly.
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Model\BB\Invoices\BB_Invoices;
class BB_InvoicesController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
$BB_Invoices=BB_Invoices::all()->toArray();
$BB_Invoices=json_encode($BB_Invoices);
//print_r($BB_Invoices);
//return View::make('BB_Invoices.index', compact($BB_Invoices));
return view('BB_Invoices.index', compact($BB_Invoices));
}
}
and I am getting this error-
"Undefined variable: BB_Invoices
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire