app/Http/Controllers/Client/ClientScriptController.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) 
    {
        $validator = $this->validator($request->all());
        if ($validator->fails()) {
            $errors = $validator->errors(); 
            $errors =  json_decode($errors);
            return response()->json([
                'success' => false,
                'message' => $errors
            ], 200);
            die();
        }
        $this->add($request->all());
        return response()->json([
            'success' => true,
            'message' => Lang::get('message.client.positiv_add_script')
        ], 200);
        die();
    }
public function store ( Request $ request ) { $ validator = $ this -> validator ( $ request -> all ( ) ) ; if ( $ validator -> fails ( ) ) { $ errors = $ validator -> errors ( ) ; $ errors = json_decode ( $ errors ) ; return response ( ) -> json ( [ 'success' => false , 'message' => $ errors ] , 200 ) ; die ( ) ; } $ this -> add ( $ request -> all ( ) ) ; return response ( ) -> json ( [ 'success' => true , 'message' => Lang :: get ( 'message.client.positiv_add_script' ) ] , 200 ) ; die ( ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .
//save block data main.js function ajax_add_script -> a child unit is added here too //error send to ajax