app/Http/Controllers/LoaiSanPhamController.php
/**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
Store a newly created resource in storage.
Store a newly created resource in storage .
public function store(Request $request)
    {
        $loaisp = new loaiSanPham;
        $loaisp->tenloai = $request->tenloai;
        $loaisp->slug = $request->slug;
        $loaisp->mota = $request->mota;
        $loaisp->id_parent = $request->id_parent;
        $loaisp->image = $imageName;
        $loaisp->save();
        return back()
            ->with('success','Thêm loại sản phẩm thành công');
    }
public function store ( Request $ request ) { $ loaisp = new loaiSanPham ; $ loaisp -> tenloai = $ request -> tenloai ; $ loaisp -> slug = $ request -> slug ; $ loaisp -> mota = $ request -> mota ; $ loaisp -> id_parent = $ request -> id_parent ; $ loaisp -> save ( ) ; return back ( ) -> with ( 'success' , 'Thêm loại sản phẩm thành công'); }
Store a newly created resource in storage.
Store a newly created resource in storage .
//        // //        $request->validate([ //            'image' => 'required|image|mimes:jpeg,png,jpg,gif,svg|max:2048', //        ]); //        $imageName = $request->image->getClientOriginalName(); //        $request->image->move(public_path('images'), $imageName); // //$loaisp->image = $imageName;