app/Http/Controllers/CcrController.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)
    {
        $data = request()->validate([
            'rjo_id' => 'required|exists:rjo,id',
            'file' => 'required|file|max:1024',
        ]);
        $file = $data['file'];
        $name_file = uniqid().'_rjo_no.'.$data['rjo_id'].'.'.$file->getClientOriginalExtension();
        $file = $file->storeAs('public/berkas/ccr/', $name_file);
        $data['file'] = $name_file;
        $ccr = Ccr::create($data);
        $route_download = route('ccr.surat', $ccr->id);
        return redirect()->route('ccr.index')->with([
            'success' => 'Data C.C.R berhasil dimasukan dan surat perintah berhasil dibuat',
            'download' => $route_download
        ]);
    }
public function store ( Request $ request ) { $ data = request ( ) -> validate ( [ 'rjo_id' => 'required|exists:rjo,id' , 'file' => 'required|file|max:1024' , ] ) ; $ file = $ data [ 'file' ] ; $ name_file = uniqid ( ) . '_rjo_no.' . $ data [ 'rjo_id' ] . '.' . $ file -> getClientOriginalExtension ( ) ; $ file = $ file -> storeAs ( 'public/berkas/ccr/' , $ name_file ) ; $ data [ 'file' ] = $ name_file ; $ ccr = Ccr :: create ( $ data ) ; $ route_download = route ( 'ccr.surat' , $ ccr -> id ) ; return redirect ( ) -> route ( 'ccr.index' ) -> with ( [ 'success' => 'Data C.C.R berhasil dimasukan dan surat perintah berhasil dibuat' , 'download' => $ route_download ] ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .