pbnskd

pbnskd

Member Since 1 Year Ago

Experience Points 550
Experience Level 1

4,450 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 1
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.

07 Sep
1 week ago

pbnskd left a reply on How To Get The Latest Entry As Per Product Id

yeah solve by make changes in config database 'strict' => true,

to 'strict' => false,

and code

 $stockin = DB::table('stockins')->latest('product_id','created_at')->groupBy('Product_id')->orderBy('created_at', 'desc')->get();

pbnskd left a reply on How To Get The Latest Entry As Per Product Id

Error

SQLSTATE[42000]: Syntax error or access violation: 1055 'stock.stockins.id' isn't in GROUP BY (SQL: select * from stockins group by Product_id order by created_at desc)

pbnskd left a reply on How To Get The Latest Entry As Per Product Id

Im trying to get the latest entry of Product id only

pbnskd left a reply on How To Get The Latest Entry As Per Product Id

Table: stockins

ID Product_id   QTY      create_at
1   1               10      2019-08-20 16:22:03
2   2               10      2019-08-20 16:22:03
3   1               10      2019-08-20 16:22:30
4   3               10      2019-08-20 16:22:03 

need Output


 ID Product_id  QTY      create_at
2   2               10      2019-08-20 16:22:03
3   1               10      2019-08-20 16:22:30
4   3               10      2019-08-20 16:22:03

pbnskd left a reply on How To Get The Latest Entry As Per Product Id

no this is not also working. it show all data

pbnskd left a reply on How To Get The Latest Entry As Per Product Id

SQLSTATE[42000]: Syntax error or access violation: 1055 'stock.stockins.id' isn't in GROUP BY (SQL: select * from stockins group by product_id order by created_at desc)

pbnskd started a new conversation How To Get The Latest Entry As Per Product Id

I want get the data of latest entry as per product_id entry

Table: stockins

 ID Product_id QTY create_at
1   1   10 2019-08-20 16:22:03
2   2   10 2019-08-20 16:22:03
3   1   10 2019-08-20 16:22:03
4   3   10 2019-08-20 16:22:03 

need Output

 ID Product_id QTY create_at
1   1   10 2019-08-20 16:22:03
2   2   10 2019-08-20 16:22:03
4   3   10 2019-08-20 16:22:03

Code

 $stockin = DB::table('stockins')->latest('created_at')->first();
19 Aug
4 weeks ago

pbnskd left a reply on Two Table Difference Calution

still not working. i'm just trying to get sum of qty_in and sum of qty_out whet productid is same and their difference

pbnskd left a reply on Two Table Difference Calution

public function stockStatus()
    {
        $stocks = DB::table('tbl_products')
            ->join('stockins', 'stockins.product_id', '=', 'tbl_products.id')
            ->join('stockouts','stockouts.product_id','=',  'tbl_products.id')
            ->select(DB::raw('sum(stockins.qty_in) AS TotolIN', 'sum(stockouts.qty_out) AS Totolout', 'SUM(TotolIN + Totolout) AS Totolqty' ))
            ->get('tbl_products.id','product_id','Totolqty');


        return redirect('/admin/stocks/stocks', compact('stocks') );

    }

Route:

Route::get('/stockStatus', '[email protected]')->name('stockStatus');

pbnskd left a reply on Two Table Difference Calution

in same controller i have use auth

public function __construct() { $this->middleware('auth'); }

pbnskd left a reply on Two Table Difference Calution

i have tried this: $stocks = DB::table('tbl_products') ->join('stockins', 'tbl_products.id', '=', 'stockins.product_id') ->join('stockouts', 'tbl_products.id','=', 'stockouts.product_id') ->select(DB::raw('sum(stockins.qty_in) AS TotolIN', 'sum(stockouts.qty_out) AS Totolout', 'SUM(TotolIN + Totolout) AS Totolqty' )) ->get('product_id','Totolqty'); but now error is Argument 2 passed to Symfony\Component\HttpFoundation\RedirectResponse::__construct() must be of the type int, array given, called in

pbnskd left a reply on Two Table Difference Calution

