<commit_before><?php
/**
 * Comments Controller
 *
 * @category   Comments
 * @package    Basic-Controllers
 * @author     <NAME><<EMAIL>>
 * @copyright  2016-2017
 * @license    The MIT License (MIT)
 * @version    GIT: $Id$
 * @since      File available since Release 1.0.0
 */
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests;
use App\Http\Requests\CommentRequest;
use DB;
use App\Comment;
use App\Program;
use App\SkeletalElement;
use Session;
use Auth;
class CommentsController extends Controller
{
    public function __construct()
    {
//        $this->middleware('advisor');
        $this->commentfor = "SkeletalElement";
        $this->skeletalelement = null;
        $this->user = Auth::user();
        $this->commentData = ['user' => $this->user, 'commentfor' => $this->commentfor, 
            'skeletalelement' => $this->skeletalelement
        ];
        
    }
    public function index()
    {
        // $comments = Comment::all();
        $comments_data= DB::table('comments')
            ->select(DB::raw('comments.text,comments.created_at,comments.active,comments.id,users.first_name,programs.name as program_name, array_to_string(array_agg(roles.name), \',\') as role_name'))    
			->join('programs','comments.program_id','=','programs.id')
            ->join('users','users.id','=','comments.user_id')
            ->join('role_user','role_user.user_id','=','users.id')
            ->join('roles','roles.id','=','role_user.role_id')
            ->orderBy('comments.created_at', 'desc')
            ->orderBy('users.id', 'desc') 
            ->get();
     
        return view('comments.index', compact('comments_data'));
		
	}
	
	public function accept($id)<commit_msg>added comment controller<commit_after><?php
/**
 * Comments Controller
 *
 * @category   Comments
 * @package    Basic-Controllers
 * @author     <NAME><<EMAIL>>
 * @copyright  2016-2017
 * @license    The MIT License (MIT)
 * @version    GIT: $Id$
 * @since      File available since Release 1.0.0
 */
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests;
use App\Http\Requests\CommentRequest;
use DB;
use App\Comment;
use App\Program;
use App\SkeletalElement;
use Session;
use Auth;
class CommentsController extends Controller
{
    public function __construct()
    {
//        $this->middleware('advisor');
        $this->commentfor = "SkeletalElement";
        $this->skeletalelement = null;
        $this->user = Auth::user();
        $this->commentData = ['user' => $this->user, 'commentfor' => $this->commentfor, 
            'skeletalelement' => $this->skeletalelement
        ];
        
    }
    public function index()
    {
        // $comments = Comment::all();
        $comments_data= DB::table('comments')
            ->select('comments.*','users.first_name','programs.name as program_name', 'roles.name as role_name')
			->join('programs','comments.program_id','=','programs.id')
            ->join('users','users.id','=','comments.user_id')
            ->join('role_user','role_user.user_id','=','users.id')
            ->join('roles','roles.id','=','role_user.role_id')
            ->orderBy('comments.created_at', 'desc')
            ->orderBy('users.id', 'desc')
            ->get();
     
        return view('comments.index', compact('comments_data'));
		
	}
	
	public function accept($id)
{'fraction_non_alphanumeric': 0.17067379044226774, 'fraction_numerical': 0.006530127634312852, 'mean_word_length': 2.974056603773585, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 47, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5618068', 'n_tokens_mistral': 1052, 'n_tokens_neox': 1026, 'n_words': 189}