Exemplo n.º 1
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $validator = \Validator::make(\Input::all(), \App\Language::$rules);
     if ($validator->passes()) {
         $language = new \App\Language();
         $language->name = \Input::get('name');
         $language->save();
         flash('Language added.');
         return \Redirect::back();
     }
     return \Redirect::back()->withInput()->withErrors($validator);
 }
Exemplo n.º 2
0
 /**
  * Creates the application.
  *
  * @return \Illuminate\Foundation\Application
  */
 public function createApplication()
 {
     $app = (require __DIR__ . '/../bootstrap/app.php');
     $app->make(Illuminate\Contracts\Console\Kernel::class)->bootstrap();
     // Set the base URL to use while testing the application
     $this->baseUrl = $app->config->get('app.url');
     // Set application language
     App\Language::detect()->apply();
     return $app;
 }
Exemplo n.º 3
0
 public function testUpdateRegional()
 {
     // Route
     $user = $this->getSuperUser();
     $page = route('user.regional');
     // Form
     $button = _('Save');
     $input = ['country_id' => App\Country::firstOrFail()->getKey(), 'language_id' => App\Language::firstOrFail()->getKey()];
     // Database
     $table = 'users';
     $data = $input + ['id' => $user->getKey()];
     // Test
     $this->missingFromDatabase($table, $data)->actingAs($user)->visit($page)->submitForm($button, $input)->seePageIs($page)->assertSessionHasNoErrors()->seeInDatabase($table, $data);
 }
