本文整理汇总了PHP中app\models\Post::CreatePost方法的典型用法代码示例。如果您正苦于以下问题:PHP Post::CreatePost方法的具体用法?PHP Post::CreatePost怎么用?PHP Post::CreatePost使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\models\Post
的用法示例。
在下文中一共展示了Post::CreatePost方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: uploadpost
public function uploadpost(Request $request)
{
$board_id = $request->input("board_id");
$description = $request->input("description");
$photo_link = '';
$user_id = '';
$place_id = $request->input("place_id");
$hashtag = $request->input("hashtag");
Post::CreatePost($board_id, $description, $photo_link, $user_id, $place_id, $hashtag);
}
示例2: store
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
//
if (!Auth::check()) {
return response()->json("Please login");
}
$description = $request->input('description');
$board_id = $request->input('board_id');
$user_id = Auth::user()->user_id;
$photo_link = $request->input('photo_link');
$post = Post::CreatePost($board_id, $description, $photo_link, $user_id, null, null);
return response()->json($post);
}
示例3: store
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
//
if (!Auth::check()) {
return response()->json("Please login");
}
$description = $request->input('description');
$board_id = $request->input('board_id');
$user_id = Auth::user()->user_id;
$photo_link = $request->input('photo_link');
if ($request->input('name_address') != null) {
$place_lat = $request->input('latitude');
$place_lng = $request->input('longitude');
$place_name = $request->input('name_address');
$place_address = $request->input('address');
$hash_tag = $request->input('hashtag');
$place = Place::createPlace($place_name, $place_address, $place_lat, $place_lng);
$post = Post::CreatePost($board_id, $description, $photo_link, $user_id, $place, $hash_tag);
} else {
$post = Post::CreatePost($board_id, $description, $photo_link, $user_id, null, $hash_tag);
}
return response()->json(true);
}