rully

rully

Member Since 3 Months Ago

Experience Points
870
Total
Experience

4,130 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
870 XP
Mar
26
2 weeks ago
Activity icon

Started a new Conversation How To Auto Add Users_id In Foreign Key And One To Many Relations

this the controller

`public function store(Request $request) { $siswa = new Siswa; $siswa->nama = $request->nama; $siswa->nisn = $request->nisn; $siswa->pict = $request->pict; $siswa->kelas = $request->kelas; $siswa->jurusan = $request->jurusan; $siswa->save();

    toastr('success!');
    return back();
}`

this is the siswa model

public function user() { return $this->hasMany(User::class); }

this is the users model

public function Siswa() { return $this->belongsTo(Siswa::class); }

Mar
23
2 weeks ago
Activity icon

Started a new Conversation Laravel Relations Foreign Key

$table->bigIncrements('id'); $table->unsignedBigInteger('siswa_id'); $table->string('name'); $table->string('email')->unique(); $table->timestamp('email_verified_at')->nullable(); $table->string('nik_nisn'); $table->string('type'); $table->string('password'); $table->rememberToken(); $table->timestamps(); $table->foreign('siswa_id')->references('id')->on('siswa');

how do i do relations in users table? while the email field is unique, when I keep trying an error occurs. maybe the error appears because the email field is unique. Any suggestions for me?

Mar
19
3 weeks ago
Activity icon

Started a new Conversation Laravel Datatables

I'm trying datatables, there's a problem when I want to redirect to the edit form, the button doesn't work at all

this is my controller

->addColumn('action', function($data){ $button = ' Action Edit Delete '; return $button; }) ->rawColumns(['action']) ->make(true);

and this is the ajax that I made :

$(document).on('click', '.edit', function(){ var id = $(this).attr('id'); $.ajax({ url :"users/" + id + "/edit", dataType:"json", success:function(data) { console.log("OK"); } }) });

the button doesnt redirect to form edit, so plz help me :)

Mar
18
3 weeks ago
Activity icon

Replied to Laravel Blade

Ok,thanks sir

Mar
17
3 weeks ago
Activity icon

Started a new Conversation Laravel Blade

{!! Form::select('users', $users, null, ['id' => 'users', 'class' => 'form-control', 'required' => 'required']) !!}

what it looks like if you change it to a normal form control?

Mar
15
3 weeks ago
Activity icon

Started a new Conversation Laravel Alerts

how to send alert when login failed,where is the controller for editing the code of auth login

Jan
29
2 months ago
Activity icon

Replied to Laravel Tech Hide From Wappalyzer

doesnt work for me, the technology stack still can be view by wappalyzer

Jan
28
2 months ago
Activity icon

Started a new Conversation Laravel Tech Hide From Wappalyzer

how to hide laravel technology from wappalyzer or the like? the tutorial says that I have to change the following code:

from: 'cookie' => 'laravel_session',

to: 'cookie' => 'yourapp_session',

whereas in laravel 5.7 my initial code is as follows: 'cookie' => env( 'SESSION_COOKIE', Str::slug(env('APP_NAME', 'salesaktif'), '_').'_session' ), i can try, but still doesnt work.anyone can help me,please?

Jan
02
3 months ago
Activity icon

Replied to Laravel Read Image From Public Folder

image, app - public -thumbnail. can you help me please

Activity icon

Replied to Laravel Read Image From Public Folder

@fylzero the same, doesnt work for me

Jan
01
3 months ago
Activity icon

Started a new Conversation Laravel Read Image From Public Folder

im stuck, please help me

I've seen some references from the web tutorial, but still can't when I try. I want to read an image from one of the folders in the public folder. I use laravel 5.8.33

anyone can help? please

this code: {{ asset('/thumbnail/. $blog->IMAGE' ) }} from src

Dec
17
3 months ago
Activity icon

Replied to Laravel Hierarchy Users

i mean how i count all results in , supervisor,mng,and general manager? the table is hierarchy

Activity icon

Replied to Laravel Hierarchy Users

