hecate0211

Experience

890

0 Best Reply Awards

  • Member Since 2 Months Ago
  • 0 Lessons Completed
  • 0 Favorites

28th October, 2017

hecate0211 started a new conversation Dont Push If Id Exists • 3 weeks ago

i have an array like this 0 => array:11 [▼ "id" => 25 "job_id" => 111222 "surveyor_id" => 25 "date1" => "2017-10-28" "date2" => "2017-11-04" "progres" => 5 "problem" => null "status1" => "No" "status2" => "Yes" "status3" => "No" ] 1 => array:11 [▼ "id" => 39 "job_id" => 111222 "surveyor_id" => 25 "date1" => "2017-11-28" "date2" => "2017-12-04" "progres" => 10 "problem" => null "status1" => "Yess" "status2" => "No" "status3" => "No" ]

i just want to push index 1 to another array, my condition to push index 1 is the biggest id

26th October, 2017

hecate0211 left a reply on Help Me With Query • 4 weeks ago

@RamjithAp bro, i have query like this

select * from jobs j left join contracts c on(c.jobs_id=j.id) where j.method=1 and (j.type=2 or j.type=3)

i try like this

$query= DB::table('contracts')->leftJoin('jobs', 'contracts.job_id', '=', 'jobs.id')->distinct('contracts.job_id')->where('j.method', '=', 1)->where('j.type','=','2)->orWhere('j.type','=','3)->orderBy('contracts.created_at', 'desc')->select('kontraks.*')>get();

but the return in this array still have method like 11 or 15

hecate0211 left a reply on Help Me With Query • 4 weeks ago

@RamjithAp btw if i just want to select from my CONTRACT TABLE the lastest updated_at like this

id          job_id      contract_no  price_contract      date               created_at
10005       1           CCC333       999                    2017-01-01      2017-01-05 10:36:38
10011       2           DEF345          1800                    2017-05-05      2017-05-07 10:36:38

btw i just want to select only from CONTRACT_TABLE

hecate0211 started a new conversation Help Me With Query • 4 weeks ago

i have 2 table like this

(JOB TABLE)
id  name    price
1   A       1,000
2   B       2,000
3   C       3,000
CONTRACT TABLE
id      job_id  contract_no price_contract  date            created_at
10002   1       AAA111      999             2017-01-01  2017-01-03 10:36:38
10003   1       BBB222      999             2017-01-01  2017-01-04 10:36:38
10005   1       CCC333      999             2017-01-01  2017-01-05 10:36:38

10010   2       ABC123      1800            2017-05-05  2017-05-05 10:36:38
10011   2       DEF345      1800            2017-05-05  2017-05-07 10:36:38

i want to join this table and get the lastest ``created_at`` like this
id_job  name    price   contract_no date            price_contract
1       A       1,000   CCC333      2017-01-01  999             
2       B       2,000   DEF345      2017-05-05  1800            

can u help me?

hecate0211 started a new conversation Get Array Value From Controller • 4 weeks ago

i have an array like this, this array from my controller and i parse to my view before i send to my view i try to see my array with dd(myArray); and my array like this

  416 => array:3 [▼
    "no" => []
    "date" => []
    "price" => []
  ]
  417 => array:3 [▼
    "no" => array:1 [▼
      0 => null
    ]
    "date" => array:1 [▼
      0 => null
    ]
    "price" => array:1 [▼
      0 => "323812000"
    ]
  ]

can u help me to solve this problem?

25th October, 2017

hecate0211 left a reply on Join 2 Array • 4 weeks ago

@matt_panton i try using ur code but i got error like this array_merge(): Argument #1 is not an array

hecate0211 left a reply on Join 2 Array • 4 weeks ago

