AbdulBazith

AbdulBazith

Member Since 1 Year Ago

Tamil Nadu, Tirunelveli

Experience Points
17,180
Total
Experience

2,820 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
7
Lessons
Completed
Best Reply Awards
2
Best Reply
Awards
  • start-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-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-token Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer-token Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • lara-evanghelist 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 4
17,180 XP
Oct
14
5 days ago
Activity icon

Replied to Problem Many To Many Relationship With Class And Fees

@siangboon @michapietsch @mstrauss @Tray2 @aurawindsurfing @lostdreamer_nl @jlrdw

sorry guys for tagging you all. o one is replying so i need help please.

Kidly suggest any idea please in very confusion state

Oct
13
6 days ago
Activity icon

Replied to Problem Many To Many Relationship With Class And Fees

i have drawn the unstructured table also: https://imgur.com/DD1CHud

This is my unstructured table format. here class, fee main category, fee sub category amount all included. how i need to split it.

Kindly some one suugest please

Oct
12
1 week ago
Activity icon

Replied to Problem Many To Many Relationship With Class And Fees

@snapey a big sorry for tagging you sorry sorry.

any suggestions please????

Activity icon

Replied to Problem Many To Many Relationship With Class And Fees

I have drawn the table in my note: https://imgur.com/rmJWDSK

Kindly refer this and suggest your idea guys please.. how to relate these three tables.

a single class can have multiple main category and a single main category can have multiple class and a a single main category can have multiple sub category

Activity icon

Started a new Conversation Problem Many To Many Relationship With Class And Fees

Guys iam working with a project school management system.

I have to work with feePayment module.

The fee payment structure is left to the client to make their won structure of fee.

In all schools the fee structure would be like category wise. 1 main category and for that main category there will sub categories

how the process is done is

the school posses Main category and sub category of fee, like below structure


Term1     payment duration (1-08-2019 to 15-08-2019)
    school Fee =  6000
    Bus Fee   =  3000
    Tution Fee= 2500

Term 2  payment duration (1-12-2019 to 15-12-2019)
    school Fee = 6000
    Lab Fee   =   3000

Term3   payment duration (1-03-2020 to 15-08-2020)
    School Fee= 6000
    extra fee = 2000

like this it goes on,

here Term1, Term2 Term3 are main cateogries and school fee, extra fee tution fee are sub categories

this is my table strucutre : https://imgur.com/KxLpQWI

Whats my problem is

the below given are three tables. how can i link them with many to many or how kindly give some suggestion please. how to link these three tables

Feemaincategory         Feesub category         class

how this works is,

``` 5th std   -Term1  -> (tutionfee, bus fee) ```

``` 6th std -  Term1-> (tution fee, bus fee) ```

here class, fee main category, fee sub category are included. how i can insert these?? how i need to make the db kindly someone suggest please

Oct
11
1 week ago
Activity icon

Replied to Input Field

@ain You can use readonly attribute for this as per @szach answer.

that works fine.

Activity icon

Replied to Attendance Value Problem In Laravel

@tisuchi ya ya you are right. using calendar is good option.

But another question raises in my mind. if i need to use calendar means then i need any table for that. else direct calendar can be used as UI.

and local holidays are decided suddenly as small small reasons. there will be no calendar occurs in net for all these holidays. some times if heavy rains means then leave will be provided by the area government.

so these also to be stored in db am i right??

for this i need to link the calendar and attendance. but i can get any idea how to do that.

Oct
10
1 week ago
Activity icon

Replied to Attendance Value Problem In Laravel

@tisuchi thank you for your suggestion.

ya you are right keeping numeric values is a better choice. i planned to keep that only.

But my problem is if any local holidays festival holidays therewill be no attendance and no records in the db.

so in report those days will be not shown. but my client is expecting the the holidays also to be shown in the screen.

say for example : if any local holiday means the reason should be inserted. so in the report that date should be shown as leave with reason.

do you understand?? else i confused you??

Oct
08
1 week ago
Activity icon

Replied to How To Make A Single Form For Edit And Update And Also For Adding

@tisuchi thank you so much for your response.

and very sorry for delay.

actually what i did is i have

//MY models
Official info
personal info
Address Info
Parents Info
Siblings Info
Previous Education Info etc 

