<commit_before><?php

namespace App\Http\Controllers;

use App\Environment;
use Illuminate\Http\Request;
use App\User;
use App\Platform;

class EnvironmentController extends Controller
{
  public function __construct()
  {
    $this->middleware('auth');
  }

  /**
   * Display a listing of the resource.
   *
   * @return \Illuminate\Http\Response
   */
  public function index()
  {
    //
  }

  /**
   * Show the form for creating a new resource.
   *
   * @return \Illuminate\Http\Response
   */
  public function create($username, $platform_name)
  {
    $user = User::where('username', $username)->first();
    $platform = Platform::where('user_id', $user->id)
        ->where('platform_name', $platform_name)->first();

    if($platform->user!=$user)
      return "nasty";

    return view('environments.create')->with('platform', $platform)->with('user', $user);
  }

  /**
   * Store a newly created resource in storage.
   *
   * @param  \Illuminate\Http\Request  $request
   * @return \Illuminate\Http\Response
   */
  public function store(Request $request, $username, $platform_name)
  {
    $user = User::where('username', $username)->first();
    $platform = Platform::where('user_id', $user->id)
        ->where('platform_name', $platform_name)->first();

    if($platform->user!=$user)
      return "nasty";

    //validate
    $this->validate($request, array(
      'environment_name' => 'required|string|max:25',
      'description' => 'string|max:255',
    ));

    //store db
    $environment = new Environment;<commit_msg>fora checks<commit_after><?php

namespace App\Http\Controllers;

use App\Environment;
use Illuminate\Http\Request;
use App\User;
use App\Platform;

class EnvironmentController extends Controller
{
  public function __construct()
  {
    $this->middleware('auth');
  }

  /**
   * Display a listing of the resource.
   *
   * @return \Illuminate\Http\Response
   */
  public function index()
  {
    //
  }

  /**
   * Show the form for creating a new resource.
   *
   * @return \Illuminate\Http\Response
   */
  public function create($username, $platform_name)
  {
    $user = User::where('username', $username)->first();
    $platform = Platform::where('user_id', $user->id)
        ->where('platform_name', $platform_name)->first();

    // if($platform->user!=$user)
    //   return "nasty";

    return view('environments.create')->with('platform', $platform)->with('user', $user);
  }

  /**
   * Store a newly created resource in storage.
   *
   * @param  \Illuminate\Http\Request  $request
   * @return \Illuminate\Http\Response
   */
  public function store(Request $request, $username, $platform_name)
  {
    $user = User::where('username', $username)->first();
    $platform = Platform::where('user_id', $user->id)
        ->where('platform_name', $platform_name)->first();

    // if($platform->user!=$user)
    //   return "nasty";

    //validate
    $this->validate($request, array(
      'environment_name' => 'required|string|max:25',
      'description' => 'string|max:255',
    ));

    //store db
    $environment = new Environment;
{'fraction_non_alphanumeric': 0.16774193548387098, 'fraction_numerical': 0.0032258064516129032, 'mean_word_length': 3.2596153846153846, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 35, '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': '6983069', 'n_tokens_mistral': 955, 'n_tokens_neox': 957, 'n_words': 200}