RuslanJohnBell

RuslanJohnBell

Member Since 1 Year Ago

Experience Points 1,530
Experience Level 1

3,470 experience to go until the next level!

In case you were wondering, you earn Laracasts experience when you:

  • Complete a lesson — 100pts
  • Create a forum thread — 50pts
  • Reply to a thread — 10pts
  • Leave a reply that is liked — 50pts
  • Receive a "Best Reply" award — 500pts
Lessons Completed 9
Lessons
Completed
Best Reply Awards 0
Best Reply
Awards
  • Start Your Engines Achievement

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • First Thousand Achievement

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • One Year Member Achievement

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • Two Year Member Achievement

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • Three Year Member Achievement

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • Four Year Member Achievement

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • Five Year Member Achievement

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • School In Session Achievement

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • Welcome To The Community Achievement

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • Full Time Learner Achievement

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • Pay It Forward Achievement

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • Subscriber Achievement

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • Lifer Achievement

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • Laracasts Evangelist Achievement

    Laracasts Evangelist

    Earned if you share a link to Laracasts on social media. Please email [email protected] with your username and post URL to be awarded this badge.

  • Chatty Cathy Achievement

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • Laracasts Veteran Achievement

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • Ten Thousand Strong Achievement

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • Laracasts Master Achievement

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • Laracasts Tutor Achievement

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • Laracasts Sensei Achievement

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • Top 50 Achievement

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

18 May
4 weeks ago

RuslanJohnBell left a reply on Laravel Resource Route

@CRONIX - THANK YOU A LOT! WORKING!

RuslanJohnBell left a reply on Laravel Resource Route

@CRONIX - Ok, I will try to do it! If it work - I will not know how to thank you!

RuslanJohnBell left a reply on Laravel Resource Route

Yes, I know, how to fetch data using resource routes. But it's doesn't work

RuslanJohnBell left a reply on Laravel Resource Route

<?php

namespace App\Http\Controllers;

use App\IndividualCraftPerson;
use App\Traits\Storing;
use Illuminate\Http\Request;
use Illuminate\Http\Response;

class IndividualCraftController extends Controller
{
    use Storing;
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        $craft = IndividualCraftPerson::with(['links', 'attachments'])->get();
        return response()->json(['craft' => $craft], Response::HTTP_OK);
    }

    /**
     * Show the form for creating a new resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function create()
    {
        //
    }

    /**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function store(Request $request)
    {
        try {
            $individual = IndividualCraftPerson::create([
                'name' => $request->name,
                'passport' => $request->passport,
                'date' => $request->date,
                'address' => $request->address,
                'responsible' => $request->responsible,
                'phone' => $request->phone,
                'email' => $request->email,
                'square' => $request->square,
                'description' => $request->description,
                'info' => $request->info
            ]);
            $this->saveIndividualCraftLinks($request, $individual);
            return response()->json(['success' => 'Вашае паведамленне паспяхова адпраўлена!'], Response::HTTP_OK);
        } catch (\Exception $exception) {
            return response()->json(['error' => 'Адбылася памылка!', 'message' => $exception->getMessage()], Response::HTTP_INTERNAL_SERVER_ERROR);
        }
    }

    /**
     * Display the specified resource.
     *
     * @param  \App\IndividualCraftPerson  $person
     * @return \Illuminate\Http\Response
     */
    public function show(IndividualCraftPerson $person)
    {
        return response()->json([
            'craft' => $person,
            'links' => $person->links()->get(),
            'attachments' => $person->attachments()->get()
        ], Response::HTTP_OK);
    }

    /**
     * Show the form for editing the specified resource.
     *
     * @param  \App\IndividualCraftPerson  $individualCraftPerson
     * @return \Illuminate\Http\Response
     */
    public function edit(IndividualCraftPerson $individualCraftPerson)
    {
        //
    }

    /**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \App\IndividualCraftPerson  $individualCraftPerson
     * @return \Illuminate\Http\Response
     */
    public function update(Request $request, IndividualCraftPerson $individualCraftPerson)
    {
        //
    }

    /**
     * Remove the specified resource from storage.
     *
     * @param  \App\IndividualCraftPerson  $individualCraftPerson
     * @return \Illuminate\Http\Response
     */
    public function destroy(IndividualCraftPerson $individualCraftPerson)
    {
        //
    }
}