//My controllers

OfficialinfoController
personalfoController
AddressfoController
ParentsfoController
SiblingsfoController
Previous EducationfoController etc

so i have a single edit form with all the sections (page name: edit-all )

in my profile page when i click the edit icon of Official details it moves to the OfficialInfoController edit and then comes to the edit-all page there i had i checking condition @isset(variableName)

so when it comes to PersonalInfo then @isset($editpersonal) like this based on the variable present i used the edit-all page

but one mistake which i done is used form tags for each section inside that @isset condition

so if my sections are 6 then i have 6 form tags. but worked fine .

Thank you for your suggestion..

Activity icon

Started a new Conversation Attendance Value Problem In Laravel

Guys iam working with a project School Management system.

i have a module Attendance for staff and student.

this is my attendance form for student: https://imgur.com/tkX80ql

here all the student for specific class is displayed with the options present, absent and half day. by default present is checked. if any student absent or half day that is changed and to be inserted into db.

My doubt is how can i insert this into database.

in my old project hotel project for employee module what i done is had attendance table like below

id      att_date        emp_id          att_count       reason  
1       01-10-19        3               1               null
2       01-10-19        4               0               fever so absent
3       01-10-19        5               0.5             half day personal work

in the above table 0=absent 1=present 0.5=halfday

this worked fine for my old project.

but it comes to report i faced many problems. because when need to take total count days for 1 month for specific employee i faced problems.

so iam asking suggestion for this project. how can i use tables for storing the attendance.

i need a report like below

Student         1       2       3       4       5       total(dates of single month)

Abdul           p       A       H       p       p       3.5  
Bazith          p       p       p       p       p       5

in the above report p=present H=half day A=Absent

if any holidays comes like Saturday and Sunday it must also be shown in the report. because if any holidays that day attendance are not taken. so in report that date should be displayed with the reason for that holiday.

Kindly some one help pleaseee..

Sep
28
3 weeks ago
Activity icon

Started a new Conversation How To Make A Single Form For Edit And Update And Also For Adding

Guys iam working with a project School Management System.

i have a add form to add the student.

it is a single form which consist of more than 5 sections like

Official info
personal info
Address Info
Parents Info
Siblings Info
Previous Education Info etc

i have controller for each of them and model also for each of them.

the above mentioned are in a single from with different sections. in this official and personal info are mandatory fields remaining are optional.

when the school staff comes and add a student she will fill the personal and official info, whether she needs she will insert other details.

and i had a profile view form where it displays the student detail with section wise.

now what client expecting is in the profile page a have edit button for each section, if they click that only that portion must be in another page with editable then they can edit.

now whether i need to have that much edit forms and for each section???

and some times they may leave the address information when adding a student. so i have a add button also in the profile page. so when the client click that, only address form should open. like wise for other also,

so my doubt is whether i need to have that much edit and add forms??

is there any simple solution???

Sep
25
3 weeks ago
Activity icon

Replied to SQLSTATE[22003]: Numeric Value Out Of Range: 1264 Out Of Range Value For Column 'emp_mobile' At Row 1

@kanchan186 check your migration of employee table with the emp_mobile

it must be longInt

sorry sorry

it is

$table->bigInteger('emp_mobile');

for further details refer: https://laravel.com/docs/5.8/migrations

Activity icon

Replied to Sum The Product Quantity Of Same Product Id In Two Tables And Sum It Laravel

@snapey sorry once again, i tried like this

 $products=Product::with('OpenStock ','Purchase ','StockIssue ')->get();

actually the adding can be done in blade file. but the sum of same products must be done in controller itself, so how to write??

is this start right?

why iam asking is in my openstock what i did is just fetched the openstock table like this

$openingstocks =OpeningStock::where('hotel_id', Auth::user()->hotel_id)->orderBy('created_at', 'asc')->where('open_date', Carbon::today())->get();

and then need to fetch rate from purchase table

so did the coding like this which u gave

  $latestPrices = Purchase::where ('hotel_id',Auth::user()->hotel_id)->whereIn('id',
        DB::table('purchase')->where ('hotel_id',Auth::user()->hotel_id)
            ->selectRaw('max(id) as id')
            ->groupBy('product_id')
            ->pluck('id')
        )->get();