error : SQLSTATE[42S02]: Base table or view not found: 1146 Table 'stocknetic.stocks' doesn't exist (SQL: select sum(stockins.qty_in) AS TotolIN from stocks inner join stockins on stocks.product_id = stockins.product_id inner join stockouts on stocks.id = =product_id)

pbnskd started a new conversation Two Table Difference Calution

Error SQLSTATE[42000]: Syntax error or access violation

Model: stockin

protected $table = 'stockins';

protected $fillable = [

'product_id'
, 
'qty_in',

];

model: stockout

protected $table = 'stockouts';

protected $fillable = [

'product_id'
, 
'qty_out',

];

Controller

public function stockStatus() {

$stocks = DB::table('stockins')
    ->join('stockins', 'stocks.product_id', '=', 'stockins.product_id')
    ->join('stockouts', 'stocks.id', '=product_id', 'stockins.product_id')
    ->select(DB::raw('sum(stockins.qty_in) AS TotolIN', 'sum(stockouts.qty_out) AS Totolout', 'SUM(TotolIN + Totolout) AS Totolqty' ))
    ->get('product_id','Totolqty');




return redirect('/admin/stocks/stocks', compact('stocks') );

}

i have not set the relationship of to table

16 Aug
1 month ago

pbnskd left a reply on Count Row From Id From Another Table ID

now error BadMethodCallException Call to undefined method App\tbl_products::suppliers()

Yeah in this product can have many suppliers

pbnskd started a new conversation Count Row From Id From Another Table ID

