Ai trái ngành muốn chuyển sang IT hãy nhìn những hình này

Mới vậy đã kêu. :doubt:

1615666189879.png
 
Code js mà khó thì đúng chán. . Mấy ông làm software thì dễ không, nhìn qua mấy job bên computer science như embedded, os, networking, al,ml, robotics , computer vision chắc khóc thét

Trong ngành it này tôi chỉ nể mấy ông làm embedded và networking mà đạt đc level cao, ngành này khó vkl.
 
Last edited:
đây là cách tôi code

PHP:
<?php

namespace App\Http\Controllers\Api;

use App\Product;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Http\Requests\Api\CreateProductRequest;
use App\Http\Requests\Api\UpdateProductRequest;

class ProductController extends Controller
{
    public function index() {
        $products = new Product();
        $products = $this->fetchAll($products);
        $products = $this->order($products);
        $products = $this->search($products);
        $products = $this->paginate($products);
        return $this->responseData($products);
    }
   
    public function store(CreateProductRequest $request)
    {
        $productInfo = $request->only('employee_id','type','diameter','softness','color', 'origin', 'long', 'height', 'amount', 'remark', 'date');
        if($productInfo['remark'] == null) {
            $productInfo['remark'] = "";
        }
        $product = new Product();
        $product->fill($productInfo);
        $product->paid = false;
        $product->save();
        return $this->responseSuccess();
    }

    public function update(UpdateProductRequest $request, $id)
    {
        if($id == null || $id == ''){
            return $this->responseError(config('errors.ID_MUST_BE_NOT_NULL'));
        }

        $product = Product::find($id);
        if(!$product){
            return $this->responseError(config('errors.PRODUCT_NOT_EXISTS'));
        }

        $productInfo = $request->only('employee_id','type','diameter','softness','color', 'origin', 'long', 'height', 'amount', 'remark', 'date');
        if($productInfo['remark'] == null) {
            $productInfo['remark'] = "";
        }
        $product->fill($productInfo)->save();
        return $this->responseSuccess();
    }

    public function destroy($id)
    {
        if($id == null || $id == ''){
            return $this->responseError(config('errors.ID_MUST_BE_NOT_NULL'));
        }

        $product = Product::find($id);
        if(!$product){
            return $this->responseError(config('errors.PRODUCT_NOT_EXISTS'));
        }

        $product->delete();
        return $this->responseSuccess();
    }
   
    private function search($products){
        if(request()->employee_id != null) {
            $products->where('employee_id', request()->employee_id);
        }
        if(request()->type != null) {
            $products->where('type', request()->type);
        }
        if(request()->diameter != null) {
            $products->where('diameter', request()->diameter);
        }
        if(request()->softness != null) {
            $products->where('softness', request()->softness);
        }
        if(request()->color != null) {
            $products->where('color', request()->color);
        }
        if(request()->origin != null) {
            $products->where('origin', request()->origin);
        }
        if(request()->long != null) {
            $products->where('long', request()->long);
        }
        if(request()->height != null) {
            $products->where('height', request()->height);
        }
        if(request()->from_date != null) {
            $products->where('date', '>=', request()->from_date);
        }
        if(request()->to_date != null) {
            $products->where('date', '<=', request()->to_date);
        }
        return $products;
    }
}
Laravel mấy đây phen, hình như nghe nói lên tới ver 7 rồi đúng ko
Sao controller vẫn còn xử lí nv thế, move qua tầng service đi chứ
 
Thằng thớt ngáo đá à, nhìn đống code còn ko bằng 1/10 code trong file excel của chị em kế toán nữa :rolleyes: thằng cốt đơ nào than code khổ thì sang làm kế toán xem ai khổ hơn :doubt:

Gửi bằng vozFApp
 
Back
Top