Lia97

Lia97

Member Since 2 Months Ago

Experience Points
400
Total
Experience

4,600 experience to go until the next level!

In case you were wondering, you earn Laracasts experience when you:

  • Complete a lesson — 100pts
  • Create a forum thread — 50pts
  • Reply to a thread — 10pts
  • Leave a reply that is liked — 50pts
  • Receive a "Best Reply" award — 500pts
Lessons Completed
0
Lessons
Completed
Best Reply Awards
0
Best Reply
Awards
  • start your engines Created with Sketch.

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • first-thousand Created with Sketch.

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • 1-year Created with Sketch.

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • 2-years Created with Sketch.

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • 3-years Created with Sketch.

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • 4-years Created with Sketch.

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • 5-years Created with Sketch.

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • school-in-session Created with Sketch.

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • welcome-newcomer Created with Sketch.

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • full-time-student Created with Sketch.

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • pay-it-forward Created with Sketch.

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • subscriber Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • evangelist Created with Sketch.

    Laracasts Evangelist

    Earned if you share a link to Laracasts on social media. Please email [email protected] with your username and post URL to be awarded this badge.

  • chatty-cathy Created with Sketch.

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • lara-veteran Created with Sketch.

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • 10k-strong Created with Sketch.

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • lara-master Created with Sketch.

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • laracasts-tutor Created with Sketch.

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • laracasts-sensei Created with Sketch.

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • top-50 Created with Sketch.

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

Level 1
400 XP
Jul
09
2 months ago
Activity icon

Started a new Conversation Make Filter Search For Query Builder

I have a code like this.

	***
	DB::raw("(SELECT TAPET_NAME FROM MA_TAPE_TYPE WHERE TAPET_CODE = a.MATERIAL_TYPE) as 	media_type"), 
	DB::raw("(SELECT TAPEF_NAME FROM MA_TAPE_FORMAT WHERE TAPEF_CODE = a.MATERIAL_FORMAT) as media_format"), 
             DB::raw("CASE WHEN a.iden_flag = 'P' THEN b.epi_title WHEN a.iden_flag = 'C' THEN b.prod_version_name WHEN a.iden_flag = 'M' THEN b.promo_name END as episode_title"),
	DB::raw("(SELECT MAX (last_date) FROM run_master WHERE run_master.row_id_epi = w.row_id AND run_master.run_aired = 'Y') as last_tx")
	***

When I call it for the search function,

	if ($request->get('media_type') != '') {
        		$medias = $medias->where('a.material_type','like','%'.strtoupper($request->get('media_type')).'%');
    	}

    	if ($request->get('media_format') != '') {
        		$medias = $medias->where('a.material_format','like','%'.strtoupper($request->get('media_no')).'%');
   		 }
	
    	if ($request->get('episode_title') != '') {
       	 $medias = $medias->where('b.promo_name','like','%'.strtoupper($request->get('episode_title')).'%');
   		 }

   		 if ($request->get('last_tx') != '') {
        	$medias = $medias->where('last_date','like','%'.strtoupper($request->get('last_tx')).'%');
   		 }

the code cannot display the data that it should.

If i write a regular query like this,

***
->select('a.MATERIAL_ID as media_no'),.....
***

And

***
	        if ($request->get('media_no') != '') {
        $medias = $medias->where('a.material_id','like','%'.strtoupper($request->get('media_no')).'%');
    }
***

I can call for the search function and successfully find the data. How should I write the correct code for my search syntax as I used the syntax for that somewhat complicated query

Jul
08
2 months ago
Activity icon

Replied to Crashes When Using Union And Pagination

I've added it, and it still does not work and remains error. What is my code is correct like that?

Activity icon

Started a new Conversation Crashes When Using Union And Pagination

I have code

            $medias = DB::connection('oracle').....
               
	$materials = DB::connection('oracle').....
                 
	$union = $materials->union($medias);

	//pagination    
	$page = Request::get('page', 1);
	$paginate = 50;

	$offSet = ($page * $paginate) - $paginate;
	$itemsForCurrentPage = array_slice($union, $offSet, $paginate, true);
	$union = new \Illuminate\Pagination\LengthAwarePaginator($itemsForCurrentPage, count($union), $paginate, $page);

	return view('ReceiveMedia.index', compact('union'));