RuslanJohnBell started a new conversation Laravel Resource Route

Hi everyone

My laravel resource route return me response with empty fields, but in another resource route everything works fine.

This is my route list

|        | POST      | api/request/individual-craft                         | individual-craft.store   | App\Http\Controllers\[email protected]    | api          |
|        | GET|HEAD  | api/request/individual-craft                         | individual-craft.index   | App\Http\Controllers\[email protected]    | api          |
|        | GET|HEAD  | api/request/individual-craft/create                  | individual-craft.create  | App\Http\Controllers\[email protected]   | api          |
|        | PUT|PATCH | api/request/individual-craft/{individual_craft}      | individual-craft.update  | App\Http\Controllers\[email protected]   | api          |
|        | GET|HEAD  | api/request/individual-craft/{individual_craft}      | individual-craft.show    | App\Http\Controllers\[email protected]     | api          |
|        | DELETE    | api/request/individual-craft/{individual_craft}      | individual-craft.destroy | App\Http\Controllers\[email protected]  | api          |
|        | GET|HEAD  | api/request/individual-craft/{individual_craft}/edit | individual-craft.edit    | App\Http\Controllers\[email protected]     | api          |

In this route POST (storing item) and get all (indexing items) works fine

But if I try to get specific item via show method, using

api/request/individual-craft/{id}

it response me

{
"craft": [],
"links": [],
"attachments": []
}

In another resource route everything work fine

Please help

27 Apr
1 month ago

RuslanJohnBell left a reply on Laravel Return Text/html Instead Of Application/json