INSERT INTO results (id, salescode, nama_ktp, no_ktp, alamat, kota, kel, kec, rt, rw, kode_pos, tanggal_lahir, jenis_kelamin, telp_rumah, no_hp, no_hp_2, email, stts_rumah, tipe_rumah, akses_lokasi, alamat_pemasangan, kota_pemasangan, kec_pemasangan, kel_pemasangan, rt_pemasangan, rw_pemasangan, kodepos_pemasangan, kategori_produk, produk_nama, value_pack, produk_market, payment, bonus, installasi_fee, catatan_pemasangan, total_harga, nomor_tlp, longitude, latitude, foto, foto_dua, foto_tiga, status_verifikasi, user_id, result_type, region, created_at, updated_at) VALUES (9, 'A001-LDR01', 'sssss', '32', NULL, NULL, NULL, 's', '32', '2', '32', '3', '3', '2', '2', NULL, 'irvslyy23@gmail.com', '0', '2', '3', '3', 'MALANG', 's', 's', 's', 's', '', 's', 's', 's', 's', 's', 's', 's', 's', 's', NULL, '-32', '999234', '794267613.png', '19842668.png', '935397725.png', 'verify', 18, 'closing', '-', '2019-12-16 20:17:16', '2019-12-15 20:17:16'), (10, 'A001-LDR02', 'sssss', '32', NULL, 'malang', NULL, 's', '32', '2', '32', '3', '3', '2', '2', NULL, 'irvslyy23@gmail.com', '0', '2', '3', '3', 'DEPOK', 's', 's', 's', 's', NULL, 's', 's', 's', 's', 's', 's', 's', 's', 's', NULL, '-32', '999234', '794267613.png', '19842668.png', '935397725.png', 'verify', 19, 'closing', 'jabodetabek', '2019-12-16 20:17:16', '2019-12-15 20:17:16'), (11, 'A001-LDR002', 'sssss', '32', NULL, NULL, NULL, 's', '32', '2', '32', '3', '3', '2', '2', NULL, 'irvslyy23@gmail.com', '0', '2', '3', '3', 'BEKASI UTARA', 's', 's', 's', 's', NULL, 's', 's', 's', 's', 's', 's', 's', 's', 's', NULL, '-32', '999234', '794267613.png', '19842668.png', '935397725.png', 'verify', 23, 'closing', 'jabodetabek', '2019-12-16 20:17:16', '2019-12-15 20:17:16'), (12, 'A001-LDR002', 'sssss', '32', NULL, NULL, NULL, 's', '32', '2', '32', '3', '3', '2', '2', NULL, 'irvslyy23@gmail.com', '0', '2', '3', '3', 'MALANG', 's', 's', 's', 's', NULL, 's', 's', 's', 's', 's', 's', 's', 's', 's', NULL, '-32', '999234', '794267613.png', '19842668.png', '935397725.png', 'verify', 23, 'closing', '-', '2019-12-16 20:17:16', '2019-12-15 20:17:16'), (13, 'A001-LDR001', 'sssss', '32', NULL, NULL, NULL, 's', '32', '2', '32', '3', '3', '2', '2', NULL, 'irvslyy23@gmail.com', '0', '2', '3', '3', 'as', 's', 's', 's', 's', NULL, 's', 's', 's', 's', 's', 's', 's', 's', 's', NULL, '-32', '999234', '794267613.png', '19842668.png', '935397725.png', 'verify', 22, 'closing', '-', '2019-12-16 20:17:16', '2019-12-15 20:17:16'), (14, 'A001-LDR001', 'sssss', '32', NULL, NULL, NULL, 's', '32', '2', '32', '3', '3', '2', '2', NULL, 'irvslyy23@gmail.com', '0', '2', '3', '3', 'as', 's', 's', 's', 's', NULL, 's', 's', 's', 's', 's', 's', 's', 's', 's', NULL, '-32', '999234', '794267613.png', '19842668.png', '935397725.png', 'verify', 22, 'closing', '-', '2019-12-16 20:17:16', '2019-12-15 20:17:16'), (15, 'A001-LDR02', 'sssss', '32', NULL, 'malang', NULL, 's', '32', '2', '32', '3', '3', '2', '2', NULL, 'irvslyy23@gmail.com', '0', '2', '3', '3', 'DEPOK', 's', 's', 's', 's', NULL, 's', 's', 's', 's', 's', 's', 's', 's', 's', NULL, '-32', '999234', '794267613.png', '19842668.png', '935397725.png', 'verify', 19, 'closing', 'jabodetabek', '2019-12-16 20:17:16', '2019-12-15 20:17:16');

