示例#1
0
 /**
  * Method to save community
  *
  * @param array $val
  * @param \App\Models\Community $community
  * @return boolean
  */
 public function save($val, $community)
 {
     $expected = ['description' => '', 'title' => '', 'can_post' => '', 'searchable' => '', 'info' => []];
     /**
      * @var $description
      * @var $title
      * @var $can_post
      * @var $searchable
      * @var $info
      */
     extract(array_merge($expected, $val));
     $community->description = \Hook::fire('filter-text', sanitizeText($description));
     $community->can_post = sanitizeText($can_post);
     $community->searchable = sanitizeText($searchable);
     $community->info = perfectSerialize($info);
     $community->title = sanitizeText($title);
     $community->save();
     return true;
 }
 protected function findModel($id)
 {
     if (($model = Community::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
 /**
  * Bootstrap any application services.
  *
  * @return void
  */
 public function boot()
 {
     View::share('communities', \App\Models\Community::all());
 }