here no rate . just need to take the qty from all the three tables. but a condition that in purchase and Stockissue table there my more entries for same product_id, so for the it must sum the qty of same product id.

Kindly please help me

Sep
19
1 month ago
Activity icon

Replied to Sum The Product Quantity Of Same Product Id In Two Tables And Sum It Laravel

@snapey sorry, sorry sorry sorry.

but when no one responding, i feel bad. thats why tagging you. if some body just give any suggestion then i can move forward.

once again sorry sorry sorry sorry.

can you give any glimpses of coding please.

Sep
18
1 month ago
Activity icon

Replied to Sum The Product Quantity Of Same Product Id In Two Tables And Sum It Laravel

@snapey can u suggest me.

dont think that iam often tagging uu. sorry

Sep
17
1 month ago
Activity icon

Started a new Conversation Sum The Product Quantity Of Same Product Id In Two Tables And Sum It Laravel

Guys iam working with a project hotel management system.

i have three tables

Table 1: OpenStock with columns

id
open_date
product_id
opening_qty

// its respective model

 public function product()
    {
        return $this->belongsTo('App\Product', 'product_id');
    }

Table 2 : Purchase with columns

id
purchase_date
product_id
product_qty

//its respective model

 public function product()
    {
        return $this->belongsTo('App\Product', 'product_id');
    }

Table 3 :StockIssue with columns

id
product_id
issued_date
issued_qty

//its respective model

 public function product()
    {
        return $this->belongsTo('App\Product', 'product_id');
    }

My products table has columns

id
product_name

what i expect is need to fetch records from OpenStock table, Purchase table, and StockIssue table and add the quantity of same product_id (sum the OpenStock and Purchase) and subtract it from stockIssue table

this what the output i expect

product     openstock       purchasestock   totalstock  issuedstock balance

potato      10              20              30          2           28
tomato      12              20              32          30          2

iam expecting the output like above.kindly some one give idea please..

i was so confused that from where i should start the query. from product table or purchase table or openstock table or issued table.

i know that need to used joins. but whenever joins are involved iam so confused.

so kindly some one suggest ideas please

Activity icon

Started a new Conversation Package For Attendance Managing Laravel

Guys iam working with a project school management system.

i need to maintain the attendance of the students.

basically in my last application what i did is had a table for the employee with columns

id      emp_id      attendance_count        reason

1       1           1                       present
2       2           0                       fever so absent
3       3           0.5                     half day permission

1= present; 0= absent; 0.5= half day

i followed this in my last project. but in this school management system i need to make the festival holidays, etc etc.

so is there any package for maintaining the attendance.

Kindly someone suggest any package please.

need to maintain

holidays of Saturdays and Sundays

festival holidays etc in calendar format

Sep
12
1 month ago
Activity icon

Replied to Search Box In Multiple Select (array Of Select Box) Not Working

@lostdreamer_nl thank you thank you sooo much.

liked your reason for vacation. think had a good vacation.

ok let me try the code and intimate you ..

Sep
11
1 month ago
Activity icon

Replied to Suggestion For Tables Collision For Main Category And Sub Category Of Fee Payment

@michapietsch thank you thank you sooo much.

yes you are right. its better to have a checkbox or radiobutton.

ya having good knowledge in javascript so i can work through it.

if possible can you suggest me idea for this also please:

https://laracasts.com/discuss/channels/guides/problem-in-fetching-records-from-db-need-suggestion-for-columns-in-table

Sep
10
1 month ago
Activity icon

Replied to Problem In Fetching Records From Db. Need Suggestion For Columns In Table

@snapey just give your suggestion that's enough

I have finalized the table and given in the below image

Refer: https://imgur.com/E12vRGr

is this right?? do i need another table? if the parent kept a balance of 1000 rupees in the term1 means, it must be fetched in the term2. thats why i kept a text box old balance in the form.

is this right??

Sep
07
1 month ago
Activity icon

Replied to Problem In Fetching Records From Db. Need Suggestion For Columns In Table

@snapey

Sorry for tagging you, can you suggest any idea.

i thought all the possible ways and mentioned in this thread. getting some what confused.