Exemplo n.º 4
0
Route::post('teachers/enquiry', 'TeacherController@postEnquiry');
Route::post('contact', 'TeacherController@postContact');
Route::post('teachers/call', 'TeacherController@postCall');
//  Contact Us
Route::get('contact', function () {
    return view('frontend.contact', ['page' => 'contact']);
});
//  Profile - Login
Route::group(['prefix' => 'profile/{user}/update', 'middleware' => 'self'], function () {
    Route::get('personal', function (App\User $user) {
        return view('frontend.profile.update.personal', ['user' => $user, 'page' => 'profile']);
    });
    Route::post('personal', 'ProfileController@updatePersonal');
    Route::post('personal/picture', 'ProfileController@updateProfilePic');
    Route::get('qualification', function (App\User $user) {
        $languages = App\Language::lists('language', 'id');
        return view('frontend.profile.update.qualification', ['user' => $user, 'page' => 'profile', 'languages' => $languages]);
    });
    Route::post('qualification', 'ProfileController@updateQualification');
    Route::get('subjects', function (App\User $user) {
        $topicsDetail = Cache::remember('topicsDetail', Carbon\Carbon::now()->addDay(), function () {
            $topicsDetail = [];
            $grades = App\Grade::all();
            foreach ($grades as $gradeKey => $grade) {
                $topicsDetail[$gradeKey]['name'] = $grade->name;
                foreach ($grade->subjects as $subjectsKey => $subject) {
                    $topicsDetail[$gradeKey]['subjects'][$subjectsKey]['name'] = $subject->name;
                    foreach ($subject->topics as $topicsKey => $topic) {
                        $topicsDetail[$gradeKey]['subjects'][$subjectsKey]['topics'][$topicsKey]['name'] = $topic->name;
                        $topicsDetail[$gradeKey]['subjects'][$subjectsKey]['topics'][$topicsKey]['id'] = $topic->id;
                    }
Exemplo n.º 5
0
<?php

/*
|--------------------------------------------------------------------------
| Model Factories
|--------------------------------------------------------------------------
|
| Here you may define all of your model factories. Model factories give
| you a convenient way to create models for testing and seeding your
| database. Just tell the factory how a default model should look.
|
*/
$factory->define(App\User::class, function ($faker) {
    return ['name' => $faker->userName, 'email' => $faker->email, 'password' => bcrypt('password'), 'remember_token' => str_random(10)];
});
$factory->define(App\Problem::class, function ($faker) {
    return ['title' => $faker->company, 'description' => join("\n\n", $faker->paragraphs($faker->numberBetween(1, 5))), 'input' => $faker->paragraph, 'output' => $faker->paragraph, 'sample_input' => $faker->postcode, 'sample_output' => join("\n", $faker->words($faker->numberBetween(1, 10))), 'time_limit' => $faker->numberBetween(1, 5), 'memory_limit' => $faker->numberBetween(1, 5) * 128, 'is_special' => $faker->boolean(15), 'status' => $faker->boolean(85)];
});
$factory->define(App\Solution::class, function ($faker) {
    return ['lang_id' => App\Language::all()->random()->id, 'problem_id' => App\Problem::all()->random()->id, 'user_id' => App\User::all()->random()->id, 'result_id' => App\Result::all()->random()->id, 'time' => $faker->numberBetween(1, 249) * 4, 'memory' => $faker->numberBetween(0, 1024) * 4, 'size' => $faker->numberBetween(20, 1200), 'is_hidden' => $faker->boolean(20), 'is_published' => $faker->boolean(95)];
});
Exemplo n.º 6
0
	<script src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.13.1/jquery.validate.min.js"></script>
	<link rel="stylesheet" href="{{asset('public/frontend/style.css')}}">
	<title>Frontpage</title>
	<script>
		var token = '<?php 
echo csrf_token();
?>
';
	</script>
</head>
<body>
	<div class="container">
		<div class="row">
			<div class="col-sm-12 text-right locale">
				<?php 
$langs = App\Language::all();
?>
				@foreach($langs as $lang) 
					<a href="#" locale="{{$lang->code}}">{{$lang->name}}</a>
				@endforeach
			</div>
			@if(Auth::check())
			<div class="col-sm-12 text-right">
				<a href="{{url('profile')}}"><strong>My Profile</strong></a>
			</div>

			@endif
			<script>
				$('.locale a').click(function(){
					var locale = $(this).attr('locale');
					$.ajax({
Exemplo n.º 7
0
 public function testDeleteLanguage()
 {
     // First non-default language
     $resource = App\Language::whereIsDefault(0)->firstOrFail();
     $this->resource('languages')->destroy($resource->getKey());
 }
Exemplo n.º 8
0
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| This file is where you may define all of the routes that are handled
| by your application. Just tell Laravel the URIs it should respond
| to using a Closure or controller method. Build something great!
|
*/
// Home page
Route::get('/', ['as' => 'home', 'uses' => 'HomeController@showMainPage']);
// Change application language
Route::get('language/{code}', ['as' => 'language.set', function ($code) {
    if ($language = App\Language::whereCode($code)->first()) {
        $language->remember();
    }
    return redirect(URL::previous() ?: route('home'));
}])->where('code', '^[a-z][a-z]$');
// Contact us area
Route::get('contact', ['as' => 'contact', 'uses' => 'HomeController@showContactForm']);
Route::post('contact', ['as' => 'contact.send', 'uses' => 'HomeController@sendContactEmail']);
// Log viewer. Permissions are handled by the controller
Route::get('logs', 'LogViewerController@showLogs');
// Guest user area
Route::group(['https', 'middleware' => 'guest', 'prefix' => 'login'], function () {
    // Login with native authentication
    Route::get('/', ['as' => 'login', 'uses' => 'AuthController@showLoginForm']);
    Route::post('/', ['as' => 'login.send', 'uses' => 'AuthController@login']);
    // Login with an Oauth provider
Exemplo n.º 9
0
// pass language and quality list into movie page
View::composer('products.__video', function ($view) {
    // get data
    $languages = App\Language::lists('name', 'id')->toArray();
    $qualities = App\Quality::lists('name', 'id')->toArray();
    $view->with('languages', $languages)->with('qualities', $qualities);
});
// pass platforms list into game page
View::composer('products.__game', function ($view) {
    // get data
    $platforms = App\Platform::lists('name', 'id')->toArray();
    $view->with('platforms', $platforms);
});
// pass languages and platforms into toolbar
View::composer('_navbar', function ($view) {
    $languages = App\Language::all();
    $platforms = App\Platform::all();
    $view->with('languages', $languages)->with('platforms', $platforms);
});
// pass languages and genres into toolbar
View::composer('videos._control_bar', function ($view) {
    $languages = App\Language::lists('name', 'name')->toArray();
    $genres = App\Genre::lists('name', 'name')->toArray();
    $view->with('languages', $languages)->with('genres', $genres);
});
// pass platforms and genres into toolbar
View::composer('games._control_bar', function ($view) {
    $platforms = App\Platform::lists('name', 'name')->toArray();
    $genres = App\Genre::lists('name', 'name')->toArray();
    $view->with('platforms', $platforms)->with('genres', $genres);
});