Thank you all! Guys, I am so stupid :-( Sorry for my disturbing. I forgot that I didn't set up my .htaccess to redirect all requests to `` /public where is my index.php ``` located.

RuslanJohnBell left a reply on Laravel Return Text/html Instead Of Application/json

@NEEONLINE - And this i got when use default responseType: 'json'

e {headers: t, status: 200, statusText: "OK", url: "http://lidbeer.by/api/send", ok: false, …}
error:
error: SyntaxError: Unexpected token < in JSON at position 0 at JSON.parse (<anonymous>) at XMLHttpRequest.c (http://lidbeer.by/main.d1591100442fe8c8eb62.js:1:353574) at e.invokeTask (http://lidbeer.by/polyfills.f33697ccc5a601f5b717.js:1:7788) at Object.onInvokeTask (http://lidbeer.by/main.d1591100442fe8c8eb62.js:1:60071) at e.invokeTask (http://lidbeer.by/polyfills.f33697ccc5a601f5b717.js:1:7709) at t.runTask (http://lidbeer.by/polyfills.f33697ccc5a601f5b717.js:1:2970) at t.invokeTask [as invoke] (http://lidbeer.by/polyfills.f33697ccc5a601f5b717.js:1:8871) at m (http://lidbeer.by/polyfills.f33697ccc5a601f5b717.js:1:22317) at XMLHttpRequest.k (http://lidbeer.by/polyfills.f33697ccc5a601f5b717.js:1:22620)
message: "Unexpected token < in JSON at position 0"
stack: "SyntaxError: Unexpected token < in JSON at position 0↵    at JSON.parse (<anonymous>)↵    at XMLHttpRequest.c (http://lidbeer.by/main.d1591100442fe8c8eb62.js:1:353574)↵    at e.invokeTask (http://lidbeer.by/polyfills.f33697ccc5a601f5b717.js:1:7788)↵    at Object.onInvokeTask (http://lidbeer.by/main.d1591100442fe8c8eb62.js:1:60071)↵    at e.invokeTask (http://lidbeer.by/polyfills.f33697ccc5a601f5b717.js:1:7709)↵    at t.runTask (http://lidbeer.by/polyfills.f33697ccc5a601f5b717.js:1:2970)↵    at t.invokeTask [as invoke] (http://lidbeer.by/polyfills.f33697ccc5a601f5b717.js:1:8871)↵    at m (http://lidbeer.by/polyfills.f33697ccc5a601f5b717.js:1:22317)↵    at XMLHttpRequest.k (http://lidbeer.by/polyfills.f33697ccc5a601f5b717.js:1:22620)"
__proto__: Error
text: "<!doctype html>↵<html lang="en">↵<head>↵  <meta charset="utf-8">↵  <title>Lidbeer</title>↵  <base href="/">↵  <meta name="viewport" content="width=device-width, initial-scale=1">↵  
↵<!-- Start: injected by Adguard -->
↵<script src="//local.adguard.com/adguard-ajax-api/injections/content-script.js?ts=63691985917691&amp;domain=lidbeer.by&amp;mask=111" nonce="e6a4b258729f4ab1abe372f450953301" type="text/javascript"></script>
↵<script src="//local.adguard.com/adguard-ajax-api/injections/userscripts.js?ts=63692003571776&name=AdGuard%20Popup%20Blocker&name=Adguard%20Assistant&name=SaveFrom.net%20helper" nonce="e6a4b258729f4ab1abe372f450953301" type="text/javascript"></script>
↵
↵<!-- End: injected by Adguard -->
↵<link href="https://fonts.googleapis.com/icon?family=Roboto:400,400i,600,600i,700,700i,800,800i" rel="stylesheet">↵  <link rel="icon" type="image/x-icon" href="favicon.ico">↵<link rel="stylesheet" href="styles.1192f31e55bb3b94c67b.css"></head>↵<body>↵  <app-root></app-root>↵  <script src="https://wd.ticketpro.by/event/ion.js?event=5814&user=15&loc=ru"></script>↵<script type="text/javascript" src="runtime.28b037467e93c87d9f7f.js"></script><script type="text/javascript" src="polyfills.f33697ccc5a601f5b717.js"></script><script type="text/javascript" src="scripts.7de4d1b43861a7927044.js"></script><script type="text/javascript" src="main.d1591100442fe8c8eb62.js"></script></body>↵</html>↵"
__proto__: Object
headers: t
lazyInit: ƒ ()
arguments: [Exception: TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them at Function.invokeGetter (<anonymous>:2:14)]
caller: [Exception: TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them at Function.invokeGetter (<anonymous>:2:14)]
length: 0
name: ""
prototype: {constructor: ƒ}
__proto__: ƒ ()
[[FunctionLocation]]: main.d159110….js:1
[[Scopes]]: Scopes[4]
lazyUpdate: null
normalizedNames: Map(0)
size: 0
__proto__: Map
[[Entries]]: Array(0)
length: 0
__proto__: Object
message: "Http failure during parsing for http://lidbeer.by/api/send"
name: "HttpErrorResponse"
ok: false
status: 200
statusText: "OK"
url: "http://lidbeer.by/api/send"
__proto__: Object

RuslanJohnBell left a reply on Laravel Return Text/html Instead Of Application/json

@NEEONLINE - LIke that

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>Lidbeer</title>
  <base href="/">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  
<!-- Start: injected by Adguard -->
<script src="//local.adguard.com/adguard-ajax-api/injections/content-script.js?ts=63691985917691&amp;domain=lidbeer.by&amp;mask=111" nonce="e6a4b258729f4ab1abe372f450953301" type="text/javascript"></script>
<script src="//local.adguard.com/adguard-ajax-api/injections/userscripts.js?ts=63692002858012&name=AdGuard%20Popup%20Blocker&name=Adguard%20Assistant&name=SaveFrom.net%20helper" nonce="e6a4b258729f4ab1abe372f450953301" type="text/javascript"></script>

<!-- End: injected by Adguard -->
<link href="https://fonts.googleapis.com/icon?family=Roboto:400,400i,600,600i,700,700i,800,800i" rel="stylesheet">
  <link rel="icon" type="image/x-icon" href="favicon.ico">
<link rel="stylesheet" href="styles.1192f31e55bb3b94c67b.css"></head>
<body>
  <app-root></app-root>
  <script src="https://wd.ticketpro.by/event/ion.js?event=5814&user=15&loc=ru"></script>
<script type="text/javascript" src="runtime.28b037467e93c87d9f7f.js"></script><script type="text/javascript" src="polyfills.f33697ccc5a601f5b717.js"></script><script type="text/javascript" src="scripts.7de4d1b43861a7927044.js"></script><script type="text/javascript" src="main.96035a50613d7dfe3d65.js"></script></body>
</html>

RuslanJohnBell left a reply on Laravel Return Text/html Instead Of Application/json

@NEEONLINE - I did it. I tried to responseType: 'text' and get full index.html page code. I don't know why I got it

RuslanJohnBell left a reply on Laravel Return Text/html Instead Of Application/json

@FTIERSCH - It returns me index.html. I using component lazy loading

RuslanJohnBell left a reply on Laravel Return Text/html Instead Of Application/json

@FTIERSCH - My component's submit method:

this.httpService.feedbackMessage(feedback).subscribe(
        data => {
          this.response = data;
          this.success = true;
          this.submitted = false;
          setTimeout(() => {
            this.success = false;
          }, 5000);
          this.form.reset();
        },
        error => {
          console.log(error.error);
          this.error = true;
          setTimeout(() => {
            this.error = false;
          }, 5000);
        }
    );

My HttpService post method:

feedbackMessage(data: any) {
    return this.http.post(`${this.base}/feedback/message`, data);
  }

RuslanJohnBell left a reply on Laravel Return Text/html Instead Of Application/json

@SNAPEY - Yes, I requested json cause I send Content-Type: application/json from my client

RuslanJohnBell left a reply on Laravel Return Text/html Instead Of Application/json

@FTIERSCH - And front-end HttpService's method return me error: SyntaxError: Unexpected token < in JSON at position 0 because it is not json, I guess

RuslanJohnBell left a reply on Laravel Return Text/html Instead Of Application/json

@FTIERSCH - Nope, cause on other project, that hosted on this server, everything works fine (I used Laravel 5.7 on it). I tried to set return response() ->json() ->header('Content-Type', 'application/json') - but nothing happend

RuslanJohnBell started a new conversation Laravel Return Text/html Instead Of Application/json

At present time I develop Angular 7 App on frontend and Laravel 5.8 on backend web-service.

When I test email's sending on localhost - everything work fine: localhost:8000 return me headers with "Content-Type: application/json", but when I try to do it on my production server - server returns me "Content-Type: text/html". On production server I use return response()->json();. I don't understand, why does it happen...

Please, help!

27 Mar
2 months ago

RuslanJohnBell started a new conversation NgOnInit Doesn't Make Foreach On Production (and No Errors) But Does It On Dev Server

I have a problem:

I have a mat-table with 671 row. Every row has 12 month-cells (one cell for one month). I inserted mat-calendar component in month-cell (one mat-calendar for specific month-cell: january for january and so on) (Look image below)

alt text

I wrote a specific method to highlight dates in from specific table in my database (every row has relation type "hasMany") (you can see it above). But this method highlits specific dates only on dev server. When I build production - it doesn't highlight anything. Application works fine: no errors. But method doesn't highlight dates. I don't know why. Code of my component you can see below:

import {
  Component,
  OnInit,
  ViewChild,
  ElementRef
} from '@angular/core';
import { AppHttpService } from '../../_services/app-http-service/app-http.service';
import { SelectionModel } from '@angular/cdk/collections';
import { AppPptxjsService } from '../../_services/app-pptxjs-service/app-pptxjs.service';
import {
  MatDialog,
  MatPaginator, MatSnackBar,
  MatSort,
  MatTableDataSource
} from '@angular/material';
import { AppAddressProgrammDialogComponent } from '../../app-dialogs/app-address-programm-dialog/app-address-programm-dialog.component';
import { HeaderComponent } from './header/header.component';
// @ts-ignore
import * as names from '../../../assets/names.json';
// @ts-ignore
import month from '../../../assets/month.json';

import {AppSideScheduleService} from '../../_services/app-side-schedule/app-side-schedule.service';

@Component({
  selector: 'app-app-dashboard-address-program',
  templateUrl: './app-dashboard-address-program.component.html',
  styleUrls: ['./app-dashboard-address-program.component.scss'],
  entryComponents: [HeaderComponent]
})
export class AppDashboardAddressProgramComponent implements OnInit {
  public header = HeaderComponent;
  public sides: any;
  public tableData: any;
  public monthNames = (<any>names).names;
  public month = [];
  public cities: any;
  public all: any;
  public options = {
    year: 'numeric',
    month: 'long',
    day: 'numeric',
  };
  public begin = null;
  public end = null;
  public tableColumns: string [] = [
    'select', 'city', 'address',
    'material', 'format', 'side',
    'type', 'price_for_belarus',
    'price_for_foreign',
    'one',
    'two', 'three', 'four',
    'five', 'six', 'seven',
    'eight', 'nine', 'ten',
    'eleven', 'twelve'
  ];
  public selection = new SelectionModel<Array<any>>(true, []);

  constructor(private httpClient: AppHttpService,
              private pptxgenService: AppPptxjsService,
              private dialog: MatDialog,
              private scheduleService: AppSideScheduleService,
              private element: ElementRef,
              private snack: MatSnackBar
  ) { }

  @ViewChild(MatPaginator) paginator: MatPaginator;
  @ViewChild(MatSort) sort: MatSort;

  ngOnInit() {
    this.fillMonthes();
    this.getSides();
    this.getCities();
    this.addresses();
  }

  isAllSelected() {
    const numSelected = this.selection.selected.length;
    const numRows = this.tableData.data.length;
    return numSelected === numRows;
  }

  masterToggle() {
    this.isAllSelected() ?
        this.selection.clear() :
        this.tableData.data.forEach(row => this.selection.select(row));
  }

  generate() {
    this.pptxgenService.generate(this.selection.selected);
  }

  setSide(data) {
    const dialog = this.dialog.open(AppAddressProgrammDialogComponent, {
      width: '60%',
      data: data
    });

    dialog.afterClosed().subscribe(result => {
      if (result) {
        return true;
      }
    });
  }

  makeRegExp(value) {
    return new RegExp(value, 'i');
  }

  applyFilter(filterValue: string) {
    this.tableData.filter = filterValue.trim().toLowerCase();
  }

  convertDate(string) {
    let formated = null;
    let splitted = null;
    month.forEach((item) => {
      if (string.search(item.name) > -1) {
        splitted = string.replace(this.makeRegExp(item.name), `${item.month}`).replace(/ г./, '').split(' ');
        formated = splitted[2] + '-' + splitted[1] + '-' + splitted[0];
      }
    });
    return new Date(formated);
  }

  getCities() {
    this.httpClient.getCities().subscribe(
        data => {
          this.cities = data;
        },
        error => {
          console.log(error);
        }
    );
  }

  getSides() {
    this.httpClient.getSides().subscribe(
        data => {
          this.sides = data;
          this.tableData = new MatTableDataSource(this.sides.sides);
          this.tableData.sort = this.sort;
          this.tableData.paginator = this.paginator;
        },
        error => {
          console.log(error);
        },
        () => {
          console.log('Requested');
        }
    );
  }

  fillMonthes() {
    this.monthNames.forEach((item, i) => {
      this.month.push(
          {
            id: item.id,
            min: new Date(new Date().getFullYear(), i, 1),
            value: item.rus,
            column: item.column
          }
      );
    });
  }

  showClient(event) {
    if (event.target.classList.contains('mat-calendar-body-cell-content') && event.target.hasAttribute('data-client')) {
        this.snack.open('Клиент: ' + event.target.dataset.client, 'Закрыть', {
          duration: -1
        });
    }
  }

  getMonthNumber(date: string) {
    return new Date(date).toLocaleDateString('ru', {month: 'numeric'});
  }

  addresses() {
    this.httpClient.getSides().subscribe(
        data => {
          let addr = [];
          this.all = data;
          addr = this.all.sides.filter( side => {
            return side.addresses.length > 0;
          });
          addr.forEach((item) => {
            item.addresses.forEach((event) => {
              switch (event.status) {
                case 1:
                  this.element.nativeElement.querySelector(`.calendar-cell-${event.sides_id}-${this.getMonthNumber(event.start_reserve_event)}`).querySelector(`#calendar-${event.sides_id}-${this.getMonthNumber(event.start_reserve_event)}`).querySelectorAll('.mat-calendar-body-cell-content').forEach(cell => {
                      if (this.convertDate(cell.parentElement.getAttribute('aria-label')).getTime() >= new Date(event.start_reserve_event).getTime() && this.convertDate(cell.parentElement.getAttribute('aria-label')).getTime() <= new Date(event.end_reserve_event).getTime()) {
                        cell.classList.add('reserved-class');
                        cell.dataset.client = event.client;
                      }
                    });
                  break;
                case 2:
                  this.element.nativeElement.querySelector(`.calendar-cell-${event.sides_id}-${this.getMonthNumber(event.start_booking_event)}`).querySelector(`#calendar-${event.sides_id}-${this.getMonthNumber(event.start_booking_event)}`).querySelectorAll('.mat-calendar-body-cell-content').forEach(cell => {
                      if (this.convertDate(cell.parentElement.getAttribute('aria-label')).getTime() >= new Date(event.start_booking_event).getTime() && this.convertDate(cell.parentElement.getAttribute('aria-label')).getTime() <= new Date(event.end_booking_event).getTime()) {
                        cell.classList.add('booking-class');
                        cell.dataset.client = event.client;
                      }
                  });
                  break;
                case 3:
                  this.element.nativeElement.querySelector(`.calendar-cell-${event.sides_id}-${this.getMonthNumber(event.start_bought_event)}`).querySelector(`#calendar-${event.sides_id}-${this.getMonthNumber(event.start_bought_event)}`).querySelectorAll('.mat-calendar-body-cell-content').forEach(cell => {
                      if (this.convertDate(cell.parentElement.getAttribute('aria-label')).getTime() >= new Date(event.start_bought_event).getTime() && this.convertDate(cell.parentElement.getAttribute('aria-label')).getTime() <= new Date(event.end_bought_event).getTime()) {
                        cell.classList.add('bought-class');
                        cell.dataset.client = event.client;
                      }
                    });
                  break;
              }
            });
          });
        },
        error => {
          console.log(error);
        }
    );
  }
}

Method addresses() highlight dates on dev but it doesn't highlight it on production

I hope that anyone can help me

10 Oct
8 months ago

RuslanJohnBell left a reply on Angular 5

Solved.

RuslanJohnBell started a new conversation Angular 5

Hello, fellows!

Can anyone help me with simulating escape keypress with click method in Angular 5? I read a lot of posts in net but still don't have any solution

RuslanJohnBell left a reply on Malformed UTF-8 Characters, Possibly Incorrectly Encoded

@gabrielbitencourt try to use port 465 and SSL encrypting. My problem was solved with this config

18 Jun
11 months ago

RuslanJohnBell left a reply on Attach Multiple Files To Email Laravel 5.4

Thanks. I solved it. :-)

RuslanJohnBell started a new conversation Attach Multiple Files To Email Laravel 5.4

Hello, guys! Please, help me to attach multiple files to email with Mailable. I cannot use model now, just need to attach uploading files.

foreach ($request->file('files') as $file)
        {
            $file->move('images/related/', $file->getClientOriginalName());
            array_push($path, public_path('images/related/', $file->getClientOriginalName()));
        }

And mailable:

$this->markdown('emails.foodkort')
            ->subject('Заяўка на фудкорт')
            ->attach($this->files);

How can I attach array of pathes??? Please, help cause I don't sleep more than 24 hours and my brain is going to blow!

RuslanJohnBell left a reply on Malformed UTF-8 Characters, Possibly Incorrectly Encoded

I solved it by using port 465 and encrypting SSL

17 Jun
1 year ago

RuslanJohnBell started a new conversation Malformed UTF-8 Characters, Possibly Incorrectly Encoded

I don't know why I get this error... I use generic mail template without any data and try to send mail to mailtrap, but always get error "Malformed UTF-8 characters, possibly incorrectly encoded"

public function sendFeedback(FeedbackFormRequest $request)
    {

        Mail::to('[email protected]')->send(new Message());

        return response()->json(['success' => 'Вашае паведамленне было паспяхова адпраўлена!']);
    }

Please, anyone help me, cause I have only three hours to make sending letters

07 Mar
1 year ago

RuslanJohnBell left a reply on Loading Class To Blade Template From Database

Oh, I resolved it, thank you! I just insert necessary thing into style atrribute like this:

<div class="cardCnH" style="background-color: {{$service->style}}">

And all done!

RuslanJohnBell started a new conversation Dynamic Class

Hi. During the creation of a certain element, I need to add a CSS class to it, which, together with all other information on this element, is written to the database. I then try to load this class through the Blade template on the page as follows

@foreach($services as $service)
                <div class="col-sm-4">
                    <div class="cardCn c4">
                        <div class="cardCnH">
                            <div class="cH">{{$service->name}}</div>
                            <div class="cB">{!!  $service->short!!}</div>
                        </div>
                        <div class="cardCnB">
                            <div class="col-sm-6 imgFlt">
                                <img class="cntImg" src="{{asset('/img/service'.$service->slug.'/preview/'.$service->preview)}}"/>
                            </div>
                            <div class="col-sm-6 btnFlt">
                                <button class="ccG"><a class="link" href="">Галерея</a></button>
                                <button class="ccM"><a class="link" href="">Подробнее...</a></button>
                            </div>
                        </div>
                    </div>
                </div>
            @endforeach

Class output, but the prescribed properties are not displayed on the page. Please, help me.

12 Jan
1 year ago

RuslanJohnBell left a reply on Setted Routes Don't Work

All the same: thank you!

RuslanJohnBell left a reply on Setted Routes Don't Work

I get 404. I don't know how, but rebooting of OS solved problem. Before that I make:

php artisan route:clear

but it didn't help. After that I made reboot. And problem was solved. May be you know why did rebooting help?

RuslanJohnBell left a reply on Setted Routes Don't Work

Please, I don't understand why it doesn't work

RuslanJohnBell left a reply on Setted Routes Don't Work

Here is full routes

<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
Auth::routes();


Route::get('/', '[email protected]');

Route::get('/events/{event}', '[email protected]');

Route::get('/{event}/{additional}', '[email protected]');

Route::get('home/create', '[email protected]')->name('create');

Route::get('/home', '[email protected]')->name('home');

Route::post('/home', '[email protected]')->name('store');

Route::get('home/edit', '[email protected]')->name('edit');

Route::get('/home/edit/{event}', '[email protected]');

Route::post('/home/edit/{event}/add', '[email protected]');

Route::post('/home/edit/{event}/video', '[email protected]');

Route::post('/home/edit/{event}/photo', '[email protected]');

Route::post('/home/edit/{event}/gallery', '[email protected]');

Route::post('/home/edit/{event}/info', '[email protected]');

Route::get('/home/edit/{event}/delete', '[email protected]');

Route::post('/home/edit/{event}/update-info', '[email protected]');

Route::post('/home/edit/{event}/update', '[email protected]');

RuslanJohnBell left a reply on Setted Routes Don't Work

Auth::routes();

Route::get('/', '[email protected]');

Route::get('/events/{event}', '[email protected]');

Route::get('/{event}/{additional}', '[email protected]');

Route::get('/home/create', '[email protected]')->name('create');

Route::get('/home', '[email protected]')->name('home');

Route::post('/home', '[email protected]')->name('store');

Route::get('/home/edit', '[email protected]')->name('edit');

Route::get('/home/edit/{event}', '[email protected]');

Route::post('/home/edit/{event}/add', '[email protected]');

Route::post('/home/edit/{event}/video', '[email protected]');

Route::post('/home/edit/{event}/photo', '[email protected]');

Route::post('/home/edit/{event}/gallery', '[email protected]');

Route::post('/home/edit/{event}/info', '[email protected]');

Route::get('/home/edit/{event}/delete', '[email protected]');

Route::post('/home/edit/{event}/update-info', '[email protected]');

Route::post('/home/edit/{event}/update', '[email protected]');

RuslanJohnBell started a new conversation Setted Routes Don't Work

I use Laravel 5.5. I created routes with controllers. All routes worked good. But one time some routes stoped working. And I don't understand why. Can you help me, please? I serve files via php -S localhost:specific_port. OS Linux.