Activity icon

Replied to Problem In Fetching Records From Db. Need Suggestion For Columns In Table

These are the columns to be saved after fee payment

acc_year_id (academic year)

class_id 

section_id

student_id

bill_no

payment_date

any_notes  (any notes can be written)

cash_type (fee paid by cash or cheque just the type can be mentioned)

discount_amt  (if any discount amount is given to that student)

fine_amt (if any fine )

balance_amt (some times parents may pay only 3/4th of the amt like if 10000 is there they will pay 8000 and keep the balance 2000 to pay in next term that is term2. like installment payment.)

fee_main_cat_id (the main category like term1 or term2)

fee_sub_cat_id (sub categories for the main category term1 bus fee, school fee, extra fee etc..)

tota_amt_of_fee_main_cat (the actual amt for the main category say like 10000 rupees)

payment_status (paid /or /not)


all the above columns i must save. my doubt is do i need all the above columns?? else shall i can remove few?? how i can make this in two tables or in a single table.

and i expect the output as like below. if the parent need the receipt as printed format the printed format should be like below

Term1
    School Fee      5000
    Bus Fee         2000
    Lab Fee         2000
    Extra fee       1000

        Total       10000


Term2 ...  (if the parent pay the term 2 fee also this will be filled same as term1)

// if the parent kept any balance means it should be given like below

Term1
    School Fee      5000
    Bus Fee         2000
    Lab Fee         2000
    Extra fee       1000

        Total       10000
        Paid          8000

        Balance       2000

and this balance is carried to next term fee that is for term2 fee. thats why i given a balance textbox in the fee payment form.

what i planned is dividing it in two tables

Table 1: Student_fee_transaction_master with columns

acc_year_id 

class_id 

section_id

student_id

bill_no

payment_date

any_notes 

cash_type 

Fees_original_amt 

discount_amt 

fine_amt 

balance_amt 

fee_main_cat_id 


Table 2: Student_fee_transaction_details with columns

id
bill_no_id (from master table)
fee_main_cat_id
fee_sub_cat_detail 

// this table fully says abt the fee sub category details


is all this right??

kindly some one hlep please??

Activity icon

Replied to Suggestion For Tables Collision For Main Category And Sub Category Of Fee Payment

@michapietsch

so that i can use a check box or radio button to have a textbox or dropdown.

Am i right??

Kindly if possible suggest me a solution for this question also please,

link: https://laracasts.com/discuss/channels/guides/problem-in-fetching-records-from-db-need-suggestion-for-columns-in-table

Sep
06
1 month ago
Activity icon

Started a new Conversation Problem In Fetching Records From Db. Need Suggestion For Columns In Table

Guys iam working with a project school management system.

i have completed 2 modules (student registration and sms panel)

Now started my 3rd module fee payment.

the fee payment takes two steps,

1)fee structure and 
2 )fee payment

In fee structure

the school posses Main category and sub category of fee, like below structure

Term1     payment duration (1-08-2019 to 15-08-2019)
    school Fee =  6000
    Bus Fee   =  3000
    Tution Fee= 2500

Term 2  payment duration (1-12-2019 to 15-12-2019)
    school Fee = 6000
    Lab Fee   =   3000

Term3   payment duration (1-03-2020 to 15-08-2020)
    School Fee= 6000
    extra fee = 2000

like this it goes on,

this structure may varies class wise (1 std 2nd std and so on...)

So for this i planned two tables to add the main category and the sub category.

here are the images

main category table: https://imgur.com/XO1B2le

sub category table: https://imgur.com/fNd9idT

so the fee structure is ready. every thing ok i think so.

Next lets move to Fee payment process

in fee payment form i have class(dropdown), section(dropdown), student name(dropdown).

when class is selected, its relevant section is selected and when section is selected the students of that section are listed. so when that specific student is selected, what i expect is the term1 and term2 that is from the fee main category, its name and its sub categories must be listed with amount to pay the fee for that student.

i have a form like this: https://imgur.com/mRqNVE6

when serach button is clicked this below portion in the image will be fetched from table. but my doubt is from which table the fee main caegory and sub category are fetched??? some student will keep the first term fee pending (few amt) and they will pay in second term. some will pay the whole fee in single slot itself.