When running it I get an error like this

Error : ErrorException (E_WARNING) array_slice() expects parameter 1 to be array, object given

I searched the solution, I get like this

	$union = $materials->union($medias)->get()->toArray();

But, it keeps me getting an error

Error : Symfony \ Component \ Debug \ Exception \ FatalErrorException (E_UNKNOWN) Maximum execution time of 60 seconds exceeded

I'm so frustrated about this. Please if you know a solution would be to tell me

Jun
24
2 months ago
Activity icon

Replied to ORA-01789: Query Block Has Incorrect Number Of Result Columns ?

@bobbybouwmann I think both of these queries already have the same type of data, because both of those queries I've tried to run with the UNION command in SQL developer and it worked fine. But, when I run into Laravel will still get the error

Activity icon

Replied to ORA-01789: Query Block Has Incorrect Number Of Result Columns ?

@bobbybouwmann Each query generates the same number of columns as 12 columns.

Activity icon

Started a new Conversation ORA-01789: Query Block Has Incorrect Number Of Result Columns ?

I have a coding like this. There are two queries and I want to use Union. But I get an error "ORA-01789: query block has incorrect number of result columns". Is there any wrong with my syntax or how?

        public function index()
        {


        $medias = DB::connection('oracle')
                   ->table('ARCHIVE_LOG_SHEET_HDR AS a')
                   ->selectRaw("a.MATERIAL_ID, 'SHOOT' as media_type, NULL as media_format, b.HOUSE_NO, a.LOG_DATE, b.FILM_NAME, NULL as episode_title, NULL as episode_no, NULL as last_tx, a.REMARKS, a.LOCATION_ID, c.REMARKS as REMARK_DTL")
                   ->leftJoin('ARCHIVE_LOG_SHEET_PROG01 AS b', 'a.LOG_ID', '=', 'b.LOG_ID')
                   ->leftJoin('ARCHIVE_LOG_SHEET_DTL AS c', 'a.LOG_ID', '=', 'c.LOG_ID');



       $materials = DB::connection('oracle')
                  ->table("STOCK_MATERIAL AS x")
                  ->select('x.MATERIAL_ID', 'y.HOUSE_NO', 'x.TXN_DATE', 'y.PROGRAM_NAME', 'w.EPI_NO', 'x.REMARKS', 'x.LOCATION_ID', 'z.remarks',
                           DB::raw("(SELECT TAPET_NAME FROM MA_TAPE_TYPE WHERE TAPET_CODE = x.MATERIAL_TYPE) as media_type"),
                           DB::raw("(SELECT TAPEF_NAME FROM MA_TAPE_FORMAT WHERE TAPEF_CODE = x.MATERIAL_FORMAT) as media_format"),
                           DB::raw("(SELECT MAX (last_date) FROM run_master WHERE run_master.row_id_epi = w.row_id AND run_master.run_aired = Y) as last_tx,"),
                           DB::raw('CASE WHEN x.iden_flag = P THEN y.epi_title WHEN x.iden_flag = C THEN y.prod_version_name WHEN x.iden_flag = M THEN y.promo_name END as episode_title'))
                  ->leftJoin('STOCK_MATERIAL_EPI AS y', 'x.MATERIAL_ID', '=', 'y.MATERIAL_ID')
                  ->leftJoin('stock_material_slag AS z', 'x.MATERIAL_ID', '=', 'z.MATERIAL_ID')
                  ->leftJoin('PUR_EPISODE_HDR AS w', 'y.ROW_ID_EPI', '=', 'w.ROW_ID')
                  ->union($medias)
                  ->paginate(50);

         return view('ReceiveMedia.index', compact('medias', 'materials'));
     }