this

Dec
16
3 months ago
Activity icon

Replied to Laravel Hierarchy Users

Sales users generate output from sales, and are stored in the results table. and in the table users can see the results of their work, leaders, supervisors, managers, and general managers. The leader can see all the sales results of all his sales users. The supervisor can see the sales results of his users based on the sales of his subordinate leaders. and so on.

(SALES) http://localhost:8000/api/Getsalesday/A001-LDR02/17 { "status": 200, "data": { "salescode": "A001-LDR02", "closing": 2, "thinking": 0, "reject": 0, "verify": 0, "unverify": 0 } }

(SALES) http://localhost:8000/api/Getsalesday/A001-LDR01/17 { "status": 200, "data": { "salescode": "A001-LDR01", "closing": 1, "thinking": 0, "reject": 0, "verify": 0, "unverify": 0 } }

(LEADER) http://localhost:8000/api/leader/16 { "status": 200, "data": { "closing": 2, "thinking": 0, "reject": 0, "verify": 0, "unverify": 0 } } Note: 16 is parent_id of users sales / id leader

(LEADER) http://localhost:8000/api/leader/17 { "status": 200, "data": { "closing": 2, "thinking": 0, "reject": 0, "verify": 0, "unverify": 0 } } Note: 17 is parent_id of users sales / id leader

----this what i mean----- the supervisor get it closing from sales (SUPERVISOR) { "status": 200, "data": { "closing": 3, "thinking": 0, "reject": 0, "verify": 0, "unverify": 0 } }

Activity icon

Replied to Laravel Hierarchy Users

this is the all users

INSERT INTO users (id, salescode, nik, username, password, email, superior, name, pict_users, status, imei, phone_number, location, role, lat, lng, token, parent_id, created_at, updated_at) VALUES (11, 'mn01', '01', 'pak feb', '$2y$12$JU9FmmAsAcqnGg5911XKzeguFoo7nR2l2BA3YlMibpPsRmeR1EYne', '[email protected]', 'admin', 'feb', '', 'active', '863863047197584', '+6285780827388', '', 'manager', NULL, NULL, NULL, 12, NULL, NULL), (12, 'gm01', '123', 'bu vera', '$2y$12$JU9FmmAsAcqnGg5911XKzeguFoo7nR2l2BA3YlMibpPsRmeR1EYne', '[email protected]', 'admin', 'vera', '', 'active', '863863047197584', '+6285780827388', '', 'GM', NULL, NULL, NULL, 0, NULL, NULL), (13, 'spv01', '01', 'pak j', '$2y$12$JU9FmmAsAcqnGg5911XKzeguFoo7nR2l2BA3YlMibpPsRmeR1EYne', 'spv01@gmail.com', 'admin', 'j', '', 'active', '863863047197584', '+6285780827388', '', 'supervisor', NULL, NULL, NULL, 11, NULL, NULL), (15, 'spv02', '01', 'pak k', '$2y$12$JU9FmmAsAcqnGg5911XKzeguFoo7nR2l2BA3YlMibpPsRmeR1EYne', 'spv02@gmail.com', 'admin', 'k', '154293107.png', 'active', '863863047197584', '+6285780827388', 'depokasd', 'supervisor', '0022', '1', NULL, 11, NULL, '2019-12-16 07:01:03'), (16, 'lead01', '01', 'pak l', '$2y$12$JU9FmmAsAcqnGg5911XKzeguFoo7nR2l2BA3YlMibpPsRmeR1EYne', 'lead01@gmail.com', 'admin', 'pak l', '', 'active', '863863047197584', '+6285780827388', '', 'leader', NULL, NULL, NULL, 13, NULL, NULL), (17, 'lead02', '02', 'pak h', '$2y$12$JU9FmmAsAcqnGg5911XKzeguFoo7nR2l2BA3YlMibpPsRmeR1EYne', 'lead02@gmail.com', 'admin', 'pak h', '', 'active', '863863047197584', '+6285780827388', '', 'leader', NULL, NULL, NULL, 13, NULL, NULL), (18, 'A001-LDR01', '01', 'pak oo', '$2y$12$JU9FmmAsAcqnGg5911XKzeguFoo7nR2l2BA3YlMibpPsRmeR1EYne', '[email protected]', 'admin', 'pak oo', '', 'active', '863863047197584', '+6285780827388', '', 'sales', NULL, NULL, NULL, 16, NULL, NULL), (19, 'A001-LDR02', '02', 'pak rr', '$2y$12$JU9FmmAsAcqnGg5911XKzeguFoo7nR2l2BA3YlMibpPsRmeR1EYne', 'SALES00@gmail.com', 'admin', 'pak rr', '', 'active', '863863047197584', '+6285780827388', '', 'sales', NULL, NULL, NULL, 17, NULL, NULL), (20, 'lead001', '001', 'pak d', '$2y$12$JU9FmmAsAcqnGg5911XKzeguFoo7nR2l2BA3YlMibpPsRmeR1EYne', 'lead001@gmail.com', 'admin', 'pak d', '', 'active', '863863047197584', '+6285780827388', '', 'leader', NULL, NULL, NULL, 15, NULL, NULL), (21, 'lead002', '002', 'pak s', '$2y$12$JU9FmmAsAcqnGg5911XKzeguFoo7nR2l2BA3YlMibpPsRmeR1EYne', 'lead002@gmail.com', 'admin', 'pak s', '', 'active', '863863047197584', '+6285780827388', '', 'leader', NULL, NULL, NULL, 15, NULL, NULL), (22, 'A001-LDR001', '01', 'pak sl', '$2y$12$JU9FmmAsAcqnGg5911XKzeguFoo7nR2l2BA3YlMibpPsRmeR1EYne', 'SALES001@gmail.com', 'admin', 'pak sl', '', 'active', '863863047197584', '+6285780827388', '', 'sales', NULL, NULL, NULL, 20, NULL, NULL), (23, 'A001-LDR002', '02', 'pak sl', '$2y$12$JU9FmmAsAcqnGg5911XKzeguFoo7nR2l2BA3YlMibpPsRmeR1EYne', 'SALES002@gmail.com', 'admin', 'pak as', '', 'active', '863863047197584', '+6285780827388', '', 'sales', NULL, NULL, NULL, 21, NULL, NULL);

