public function deleteComment()
 {
     if (!Acl::isSuperAdmin()) {
         return Redirect::route('home');
     }
     $id = e(Input::get('id'));
     $comment = Comment::find($id);
     $comment->delete();
     return Redirect::back()->with('success', trans('directory.comment_deleted'));
 }
Beispiel #2
0
 public function isAdminFilter($entity_name, $entity_id)
 {
     if (\Auth::check()) {
         if (\Acl::isSuperAdmin()) {
             return true;
         }
         return \Access::where('user_id', \Auth::user()->id)->where('entity_name', $entity_name)->where('entity_id', $entity_id)->count();
     }
     return false;
 }
 public function deleteHandle($id)
 {
     $domain = Domain::find($id);
     if (Acl::isAdmin($domain) || Acl::isSuperAdmin()) {
         DB::statement('SET FOREIGN_KEY_CHECKS=0');
         $domain->siteViewers()->delete();
         $domain->domainVotes()->delete();
         $domain->delete();
         DB::statement('SET FOREIGN_KEY_CHECKS=0');
         try {
             $path_details = explode("/", $domain->thumb, 2);
             $folder = $path_details[0];
             File::deleteDirectory(public_path('assets/thumbs/' . $folder));
         } catch (Exception $e) {
         }
         return Redirect::route('domains-pending')->with('success', trans('directory.domain_deleted'));
     }
     return Redirect::back()->with('error', Lang::get('directory.delete_denied', ['domain' => $domain->name]));
 }
Beispiel #4
0
<?php

$comments = Comment::where('domain_id', $domain->id);
if (!Acl::isSuperAdmin()) {
    $comments = $comments->where('status', 1);
}
$comments = $comments->orderBy('created_at', 'DESC')->get();
?>

<div class="col-md-12 bottom" style="background-color: #FFF;">
	<h4 style="margin-bottom: 20px;">{{ trans('directory.comments') }} ( {{ $comments->count() }} )</h4>	
</div>
@if(empty($comments))
	{{ trans('directory.no_comments') }}
@else

	@foreach($comments as $comment)
		<div class="bottom col-lg-12 col-md-12 col-sm-12 col-xs-12" style="padding: 20px 0;">
			<?php 
$adder = User::find($comment->user_id) ? User::find($comment->user_id)->firstname : trans('general.anonymous_user');
?>
			{{ trans('general.in') }} {{ date("d-m-Y", strtotime($comment->created_at)) }} {{ $comment->user_id }} {{ $adder }} {{ trans('general.wrote') }}:<br />
			<q>{{ $comment->comment }}</q>
			<br />
			@if(Acl::isSuperAdmin())
				<div class="col-xs-4">
					<a href="{{ URL::route('comment-edit', [$comment->id]) }}" class="btn btn-info"> 
						{{ trans('general.edit') }}
					</a>
				</div>	
				{{ Form::open(['route' => 'approve-disapprove-comment', 'class' => 'col-xs-4 form-horizontal']) }}	
 public function editHandle()
 {
     $id = e(Input::get('id'));
     $category = Category::find($id);
     $path = DirectoryHelpers::seoString(e(Input::get('path')));
     $nice_input_names = ['is_root' => trans('directory.is_root'), 'name' => trans('directory.name'), 'path' => trans('directory.path'), 'description' => trans('directory.description'), 'keywords' => trans('directory.keywords')];
     $rules = ['is_root' => 'required', 'name' => 'required|between:2,50|unique:categories,name,' . $id, 'path' => 'required|between:2,50|unique:categories,path,' . $id, 'description' => 'between:5,1000', 'keywords' => 'between:5,255'];
     $is_root = Input::get('is_root');
     if ('no' == $is_root) {
         $nice_input_names['parent_id'] = trans('directory.parent');
         if ($id == Input::get('parent_id')) {
             //return Redirect::route('category.edit', [$id])->with('error', trans('directory.same_category_choosen'))->withInput();
         }
     }
     $validator = Validator::make(Input::all(), $rules, [], $nice_input_names);
     if ($validator->fails()) {
         return Redirect::route('category.edit', [$id])->withErrors($validator)->withInput();
     }
     $status = Acl::isSuperAdmin() ? 1 : 0;
     $category->update(['status' => $status, 'name' => e(Input::get('name')), 'slug' => $path, 'path' => $path, 'description' => e(Input::get('description')), 'keywords' => e(Input::get('keywords'))]);
     try {
         if ('yes' == $is_root) {
             $category->makeRoot();
         }
         if ('no' == $is_root) {
             $parent = Category::find(e(Input::get('parent_id')));
             if ($id != Input::get('parent_id') && !$parent->isDescendantOf($category)) {
                 $category->makeChildOf($parent);
             }
         }
         return Redirect::route('category.edit', [$id])->with('success', Lang::get('directory.category_updated', ['category' => $category->name]));
     } catch (Exception $ex) {
         dd($ex->getMessage());
         return Redirect::route('category.edit', [$id])->withErrors($ex->getMessage())->withInput();
     }
 }