pbnskd

pbnskd

Member Since 1 Year Ago

Experience Points
550
Total
Experience

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.

Level 1
550 XP
Sep
07
4 months ago
Activity icon

Replied to 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();
Activity icon

Replied to 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)

Activity icon

Replied to How To Get The Latest Entry As Per Product Id

Im trying to get the latest entry of Product id only

Activity icon

Replied to 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
Activity icon

Replied to How To Get The Latest Entry As Per Product Id

no this is not also working. it show all data

Activity icon

Replied to 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)

Activity icon

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();
Aug
19
5 months ago
Activity icon

Replied to 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

Activity icon

Replied to 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');
Activity icon

Replied to Two Table Difference Calution

in same controller i have use auth

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

Activity icon

Replied to 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

Activity icon

Replied to 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)

Activity icon

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

Aug
16
5 months ago
Activity icon

Replied to 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

Activity icon

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');

}