Search
 
SCRIPT & CODE EXAMPLE
 

PHP

Laravel: Foreign id does not have default value

/**
     * Store a newly created resource in storage.
     *
     * @param  IlluminateHttpRequest  $request
     * @return IlluminateHttpResponse
     */
    public function store(Request $request)
    {
        //
        $validator = Validator::make($request->all(), [
            'preferred_day' => [
                'required',
                Rule::in('wednesday','friday'),
            ],
            'preferred_time' => 'required|date_format:h:i:s',
            'goals' => 'required|min:10',
        ]);

        if ($validator->fails()) {
            return response()->json($validator->errors(), 422);
        }

        $validated = $validator->validated();

        $detail = ClientDetail::create($validated);
        return new ClientDetailResource($detail);
    }
Comment

PREVIOUS NEXT
Code Example
Php :: wordpress get post type from url 
Php :: layer order matplotlib 
Php :: how to include page specific css in xphp smart header 
Php :: remove rank math next prev canonical 
Php :: laravel how to address to git repo for develop packages 
Php :: custom morph relation laravel 
Php :: SQLSTATE[42S02]: Base table or view not found: 1146 Table many to many in laravel 
Php :: json encode unset array 
Php :: php tools for visual studio package did not load correctly 
Php :: text short in laravel 
Php :: php?gs=3 
Php :: PHP catch eval output 
Php :: php artisan seading 
Php :: remove public in laravel 
Php :: visual studio php dollar sign double click 
Php :: enable gutenberg for template 
Php :: php send sms for aws sns sdk 2 
Php :: null coalesce operator in php (laravel) 
Php :: Define Events in Model 
Php :: logout php mysql 
Php :: developer polyglots 
Php :: symfony postgresql 
Php :: add element to this array 
Php :: define table name in model laravel 
Php :: Syntax error or access violation: 1072 Key column doesnt exist in table laravel migrate 
Php :: php html entity for url 
Php :: mysqli_fetch_all() expects parameter 1 to be mysqli_result, boolean given in C:xampphtdocscomplete-blog-phpadminincludespost_functions.php on line 31 
Php :: install google binary ou firefox binary 
Php :: php oops 
Php :: adding n days to a DATETIME format value 
ADD CONTENT
Topic
Content
Source link
Name
1+3 =