Get the solution ↓↓↓
If$title variable is containsnotVariable that make$posts->$title equivalen to$posts->notVariable. So you just need to remove$ on$posts key/attribute.
change
$posts->$title = $title;
Log::info($posts);
$posts->$slug = $request->input('pxp-submit-comm-slug');
$posts->$content = $overview;
$posts->$featured_url = $photo;
$posts->$post_status = $post_status;
to
$posts->title = $title;
Log::info($posts);
$posts->slug = $request->input('pxp-submit-comm-slug');
$posts->content = $overview;
$posts->featured_url = $photo;
$posts->post_status = $post_status;
PHP allows for the use of variable variables as well as using variables as object keys (see this post for more explanation). You appear to be unintentionally incorporating this principle.
Before theLog::info() statement you are setting
$posts->$title = $title
In PHP this is actually setting the key as$titles value which explains the "Two Homes NOW Under Construction for Late Spring Move-in Dates" key in your object. You aren't getting an Undefined variable error for$title because that variable exists. You are getting the Undefined variable: slug error because you are attempting to use the variables$slug,$content, etc. which do not exist to set the other keys. You need to update your code to remove the$ after the arrow.
$posts->title = $title;
$posts->slug = $request->input('pxp-submit-comm-slug');
$posts->content = $overview;
$posts->featured_url = $photo;
$posts->post_status = $post_status;
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Find the answer in similar questions on our website.
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.
PHP (from the English Hypertext Preprocessor - hypertext preprocessor) is a scripting programming language for developing web applications. Supported by most hosting providers, it is one of the most popular tools for creating dynamic websites.
The PHP scripting language has gained wide popularity due to its processing speed, simplicity, cross-platform, functionality and distribution of source codes under its own license.
https://www.php.net/
Welcome to the Q&A site for web developers. Here you can ask a question about the problem you are facing and get answers from other experts. We have created a user-friendly interface so that you can quickly and free of charge ask a question about a web programming problem. We also invite other experts to join our community and help other members who ask questions. In addition, you can use our search for questions with a solution.
Ask about the real problem you are facing. Describe in detail what you are doing and what you want to achieve.
Our goal is to create a strong community in which everyone will support each other. If you find a question and know the answer to it, help others with your knowledge.