Activity icon

Replied to Laravel Hierarchy Users

this is the users tabel

CREATE TABLE users ( id bigint(20) UNSIGNED NOT NULL, salescode varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, nik varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, username varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, password varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, email varchar(120) COLLATE utf8mb4_unicode_ci NOT NULL, superior varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, name varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, pict_users varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, status varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, imei varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, phone_number varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, location varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, role varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, lat varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, lng varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, token varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, parent_id int(11) NOT NULL, created_at timestamp NULL DEFAULT NULL, updated_at timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

Activity icon

Replied to Laravel Hierarchy Users

this the results table

CREATE TABLE results ( id int(10) UNSIGNED NOT NULL, salescode varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, nama_ktp varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, no_ktp varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, alamat varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, kota varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, kel varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, kec varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, rt varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, rw varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, kode_pos varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, tanggal_lahir varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, jenis_kelamin varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, telp_rumah varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, no_hp varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, no_hp_2 varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, email varchar(120) COLLATE utf8mb4_unicode_ci DEFAULT NULL, stts_rumah varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, tipe_rumah varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, akses_lokasi varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, alamat_pemasangan varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, kota_pemasangan varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, kec_pemasangan varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, kel_pemasangan varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, rt_pemasangan varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, rw_pemasangan varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, kodepos_pemasangan varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, kategori_produk varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, produk_nama varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, value_pack varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, produk_market varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, payment varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, bonus varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, installasi_fee varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, catatan_pemasangan varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, total_harga varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, nomor_tlp varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, longitude varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, latitude varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, foto varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, foto_dua varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, foto_tiga varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, status_verifikasi varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'open', user_id int(11) NOT NULL, result_type varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, created_at timestamp NULL DEFAULT NULL, updated_at timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

Dec
15
3 months ago
Activity icon

Replied to Laravel Hierarchy Users

@tray2 no,

sales A001-22 'closing' => 2, 'reject' => 2,

sales A002-22 'closing' => 2, 'reject' => 3,

leader A001-22 'closing' => 4, 'reject' => 5,

closing and reject leader is get it from sales A001 and A002,it solved. but, how i get it up to supervisor,manager,and,general manager?

Activity icon

Started a new Conversation Laravel Hierarchy Users

hey guys, i have one table the relation is many to many, and in this table i have users: -general manager users -manager users -supervisor users -leader users -sales users

and i have one table again, the table name is RESULTS,The contents of the results table are the results of the sales trade, where the sales have a salescode. how to take sales sales results in the RESULTS table while the sales account and account leader section has taken sales results using a join how to continue taking sales sales results in the account leader to the top, dynamically

Activity icon

Replied to Laravel Migrations

@bobbybouwmann thanks brow,this work!

Dec
14
3 months ago
Activity icon

Started a new Conversation Laravel Migrations

heyy guys, i wanna ask about laravel migration. how to create migrations table without S ? i already,edit schema name and create without s but when im create export table to excel laravel showing the error like this:

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'inventori.stocks' doesn't exist (SQL: select * from stocks)

thanks rully

Dec
12
3 months ago
Activity icon

Started a new Conversation Group Latest Sales Results By Salescode

$hari = DB::table('users')->where('result_type','=','closing')->join('results','users.id','=','results.user_id') ->select(DB::raw('results.salescode,latitude,longitude')) ->groupBy('salescode','latitude','longitude') ->orderBy('results.created_at','desc') ->get();

in this code i wanna grouping sales result by salescode,latitude,long. but when i grouping salescode sales results, there is a double salescode and does not take the final sales result (latest results/salescode,long,latt)

note: only each salescode and the latest results

and this is the ouput

{ "status": 200, "data": [ { "salescode": "A003", "latitude": "999234", "longitude": "-32" }, { "salescode": "A002", "latitude": "999234", "longitude": "-32" }, { "salescode": "A001", "latitude": "999234", "longitude": "-67723123" }, { "salescode": "A001", "latitude": "s", "longitude": "s" }, { "salescode": "A001", "latitude": null, "longitude": null } ] }

Activity icon

Replied to Get Users Data

@sujancse oke thxx,bro

Activity icon

Replied to Get Users Data

@tisuchi { "status": 200, "data": [ { "sales_count": 4, "salescode": "A001" }, { "sales_count": 2, "salescode": "A002" }, { "sales_count": 1, "salescode": "A003" } ] }

this is the result. i mean, in salescode show with user data

Activity icon

Replied to Get Users Data

@tisuchi

$close = DB::table('users')->where('result_type','=','closing')->join('results', 'users.id', '=','results.user_id') ->select(DB::raw('count(*) as sales_count, results.salescode')) ->groupBy('salescode') ->orderBy('results.salescode','ASC') ->take(3) ->get();

but the results is the same

Activity icon

Replied to Get Users Data

yes, i understand. how i get user data? like email,salescode,nik,superior,status

Dec
11
3 months ago
Activity icon

Started a new Conversation Get Users Data

public function topsales(){ $users = DB::table('results') ->select(DB::raw('count(*) as sales_count, salescode')) ->where('salescode', '<>', 1) ->groupBy('salescode') ->orderBy('sales_count', 'desc') ->take(10) ->get();

    if (true) {
      return response()->json([
        'sales top 3' => $users,
      ]);
     }
  }

i have two tables. results and user. from the results table, there are sales sales results,and i want to sort the most sales result tables and retrieve sales user data that sells them, but i can only get salescode. how can all the sales data appear

Activity icon

Replied to Hello Guys, How To Add WhereDay Conditions In This Code :)

okee thxx sir,you're very good this work!

Activity icon

Replied to Hello Guys, How To Add WhereDay Conditions In This Code :)

SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'created_at' in on clause is ambiguous (SQL: select count(*) as aggregate from users inner join results on users.id = results.user_id and result_type = closing and day(created_at) = 11 where parent_id = 10)

Activity icon

Replied to Hello Guys, How To Add WhereDay Conditions In This Code :)

when i try, the query is ambigous how about that?

Dec
10
3 months ago
Activity icon

Started a new Conversation Hello Guys, How To Add WhereDay Conditions In This Code :)

hello guys, how to add whereDay conditions in this code :)

public function manage($id) {

   $users = DB::table('users')
   ->where('parent_id','=',$id)
        ->join('results',function($join){
           $join->on('users.id','=','results.user_id')
           ->where('result_type','=','closing');
        })
        ->count();
        return $users;
}