Jabbadar
7/8/2016 - 9:16 PM

Helper Functions.

Helper Functions.

// Get Model from Eloquent object (controller)
$model = get_class($object);  // Full path
$model = class_basename(get_class($object)); // Model name


// Get current path 
// eg: foo/bar
$uri = $request->path(); 
// or
$uri = Request::path(); // Blade: {{ Request::path() }}

// Get current url 
// eg: http://domain.com/foo/bar
$url = $request->url();
// or
$url = Request::url(); // Blade: {{ Request::url() }}

// http://easylaravel.com/check-current-url


// Debug queries
dump($query->toSql());  // Get the query string
dump($query->getBindings()); // Get the query bindings