@tisuchi i tried using array_merge() but the resulut will like this array:868 [▼ 0 => {#229 ▼ +"id": 1 +"name": "name" +"price": "98,302,820.00" } 1 => {#229 ▼ +"id": 2 +"name": "name2" +"price": "98,302,820.00" } 3 => array:1 [▼ 0 => {#672 ▼ +"created_at": "2017-01-12 21:00:01" +"updated_at": "2017-01-13 13:00:02" } ] 4 => array:1 [▼ 0 => {#672 ▼ +"created_at": "2017-01-12 21:00:01" +"updated_at": "2017-01-13 13:00:02" } ]

hecate0211 left a reply on How To Select Data In Table • 4 weeks ago

@tykuss can u help me again, i was wrong the critreai wasn't the biggest progress but the lastest date..

hecate0211 started a new conversation Combine 2 Array • 4 weeks ago

i have 2 array and i want to combine the array like this

array 1 like this (btw this array i got from query and make it to array
array:868 [▼
  0 => {#229 ▼
    +"id": 1
    +"name": "name"
    +"price": "98,302,820.00"
  }
  1 => {#229 ▼
    +"id": 2
    +"name": "name2"
    +"price": "98,302,820.00"
  }
array 2 like this(btw this array i got from query, and in my php i using array_push from array 1 to get id)
 0 => array:1 [▼
    0 => {#672 ▼
      +"created_at": "2017-01-12 21:00:01"
      +"updated_at": "2017-01-13 13:00:02"
    }
  ]
 1 => array:1 [▼
    0 => {#672 ▼
      +"created_at": "2017-01-12 21:00:01"
      +"updated_at": "2017-01-13 13:00:02"
    }
  ]

and i want to join this 2 array like this

array:868 [▼
  0 => {#229 ▼
    +"id": 1
    +"name": "name"
    +"price": "98,302,820.00"
+"created_at": "2017-01-12 21:00:01"
      +"updated_at": "2017-01-13 13:00:02"
  }
  1 => {#229 ▼
    +"id": 2
    +"name": "name2"
    +"price": "98,302,820.00"
    +"created_at": "2017-01-12 21:00:01"
    +"updated_at": "2017-01-13 13:00:02"
  }

23rd October, 2017

hecate0211 left a reply on Change Laravel Login • 1 month ago

@tisuchi coz i have a lot of data in my previous DB and using username and password(md5), and now i want to migrate to laravel.

hecate0211 started a new conversation Change Laravel Login • 1 month ago

if u use php artisan make:auth in our database automatically create users table, and have coloumn email, password, remember toker, etc.. if u want to login it will check ur email and password.. i want to change login using username and password(MD5) can u help me?

20th October, 2017

hecate0211 left a reply on How To Select Data In Table • 1 month ago

@tykus thx bro

hecate0211 left a reply on I Can Not Register A User • 1 month ago

make sure in your file .env DB_DATABASE, DB_USERNAME, and DB_password is correct with your database

hecate0211 left a reply on How To Select Data In Table • 1 month ago

@tykus the biggest progress

hecate0211 started a new conversation How To Select Data In Table • 1 month ago

i have 2 table in my DB, job and job_detail job table have id, name and job_detail have id, job_id(fk), progress

i try this query

select *
from job j INNER JOIN job_detail jd on (j.id=jd.job_id)

and my query result like this

id  name    progress
1   A       20
2   B       2
2   B       40

i just want to get only like this

id  name    progress
1   A       20
2   B       40

can someone help me with this problem?? thx

13th October, 2017

hecate0211 left a reply on How To Update From Array • 1 month ago

@saurabhd thanks for ur help

hecate0211 started a new conversation How To Update From Array • 1 month ago

i have an array like this

["id"=>1, "persen"=>20]
["id"=>2, "persen"=>40]
["id"=>3 "persen"=>100]

how to update this array to my database??

11th October, 2017

hecate0211 started a new conversation Why I Cant Return To Other Linke After I Send Ajax To Controller • 1 month ago

this is my script for send ajax to controller

function simpan(){
        var data = [];
        var input = document.getElementById("lblWeek").value;
        for(i=1;i<=input;i++){
            var id = document.getElementById(i).value;
            data.push(id);
        }
        alert(data);
         $.ajax({
              url:'/a',
              type: 'POST',
              headers:{"content-type" : "application/json"},
              data: JSON.stringify(data),
          });

    }   

and this is my route

Route::post('a','[email protected]');

and this is my Controller

 public function testing(Request $request)
    {
        
        $datas = $request->all();
        $dataset = [];
        foreach ($datas as $data) {
            $dataset[] = [
                'input' => $data[0]
            ];
        }

        return view('home');
    }

i cant return to my home, but i check using chrome inspect element in network tab, i saw it back to home, but in my program not back to my home

9th October, 2017

hecate0211 left a reply on How To Make Sub Query Where In Laravel • 1 month ago

@cronix but if u use DB::select('myquery') i cant use pagination function.. can u help me?

hecate0211 left a reply on How To Make Sub Query Where In Laravel • 1 month ago

@Cronix thx bro

hecate0211 left a reply on How To Make Sub Query Where In Laravel • 1 month ago

@Cronix yeah i using model.. can u give exaple how to use DB::raw ?? i still dont understand how to use it

hecate0211 started a new conversation How To Make Sub Query Where In Laravel • 1 month ago

this is my query

FROM users u INNER JOIN kegiatan_surveys ks on(u.id = ks.user_surveyor_id) inner join pekerjaans p on (ks.pekerjaan_id = p.id_pekerjaan) inner join kontraks k on(k.pekerjaan_id=p.id_pekerjaan) inner JOIN setting_basts sb on (sb.kontrak_id=k.id_kontrak)
WHERE ks.tgl_survey > (SELECT ks.tgl_survey
       FROM pekerjaans p inner join kegiatan_surveys ks on(ks.pekerjaan_id=p.id_pekerjaan)
       ORDER by ks.tgl_survey asc
      limit 1
      )

but i dont know how to make this to laravel can some one help me??

4th October, 2017

hecate0211 started a new conversation PHP Array Output • 1 month ago

i have an array like this

    $arrays = array(array('a','b','c','d','e'), array(1,2,3,4,5));

and i want to show this array like this [['a','b','c','d','e'],[1,2,3,4,5]]

i have try using print_r and dd but it cant show up like that.. can u help me?

hecate0211 left a reply on How To Return Back The Page After Saving Data?? • 1 month ago

@denisdulici it doesnt work too

hecate0211 started a new conversation Type Error: Too Few Arguments To Function App\Http\Controllers\TesController::saveJson() • 1 month ago

i got this error

Type error: Too few arguments to function App\Http\Controllers\TesController::saveJson(), 1 passed and exactly 2 expected

when i create function in my controller

**
     * Update the specified user.
     *
     * @param  Request  $request
     * @param  int  $id
     * @return Response
     */
        public function saveJson(Request $request, $id)
        {
            
            echo($id);


        }

hecate0211 left a reply on How To Check User Role If Equals As Admin In Blade • 1 month ago

@Ugo4brain i try u code and got this error

Call to undefined method Illuminate\Database\Query\Builder::hasRole() (View: C:\xampp\htdocs\tes\resources\views\layouts\home.blade.php) (View: C:\xampp\htdocs\tes\resources\views\layouts\home.blade.php)

3rd October, 2017

hecate0211 left a reply on How To Check User Role If Equals As Admin In Blade • 1 month ago

@Ugo4brain

public function isAdministrator()
   {
       return $this->hasRole('Admin');
   } 

this code write on userController or in user model??

hecate0211 started a new conversation How To Check User Role If Equals As Admin In Blade • 1 month ago

i want to check if my user role if Admin in my home.blade.php

my database user colomn

name = admin
password = admin
role = Admin

can u help me??

18th September, 2017

hecate0211 left a reply on How To Send Array From Script To Controler • 2 months ago

@Dry7 bro, when i send the array.. why i got null when use

 $data = json_decode($request->getContent());

and when i use

$data2 = $request->getContent();

the result i got

16th September, 2017

hecate0211 left a reply on How To Send Array From Script To Controler • 2 months ago

@Dry7 oh iknow my error thanks for ur big help bro

hecate0211 left a reply on How To Send Array From Script To Controler • 2 months ago

@Dry7 i already use in my code


public function saveJson($request)
        {
            $data = json_decode($request->getContent());
        }

and got error


(1/1) FatalThrowableError
Type error: Too few arguments to function App\Http\Controllers\RabController::saveJson(), 0 passed and exactly 1 expected```

hecate0211 left a reply on How To Send Array From Script To Controler • 2 months ago

@Dry7 this is my full code

view

<button class="btn btn-primary" id='save' onclick="sendData()">Import File</button>

<script type="text/javascript">
              function sendData() {
                  var data = [
                      1,
                      2,
                      3
                    ];
                  $.ajax({
                      url:'/test',
                      type: 'POST',
                      dataType:'json',
                      contentType: 'json',
                      data: {data:JSON.stringify(data)},
                      contentType: 'application/json; charset=utf-8',
                  });
              }
</script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>

route

Route::post('/test','[email protected]');

controller

public function saveJson($request)
        {
            $data = json_decode($request->getContent());

        }

hecate0211 left a reply on How To Send Array From Script To Controler • 2 months ago

@Dry7

(1/1) FatalThrowableError
Type error: Too few arguments to function App\Http\Controllers\RabController::saveJson(), 0 passed and exactly 1 expected

i got this error

hecate0211 left a reply on How To Send Array From Script To Controler • 2 months ago

@Dry7 but how to send the json to controller?? i try use

var jsonPost = JSON.stringify(dataTables);
                alert(jsonPost);
                
                $.ajax({
                    url:'/tes',
                    type: 'POST',
                    dataType:'json',
                    contentType: 'json',
                    data: {data:jsonPost}
                });

but i dont know if it work or not i still confuse can u teach me bro?

14th September, 2017

hecate0211 started a new conversation How To Send Array From Script To Controler • 2 months ago

i want to send my array to controller, but i idont understand how to send it

this is my view

Import File

this is my script document.querySelector('#save').addEventListener('click', function() { var dataTables = []; var rows = hot.countRows()-20; var cells = hot.countCols();

            for(i =1; i<rows;i++){
                  dataTables = [dataTables, [hot.getDataAtCell(i,0), hot.getDataAtCell(i,1),
                  hot.getDataAtCell(i,2),hot.getDataAtCell(i,3),hot.getDataAtCell(i,4),
                  hot.getDataAtCell(i,5)]];
            }
            
          });

can someone help me?

Edit Your Profile
Update

Want to change your profile photo? We pull from gravatar.com.