When the year, class, section name are selected, the below portion must be rose with the tem1 and term2 info below.

my doubt is from which table it must be fetched. some students may pay the fee in a single slot for whole year, some student may pay the fee for that term. some student may pay the fee in installment. that is if termfee is 10000 means, 8000 they will pay, 2000 they will keep the balance, and they will pay in next term.

My doubt is from which table it must fetch the record of fees. in which table the fee details must be saved. what columns i should have in feepayment table?? please,

Kindly some one help please

Aug
31
1 month ago
Activity icon

Replied to Suggestion For Tables Collision For Main Category And Sub Category Of Fee Payment

@michapietsch thank you soo much for your response.

ya thats what i expect.

but the problem is whether to keep a text box in the form or drop down. if already it is there its id should be used. else the new record should be created.

textbox?? or dropdown?? or datalist?? which to use??? in the form??

Aug
30
1 month ago
Activity icon

Started a new Conversation Suggestion For Tables Collision For Main Category And Sub Category Of Fee Payment

Guys iam working with a school project. its a school management system.

whats my doubt is my application is dynamic, so the fee payment takes two steps,

fee structure and fee payment

first my doubt is in fee structure

the school posses Main category and sub category of fee, like below structure

Term1     payment duration (1-08-2019 to 15-08-2019)
    school Fee =  6000
    Bus Fee   =  3000
    Tution Fee= 2500

Term 2  payment duration (1-12-2019 to 15-12-2019)
    school Fee = 6000
    Lab Fee   =   3000

Term3   payment duration (1-03-2020 to 15-08-2020)
    School Fee= 6000
    extra fee = 2000

like this it goes on,

this structure may varies class wise (1 std 2nd std and so on...)

So for this i planned two tables to add the main category and the sub category.

table main category has columns like

  $table->bigIncrements('id');
            $table->bigInteger('acc_year_id')->unsigned();
            $table->foreign('acc_year_id')->references('id')->on('academic_years')->onDelete('cascade');
            $table->string('fee_main_cat');
            $table->date('due_start_date')->nullable();
            $table->date('due_end_date')->nullable();
            $table->bigInteger('total_amt')->nullable();
            $table->longText('note')->nullable();
            $table->string('status')->nullable();
            $table->timestamps();

the view of the above table is : https://imgur.com/Gwo9vYQ

and sub category table has columns below

 $table->bigIncrements('id');
            $table->bigInteger('acc_year_id')->unsigned();
            $table->foreign('acc_year_id')->references('id')->on('academic_years')->onDelete('cascade');
            $table->bigInteger('class_id')->unsigned();
            $table->foreign('class_id')->references('id')->on('class_details')->onDelete('cascade');
            $table->bigInteger('fee_main_cat_id')->unsigned();
            $table->foreign('fee_main_cat_id')->references('id')->on('fee_main_cats')->onDelete('cascade');
            $table->string('fee_sub_cat');
            $table->bigInteger('amt')->nullable();
            $table->longText('note')->nullable();
            $table->string('status')->nullable();

the view of the above table is : https://imgur.com/bNX2JOR

whether the above columns are right.

so for this i have created a form like this : https://imgur.com/z6AY2xX

in this form to add sub category i used table because for one main category there may be 2 or 3 sub categories.

in some occurrence there may not be any sub categories.

here whats the problem iam facing is, i planned everything, the fee main category which is typed by the user in the form will be added to the main category table, and the id of that is picked, and it is added to the sub categories table with its details. here the problem is i should not enter the main category two times, so used datalist in html, which act as textbox and aswell as dropdown. if data there it shows else user can enter.

but i failed. then only i got confusion.

is one form is enough for both. else need two forms.

kindly suggest your ideas please

Aug
29
1 month ago
Activity icon

Replied to Multiply The Qty And Rate From Two Tables With Same Product_id In Laravel

@snapey sorry for disturbing you once again,

small doubt

if i need the overall total amount of the <td>{{ $latestprices->where('product_id',$product->id)->first()->rate_per_kg * $product->openingstock->open_qty }} </td>

the above query is in forloop, so for each product the rate is multiplied with qty and displayed. i need the overall amount at last after the foreach means what should i do?

