Support the ongoing development of Laravel.io →
posted 10 years ago
Eloquent
Last updated 2 years ago.
0

This code is working correctly but slow

class Content extends Eloquent {

	protected $table = 'content';

	public static function getTranslate($columns = array('*')) {

		$lng_table = Config::get('language.table');
		$lng_field = Config::get('language.field');

		$instance = new static;

		return $instance->newQuery()->join('lng_terms', function($join) {

			$join->on('content.id', '=', 'lng_terms.gid')
				->where('lng_terms.structure', '=', __CLASS__)
				->where('lng_terms.lang', '=', LaravelLocalization::getDefaultLocale());
		});
	}	
}
Route::group(array('prefix' => LaravelLocalization::setLocale()), function()
{
	Route::get('/', function()
	{
		return View::make('hello');
	});

	Route::get('/{path}', function($url)
	{
		echo Content::getTranslate()->where('url', '=', $url)->get();
	});	
});

Can anyone help me to accelerate this code?

Last updated 2 years ago.
0

debug = false, but slowly

Last updated 2 years ago.
0

If i use 12.0.0.1 instead of localhost for mysql connection this working fast!))) Hurray!

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

esomkin esomkin Joined 18 Mar 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.