EMfinanga

EMfinanga

Member Since 6 Months Ago

Experience Points
3,530
Total
Experience

1,470 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-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 1
3,530 XP
Nov
10
1 week ago
Activity icon

Started a new Conversation Stock Items With Location(store)

kindly i want a idea how can i do this in MY ACCOUNTS app as per below info.

i want to have an option to create items with store, lets say items 1 has a quantity -200 pcs, so i want to locate 100 pc to store 1 and 100 pc to store 2 in my DB

so i want an idea to relate the stock items table and store table.

keep in mind that i want store can be an option that means you can direct that pc to that store or not

Oct
10
1 month ago
Activity icon

Replied to Get Data Of Day, Week, Month, YEAR

i want to excute the report of sales, to get all data,

example this is the query i used now

public function salesreport(Request $request) {

$sales = Sales::select("sales.*")
->whereBetween('created_at', [$request->input('from'), $request->input('to')])->get();

return view('reports.salesreport',compact('sales')); }

Activity icon

Started a new Conversation Get Data Of Day, Week, Month, YEAR

how can i create a query to select data by day, week, month and year?

Activity icon

Started a new Conversation Function Of Select Data In Date Range WhereBetween

someone can assist me the query to select data range by date.

i want a user input a date., How can i rebuild my query?

public function salesreport()
{

    $sales = Sales::select("sales.*")
    ->whereBetween('created_at', ['2019-09-01', '2019-09-10'])->get();

return view('reports.salesreport'); }

Sep
24
1 month ago
Activity icon

Replied to Check Quantity If It Available On Stock

@braunson this is what i tried its work but does not check the quantity so i want to apply that logic

Activity icon

Replied to Check Quantity If It Available On Stock

