示例#1
0
 /**
  * @inheritdoc
  */
 public function getByName($userName, $folderName)
 {
     $user = $this->users->getByName($userName);
     if (!$user) {
         return;
     }
     return $this->folder->findUserFolder($user->getKey(), $folderName);
 }
示例#2
0
 public function index()
 {
     $folderName = Input::get('folder');
     $groupName = Input::has('group') ? shadow(Input::get('group')) : 'all';
     $className = 'Strimoid\\Models\\Folders\\' . studly_case($folderName ?: $groupName);
     if (Input::has('folder') && !class_exists('Folders\\' . studly_case($folderName))) {
         $user = Input::has('user') ? User::findOrFail(Input::get('user')) : Auth::user();
         $folder = Folder::findUserFolderOrFail($user->getKey(), Input::get('folder'));
         if (!$folder->public && (Auth::guest() || $user->getKey() != Auth::id())) {
             App::abort(404);
         }
         $builder = $folder->entries();
     } elseif (class_exists($className)) {
         $fakeGroup = new $className();
         $builder = $fakeGroup->entries();
         $builder->orderBy('sticky_global', 'desc');
     } else {
         $group = Group::name($groupName)->firstOrFail();
         $group->checkAccess();
         $builder = $group->entries();
         // Allow group moderators to stick contents
         $builder->orderBy('sticky_group', 'desc');
     }
     $builder->with(['user', 'group', 'replies', 'replies.user'])->orderBy('created_at', 'desc');
     $perPage = Input::has('per_page') ? between(Input::get('per_page'), 1, 100) : 20;
     return $builder->paginate($perPage);
 }
示例#3
0
 public function removeFromFolder()
 {
     $group = Group::findOrFail(Input::get('group'));
     $folder = Folder::findOrFail(Input::get('folder'));
     $folder->groups()->detach($group);
     return Response::json(['status' => 'ok']);
 }