当前位置: 首页>>代码示例>>PHP>>正文


PHP Photo::updateAvatar方法代码示例

本文整理汇总了PHP中Photo::updateAvatar方法的典型用法代码示例。如果您正苦于以下问题:PHP Photo::updateAvatar方法的具体用法?PHP Photo::updateAvatar怎么用?PHP Photo::updateAvatar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Photo的用法示例。


在下文中一共展示了Photo::updateAvatar方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: UpdateEvent

 public static function UpdateEvent($input)
 {
     $id = $input['id'];
     $rules = array('event_category_id' => 'required', 'city_id' => 'required', 'name' => 'required', 'stewardship' => 'required|min:5', 'description' => 'required|min:5', 'location' => 'required', 'started_at' => 'required', 'ended_at' => 'required');
     $validator = Validator::make($input, $rules);
     if ($validator->fails()) {
         return $validator->errors()->all();
     } else {
         $started_at = empty($input['started_at']) ? 'no' : preg_split("/([\\/: ])/", $input['started_at']);
         $ended_at = empty($input['ended_at']) ? 'no' : preg_split("/([\\/: ])/", $input['ended_at']);
         $input = array('event_category_id' => $input['event_category_id'], 'city_id' => $input['city_id'], 'email' => $input['email'], 'name' => $input['name'], 'user_id' => Auth::check() ? Auth::user()->id : '', 'stewardship' => $input['stewardship'], 'description' => $input['description'], 'location' => $input['location'], 'website_url' => $input['website_url'], 'social_media_urls' => $input['social_media_urls'], 'status' => $input['status'], 'started_at' => mktime((int) $started_at[3], (int) $started_at[4], 0, (int) $started_at[0], (int) $started_at[1], (int) $started_at[2]), 'ended_at' => mktime((int) $ended_at[3], (int) $ended_at[4], 0, (int) $ended_at[0], (int) $ended_at[1], (int) $ended_at[2]), 'created_at' => time(), 'updated_at' => time());
         $getSlug = Events::where('id', $id)->first();
         $slug = Str::slug($input['name']);
         // jika input tidak sama dengan slug di database
         if (strcmp($input['name'], $getSlug['name']) != 0) {
             $checkSlug = Events::where('slug', $slug)->where('id', '!=', $id)->count();
             if ($checkSlug > 0) {
                 $input['slug'] = $slug . "-" . $id;
             } else {
                 $input['slug'] = $slug;
             }
         }
         $photo = Photo::updateAvatar($getSlug['cover_photo_id'], 'events', $getSlug->id);
         $input['cover_photo_id'] = $photo['cover_photo_id'];
         $event = Events::find($id);
         $event->fill($input);
         $event->save();
         return "ok";
     }
 }
开发者ID:marthem,项目名称:bagikasih,代码行数:30,代码来源:Events.php

示例2: UpdateSocialTarget

 public static function UpdateSocialTarget($input)
 {
     $id = $input['id'];
     $rules = array('name' => 'required', 'stewardship' => 'required|min:5', 'description' => 'required|min:5', 'address' => 'required', 'phone_number' => 'required');
     $validator = Validator::make($input, $rules);
     if ($validator->fails()) {
         return $validator->errors()->all();
     } else {
         $getSlug = SocialTarget::where('id', $id)->first();
         $slug = Str::slug($input['name']);
         // jika input tidak sama dengan slug di database
         if (strcmp($input['name'], $getSlug['name']) != 0) {
             $checkSlug = SocialTarget::where('slug', $slug)->where('id', '!=', $id)->count();
             if ($checkSlug > 0) {
                 $input['slug'] = $slug . "-" . $id;
             } else {
                 $input['slug'] = $slug;
             }
         }
         $photo = Photo::updateAvatar($getSlug['cover_photo_id'], 'social_targets', $getSlug->id);
         $input['cover_photo_id'] = $photo['cover_photo_id'];
         $SocialTarget = SocialTarget::find($id);
         $SocialTarget->fill($input);
         $SocialTarget->save();
         return "ok";
     }
 }
开发者ID:marthem,项目名称:bagikasih,代码行数:27,代码来源:SocialTarget.php

示例3: UpdateSocialAction

 public static function UpdateSocialAction($input)
 {
     $rules = array('name' => 'required', 'description' => 'required|min:5', 'stewardship' => 'required|min:5', 'bank_account_description' => 'required|min:5', 'currency' => 'required', 'total_donation_target' => 'required', 'expired_at' => 'required');
     $validator = Validator::make($input, $rules);
     if ($validator->fails()) {
         return $validator->errors()->all();
     } else {
         $id = $input['id'];
         unset($input['id']);
         if (!empty($input['expired_at'])) {
             $started_at = preg_split("/([\\/: ])/", $input['expired_at']);
             $input['expired_at'] = mktime((int) $started_at[3], (int) $started_at[4], 0, (int) $started_at[0], (int) $started_at[1], (int) $started_at[2]);
         } else {
             $input['expired_at'] = '';
         }
         $getSlug = SocialAction::where('id', $id)->first();
         $slug = Str::slug($input['name']);
         // jika input tidak sama dengan slug di database
         if (strcmp($input['name'], $getSlug['name']) != 0) {
             $checkSlug = SocialAction::where('slug', $slug)->where('id', '!=', $id)->count();
             if ($checkSlug > 0) {
                 $input['slug'] = $slug . "-" . $id;
             } else {
                 $input['slug'] = $slug;
             }
         }
         $photo = Photo::updateAvatar($getSlug['cover_photo_id'], 'social_actions', $getSlug->id);
         $input['cover_photo_id'] = $photo['cover_photo_id'];
         $SocialAction = SocialAction::find($id);
         $SocialAction->fill($input);
         $SocialAction->save();
         return "ok";
     }
 }
开发者ID:marthem,项目名称:bagikasih,代码行数:34,代码来源:SocialAction.php


注:本文中的Photo::updateAvatar方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。