Skip to content

Instantly share code, notes, and snippets.

@worldwayii
Created July 29, 2017 22:00
Show Gist options
  • Save worldwayii/1e3f7147e80ca376aea3d90cdfcf1012 to your computer and use it in GitHub Desktop.
Save worldwayii/1e3f7147e80ca376aea3d90cdfcf1012 to your computer and use it in GitHub Desktop.
<?php
namespace Legitcar\Http\Controllers;
use Illuminate\Http\Request;
use Legitcar\Api\V1\Models\Lga;
use Legitcar\Api\V1\Models\Year;
use Legitcar\Api\V1\Models\State;
use Legitcar\Api\V1\Models\Month;
use Legitcar\Api\V1\Models\Country;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
class HomeController extends Controller
{
/**
*@return View
*/
public function home()
{
$countryid = Country::all();
$stateid = State::where('country_id',38)->get();
$lgaid = Lga::all('name','id');
$month = Month::all('name','id');
$year = Year::all('year','id');
return View('home')->with(['countryid' => $countryid, 'stateid' => $stateid, 'lgaid' => $lgaid, 'month' =>$month, 'year' => $year]);
}
/**
*@return View
*/
//This controller returns the local governments that have same state_id to Json
public function getLga($id)
{
$lga = Lga::where('state_id',$id)->get();
return response()->json(['Success' => $lga,200]);
}
/**
*@return View
*/
public function about()
{
return $this->craft('about', 'About', 'All you need to know about LegitCar', '', 'About, About Us, About legitcar');
}
/**
*@return View
*/
public function disclaim()
{
return $this->craft('disclaim', 'Disclaimer', '', '', 'Disclaimer');
}
/**
*@return View
*/
public function contact()
{
return $this->craft('contact', 'Contact', '', '', 'Contact Us, contact');
}
/**
*@return View
*/
public function faq()
{
return $this->craft('faq', 'FAQs', 'Frequently Asked Questions', 'Frequently Asked Questions', 'faqs, frequently asked questions');
}
/**
*@return View
*/
public function terms()
{
return $this->craft('terms', 'Terms and Conditions', 'As of 6th June, 2017', '', 'Terms and conditions, terms, conditions');
}
/**
*@param string $page_id
*@param string $page_title
*@param string $page_subtitle
*@param string $page_description
*@param string $page_keywords
*@return View
*/
private function craft($page_id, $page_title, $page_subtitle = '',
$page_description = '', $page_keywords= ''
) {
return View('home.' . $page_id)->with([
'page_id' => $page_id,
'page_title' => $page_title,
'page_subtitle' => $page_subtitle,
'page_description' => $page_description,
'page_keywords' => $page_keywords
]);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment