/**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index($route)
 {
     if (LaravelLocalization::getCurrentLocale() == 'en') {
         $audience = Audience::where('route_en', $route)->first();
         $audiences = Audience::all();
         return view('audiences.' . $route . '.index')->with(['audience' => $audience, 'audiences' => $audiences]);
     } elseif (LaravelLocalization::getCurrentLocale() == 'nl') {
         $audience = Audience::where('route_nl', $route)->first();
         $audiences = Audience::all();
         return view('audiences.' . $audience->route_en . '.index')->with(['audience' => $audience, 'audiences' => $audiences]);
     }
 }
 /**
  * @param $view
  *
  * @return mixed
  */
 private function assignDynamicFieldsToPageObject($view)
 {
     $arrAllow = ['page', 'homepage', "en.blog.slug"];
     $data = $view->getData();
     $routName = Route::currentRouteName();
     if (in_array($routName, $arrAllow)) {
         $arrType = config('asgard.dynamicfield.config.entity-type');
         $arrType = array_keys($arrType);
         if (count($data)) {
             foreach ($data as $item) {
                 if (is_object($item)) {
                     $className = get_class($item);
                     if (in_array($className, $arrType)) {
                         $locale = LaravelLocalization::getCurrentLocale();
                         $request = Request::all();
                         $dynamicFields = new DynamicFields($item, $locale);
                         $dynamicFields->init($request);
                         $fieldValues = $dynamicFields->getFieldValues($locale);
                         $view->with('dynamicfields', $fieldValues);
                     }
                 }
             }
         }
     }
     return $view;
 }
 /**
  * Bootstrap any application services.
  *
  * @return void
  */
 public function boot()
 {
     /*Localization variable*/
     view()->composer('*', function ($view) {
         $view->with('lang', LaravelLocalization::getCurrentLocale());
     });
     /*Admin main menu list*/
     view()->composer('admin/template/side-bar/menu-left', 'App\\Http\\Composers\\AdminMainMenuListComposer');
 }
 public function subtest()
 {
     $localeCode = LaravelLocalization::getCurrentLocale();
     $urltrans = trans('test::routes.subtest');
     \Debugbar::info($urltrans);
     $test = LaravelLocalization::getLocalizedURL($localeCode, route('test'));
     \Debugbar::info($test);
     return '<p>Sub-test</p><p><b>Language</b>: ' . $localeCode . '</p><p>Our translation url: ' . $urltrans . '</p>';
 }
Exemple #5
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index($route)
 {
     if (LaravelLocalization::getCurrentLocale() == 'en') {
         $page = Page::where(['route_en' => $route])->first();
         return view('pages.index', array('slug' => $page->slug_en, 'page' => $page));
     } elseif (LaravelLocalization::getCurrentLocale() == 'nl') {
         $page = Page::where(['route_nl' => $route])->first();
         return view('pages.index', array('slug' => $page->slug_nl, 'page' => $page));
     }
 }
Exemple #6
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index($route)
 {
     if (LaravelLocalization::getCurrentLocale() == 'en') {
         $post = Post::where('route_en', $route)->first();
         return view('posts.post')->with(['post' => $post]);
     } elseif (LaravelLocalization::getCurrentLocale() == 'nl') {
         $post = Post::where('route_nl', $route)->first();
         return view('posts.post')->with(['post' => $post]);
     }
 }
 /**
  * Extend the validator with new rules.
  * @param  string $rule
  * @return void
  */
 protected function extendValidator($rule)
 {
     $method = studly_case($rule);
     if (\Mcamara\LaravelLocalization\Facades\LaravelLocalization::class) {
         $translation = trans('colorvalidator::validation', [], 'messages', \Mcamara\LaravelLocalization\Facades\LaravelLocalization::getCurrentLocale());
     } else {
         $translation = trans('colorvalidator::validation');
     }
     $this->app['validator']->extend($rule, 'Russoedu\\ColorValidator\\colorvalidator@validate' . $method, $translation[$rule]);
 }
 public function __construct(Request $request)
 {
     $this->local = LaravelLocalization::getCurrentLocale();
     //Current local
     $this->request = $request->url();
     //Current url
     $this->routeName = $request->route()->getAction()['_active_menu'];
     //Current route name
     //dd($this->routeName);
 }
Exemple #9
0
 /**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function getEvent($route)
 {
     if (LaravelLocalization::getCurrentLocale() == 'en') {
         $event = Event::where(['route_en' => $route])->first();
         return view('events.event', array('name' => $event->name_en, 'event' => $event));
     } elseif (LaravelLocalization::getCurrentLocale() == 'nl') {
         $event = Event::where(['route_nl' => $route])->first();
         return view('events.event', array('name' => $event->name_nl, 'event' => $event));
     }
 }
Exemple #10
0
 /**
  * Create an instance of a Date object, when retrieving the updated_at attribute.
  * Set its locale.
  *
  * @param $value
  * @return Date
  */
 protected function getUpdatedAtAttribute($value)
 {
     $date = $this['updated_at'] = Date::parse($value);
     $date->setLocale(LaravelLocalization::getCurrentLocale());
     $locale = LaravelLocalization::getCurrentLocale();
     if ($locale == 'de') {
         return $date->format('j. F, Y');
     } else {
         return $date->format('jS F, Y');
     }
 }
Exemple #11
0
 /**
  * Render an exception into an HTTP response.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Exception  $e
  * @return \Illuminate\Http\Response
  */
 public function render($request, Exception $e)
 {
     if ($e instanceof ModelNotFoundException) {
         return redirect('/');
     }
     if ($e instanceof MethodNotAllowedHttpException) {
         return redirect('/');
     }
     if ($e instanceof NotFoundHttpException) {
         return response(view('errors.404'), 404);
     }
     if ($e instanceof InvalidConfirmationCodeException) {
         Session::flash('flash_message', $e->getMessage());
         return redirect('/');
     }
     if ($e instanceof UserNotOwnerOfProjectException) {
         Session::flash('flash_message', $e->getMessage());
         return redirect(LaravelLocalization::getCurrentLocale() . '/' . trans('routes.create-project'));
     }
     if ($e instanceof ProjectCompletedException) {
         Session::flash('flash_message', $e->getMessage());
         return redirect(LaravelLocalization::getCurrentLocale() . '/' . trans('routes.create-project'));
     }
     if ($e instanceof UserRequiresAuthenticationException) {
         if ($request->ajax() || $request->wantsJson()) {
             return response()->json(['login' => '<i class="fa fa-exclamation-circle fa-lg"></i>' . trans('create-project-form.login')]);
         } else {
             Session::flash('flash_message', $e->getMessage());
             return redirect('/');
         }
     }
     if ($e instanceof UserHasIncompleteProjectException) {
         if ($request->ajax() || $request->wantsJson()) {
             return response()->json(['incomplete' => '<i class="fa fa-exclamation-circle fa-lg"></i>' . trans('create-project-form.incomplete')]);
         }
     }
     if ($e instanceof UserAlreadyHasSubmittedProjectException) {
         if ($request->ajax() || $request->wantsJson()) {
             return response()->json(['pendingProject' => '<i class="fa fa-exclamation-circle fa-lg"></i>' . trans('create-project-form.pending-project')]);
         }
     }
     if ($e instanceof UserHasCurrentLiveProjectException) {
         if ($request->ajax() || $request->wantsJson()) {
             return response()->json(['liveProject' => '<i class="fa fa-exclamation-circle fa-lg"></i>' . trans('create-project-form.live-project')]);
         }
     }
     if ($e instanceof ProjectNameAlreadyTakenException) {
         if ($request->ajax() || $request->wantsJson()) {
             return response()->json(['duplicateName' => '<i class="fa fa-exclamation-circle fa-lg"></i>' . trans('create-project-form.duplicate-name')]);
         }
     }
     return parent::render($request, $e);
 }
 public function compose(View $view)
 {
     $path = $this->request->path();
     $currentLanguage = LaravelLocalization::getCurrentLocale();
     if (starts_with($path, $currentLanguage . '/')) {
         $path = str_replace($currentLanguage . '/', '', $path);
     } elseif ($path == $currentLanguage) {
         $path = str_replace($currentLanguage, '', $path);
     }
     $main_banners = MainBanner::inURL($path)->orderBy('sort_order', 'ASC')->get();
     $view->with(['main_banners' => $main_banners]);
 }
 /**
  * Log the user out of the application.
  *
  * @return \Illuminate\Http\Response
  */
 public function getLogout()
 {
     $this->auth->logout();
     // store success feed back message in a session
     if (Session::has('deleted')) {
         Session::flash('flash_message', Session::get('deleted'));
         Session::forget('deleted');
     } else {
         Session::flash('flash_message', trans('login-page.logout'));
     }
     // clear user_id key in session
     Session::forget('username');
     return redirect(property_exists($this, 'redirectAfterLogout') ? $this->redirectAfterLogout : LaravelLocalization::getCurrentLocale() . '/' . trans('routes.account/login'));
 }
 /**
  * Save an incomplete state of a Project.
  *
  * @param SaveProjectRequest $request
  * @return string
  * @throws ProjectNameAlreadyTakenException
  */
 public function save(SaveProjectRequest $request)
 {
     $existingProject = Project::where('project_name', '=', $request->get('project_name'))->first();
     if (!is_null($existingProject) && $existingProject->user_id != Auth::user()->id) {
         throw new ProjectNameAlreadyTakenException();
     }
     $projectDetails = ['project_name' => $request->get('project_name'), 'short_desc' => $request->get('short_desc'), 'full_desc' => $request->get('full_desc'), 'target_amount' => $request->get('target_amount'), 'child_name' => $request->get('child_name'), 'slug' => strtolower(preg_replace('/[\\s-]+/', '-', $request->get('project_name'))), 'user_id' => Auth::user()->id];
     $userDetails = ['first_name' => $request->get('first_name'), 'last_name' => $request->get('last_name'), 'email' => $request->get('email'), 'tel_number' => $request->get('tel_number'), 'street' => $request->get('street'), 'postcode' => $request->get('postcode'), 'city' => $request->get('city'), 'country' => $request->get('country')];
     $userDocuments = [$request->file('doc_1_mand') ? $request->file('doc_1_mand') : $request->get('doc1Mand'), $request->file('doc_2_mand') ? $request->file('doc_2_mand') : $request->get('doc2Mand'), $request->file('doc_3') ? $request->file('doc_3') : $request->get('doc3'), $request->file('doc_4') ? $request->file('doc_4') : $request->get('doc4'), $request->file('doc_5') ? $request->file('doc_5') : $request->get('doc5'), $request->file('doc_6') ? $request->file('doc_6') : $request->get('doc6')];
     $userImages = ['main_img' => $request->file('main_img') ? $request->file('main_img') : $request->get('mainImage'), 'img_2' => $request->file('img_2') ? $request->file('img_2') : $request->get('img2'), 'img_3' => $request->file('img_3') ? $request->file('img_3') : $request->get('img3'), 'img_4' => $request->file('img_4') ? $request->file('img_4') : $request->get('img4')];
     // Find the Project which belongs to the user, or create a new one.
     $projectID = !is_null(Auth::user()->incompleteProject->first()) ? Auth::user()->incompleteProject->first()->id : null;
     $project = Project::findOrNew($projectID);
     // Store the original project slug,
     // for the saved images, in case of user edit.
     $originalProjectSlug = $project->slug;
     // Update or fill the Project attributes.
     foreach ($projectDetails as $attribute => $value) {
         $project->{$attribute} = $value;
     }
     // Save the changes to the Project.
     $project->save();
     // Update user model.
     $user = Auth::user();
     foreach ($userDetails as $attribute => $value) {
         $user->{$attribute} = $value;
     }
     $user->save();
     // Make the image and document directories.
     $imageFolderPath = public_path("img/{$project->slug}");
     $documentFolderPath = public_path("documents/{$project->slug}");
     $this->makeImageDirectories($imageFolderPath);
     $this->makeDocumentDirectory($documentFolderPath);
     // Create new Document instances in the database.
     // Move the documents to their directory.
     $this->moveDocumentsAndSaveToDB($userDocuments, $documentFolderPath, $project->id, $originalProjectSlug);
     // Resize the images to our needs, and save them in their directories.
     $this->resizeImagesAndSaveToFolders($userImages, $project->child_name, $imageFolderPath, $originalProjectSlug);
     // Create new Image instances in the database.
     $this->saveImageInstancesToDB($userImages, $project->child_name, $project->id);
     Session::flash('flash_message', trans('create-project-form.save-success'));
     return json_encode(['url' => url(LaravelLocalization::getCurrentLocale() . '/' . trans('routes.create-project/edit') . '/' . $project->slug)]);
 }
