Answer the question
In order to leave comments, you need to log in
How to display data in another template?
Actually there is a CabinetController controller, in it I am trying to display data from the database table to the Cabinet template. Since I am new to laravel, I naturally did not think of how to transfer this data to the site.blade.php template.
class CabinetController extends BaseController {
public function Index(){
if(Auth::check()){
$sites = Site::selectSite();
return View::make('Cabinet')->with('sites', $sites);
}
else{
return View::make('cabinet.error');
}
}
}
class Site extends Eloquent {
public static $unguarded = true;
public static function selectSite(){
$sites = Site::all();
return $sites;
}
}
Answer the question
In order to leave comments, you need to log in
Love the manual and look there every time you don't know how to do this or that. It's much faster, I assure you, than asking and waiting for an answer.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question