When running the coding I get an error "Illuminate\Database\QueryException thrown with message "Error Code : 1789 Error Message : ORA-01789: query block has incorrect number of result columns Position : 0 Statement : select count() as aggregate from "STOCK_MATERIAL" x left join "STOCK_MATERIAL_EPI" y on "X"."MATERIAL_ID" = "Y"."MATERIAL_ID" left join "STOCK_MATERIAL_SLAG" z on "X"."MATERIAL_ID" = "Z"."MATERIAL_ID" left join "PUR_EPISODE_HDR" w on "Y"."ROW_ID_EPI" = "W"."ROW_ID" union select a.MATERIAL_ID, 'SHOOT' as media_type, '' as media_format, b.HOUSE_NO, a.LOG_DATE, b.FILM_NAME, '' as episode_title, '' as episode_no, '' as last_tx, a.REMARKS, a.LOCATION_ID, c.REMARKS as REMARK_DTL from "ARCHIVE_LOG_SHEET_HDR" a left join "ARCHIVE_LOG_SHEET_PROG01" b on "A"."LOG_ID" = "B"."LOG_ID" left join "ARCHIVE_LOG_SHEET_DTL" c on "A"."LOG_ID" = "C"."LOG_ID" Bindings : [] (SQL: select count() as aggregate from "STOCK_MATERIAL" x left join "STOCK_MATERIAL_EPI" y on "X"."MATERIAL_ID" = "Y"."MATERIAL_ID" left join "STOCK_MATERIAL_SLAG" z on "X"."MATERIAL_ID" = "Z"."MATERIAL_ID" left join "PUR_EPISODE_HDR" w on "Y"."ROW_ID_EPI" = "W"."ROW_ID" union select a.MATERIAL_ID, 'SHOOT' as media_type, '' as media_format, b.HOUSE_NO, a.LOG_DATE, b.FILM_NAME, '' as episode_title, '' as episode_no, '' as last_tx, a.REMARKS, a.LOCATION_ID, c.REMARKS as REMARK_DTL from "ARCHIVE_LOG_SHEET_HDR" a left join "ARCHIVE_LOG_SHEET_PROG01" b on "A"."LOG_ID" = "B"."LOG_ID" left join "ARCHIVE_LOG_SHEET_DTL" c on "A"."LOG_ID" = "C"."LOG_ID")"

Jun
23
2 months ago
Activity icon

Started a new Conversation How This Query Works For Eloquent

I have a query like this. How should I convert it into a eloquent or query builder

SELECT x.MATERIAL_ID, (SELECT TAPET_NAME FROM MA_TAPE_TYPE WHERE TAPET_CODE = x.MATERIAL_TYPE) as media_type, (SELECT TAPEF_NAME FROM MA_TAPE_FORMAT WHERE TAPEF_CODE = x.MATERIAL_FORMAT) as media_format, STOCK_MATERIAL_EPI.HOUSE_NO, x.TXN_DATE, STOCK_MATERIAL_EPI.PROGRAM_NAME, CASE WHEN x.iden_flag = 'P' THEN STOCK_MATERIAL_EPI.epi_title WHEN x.iden_flag = 'C' THEN STOCK_MATERIAL_EPI.prod_version_name WHEN x.iden_flag = 'M' THEN STOCK_MATERIAL_EPI.promo_name END as episode_title, PUR_EPISODE_HDR.EPI_NO, (SELECT MAX (last_date) FROM run_master WHERE run_master.row_id_epi = PUR_EPISODE_HDR.row_id AND run_master.run_aired = 'Y') as last_tx, x.REMARKS, x.LOCATION_ID as shelf_no, stock_material_slag.remarks as short_list FROM STOCK_MATERIAL x LEFT JOIN STOCK_MATERIAL_EPI ON x.MATERIAL_ID = STOCK_MATERIAL_EPI.MATERIAL_ID LEFT JOIN stock_material_slag ON x.MATERIAL_ID = stock_material_slag.MATERIAL_ID LEFT JOIN PUR_EPISODE_HDR ON STOCK_MATERIAL_EPI.ROW_ID_EPI = PUR_EPISODE_HDR.ROW_ID

Activity icon

Started a new Conversation How To Convert This Query Into Laravel Eloquent Or Query Builder Way?

Can you help me. This is my query. I was confused, had to change. Very confusing for me. Subquery is so much as well as many conditions. Makes me confused how to convert to eloquent

