app/Http/Controllers/DataController.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)
    {
        $this->validate($request, [
           'surname' => 'required|max:20',
            'name'  => 'required|max:20'
        ]);
        Worker::create($request->all());
        return response()->json(['message'=> 'Нові дані записані в базу']);
    }
public function store ( Request $ request ) { $ this -> validate ( $ request , [ 'surname' => 'required|max:20' , 'name' => 'required|max:20' ] ) ; Worker :: create ( $ request -> all ( ) ) ; return response ( ) -> json ( [ 'message' => 'Нові дані записані в базу']); }
Store a newly created resource in storage.
Store a newly created resource in storage .