for ($a=0; $a < count($ids); $a++) { //create detail on data faktur

$ido=$request->name[$a];
$store=$request->store[$a];

$model=([
    'invoice_no'=>$fk, 
    'customer_id'=>$request->customer_id, 
    //'product_code'=>$request->product_code[$a], 
    'name'=>$request->name[$a],
    'store'=>$request->store[$a],
    'selling_price'=>$request->selling_price[$a], 
    'amount'=>$request->amount[$a],
    'qty'=>$request->qty[$a], 
]);
//update stok
 $data=Stock::select('quantity','store')->where([
                ['id', '=', $ido],
                ['store', '=', $store],
                  ])->first();
// apply  conditions
//check if available

$check=(int)$data->quantity < (int)$request->qty[$a];
dd($data);
if($check){

return redirect()->back()
            ->with('success','quantity is Less that entered');
    // return view('sales.index')->with('success', 'not register'); 
}
else{
$stokl=(int)$data->quantity-(int)$request->qty[$a];
// dd($stokl);

$model1=([
    'quantity'=>$stokl,

]);
$x=Stock::find($ido);

if($x->update($model1))
{
    Sales::create($model);
}
Activity icon

Started a new Conversation Check Quantity If It Available On Stock

I need an idea regards on my explanation

I have order form i want to check quantity, if the quatity request is available on the stock, i have two store store 1 and 2

So i select product and store on the order form, i want to check before i save the order.

Someone can help me to create this loop

Activity icon

Replied to Find Collection By Id

@snapey but i define it in the model,

but my concept is to select a customer and get his invoice from sales table

Activity icon

Replied to Find Collection By Id

@munazzil , i get the same error

Sep
23
1 month ago
Activity icon

Replied to Find Collection By Id

@tykus i dont know how to apply this

Activity icon

Replied to Find Collection By Id

@munazzil i get this error.

                    Order direction must be "asc" or "desc".
Activity icon

Replied to Find Collection By Id

customer has many invoice, that why i want to select customer and return all invoice belong to customer

    example this customer has this invoices 
            
               FK060919#0001,   FK060919#0003,   FK060919#0007,
Activity icon

Replied to Find Collection By Id

i want to show only some data which is specific selected id

Activity icon

Replied to Find Collection By Id

when i run that foreach its comes multiples, keep in mind that i want to show only one specific selected id

                     public function show($id)
              {

               $customer_ledger=Sales::with('customer')
                 -> select('invoice_no','customer_id','created_at',DB::raw('sum(amount) as totalM'))
                 ->where('customer_id', $id)
                   ->groupby('invoice_no','customer_id','created_at')
                             
                                 ->get();
                 return view('customers.customer_ledger',compact('customer_ledger'));
               }
Activity icon

Started a new Conversation Find Collection By Id

i have two table which is related, i want to select some data where the id is equal to selected, and display in blade

i tried this but get the below error.

 Property [customer] does not exist on this collection instance. 

my code:

         $customer_ledger=Sales::with('customer')
                   -> select('invoice_no','customer_id','created_at',DB::raw('sum(amount) as totalM'))
                   ->where('customer_id', $id)
                     ->groupby('invoice_no','customer_id','created_at')
                      ->get();
Sep
07
2 months ago
Activity icon

Replied to Check Multiple Input With Foreach Loop

How to implement this on my code below? $ids=$request->name;

 for ($a=0; $a < count($ids); $a++)
 {
    //create detail on data faktur

    $ido=$request->name[$a];
    $store=$request->store[$a];

    $model=([
        'invoice_no'=>$fk, 
        'customer_id'=>$request->customer_id, 
        //'product_code'=>$request->product_code[$a], 
        'name'=>$request->name[$a],
        'store'=>$request->store[$a],
        'selling_price'=>$request->selling_price[$a], 
        'amount'=>$request->amount[$a],
        'qty'=>$request->qty[$a], 
    ]);
    //update stok
     $data=Stock::select('quantity','store')->where([
                    ['id', '=', $ido],
                    ['store', '=', $store],
                      ])->first();
    // apply  conditions
    //check if available

    $check=(int)$data->quantity < (int)$request->qty[$a];
    dd($data);
    if($check){
    
    return redirect()->back()
                ->with('success','quantity is Less that entered');
        // return view('sales.index')->with('success', 'not register'); 
    }
    else{
    $stokl=(int)$data->quantity-(int)$request->qty[$a];
    // dd($stokl);

    $model1=([
        'quantity'=>$stokl,

    ]);
    $x=Stock::find($ido);

    if($x->update($model1))
    {
        Sales::create($model);
    }
Activity icon

Started a new Conversation Check Multiple Input With Foreach Loop

I have multiple input of order form(product,price, qnty, store and amount)

I want to put the condition if the product quantity is bigger than stock then redirect back with error

Also i want to check foreach product name if it available (added) on stock inorder to perform the sales if not redirect it back.

Someone can share me an idea to archive this as well.

Sep
05
2 months ago
Activity icon

Started a new Conversation To Check If Satisfy The Condition Statement

i want to have the condition regarding on my code to check few thing as per below

  1. check if the quantity is less than entered with user, and if is less don't save the data display the list of that product which is less
  • right now my code is working only for one products and save others which is not less than.
  1. Also i i want to check if the product is selected as per query says, if not true then display the error of that products is not satisfy the condition.
    • right now my code is working fine but it checks well but if there is error it save only product which is sastify condition.

below is my code of controller

                $ids=$request->name;

    
     for ($a=0; $a < count($ids); $a++)
     {
        //create detail on data faktur

        $ido=$request->name[$a];
        $store=$request->store[$a];

        $model=([
            'invoice_no'=>$fk, 
            'customer_id'=>$request->customer_id, 
            //'product_code'=>$request->product_code[$a], 
            'name'=>$request->name[$a],
            'store'=>$request->store[$a],
            'selling_price'=>$request->selling_price[$a], 
            'amount'=>$request->amount[$a],
            'qty'=>$request->qty[$a], 
        ]);
        //update stok
         $data=Stock::select('quantity','store')->where([
                        ['id', '=', $ido],
                        ['store', '=', $store],
                          ])->first();
        // apply  conditions
        //check if available

        $check=(int)$data->quantity < (int)$request->qty[$a];
        dd($data);
        if($check){
        
        return redirect()->back()
                    ->with('success','quantity is Less that entered');
            // return view('sales.index')->with('success', 'not register'); 
        }
        else{
        $stokl=(int)$data->quantity-(int)$request->qty[$a];
        // dd($stokl);

        $model1=([
            'quantity'=>$stokl,

        ]);
        $x=Stock::find($ido);

        if($x->update($model1))
        {
            Sales::create($model);
        }
        }

i need the help on declare the condition

Sep
03
2 months ago
Activity icon

Started a new Conversation Loop Multiple Select Data

i have a invoice which perform sales basis, , so i want to select product_id and store name(office or Yard) then to calculate some some formular as per code below.

but right now it select only one row and perform calculation, i want to select multiple row according then perform calculation.

below is my code.

           for ($a=0; $a < count($ids); $a++)
    {
        //create detail on data 

        $ido=$request->name[$a];
        $store=$request->store[$a];

        $model=([
            'invoice_no'=>$fk, 
            'customer_id'=>$request->customer_id, 
             'name'=>$request->name[$a],
            'store'=>$request->store[$a],
            'selling_price'=>$request->selling_price[$a], 
            'amount'=>$request->amount[$a],
            'qty'=>$request->qty[$a], 
        ]);
        //update stok
         $data=Stock::select('quantity')->where([
                        ['id', '=', $ido],
                        ['store', '=', $store],
                          ])->first();
        //$data=Stock::select('quantity')->where('id','=',$ido)->first();
  
        $stokl=(int)$data->quantity-(int)$request->qty[$a];

        dd($stokl);
        
        $model1=([
            'quantity'=>$stokl,

        ]);
        $x=Stock::find($ido);

        if($x->update($model1))
        {
            Sales::create($model);
        }

when i running dd($stokl); is show the calculation of one row, while i entered two rows

Sep
02
2 months ago
Activity icon

Replied to Select Multiple Input

There is the second, answer he sent i don't see it inorder to mark as answer that why i comment like that

Activity icon

Replied to Select Multiple Input

@sti3bas your answer is correct, thank you

Activity icon

Replied to Select Multiple Input

i get null

Activity icon

Started a new Conversation Select Multiple Input

i want to select qnty where the condition is much

 $product_id=$request->product_id;
     $store=$request->store;

   $data=Stock::select('quantity')->where(['id'=> $product_id,'store'=>$store])->get();
                                           // ->where('store','=', $store)->get();

     $stockl=(int)$data->quantity+(int)$request->quantity;
     dd($data);

i get the error below

           Property [quantity] does not exist on this collection instance.
Aug
06
3 months ago
Activity icon

Replied to DomPdf Does Not Works

@bobbybouwmann pdf.blade.php it existing

Activity icon

Started a new Conversation DomPdf Does Not Works

hello i try to make a pdf, but the browser is loading to much, and does not work

   public function export_pdf($invoice_no)
{


  $customerInvoice1 = Sales::with('customer')
  ->where('invoice_no', $invoice_no)->first();

  $customerInvoice = Sales::with('customer')
   
  ->where('invoice_no', $invoice_no)->get();

    $totalAmount = $customerInvoice->sum('amount');


$pdf =PDF::loadView('sales.pdf',compact('customerInvoice','totalAmount','customerInvoice1'));

$fieldName=$customerInvoice1->invoice_no;
return $pdf->stream($fieldName. '.pdf'); 

}
Activity icon

Replied to Get Data From Database Without Using Loop

@ftiersch im get some error

    #message: "Trying to get property 'name' of non-object"

i want to select the invoice number then to get all the details regards that invoice number include customer details from customer table

and show me how on the blade can be like

Activity icon

Started a new Conversation Get Data From Database Without Using Loop

I want to achive the particular detail for customer invoice, i dot want to loop customer name,customer adress and customer phone,

how can i pass that info details in my blade

this is my controller

           public function show($invoice_no)
  {

  $customerInvoice = Sales::with('customer')->where('invoice_no','=', $invoice_no)->get();
    $totalAmount = $customerInvoice->sum('amount');
   return view('sales.show', compact('customerInvoice','totalAmount'));
  }
Jul
28
3 months ago
Activity icon

Replied to Create Cash Invoice

No, what i mean here, i want to select the products name, the can display one raw with price and qnty then i can able to add rows and delete rows

Activity icon

Started a new Conversation Create Cash Invoice

kindly i want to create invoice, cashier can select customer/write customer and input multiple orders, price,quantity amount in database

some one can assist me

Jul
20
3 months ago
Activity icon

Started a new Conversation Decrement And Increment The Stock Daily

i want to get a concept about stock decrement and increment

everyday the items is coming to intered in the stock and everyday is saling out,

assist me the concept steps to archive this

Jul
08
4 months ago
Activity icon

Started a new Conversation How To Fetch Data From User Table

i have two tables user and profile table so in profile table i have advocate_id which is related from user.id

so how can i related this two table

i tried this code but i get the errror

my model protected $table = 'profiles'; protected $primaryKey = 'id'; protected $fillable = [ 'advocate_id','Ad_title', 'education','office_add','file','skill','phone'];

       public function user(){
           return $this->belongsTo('App\User', 'advocate_id');
       }

my controller

    public function index()
   {
    
     $adlist = Profile::with('user')->get();
      $userlist=User::where('user_type','Client')->get();
    
     return view('advocate.index',compact('adlist','userlist'));
  
      }

my blade view @foreach($adlist as $key=> $dt) {{++$key}} {{$dt->user->name}} {{$dt->Ad_title}} {{$dt->phone}} {{$dt->user->email}} {{$dt->office_add}} {{$dt->created_at}}

error

    "Trying to get property 'name' of non-object (View: 
    C:\xampp\htdocs\ACS\resources\views\advocate\index.blade.php)"
Jul
06
4 months ago
Activity icon

Replied to Ideas Of To Create A Simple Chats

no, i want like massanger

Activity icon

Started a new Conversation Ideas Of To Create A Simple Chats

i want to create simple chats,i have two users user A and User B, those user are inserted in one table called User,

so i want user A to chats with user B

Activity icon

Replied to How To Update My Array Data

public function up() { Schema::create('profiles', function (Blueprint $table) { $table->bigIncrements('id'); $table->integer('advocate_id')->unsigned(); $table->string('Ad_title'); $table->string('education'); $table->string('office_add'); $table->string('image'); $table->string('skill'); $table->integer('phone'); $table->timestamps(); }); }

Activity icon

Replied to How To Update My Array Data

the record is there in database with ID =3,

that why i told you on another question that what i want to archive

Activity icon

Replied to How To Update My Array Data

Profile::find(3) [!] Aliasing 'Profile' to 'App\Profile' for this Tinker session. => null >>> Profile::find(3) => null >>> i run in twice i get that

Activity icon

Replied to How To Update My Array Data

i have a data with ID of 3 which i inserted manually, so keep in mind that i want to update those data, no matter is there in DB or not

Activity icon

Replied to How To Update My Array Data

i get this

 null
 "3"
Activity icon

Replied to Error "Creating Default Object From Empty Value"

@snapey , i have this issue, i have created a user on USER table, so i want when that user login can update the profile and save data to another table "Profile "

so this is what i want to archive

Activity icon

Replied to How To Update My Array Data

@snapey i changed but still get the same error

Activity icon

Replied to Error "Creating Default Object From Empty Value"

how should i passing it?

Activity icon

Started a new Conversation Error "Creating Default Object From Empty Value"

i dont know what the problem here of my code to update

   public function update(Request $request, $advocate_id)
     {

        $this->validate($request, [
        'Ad_title' => 'required',
        'education' => 'required',
        'office_add' => 'required',
        'skill' => 'required',
        'phone' => 'required',
      
       
       
          ]);
  
    $updateprofile = Profile::find($advocate_id);
    $updateprofile->advocate_id=Auth::user()->id;
    $updateprofile->Ad_title = $request->get('Ad_title');
    $updateprofile->education = $request->get('education');
    $updateprofile->office_add = $request->get('office_add');
     $updateprofile->skill = $request->get('skill');
    $updateprofile->phone = $request->get('phone');
    
    $updateprofile->save();
    return redirect()->route('advocate.profile')->with('success', 'Data Updated');

       }

i get the error subjected above

Activity icon

Replied to How To Update My Array Data

i tried this code below but i get this error

         public function update(Request $request, $advocate_id)
     {

        $this->validate($request, [
        'Ad_title' => 'required',
        'education' => 'required',
        'office_add' => 'required',
        'skill' => 'required',
        'phone' => 'required',
        ]);
  
    $updateprofile = Profile::find($advocate_id);
    $updateprofile->advocate_id=Auth::user()->id;
    $updateprofile->Ad_title = $request->get('Ad_title');
    $updateprofile->education = $request->get('education');
    $updateprofile->office_add = $request->get('office_add');
     $updateprofile->skill = $request->get('skill');
    $updateprofile->phone = $request->get('phone');
    
    $updateprofile->save();
    return redirect()->route('advocate.profile')->with('success', 'Data Updated');

    }

Error

   "Creating default object from empty value"
Activity icon

Started a new Conversation How To Update My Array Data

i need help how the controller should be , i have my form to update some data below is my blade view and model, so i want to setup my controller to update those data.

my form

   <form  action="advocate/profile/.$data->id" method="POST" class="form-horizontal" enctype="multipart/form-data">
               {{ csrf_field() }} 
              <div class="form-group">
                <label for="inputName" class="col-sm-2 control-label">Title Name</label>

                <div class="col-sm-10">
                  <input type="text" class="form-control" name="Ad_title" id="inputName" placeholder="Name">
                </div>
              </div>
              <div class="form-group">
                <label for="inputName" class="col-sm-2 control-label">Education </label>

                <div class="col-sm-10">
                  <input type="text" class="form-control" name="education" id="inputName" placeholder="Name">
                </div>
              </div>
              <div class="form-group">
                <label for="inputEmail" class="col-sm-2 control-label">office Address</label>

                <div class="col-sm-10">
                  <input type="text" class="form-control" name="office_add" id="inputEmail" placeholder="Email">
                </div>
              </div>
              <div class="form-group">
                <label for="inputName" class="col-sm-2 control-label">Image</label>

                <div class="col-sm-10">
                  <input type="file" class="form-control" name="file" id="inputName" placeholder="Name">
                </div>
              </div>
              <div class="form-group">
                <label for="inputExperience" class="col-sm-2 control-label">Skills</label>

                <div class="col-sm-10">
                  <textarea class="form-control" name="skill" id="inputExperience" placeholder="Experience"> 
         </textarea>
                </div>
              </div>

my model

       protected $table    = 'profiles';
   protected $primaryKey = 'id';
  protected $fillable = [ 'advocate_id','Ad_title', 'education','office_add','file','skill','phone'];

    public function user(){
    return $this->belongsTo('App\User','advocate_id');
      }
Jul
03
4 months ago
Activity icon

Started a new Conversation Fetch Data From Database Base On Users

i have two users Admin and advocate,

i want Admin to view all data from selected model and advocate to view a specific data from the same model,

now i managed view a spefics data from advocate

below is my code

     public function index()
  {
    //

    $userId = Auth::user()->id;
   $case = CaseManage::where('ad_id',$userId)->get();
    return view('case_manage.add_case')->with(compact('case'));
   }
Activity icon

Started a new Conversation Insert User Id() Into Another Table

my code has error

 " SQLSTATE[22007]: Invalid datetime format: 1366 Incorrect integer value: 

'{"id":3,"name":"Justine","email":"[email protected]","user_type":"Advocate","email_verified_at":null,"created_at":"2019-06-17 09' for column 'ad_id' at row 1 (SQL: insert into case_manages (ad_id, case_title, file, updated_at, created_at) values ({"id":3,"name":"Justine","email":"[email protected]","user_type":"Advocate","email_verified_at":null,"created_at":"2019-06-17 09:52:18","updated_at":"2019-06-17 09:52:18"}, mama, Lecture Five-Design, Develop and Market a Product (3).pptx, 2019-07-03 12:05:32, 2019-07-03 12:05:32)) "

my code

      public function store(Request $request)
  {
    //

  if($file = $request->file('file')){
    $docsfile=$file->getClientOriginalName();
    if($file->move('Case_file', $docsfile)){

        $upload= new CaseManage();
        $upload->ad_id=Auth::user();
         $upload->case_title= $request->input('title');
         $upload->file=$docsfile;

         $upload->save();

   return redirect('add_case')->with('success','success Laws uploaded');

    };

    }

return redirect()->back()->with('success','Not Uploaded'); }

Jun
03
5 months ago
Activity icon

Replied to Decrement Stock Product Quantity As Per Ordered

No, the flow is like this

I have stock menu, after add all products in DB, then on stock menu i select the product name and entered the stock detail (quantity and store; either store 1 and store 2) the i save it

After that i make a order, so i want when i make a order i want to select the store inorder to decrement it.

Activity icon

Started a new Conversation Decrement Stock Product Quantity As Per Ordered

I have two store, store 1 and Store 2, i want to decrement quantity in store 1 based on order

Some one can assist me the concept ?