<?php

use Mcamara\LaravelLocalization\Facades\LaravelLocalization;
return ['start' => 'Start', 'project-details' => 'Project Details', 'your-details' => 'Your Details', 'supporting-evidence' => 'Supporting Docs', 'summary' => 'Summary', 'start-project' => 'Start Project', 'save-progress' => 'Save Progress', 'back' => 'Back', 'next' => 'Next', 'submit' => 'Submit for Approval', 'continue' => 'Continue', 'delete' => 'Delete', 'terms-cond-1' => 'By submitting your project, you agree to our ', 'terms-cond-2' => 'Terms and Conditons', 'terms-cond-3' => 'Close', 'project-title' => 'Project Title:', 'short-description' => 'Short Description:', 'main-image' => 'Main Image:', 'secondary-images' => 'Secondary Images:', 'full-description' => 'Full Description:', 'fundraise-amount' => 'Fundraise Amount:', 'child-name' => 'First name of Child:', 'first-name' => 'Your First Name:', 'last-name' => 'Your Last Name:', 'email' => 'Your Email Address:', 'street' => 'Street:', 'postcode' => 'Postcode:', 'city' => 'City:', 'country' => 'Country:', 'tel-number' => 'Telephone Number:', 'main-documents' => 'Documents of Evidence:', 'secondary-documents' => 'Additional Documents:', 'images-and-documents' => 'Images & Documents:', 'place-short-desc' => 'A short description about your project. In 180 characters or less.', 'place-full-desc' => 'The full description of your project. This is where you tell your story.', 'place-fundraise-amt' => 'The amount you wish to fundraise. Minimum &#8364;500', 'place-country' => 'Austria', 'exp-project-title' => 'Please name your project, then click "Start Project" to begin.', 'exp-recent-project' => 'Project\'s you have recently started', 'exp-no-recent-project-1' => 'Great! You currently have no incomplete projects to continue with.', 'exp-no-recent-project-2' => 'Now is a great time to start a new one!', 'exp-main-image-1' => 'Choose an image from your computer.', 'exp-main-image-2' => 'This will be the main display photo for your project, <br/> So make it a good one!', 'exp-main-image-3' => 'JPEG, PNG, BMP, TIFF. 20MB file limit. <br/> Minimum size 768 x 1024 pixels', 'exp-secondary-image' => 'Click to upload an image', 'exp-evidence-1' => 'We require supporting evidence of your child\'s ailment.', 'exp-evidence-2' => 'A written letter from your medical practitioner or hospital, stating the condition of your child\'s ailment.', 'exp-evidence-3' => 'A document supporting evidence of your financial situation, including child care allowance.', 'exp-evidence-4' => 'The more evidence you submit, the more likely the successful outcome of your application.', 'exp-document-label' => 'minimum of 2 documents mandatory', 'exp-document-input' => 'Click to upload a document', 'validation-error' => ' Sorry, there are some errors in the form.', 'project-complete' => 'Project can no longer be edited.', 'save-success' => 'Project successfully saved.', 'delete-success' => 'Project successfully removed.', 'login' => ' Please <a href="' . url(LaravelLocalization::getCurrentLocale() . '/' . trans('routes.account/login')) . '">Login</a> or <a href="' . url(LaravelLocalization::getCurrentLocale() . '/' . trans('routes.account/register')) . '">Register</a> to Start a Project.', 'incomplete' => ' You currently have an incomplete project saved. Please continue with the saved project, or delete it.', 'live-project' => ' You currently have a live project on our website. We will welcome another submission once it has successfully ended.', 'duplicate-name' => ' Sorry, you cannot rename your project to that title. As another user has taken it for use.', 'pending-project' => ' You currently have a project submitted for approval. We will welcome another submission once it has successfully ended.', 'not-owner' => 'Sorry, you are not the owner of this project.', 'not-authenticated' => 'Please login to continue to page.', 'pending-approval' => 'Pending Approval', 'currently-live' => 'Currently Live', 'tips-heading' => 'Helpful tips for creating / submitting a project', 'tip-1-title' => 'Project Title', 'tip-1-1' => 'The title of your project, is what describes your cause. It should clearly identify what you are fundraising for.', 'tip-2-title' => 'Short Description', 'tip-2-1' => 'The short description of your project, is what our viewers see first. This is a perfect time to captivate an audience.', 'tip-2-2' => 'So be sure to describe your project well, and touch the hearts of our audiences!', 'tip-3-title' => 'Main Image', 'tip-3-1' => 'Selecting your main image, is a very important part of setting up your project.', 'tip-3-2' => 'Be sure to choose an image that relates well to your short description. Having an image that is not blurry, and high in definition will work in your favour.', 'tip-3-3' => 'Like words, an image also tells a story to our audiences.', 'tip-4-title' => 'Full Description', 'tip-4-1' => 'The full description of your project is the place where you can tell your story to our audiences.', 'tip-4-2' => 'This is the time to express your needs in detail, and to share with our audiences some information about your child and how the fundraised money will make a positive impact to your lives.', 'tip-4-3' => 'A well planned and thought out full description of your project, will ultimately help our audiences make the right decision to fund money to you and your child.', 'tip-5-title' => 'Supporting Evidence', 'tip-5-1' => 'Creating a successful campaign, means having it approved.', 'tip-5-2' => 'The best way to have this happen, is to provide us with documents of evidence that clearly express to us, your situation and the reasons for you requiring support.', 'tip-5-3' => 'We only ask for two documents, as a mandatory requirement. However the more evidence you can supply the better the likelyhood of your application beeing approved.'];
 public function getAllSearchResults()
 {
     $searchterm = Input::get('keyword');
     if (strlen($searchterm) >= 3) {
         $posts = Post::where('slug_nl', 'LIKE', '%' . $searchterm . '%')->orWhere('slug_en', 'LIKE', '%' . $searchterm . '%')->orWhere('slug_fr', 'LIKE', '%' . $searchterm . '%')->orWhere('name_nl', 'LIKE', '%' . $searchterm . '%')->orWhere('name_en', 'LIKE', '%' . $searchterm . '%')->orWhere('name_fr', 'LIKE', '%' . $searchterm . '%')->orWhere('subtitle_nl', 'LIKE', '%' . $searchterm . '%')->orWhere('subtitle_en', 'LIKE', '%' . $searchterm . '%')->orWhere('subtitle_fr', 'LIKE', '%' . $searchterm . '%')->orWhere('text_nl', 'LIKE', '%' . $searchterm . '%')->orWhere('text_en', 'LIKE', '%' . $searchterm . '%')->orWhere('text_fr', 'LIKE', '%' . $searchterm . '%')->orWhere('bullets_nl', 'LIKE', '%' . $searchterm . '%')->orWhere('bullets_en', 'LIKE', '%' . $searchterm . '%')->orWhere('bullets_fr', 'LIKE', '%' . $searchterm . '%')->orWhere('location_nl', 'LIKE', '%' . $searchterm . '%')->orWhere('location_en', 'LIKE', '%' . $searchterm . '%')->orWhere('location_fr', 'LIKE', '%' . $searchterm . '%')->orWhere('price', 'LIKE', '%' . $searchterm . '%')->get();
         foreach ($posts as $post) {
             $audiences = explode(",", $post->audiences);
             $post->audiences = "";
             for ($i = 0; $i < count($audiences); $i++) {
                 $post->audiences = substr_replace($post->audiences . Audience::where('id', $audiences[$i])->first()->name_en . ", ", "", -1);
             }
         }
         $results = Offer::where('name_nl', 'LIKE', '%' . $searchterm . '%')->orWhere('name_en', 'LIKE', '%' . $searchterm . '%')->orWhere('name_fr', 'LIKE', '%' . $searchterm . '%')->orWhere('description_nl', 'LIKE', '%' . $searchterm . '%')->orWhere('description_en', 'LIKE', '%' . $searchterm . '%')->orWhere('description_fr', 'LIKE', '%' . $searchterm . '%')->orWhere('bullets_nl', 'LIKE', '%' . $searchterm . '%')->orWhere('bullets_en', 'LIKE', '%' . $searchterm . '%')->orWhere('bullets_fr', 'LIKE', '%' . $searchterm . '%')->get();
         if (LaravelLocalization::getCurrentLocale() == 'en') {
             foreach ($results as $result) {
                 $result->audiences = Audience::where('id', $result->audience_id)->first()->name_en;
             }
         } elseif (LaravelLocalization::getCurrentLocale() == 'nl') {
             foreach ($results as $result) {
                 $result->audiences = Audience::where('id', $result->audience_id)->first()->name_nl;
             }
         }
         $results = array_merge($results->all(), $posts->all());
         return $results;
     } else {
         return null;
     }
 }
Exemple #17
0
 /**
  * Calculate the current Locale path  prefix if needed
  * @return string
  */
 protected function getRealLocale()
 {
     return LaravelLocalization::getCurrentLocale() == LaravelLocalization::getDefaultLocale() ? '' : '/' . LaravelLocalization::getCurrentLocale();
 }