this means what should i do??

Aug
23
1 month ago
Activity icon

Replied to Multiply The Qty And Rate From Two Tables With Same Product_id In Laravel

@snapey thank you soo much everything worked fine.. thank you thank you..

you should do me a favor,

kindly paste your answer in this link also, because this also the same question

https://laracasts.com/discuss/channels/laravel/multiply-product-qty-with-rate-with-maximum-rate-in-the-list-in-relationship

so that u can get one credit please.

Activity icon

Replied to Multiply The Qty And Rate From Two Tables With Same Product_id In Laravel

@siangboon not like that, but when we struct in coding, suddenly it remembers Laracast, when it comes to laracast it remembers @snapey .. thats the reason..

Aug
21
1 month ago
Activity icon

Replied to Calculating Attendance Total Present And Absent Laravel

@kvithalani very sorry. some what busy in another work.

let me try it and say.

thank you for your response

Activity icon

Replied to Search Box In Multiple Select (array Of Select Box) Not Working

@lostdreamer_nl

If possible Kindly reply please for this, and sorry for tagging you

Activity icon

Replied to Multiply The Qty And Rate From Two Tables With Same Product_id In Laravel

@snapey ya i found the mistake.

the problem is some product doesnt have rate_per_kg in the rate table. thats the issue. sowhat i did is

//used isset to check whether it is there or not. sothat it worked fine. is this right format.
 @isset($latestprices->where('product_id',$openstock->product->id)->first()->rate_per_kg)
  <td>{{ $latestprices->where('product_id',$product->id)->first()->rate_per_kg }}
      </td>

is this format right?? but this working

Aug
15
2 months ago
Aug
13
2 months ago
Activity icon

Replied to Multiply The Qty And Rate From Two Tables With Same Product_id In Laravel

@snapey then if i loop my products means it works??

because if i loop my products means, how i will get the open_qty from OpenStock??

Aug
11
2 months ago
Activity icon

Replied to Multiply The Qty And Rate From Two Tables With Same Product_id In Laravel

@snapey actually the problem is in <td>{{ $latestprices->where('product_id',$product->id)->first()->rate_per_kg }} </td> line

 @php ($s_no = 1)
  @foreach($products as $product)
  <tr>
      <td>{{ $s_no }}</td>
      <td>{{ $product->open_date }}</td>
      <td>{{ $product->id }}</td>
      <td>{{ $product->product->product_name }} </td>

      <td>{{ $product->open_qty }}</td>
      <td>{{ $latestprices->where('product_id',$product->id)->first()->rate_per_kg }}
      </td>// this line itself the error is there. it showing error. rate_per_kg is the error.
      <td>{{ $latestprices->where('product_id',$product->id)->first()->rate_per_kg * $product->openingstock->open_qty  }}
      </td>
  </tr>
  @php ($s_no++)
  @endforeach



the below is the error.

