Call Specific Value From SQL Table
Seeking your assistance i've a website laravel based where i need to have multi-lingual support for pages i've the following code to view pages :
@extends('web.layout')
@section('content')
<section class="aboutus-content aboutus-content-one">
<div class="container">
<div class="heading">
<h2>
<?=$result['pages'][0]->name?>
</h2>
<hr style="margin-bottom: 10;">
</div>`
<?=stripslashes($result['pages'][0]->description)?>
</div>
</section>
@endsection
the call function
$result['pages'] = DB::table('pages')
->leftJoin('pages_description', 'pages_description.page_id', '=', 'pages.page_id')
->where([['type','2'],['status','1'],['pages_description.language_id',session('language_id')]])
->orwhere([['type','2'],['status','1'],['pages_description.language_id',session('language_id')]])->orderBy('pages_description.name', 'ASC')->get();
database is just like this : https://prnt.sc/rpn9ye
issue is when i switch page language it wont grab arabic language it is stuck to english only to me despite it has the inputs correctly in database.
thank you in advance
Answer
it is solved by now
public function getPages($request) { $pages = DB::table('pages') ->leftJoin('pages_description', 'pages_description.page_id', '=', 'pages.page_id') ->where([['pages.status', '1'], ['type', 2], ['pages_description.language_id', session('language_id')], ['pages.slug', $request->name]]) ->orwhere([['pages.status', '1'], ['type', 2], ['pages_description.language_id', session('language_id')], ['pages.slug', $request->name]]) ->get(); return $pages; }
i've replaced one in orwhere with direct session id and it worked.
Related Questions
- → "failed to open stream" error when executing "migrate:make"
- → October CMS Plugin Routes.php not registering
- → OctoberCMS Migrate Table
- → OctoberCMS Rain User plugin not working or redirecting
- → October CMS Custom Mail Layout
- → October CMS - How to correctly route
- → October CMS - Conditionally Load a Different Page
- → Make a Laravel collection into angular array (octobercms)
- → In OctoberCMS how do you find the hint path?
- → How to register middlewares in OctoberCMS plugin?
- → Validating fileupload(image Dimensions) in Backend Octobercms
- → OctoberCMS Fileupload completely destroys my backend
- → How do I call the value from another backed page form and use it on a component in OctoberCms