SELECT x.MATERIAL_ID, (SELECT TAPET_NAME FROM MA_TAPE_TYPE WHERE TAPET_CODE = x.MATERIAL_TYPE) as media_type, (SELECT TAPEF_NAME FROM MA_TAPE_FORMAT WHERE TAPEF_CODE = x.MATERIAL_FORMAT) as media_format, STOCK_MATERIAL_EPI.HOUSE_NO, x.TXN_DATE, STOCK_MATERIAL_EPI.PROGRAM_NAME, CASE WHEN x.iden_flag = 'P' THEN STOCK_MATERIAL_EPI.epi_title WHEN x.iden_flag = 'C' THEN STOCK_MATERIAL_EPI.prod_version_name WHEN x.iden_flag = 'M' THEN STOCK_MATERIAL_EPI.promo_name END as episode_title, PUR_EPISODE_HDR.EPI_NO, (SELECT MAX (last_date) FROM run_master WHERE run_master.row_id_epi = PUR_EPISODE_HDR.row_id AND run_master.run_aired = 'Y') as last_tx, x.REMARKS, x.LOCATION_ID as shelf_no, stock_material_slag.remarks as short_list FROM STOCK_MATERIAL x LEFT JOIN STOCK_MATERIAL_EPI ON x.MATERIAL_ID = STOCK_MATERIAL_EPI.MATERIAL_ID LEFT JOIN stock_material_slag ON x.MATERIAL_ID = stock_material_slag.MATERIAL_ID LEFT JOIN PUR_EPISODE_HDR ON STOCK_MATERIAL_EPI.ROW_ID_EPI = PUR_EPISODE_HDR.ROW_ID

Can someone help me...

Activity icon

Replied to How To Convert This Raw Query Into Laravel Eloquent Way?

Maybe, until now honestly I'm still confused distinguish to have to use a query builder or eloquent.

What if I write a script like this..

               $medias = DB::connection('oracle')
                          ->table('ARCHIVE_LOG_SHEET_HDR AS a')
                          ->select('a.LOG_ID', 'a.MATERIAL_ID', 'a.LOG_DATE', 'a.REMARKS', 'a.LOCATION_ID',
                                   'b.FILM_NAME', 'b.HOUSE_NO',
                                   'c.REMARKS as REMARK_DTL')
                          ->leftJoin('ARCHIVE_LOG_SHEET_PROG01 AS b', 'b.LOG_ID', '=', 'a.LOG_ID')
                          ->leftJoin('ARCHIVE_LOG_SHEET_DTL AS c', 'c.LOG_ID', '=', 'a.LOG_ID');

Is it included in the query builder or eloquent?

Activity icon

Replied to How To Convert This Raw Query Into Laravel Eloquent Way?

Alright, if like that. What can I put it like, does the script below work?

$medias = DB::connection('oracle') ->table('ARCHIVE_LOG_SHEET_HDR') ->selectRaw("ARCHIVE_LOG_SHEET_HDR.MATERIAL_ID as media_no, 'SHOOT' as media_type, '' as media_format, ARCHIVE_LOG_SHEET_PROG01.HOUSE_NO as house_no, ARCHIVE_LOG_SHEET_HDR.LOG_DATE as entry_date, ARCHIVE_LOG_SHEET_PROG01.FILM_NAME as program_name, '' as episode_title, '' as episode_no, '' as last_tx, ARCHIVE_LOG_SHEET_HDR.REMARKS as remarks, ARCHIVE_LOG_SHEET_HDR.LOCATION_ID as shelf_no, ARCHIVE_LOG_SHEET_DTL.REMARKS as short_list") ->leftJoin('ARCHIVE_LOG_SHEET_PROG01', 'ARCHIVE_LOG_SHEET_HDR.LOG_ID', '=', 'ARCHIVE_LOG_SHEET_PROG01.LOG_ID') ->leftJoin('ARCHIVE_LOG_SHEET_DTL', 'ARCHIVE_LOG_SHEET_HDR.LOG_ID', '=', 'ARCHIVE_LOG_SHEET_DTL.LOG_ID') ->get()

But actually I want to use eloquent

Activity icon

Started a new Conversation A

Can you help me. This is my query. I was confused, had to change. Very confusing for me. Subquery is so much as well as many conditions. Makes me confused how to convert to eloquent

Activity icon

Started a new Conversation How To Convert This Raw Query Into Laravel Eloquent Way?

I'm confused, how to change this query to Eloquent. Can you help me. This is my raw query.