Trying to get property 'rate_per_kg' of non-object (View: 

why this problem @snapey

Aug
10
2 months ago
Activity icon

Replied to Multiply The Qty And Rate From Two Tables With Same Product_id In Laravel

@snapey

i tried like this

actually

my controller

// this collection contains the data of OpeningStock tables (id,open_date,product_id,open_qty)

 $products=OpeningStock::where ('hotel_id',Auth::user()->hotel_id)->get(); 

and this
// has the collection details of ProductRate  table
$latestPrices = ProductRate::where ('hotel_id',Auth::user()->hotel_id)->whereBetween('d_date', [$request->from_date, $request->to_date])->whereIn('id',
        DB::table('product_rate')
            ->selectRaw('max(id) as id')
            ->groupBy('product_id')
            ->pluck('id')
        )->get();

in my view i have given

   @php ($s_no = 1)
  @foreach($products as $product)
  <tr>
      <td>{{ $s_no }}</td>
      <td>{{ $product->open_date }}</td>
      <td>{{ $product->id }}</td>
      <td>{{ $product->product->product_name }} </td>

      <td>{{ $product->open_qty }}</td>
      <td>{{ $latestprices->where('product_id',$product->id)->first()->rate_per_kg }}
      </td>
      <td>{{ $latestprices->where('product_id',$product->id)->first()->rate_per_kg * $product->openingstock->open_qty  }}
      </td>
  </tr>
  @php ($s_no++)
  @endforeach

but showing error Trying to get property 'open_qty' of non-object (View:

rate_per_kg is the correct field name then why it showing error??

my table product_rate with columns

id
r_date
product_id
rate_per_kg

db structure below

id      r_date          product_id      rate_per_kg
1       21-07-2019          1               10
2       22-07-2019          1               11
3       21-07-2019          2               35

Refer: https://imgur.com/12VSkYt

then whats the problem?? Kindly help without hesitation please.

Aug
09
2 months ago
Activity icon

Replied to Multiply The Qty And Rate From Two Tables With Same Product_id In Laravel

@snapey

that without my knowledge started the work. at that time i too dont know what to do so.

Activity icon

Replied to Multiply The Qty And Rate From Two Tables With Same Product_id In Laravel

@snapey

ahh snapey very sorry. actually i confused whether need to pass Latestprice in loop and that in array u have given as prices, i thought like that. very sorry. very very sorry.

another big problem is

now everthing is fine but showing error in Method firstWhere does not exist. (View:

when i checked in google mine

version is Laravel Framework 5.4.36

but The firstWhere method was added in Laravel 5.5.23:

now what to do?? can i upgrade it or is there any solution??

and kindly say that howyou guys knowing all these functions in laravel. almost 1 and half years over for me and faced 4 projects alone. still cant learn laravel. how you guys knowing about all the functions and joins etc??

is there any specific materials to learn.

Activity icon

Started a new Conversation Calculating Attendance Total Present And Absent Laravel

guys i need to calculate the attendance of of my employees.

this is my emp_attendance table has columns

att_date        emp_id       att-count       reason
01/07           1            1               
01/07           2               0            Leave fever 
02/07           1               0.5             halfday fever
02/07           2               1
03/07        1          0           absent  



the problem is

so in the above for employee 1

the present days is 1.5 (1+0.5)

the absentdays is 1.5 (1+0.5) (here the problem is the 0 are absent so that must be count and 0.5 is half day that must be sum and then both must be added ). so the count of 0 is 1 and the sum of 0.5 is 0.5 so adding both 1.5 is the absent days

total days are 3 (1 + 1 + 1)

these are my models

//employee model

public function empattendance()
    {
        return $this->hasMany('App\EmpAttendance', 'emp_id');
    }


//empattendance model


public function employee()
    {
        return $this->belongsTo('App\Employee', 'emp_id');
    }


iam expecting the output as

Sno     Name        TotalDays       Present         Absent

1       MANI        31              25          6
2       ABDUL       31              23          8


how to display this??

Activity icon

Replied to Multiply The Qty And Rate From Two Tables With Same Product_id In Laravel

@snapey

then do i need to write two foreach in blade file

now i have changed y code like this

in my controller


$latestPrices = ProductRate::where ('hotel_id',Auth::user()->hotel_id)->whereBetween('d_date', [$request->from_date, $request->to_date])->whereIn('id',
        DB::table('product_rate')
            ->selectRaw('max(id) as id')
            ->groupBy('product_id')
            ->pluck('id')
        )->get();


 $products=OpeningStock::where ('hotel_id',Auth::user()->hotel_id)->get();

    return view('Stock.manage-opening-stock')->withLatestprices($latestPrices)->withProducts($products);

in my blade how to loop through.

@foreach($products as $product)
<tr>
    <td>{{ $product->id }}</td>
    <td>{{ $product->name }} </td>
    <td>{{ $product->openstock->open_qty }}</td>
    <td>{{ $prices->firstWhere('product_id',$product->id)->rate_per_kg }}</td>
    <td>{{ $prices->firstWhere('product_id',$product->id)->rate_per_kg * $product->openingstock->open_qty  }} </td>
</tr>
@endforeach

showing error Undefined variable: prices (View:

where should i use $price

actually i cant understand where to use these variables.

and why i have given date range is because, the purchase is done daily. so the rate varies daily. so with given date the latest rate of the product must be picked and should be multiplied.

for July month if we need to check the stock rate means so i have given date range

Activity icon

Replied to Multiply The Qty And Rate From Two Tables With Same Product_id In Laravel

@snapey but

this is my exact query,

in my controller

$latestPrices = ProductRate::where ('hotel_id',Auth::user()->hotel_id)->whereBetween('d_date', [$request->from_date, $request->to_date])->whereIn('id',
        DB::table('product_rate')
            ->selectRaw('max(id) as id')
            ->groupBy('product_id')
            ->pluck('id')
        )->get();


    return view('Stock.manage-opening-stock')->withLatestprices($latestPrices);

in my blade

@foreach($products as $product)
<tr>
    <td>{{ $product->id }}</td>
    <td>{{ $product->name }} </td>
    <td>{{ $product->openstock->open_qty }}</td>
    <td>{{ $prices->firstWhere('product_id',$product->id)->rate_per_kg }}</td>
    <td>{{ $prices->firstWhere('product_id',$product->id)->rate_per_kg * $product->openingstock->open_qty  }} </td>
</tr>

@endforeach

this shows error Undefined variable: product actually latestprice is the variable passing from controller. then how i can loop product.

i cant understand.

with what should i make loop?? why??

Activity icon

Replied to Display Attendance Report In Laravel Blade File

@mstrauss

yes how do i will miss that.

<?php

namespace App\Http\Controllers;

use Alert;
use App\EmpAttendance;
use App\Employee;
use Auth;
use Carbon\Carbon;
use Illuminate\Http\Request;
use Input;
use Illuminate\Support\Facades\DB;


Aug
08
2 months ago
Activity icon

Replied to Multiply The Qty And Rate From Two Tables With Same Product_id In Laravel

@snapey thank you for your response.

i tired like this but showing error

in my controller

$latestPrices = ProductRate::where ('hotel_id',Auth::user()->hotel_id)->whereBetween('d_date', [$request->from_date, $request->to_date])->whereIn('id',
        DB::table('product_rate')
            ->selectRaw('max(id) as id')
            ->groupBy('product_id')
            ->pluck('id')
        )->get();

and in my blade file

<td>{{ $product->id }}</td>
<td>{{ $product->name }} </td>
<td>{{ $product->openstock->open_qty }}</td>
<td>{{ $prices->firstWhere('product_id',$product->id)->rate_per_kg }}</td>
<td>{{ $prices->firstWhere('product_id',$product->id)->rate_per_kg * $product->openingstock->open_qty  }} </td>


the error is

Property [open_qty] does not exist on this collection instance. (View: C:\xampp\htdocs\Laravel\hotel_sri_ram_prasad\resources\views\Stock\manage-opening-stock.blade.php)

actually my relation between stock and product table is

//in my product model

 public function openstock()
    {
        return $this->hasMany('App\Stock', 'product_id');
    }


// in my stock model

public function product()
    {
        return $this->belongsTo('App\Product', 'product_id');
    }

i tired forloop like below

 @foreach($latestprices as $prices)
<tr>
    <td>{{ $product->id }}</td>
    <td>{{ $product->name }} </td>
    <td>{{ $product->openstock->open_qty }}</td>
    <td>{{ $prices->firstWhere('product_id',$product->id)->rate_per_kg }}</td>
    <td>{{ $prices->firstWhere('product_id',$product->id)->rate_per_kg * $product->openingstock->open_qty  }} </td>
</tr>

@endforeach

the same error occurs

and when i comment <td>{{ $product->openstock->open_qty }}</td> then the error is

Call to undefined method Illuminate\Database\Query\Builder::firstWhere() (View: C:\xampp\htdocs\Laravel\hotel_sri_ram_prasad\resources\views\Stock\manage-opening-stock.blade.php)


   <td>{{ $product->id }}</td>
   <td>{{ $product->product_name }} </td>

when i use just the above two lines, only 357 th id record is displayed , 357 Garlic like this only displayed many times

Whats the problem kindly suggest please

Activity icon

Replied to Display Attendance Report In Laravel Blade File

@mstrauss

exactly i gave like this

   $employees = Employee::withCount([
    'empattendance',
    'empattendance as present' => function (Builder $query) {
        $query->where('att-count', 1);
    }
])->get();

dd($employees);

but i dont know whats the problem.

now what should i doo