paklic9

paklic9

Member Since 10 Months Ago

Experience Points 210
Experience
Level
Lessons Completed 0
Lessons
Completed
Best Reply Awards 0
Best Answer
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.

28 Jan
9 months ago

paklic9 left a reply on File Validation

Thanks! That works.

paklic9 started a new conversation File Validation

I have problem with file validation. It doesnt validate. I am not sure, if I am doing it right, because I know, there is more similarly ways to do it. Can you help me? How to validate the file.

My code:

    $files = $request->file('soubory');
    if($request->hasFile('soubory'))
    {
      $i = 0;
      $dbfilename = [];
      foreach ($files as $file) {
        $rules = array('file' => 'required|mimes:png,gif,jpeg,txt,pdf,doc');
        $validator = \Validator::make(array('file'=> $file), $rules);
        if($validator->passes()){
          $fileExtension = $file->getClientOriginalExtension();
          $fullFileName = $file->getClientOriginalName();
          $filename = pathinfo($fullFileName)['filename'];
          $file->storePubliclyAs('/upload/' . Auth::user()->id, $filename . ('_') . time() . rand(0, 99999) . $i . '.' . $fileExtension, 'public');
          array_push($dbfilename,$fullFileName);
          $i++;
        }
      }
      $dbfilename = implode(', ', $dbfilename);

Thanks in advance for help.

15 Jan
10 months ago

paklic9 left a reply on Shared Hostling - Error When Trying Insert Something To Database

@Snapey

They doesnt say, that i cannot have the file. I have it on server, but it not using it for some reason. On some czech forum, they just said, that I need write all to config files.

I copied whole projekt to www folder(public) and made .htaccess (that redirect to public) and code is:

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_URI} !^public
RewriteRule ^(.*)$ public/ [L]
</IfModule>

and then in public I have main .htaccess:

<IfModule mod_rewrite.c>
    RewriteEngine On

    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} (.+)/$
    RewriteRule ^ %1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

I had to remove this(because Options -MultiViews isnt allowed):

    <IfModule mod_negotiation.c>
        Options -MultiViews -Indexes
    </IfModule>

@mdecooman

Actually its just small project for my friend and he wants to have it hosted in czech (with small budget on the beginning) and he is paying it.

In near future I plan to buy some small cheapest vps (somewhere in EU) for my project, but in this situation I will need to use the shared hostling like that.

And for now I am learing/developing on localhost on windows. And I know, what is and how to use virtualbox (like a home vps).

paklic9 left a reply on Shared Hostling - Error When Trying Insert Something To Database

@mdecooman

Thanks for answer. Yeah, only I have acess to the ftp, where data are stored, so it should be okey, as you say. And no my apllication is not collecting credit cards. It would be different, if the application collects credit cards?

About that chmod, i thought it. Just some guy said it on forum, that you should do it (and here its also written https://github.com/JosefKuchar/Larawed#post-installpatch ).

P.S.: I am just beginner in all of this, still learing a lot. I recently started to interest in Laravel and all these things. And I am just student on high school, so for it I am using shared hostling(it costs less than 30$ per year without domain). VPS would be like 2x more (60$). But in future I will move to VPS. It looks like everything will work now on shared hostling also.

paklic9 left a reply on Shared Hostling - Error When Trying Insert Something To Database

Okey, I got it. The problem was in session.php and exactly in secure. I had it on true, when i set it to false, it is working. Does somebody know, why? I have HTTPS on website.

I just found, that I can only change APP_KEY and database information and it working all, because other stuffs will be set by default, if it cannot use .env file. So only if I need modify some settings, I have to change it, otherwise i can leave it, right? Like the default secure looks:

'secure' => env('SESSION_SECURE_COOKIE', false),

I have last two question. Snapey why is that problem? To use it without .env file? Do I break some security thing, when i am not using .env, but filling it hardcore in config files? It is safe to use it without .env in comercial use?

And do I need to set access rights 777 to storage and bootstrap/cache recursively? I found that on internet, but it looks like everything is also working without it. I am scared about setting things to 777, because it usualy break some security or am I wrong?

P.S.: All biggest shared hostlings in our country (Czech republic) do not allow to use .env file. At least, what i checked.

paklic9 left a reply on Shared Hostling - Error When Trying Insert Something To Database

Okey, I got it. I thank you all for help. The problem was in session.php and exactly in cookie. I had it like this (because one little older tutorial said it):

'cookie' => 'laravel_session'

But i should be:

'cookie' => str_slug('laravel', '_').'_session',

I just found, that I can only change APP_KEY and database information and it working all, because other stuffs will be set by default, if it cannot use .env file. So only if I need modify some settings, I have to change it, otherwise i can leave it, right? Like the default cookie looks:

'cookie' => env(
'SESSION_COOKIE',
str_slug(env('APP_NAME', 'laravel'), '_').'_session'
),

I have last two question. Snapey why is that problem? To use it without .env file? Do I break some security thing, when i am not using .env, but filling it hardcore in config files? It is safe to use it without .env in comercial use?

And do I need to set access rights 777 to storage and bootstrap/cache recursively? I found that on internet, but it looks like everything is also working without it. I am scared about setting things to 777, because it usualy break some security or am I wrong?

P.S.: All biggest shared hostlings in our country (Czech republic) do not allow to use .env file. At least, what i checked.

paklic9 left a reply on Shared Hostling - Error When Trying Insert Something To Database

jlrdw: I should have done these basics.

Snapey: I cannot use env file on this shared hostling, so I had to set all settings inside config files and I did set all setting like in .env file or default, if it wasnt in .env. And SESSION_DOMAIN wasnt in .env, so I left it on default (null). So it looks like this:

'domain' => null,

I tried to change it to:

'domain' => '.kingworld.cz',

But its not working and I am not sure, if its right set.

So what to do? Is it possible to change some parametrs in config to make it work?

14 Jan
10 months ago

paklic9 started a new conversation Shared Hostling - Error When Trying Insert Something To Database

Hi, I have problem with setting correctly my website on shared hosting (forpsi). I did all what I found on internet. And all is working except one thing. The problem is, when I am trying to write/insert something to databse (login, register, insert a form). It always do: The page has expired due to inactivity. Please refresh and try again.

I also tried to set access rights 777 to storage and bootstrap/cache recursively, but it didnt helped. PS: Reading and getting data from database is working and showing the data from database on page is also working.

13 Jan
10 months ago

paklic9 left a reply on Undefined Variable In Function With Query

oh, that's easy. I was trying to do it much harder. :D Thank you so much.

paklic9 started a new conversation Undefined Variable In Function With Query

Hi, I have problem with my function, error is: "Undefined variable: filtry". I know why, the variable $filtry have to be defined in query function (like variable $j is), then it is working. But I cannot have this variable static, because variable $filtry will be always diffrent, so I need set it before function, then call it in function. Is it possible? Thanks in advance for help.

My function:

function dbselect($tabulka, $filtry){ $inzerce = \DB::table($tabulka) ->where(function($query){ $j = 0; foreach ($filtry as $filtr) { $filtr = \Request::has($filtr) ? \Request::get($filtr) : []; if(isset($filtr)){ $i = 0; foreach ($filtr as $polozka) { if ($i == 0) { $query->where($filtry[$j],'=', $polozka); $i++; } else{ $query->orwhere($filtry[$j],'=', $polozka); $i++; } } } $j++; } })->get(); }

Calling function:

$filtry = ['kategorie']; dbselect('zviratas', $filtry);