I was try to count row 'supplier_id'from the from another table id(>{{$product->id}} Code

View

@if($products)

@foreach($products as $product)


    <tr>
        <td>{{$product->id}}</td>
        <td> <img height="30" src="{{$product->photo ? $product->photo->file : 'http://placehold.it/400x400'}}" alt="" ></td>
        <td><a href="{{route('admin.stocks.edit',[$product->id])}}">{{$product->pName}}</a></td>
        


                <td>{{$supplier}}</td>


@endforeach

@endif

Controller

public function index()

{

$products = tbl_products::all();

$supplier = tbl_product_supplier::where('supplier_id','=',$products)->count();


return view('admin.stocks.index', compact('products','supplier'));

}

model

protected $fillable = [

    'product_id',

'supplier_id', 'price',

public function products(){

return $this->belongsTo('App\tbl_products');

}

28 Feb
1 year ago

pbnskd started a new conversation Method Join Does Not Exist.

Controller

public function Currrenquiries(){


    $enquiries = enquiry::all()->join('assign', 'enquiry.id', '=', 'assign.EnquiryID')

                   ->where('person', 'AAAA')
        ->get();


    return view::make(enquiry.CurrentEnquiry', compact('enquiries'));

}

Model

class enquiry extends Model
{
    protected $table = 'enquiries';

    protected $fillable = ['EnquiryDate', 'Name'];

    public function enquiry(){

        return $this->hasOne(Assign::class);


    }

}

class Assign extends Model
{
    protected $table = 'assigns';
    protected $fillable = ['EnquiryID', 'Person', 'Remark'];

}

HTML Table

<tbody>
@foreach($enquiries as $enquiry)
    <tr class="odd gradeX">
        <td> {{$enquiry->Name}} </td>
        <td> {{$enquiry->Remark}} </td>
              

                </tr>

@endforeach
            </tbody>
27 Feb
1 year ago

pbnskd left a reply on Property [id] Does Not Exist On This Collection Instance.

@extends('layout.master')
@section('datatable')
@include('layout.style.datatable')
@stop
@section('page')
Enquiry
@stop
@section('contain')

<div class="row">
    <div class="col-md-12">
        <!-- BEGIN EXAMPLE TABLE PORTLET-->
        <div class="portlet light bordered">
            <div class="portlet-title">
                <div class="caption font-dark">
                    <i class="icon-settings font-dark"></i>
                    <span class="caption-subject bold uppercase"> Enquiry List</span>
                </div>

            </div>
            <div class="portlet-body">
                <div class="table-toolbar">
                    <div class="row">
                        <div class="col-md-6">
                            <div class="btn-group">
                                <button id="sample_editable_1_new" class="btn sbold green"> Reload
                                    <i class="fa fa-plus"></i>
                                </button>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="btn-group pull-right">
                                <button class="btn green  btn-outline dropdown-toggle" data-toggle="dropdown">Tools
                                    <i class="fa fa-angle-down"></i>
                                </button>
                                <ul class="dropdown-menu pull-right">
                                    <li>
                                        <a href="javascript:;">
                                            <i class="fa fa-print"></i> Print </a>
                                        </li>
                                        <li>
                                            <a href="javascript:;">
                                                <i class="fa fa-file-pdf-o"></i> Save as PDF </a>
                                            </li>
                                            <li>
                                                <a href="javascript:;">
                                                    <i class="fa fa-file-excel-o"></i> Export to Excel </a>
                                                </li>
                                            </ul>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <table class="table table-striped table-bordered table-hover table-checkable order-column" id="sample_1">
                                <thead>
                                    <tr>
                                        <th>
                                            <label class="mt-checkbox mt-checkbox-single mt-checkbox-outline">
                                                <input type="checkbox" class="group-checkable" data-set="#sample_1 .checkboxes" />
                                                <span></span>
                                            </label>
                                        </th>
                                        <th> ID </th>
                                        <th> Enquiry Name </th>
                                        
                                    </tr>
                                </thead>
                                <tbody>
                                @foreach($enquiries as $enquiries)
                                    <tr class="odd gradeX">
                                        <td>
                                            <label class="mt-checkbox mt-checkbox-single mt-checkbox-outline">
                                                <input type="checkbox" class="checkboxes" value="1" />
                                                <span></span>
                                            </label>
                                        </td>
                                        <td> {{$enquiries->id}} </td>
                                        <td> {{$enquiries->Name}} </td>
                                        


                                        <td>
                                            <a class="btn btn-outline dark" data-target="#stack1" data-toggle="modal" data-action=""> Assign to </a>
                                        </td>
                                        assign


                                                </tr>

                                @endforeach
                                            </tbody>
                                        </table>
                                    </div>
                                </div>
                                <!-- END EXAMPLE TABLE PORTLET-->
                            </div>

    <div id="stack1" class="modal fade" tabindex="-1" data-focus-on="input:first">

            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>

                <h4 class="modal-title">Assign Enquiry To</h4>
            </div>

            <div class="modal-body">
                @foreach($enquiries as $enquiry)
                <form method="post" action="{{route('assign', $enquiry->id)}}">
                    {{csrf_field()}}
                <p>Assign to </p>
                <div class="form-group">
                    <label class=" control-label">Remark</label>

                    <textarea class="form-control" rows="3" name="remark"></textarea>

                </div>

                <div class="form-group">

                    <label class="control-label">Peerson</label>

                    <select class="form-control" name="DPPerson">
                        <option>AAAA</option>
                        <option>BBBBB</option>
                        <option>CCCCC</option>
                        <option>DDDD</option>
                    </select>

                </div>

                <div class="modal-footer">
                    <button type="button" data-dismiss="modal" class="btn btn-outline dark">Close</button>
                    <button type="submit" class="btn green">Ok</button>

                </div>
                </form>
                @endforeach
            </div></div>


</div>
                        @stop

                        @section('data-script')
                        @include('layout.Script.data-script')
                        @[email protected]('layout.master')
@section('datatable')
@include('layout.style.datatable')
@stop

pbnskd left a reply on Property [id] Does Not Exist On This Collection Instance.

class EnquiryContoller extends Controller
{
public function CurentEnquires()
{
    $enquiries = enquiry::all()->where('Status', '');


    return view(enquiry.AssignEnquiry', compact('enquiries'));
}

public function PostAssign(Request $request, $id){

    $assign = new Assign([
        'EnquiryID' => $id,
        'Person' => $request->input((DPperson)),
        'Remark' => $request->input(('remark'))

    ]);
    $assign ->save();

    return redirect()->route('/');

}
}

pbnskd left a reply on Property [id] Does Not Exist On This Collection Instance.

i have try that also it also gives same error

pbnskd left a reply on Property [id] Does Not Exist On This Collection Instance.

In same page table like this

@foreach($enquiries as $enquiries)
                                    <tr class="odd gradeX">
                                        <td>

                                                <input type="checkbox" class="checkboxes" value="1" />
                                                <span></span>
                                            </label>
                                        </td>
                                        <td> {{$enquiries->id}} </td>
                                        <td> {{$enquiries->Name}} </td>
                                       

                                        <td>
                                            <a class="btn btn-outline dark" data-target="#stack1" data-toggle="modal" data-action=""> Assign to </a>
                                        </td>
                                        assign


                                                </tr>

                                @endforeach

                                            </tbody>
                                        </table>
 <div id="stack1" class="modal fade" tabindex="-1" data-focus-on="input:first">

            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>

                <h4 class="modal-title">Assign Enquiry To</h4>
            </div>
       
            <div class="modal-body">
                 <form method="POST" action="{{route('assign', $enquiries->id)}}">
        {{csrf_field()}}
    <p>Assign to </p>
    <div class="form-group">
        <label class=" control-label">Remark</label>

        <textarea class="form-control" rows="3" name="remark"></textarea>

    </div>

    <div class="form-group">

        <label class="control-label">Person</label>

        <select class="form-control" name=" DPperson ">
            <option>AAAA</option>
            <option>BBBBB</option>
            <option>CCCCC</option>
            <option>DDDD</option>
        </select>

    </div>

    <div class="modal-footer">
        <button type="button" data-dismiss="modal" class="btn btn-outline dark">Close</button>
        <button type="submit" class="btn green">Ok</button>

    </div>
    </form>
            </div>
       </div>

pbnskd left a reply on Property [id] Does Not Exist On This Collection Instance.

i'm getting problem in posting code in laracast

pbnskd left a reply on Property [id] Does Not Exist On This Collection Instance.

form method="POST" action="{{route('assign', $enquiries->id)}}"

pbnskd started a new conversation Property [id] Does Not Exist On This Collection Instance.

Controller

class EnquiryContoller extends Controller
{
public function CurentEnquires()
{
    $enquiries = enquiry::all()->where('Status', '');


    return view(enquiry.AssignEnquiry', compact('enquiries'));
}

public function PostAssign(Request $request, $id){

    $assign = new Assign([
        'EnquiryID' => $id,
        'Person' => $request->input((DPperson)),
        'Remark' => $request->input(('remark'))

    ]);
    $assign ->save();

    return redirect()->route('/');

}
}

Route

Route::get('/Currrenquiries',[
    'uses' =>'[email protected]',
    'as' =>'enquiries'
]);

Route::Post('/assign/{id}',[
    'uses' =>'[email protected]',
    'as' =>'assign'
]);

Form

    <form method="POST" action="{{route('assign', $enquiries->id)}}">
        {{csrf_field()}}
    <p>Assign to </p>
    <div class="form-group">
        <label class=" control-label">Remark</label>

        <textarea class="form-control" rows="3" name="remark"></textarea>

    </div>

    <div class="form-group">

        <label class="control-label">Person</label>

        <select class="form-control" name=" DPperson ">
            <option>AAAA</option>
            <option>BBBBB</option>
            <option>CCCCC</option>
            <option>DDDD</option>
        </select>

    </div>

    <div class="modal-footer">
        <button type="button" data-dismiss="modal" class="btn btn-outline dark">Close</button>
        <button type="submit" class="btn green">Ok</button>

    </div>
    </form>

Model

class enquiry extends Model
{
    protected $table = 'enquiries';

    protected $fillable = ['EnquiryDate', 'Name'];

    public function assign(){

        return $this->belongsTo('App\Assign');

    }

}

class Assign extends Model
{
    protected $table = 'assigns';
    protected $fillable = ['EnquiryID', 'Person', 'Remark' ];

    public function enquiry(){

        return $this->belongsTo('App\Enquiry');

    }

}