kordix

kordix

Member Since 1 Year Ago

Experience Points 8,930
Experience Level 2

1,070 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 69
Lessons
Completed
Best Reply Awards 1
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.

30 May
3 weeks ago

kordix started a new conversation Store Php Variables In The View

This works inside blade.php file:

<?php
$variable1 = 'value';
$varable2 = 'anothervalue'
?>

@section('content)
{{$variable1}} {{$variable2}}
@endsection

```

But that doesn't work:
```
@include('data')

@section('content)
{{$variable1}} {{$variable2}}
@endsection
```
Where in data.blade.php I have the mentioned variables

It may be not proper method anyway, but first I want to pass the same variables for create and edit view and I don't want to define them twice in the controller, second I it's annoying to list all the variables like so:
```
return view('createnew2', compact('variable1','variable2','variable3')); etc.
    
``
29 May
4 weeks ago

kordix started a new conversation Handle Edititing Without Another View

I'm courious if any of you came to same problem.

Making another views for creating and editing is really annoying. You have to make all the changes twice, with just that edit view has another post route and edit field and @if's to restore old values, the rest is the same. But it's really annoying to maintain both views.

Has anyone tried some other solution? I suppose it isn't possible with php. Maybe I should make the app in JavaScript framework and then Laravel will just handle the database api and authorisation.

Then restoring all values will be handled just by javascript without @if's

Or someone has maybe better idea?

28 May
4 weeks ago

kordix started a new conversation Edit View Restore Saved Options Without @if

Usually when we want to restore option to stored value we can do this likwise:

    @foreach($channels as $channel)
    <option value="{{$channel->name}}" @if($position->channel==$channel->name)selected @endif >{{$channel->name}}</option>
    @endforeach

But I've got some code generated by JavaScript and it's hard to maintain that methodology.

Has anyone here tried some other method?

I was thinking about restoring proper values in JavaScript. So we get the element from database and by it we set proper option and input values. I think that Vue reactivity may here come in handy.

I was just wondering if someone here tried and maybe has some tips for that

17 May
1 month ago

kordix left a reply on Serve Many Laravel Apps (virtual Hosts) On One VPS WITHOUT DOMAIN

I'm going to buy the domain, big thanks for answer

kordix started a new conversation Serve Many Laravel Apps (virtual Hosts) On One VPS WITHOUT DOMAIN

I have laravel already working on one virtual host.

But can we serve many apps on one VPS without buying the domain, using the ip?

Like http://ip/site1 http://ip/site2

To make it more obvious it can be:

http://ip/myaliasttest should lead to <Directory /var/www/html/site1/public> and http://ip/myaliasttest2 should lead to <Directory /var/www/html/site2/public>

there should be nothing available on http://ip

10 May
1 month ago

kordix left a reply on Encrypted Value In .env

I didn't really mean to secure application that way, but I don't like it that anyone who uses my computer can easily get my password.

Or I would like for e.g. workmates just present my code without showing them my passwords

I'm courious nobody has the same issue?

kordix started a new conversation Encrypted Value In .env

My goal is to write encrypted password in .env file. I've searched the web and this seems to be a solution: https://packagist.org/packages/baglerit/envariable

I need to use it without crypt facade But I can't use this in database.php

$crypt = new Illuminate\Encryption\Encrypter(env('APP_KEY'));

Shows error in console when I serve the application: The only supported ciphers are AES-128-CBC and AES-256-CBC with the correct key lengths.

I use it just in the top of the file, maybe i do it wrong?

Of course i have the APP_KEY generated

P.S I see that something changed from version 5.0

In 5.0 it was

void __construct(string $key)

In 5.8

void __construct(string $key, string $cipher = 'AES-128-CBC')

Seems i have to add second argument with that cipher? I try:

$crypt = new Illuminate\Encryption\Encrypter(env('APP_KEY'),'AES-128-CBC');

But it doesn't work, same exception

20 Mar
3 months ago

kordix left a reply on Auth Middleware Store Problem No Message

  public function __construct()
    {
        $this->middleware('auth', ['only' => ['store','update']]);
    }

public function store(){
//just typical store method like any else...
}

Maybe I should just disable possibility to store until user is logged in...

kordix started a new conversation Auth Middleware Store Problem No Message

I want only store method to be guarded by auth middleware - I want the create and index method to be publicly accessible. It quite works - redirects to login when I try to store without logging in - but after it throws "no message" error. Can't it just make the proper store, or if it isn't possible to prevent storing and go back to previous page?

04 Mar
3 months ago

kordix left a reply on Reaching Api After Deployment On Digital Ocean

SOLUTION I had to allow mod_rewrite

kordix left a reply on Reaching Api After Deployment On Digital Ocean

I have set public as document root but I still have to write index.php and api is not working

Last time i thought I have to set public/index.php instead of public, but it worked only because I had local instance running

I did it like in tutorials someone could help?

02 Mar
3 months ago

kordix left a reply on Fabricjs Does Not Work With Laravel

When I added defer to included scripts it works, but maybe can someone explain why it didn't work?

kordix started a new conversation Fabricjs Does Not With Laravel

I am talking about fabric.js library

That library works fine when i run it outside Laravel, when I include it in the view it simply does not work. That code works perfectly:

  <canvas class="" id="c2"></canvas>
var canvas = new fabric.Canvas('c2');

var triangle = new fabric.Triangle({ left:50,
  angle: 30,
  width:50,
  height:30,
  selectable:false,
  angle:40 });

canvas.add(triangle);

But if I run it inside Laravel it just doesn't work. I have indeed the canvas in the view, I load fabric.js library and that script, it even shows errors if I have any. If I don't load fabric.js it shows 'fabric undefined').

Maybe someone had the same problem with that or any other library?

15 Feb
4 months ago

kordix left a reply on != Or <> Does Not Work In @if

It's good the quotes made it

12 Feb
4 months ago

kordix left a reply on != Or <> Does Not Work In @if

I swear on God dd($drzwi->wizjer) shows "S" @if($drzwi->wizjer <> 0) Wizjer @endif does not show anything this works @if($drzwi->kontaktron == 1)Kontaktron @endif just I swear on God next to it in the same place

11 Feb
4 months ago

kordix left a reply on Reaching Api After Deployment On Digital Ocean

In 000-default.conf

<VirtualHost *:80>
        ServerAdmin [email protected]
        DocumentRoot /var/www/html/konfigurator/public

        <Directory /var/www/html/konfigurator/public>
            Options Indexes FollowSymLinks
            AllowOverride All
            Require all granted
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

        <IfModule mod_dir.c>
            DirectoryIndex index.php index.pl index.cgi index.html index.xhtml index.htm
        </IfModule>

</VirtualHost>

It works quite well but still I must write index.php , without it the site kind of "catches" the routing but result at not found, when i write http://myip/index.php works perfectly, but routing works like ttp://myip/index.php/myroute that's still ridicioulous

kordix started a new conversation != Or <> Does Not Work In @if

When I use

@if($variable <> 0)   text @endif

or

@if($variable != 0)   text @endif

In blade file it does not work , other comparisions works perfectly. You know anything about that?

kordix started a new conversation Reaching Api After Deployment On Digital Ocean

Such api route: http://localhost:8000/api/handles/KK works perfectly on local serving But after deploying the app on DigitalOcean I can't get to api in any way. I tried http:// MYIP /mysite/api/handles/KK or http://MYIP/mysite/public/api/handles/KK

(the app isn't directly in www folder but subfolder since i have many apps)

EDIT now it works after I run php artisan serve on remote server, but do I have to keep it all the time or what? Is that a proper method?

29 Dec
5 months ago

kordix left a reply on AssertSee Does Not Work

return RemoteWebDriver::create(
            'http://localhost:8000',
            DesiredCapabilities::chrome()->setCapability(
                ChromeOptions::CAPABILITY,
                $options
            )
        );

I switched here to port 8000 instead 9515 not it shows error instead of failure

Tests\Browser\ExampleTest::testBasicExample
TypeError: Argument 1 passed to Facebook\WebDriver\Remote\DesiredCapabilities::__construct() must be of the type array, null given, called in C:\xampp\PROJEKTY\dupa\vendor\facebook\webdriver\lib\Remote\RemoteWebDriver.php on line 127

C:\xampp\PROJEKTY\dupa\vendor\facebook\webdriver\lib\Remote\DesiredCapabilities.php:33
C:\xampp\PROJEKTY\dupa\vendor\facebook\webdriver\lib\Remote\RemoteWebDriver.php:127
C:\xampp\PROJEKTY\dupa\tests\DuskTestCase.php:42
C:\xampp\PROJEKTY\dupa\vendor\laravel\dusk\src\Concerns\ProvidesBrowser.php:192
C:\xampp\PROJEKTY\dupa\vendor\laravel\framework\src\Illuminate\Support\helpers.php:754
C:\xampp\PROJEKTY\dupa\vendor\laravel\dusk\src\Concerns\ProvidesBrowser.php:193
C:\xampp\PROJEKTY\dupa\vendor\laravel\dusk\src\Concerns\ProvidesBrowser.php:93
C:\xampp\PROJEKTY\dupa\vendor\laravel\dusk\src\Concerns\ProvidesBrowser.php:64
C:\xampp\PROJEKTY\dupa\tests\Browser\ExampleTest.php:21

kordix left a reply on AssertSee Does Not Work

@SHEZ1983 - It does not work and public function testBasicExample() { $this->browse(function (Browser $browser) { $browser->visit('/') ->assertSee('Laravel'); }); }

and

and public function testBasicExample() { $this->browse(function (Browser $browser) { $browser->visit('/') ->assertDontSee('Laravel'); }); } and

kordix started a new conversation AssertSee Does Not Work

AssertSee does not work at all - fresh Laravel Installation fresh php artisan dusk:install , big text on middle on the screen "Laravel" and public function testBasicExample() { $this->browse(function (Browser $browser) { $browser->visit('/') ->assertSee('Laravel'); }); } does not work public function testBasicExample() { $this->browse(function (Browser $browser) { $browser->visit('/') ->assertDontSee('Laravel'); }); } DOES work

kordix started a new conversation Laracasts Can't Perform Payment

I update data for my credit card it just shows Uh Oh your card does not support this type of purchase

I used payment with that credit card twice

You 've got an idea?

22 Dec
6 months ago

kordix left a reply on Something Like @if In Controllers

Damn that was good thanks

kordix started a new conversation Something Like @if In Controllers

Can I use something like @if but in controllers, not in the views?

Here's concept: I have a language learning program. It just asks me for words, when i answer for one word it moves to another. I have a $next variable to set the next word, it depends from a few factors. If I want to use one category, its ->where('category'=$this->currentcategory , if I want to learn sentences its ->where('sentence'=$this->sentencesetting etc.

Now what I can do is writing multiple if's for every condition. Can't I just conditionally add some piece of code?

22 Jul
11 months ago

kordix left a reply on Error Installing Laravel 5.6 App On Remote Hosting

I was having similiar issues, beside storage there is bootstrap folder to set chmods

kordix left a reply on Grouping And Searching Data

Really no one has no clue?

I was thinking it would look something like that in the view

@foreach($categories as $category) {{$category->title}} @foreach($category->subcategories as $subcategory) {{$subcategory->title}} @foreach($subcategory->jokes as $joke) {{$joke->title}} @endforeach @endforeach @endforeach

Has anyone used such a construction?

kordix left a reply on Create/update Sql Records Without Form

Sorry my answer was cut ('<a href' code was converted to link) , I added more description

21 Jul
11 months ago

kordix started a new conversation Create/update Sql Records Without Form

Can I make update in SQL without nor {{csrf_field}}?

I would like just to make controller which updates some record in database and execute with ?

17 Jul
11 months ago

kordix started a new conversation Grouping And Searching Data

I want to makes a Jokes application. Basically it's just a typical CRUD with jokes catalogue.

But I have a few slight problems.

First thing is showing all data grouped by given order. It's quite easy - i can just use orderby() on collection. But I need to make modifications in the view - precisely I want to give a header for each group.

So let's say it's like that.

NEW JOKES vulgar jokes politics blondes doctors policemen decent jokes politics blondes doctors policemen OLD JOKES vulgar jokes politics blondes doctors policemen decent jokes politics blondes doctors policemen

With manytomany relationship I can easily define one group given by user, or just group by category. In the view it would like something like that:

@foreach($categories as $category)
    <b>{{$category->title}}</b><br>
    @foreach($category->jokes as $joke)
        {{$joke->title}}
    @endforeach

What I need is category + SUBcategory + SUB-SUBcategory Is there something like groupby() which gives collections array wchich I can use with @foreach in the view?

12 Jul
11 months ago

kordix started a new conversation Simple Refactor Doesn't Work

this: $next = Question::where('id', '>', $id) ->min('id'); return redirect()->route('show', ['id'=>$next]); inside a function does work

but if I want to export this to another function and it just does nothing

Following function doesn't work:

public function setCounter($id, Request $request) { Question::find($id)->update(['counter'=> request('counter')]);

    session()->flash('message', 'Ok masz rację');
   $this->nextt($id);
}

public function nextt($id) { $next = Question::where('id', '>', $id) ->min('id'); return redirect()->route('show', ['id'=>$next]); }

It just makes no redirect It's just not possible to redirect by calling another function?

08 Jul
11 months ago

kordix started a new conversation Route To Controller

In symfony I could make routing just inside the controller, just by setting the route above the controller method, I didn't have to set routes in seperate file.

But I think about slightly different thing, I want to execute the method directly in the view, something like href={{route(name)}}, but it should be something like {{controller('methodname')}}

Do I have to set every single method I use in web.php file?

12 Jun
1 year ago

kordix left a reply on Saving "{{" In A Database And Showing In The View

Yes I tried exactly like that {!! html_entity_decode($variable) !!}

Just anything between curly braces f.e. {{ product.name }} wouldn't work, { product.name }} will.

kordix started a new conversation Saving "{{" In A Database And Showing In The View

I want to make an app to store code snippets in the database and pass them to the view. Everything works fine, but if it contains double curly braces "{{ }}" it gets knotched up, the site blinks for a moment and then it shows nothing.

I tried {!! !!} , htmlentities(), html_entity_decode, and some Blade directive it does not work

Yet so simple but so annoying im searching for solution long time maybe you can help

05 May
1 year ago

kordix left a reply on Products Available For Given Products Setting

Thanks I was just thinking about something like that I still got one more problem it is easy to show this data but I wonder how to use this in configurator with select forms. When I click position in select form then it would show possible handles for that door, also in the select form

Is it possible without JS and AJAX?

30 Apr
1 year ago

kordix started a new conversation Products Available For Given Products Setting

I am making a door configurator. I have seperate tables with door models and handles. Every door model has other handles available to choose.

E.g. doors number 5 has only available to choose handles number 3,4, and 7.

Have you got idea how to write such settings in SQL?

First thing I miss is array datatype in SQL to store that data.

Other thing is that really seems not to be that difficult but I need some... X ingredient that will rig this up. I was thinking about many to many relationship, but maybe i don't need any? Maybe handles table should have a door_models column where available doors are seperated by comma? But I dont know how te prepare a select form basing on that setting.

At first glance I thought this will be really easy, but i really don't know how to "bite" that thing

31 Mar
1 year ago

kordix started a new conversation Laravel Forum Without TDD

Have you seen something comparable to this:

https://laracasts.com/series/lets-build-a-forum-with-laravel

but without TDD aproach? I mean there may be some units tests, but not so hardcore-unit-testing approach. I would like to see exactly something like that, but without TDD

13 Mar
1 year ago

kordix left a reply on Laravel Tutorial For A Nice Project

I did it already

12 Mar
1 year ago

kordix left a reply on Laravel Tutorial For A Nice Project

Hmm I think somthing like CRM or ERP project would be nice, it can be kind of based on a shop project

kordix started a new conversation Laravel Tutorial For A Nice Project

Do you know any good tutorial for a nice Laravel project and something ELSE than todolist or shop? I am not really interested in "adanced Eloquent", "advanced autenthication" or others single aspects of framework. The best I like is bigger projects where you can use such aspects in practice.

I see there is Project Flyer tutorial here, that's also quite nice, but it's hard to find anything else.

Forum with TDD is a nice project but it's bloated with unit test what kinda freaks me out. Have you seen something like this without TDD manner?

31 Jan
1 year ago

kordix started a new conversation Difference Between Dates Taken From SQL

I can easily get some difference between dates in the view f.e.

I can also use Carbon in controller and pass it to the view

$date = "2016-09-17 11:00:00"; $datecarbon = new Carbon($date);

return view('someview', compact('date'));

But I can't use it on sql records. I can't use DateTime object or Carbon inside @foreach blade directive and {{}} syntax.

F.e. I have a few hundred dates in the sql table and I want to add additional column with difference between dates.

It seems to be easy but I have to somehow combine controller logic and blade directives.

02 Jan
1 year ago

kordix left a reply on Heroku Whoopsing

Alright I was lazy and removed .env from gitignore. Now works.

I'll check config vars anyway. I hope x]

kordix started a new conversation Heroku Whoopsing

I uploaded application on heroku, I see the site but I can't do anything with database. Probably.

I can't register new user, whhops, looks something went wrong.

I have database set up. Php artisan migrate and refresh went fine. It is external database and I checked if it done refresh in phpmyadmin database (I moved data to external base from localhost manually). So I see credentials in .env are good.

But what is interesting it worked only from localhost. When I run heroku bash and then migrate, there is error SQLSTATE[HY000] [2002] Connection refused

When I run key generate on heroku bash there is file_get_contents(/app/.env): failed to open stream: No such file or directory

P.S I turned on debug mode in app.php , I also tried this https://laracasts.com/discuss/channels/laravel/whoops-looks-like-something-went-wrong-when-pushing-to-heroku

Now it shows typical whoops error with same information SQLSTATE[HY000] [2002] Connection refused

kordix left a reply on HTML Line Break Interpretation Saved In SQL, From Textarea

Daamn thanks, again easy things which I search for hours.

Maybe I'm searching wrong way? I write "blade new line crud", "blade interpret new line entity inside strings" or "html new line entity Laravel Blade" etc.

BTW do you have a way to interpret other HTML tags like some text , some text< /i> ?

kordix left a reply on Is There A Significant Advantage Of Using Vue With Laravel Over JQuery AJAX?

I join to the question. I know that jQuery is dead and now you must know modern frameworks. But what can I do better/faster using "modern frameworks" instead jquery?

kordix left a reply on HTML Line Break Interpretation Saved In SQL, From Textarea

It is still not it.

It just changes new lines to But it does not take effect. Instead of new line I just see

kordix started a new conversation HTML Line Break Interpretation Saved In SQL, From Textarea

I want to save line breaks or other html intepretation in my CRUD application, f.e. "Line 1 Line 2" should make a new line or "bold text"

I also tried special chars like \n &br; They disappear when i write them to sql.

I may try WYSIWYG editor but for my use it would just interpret html.

I suppose solution is easy but I can't find it.

kordix left a reply on How To Deploy A Laravel Application Toa Local Server

I quite dont understand, you want do deploy your app for the world or just for localhost? If localhost why you have to use Windows Server?

You can't just run windows installer?

29 Dec
1 year ago

kordix left a reply on How To EDIT Posts / Items / Threads

Damn, that's how things should be explained in documentation. I couldn't find any good answer.

I used dd() function and I realized i made stupid mistake - there was no task with id 1.

I would figure it out anyway but if I read this answer before I would save hours.

Big thanks.

kordix started a new conversation How To EDIT Posts / Items / Threads

Im scared that I can't find anywhere proper way to have possibility to EDIT posts.

EDITING is not mentioned in Laravel from Scratch series.

In forum series there is update() method

public function update($channel, Thread $thread) { $this->authorize('update', $thread);

    $thread->update(request()->validate([
        'title' => 'required',
        'body' => 'required'
    ]));

    return $thread;
}

But this does not tell me much. There is no edit() method and no edit.blade.php

I tried this tutorial http://itsolutionstuff.com/post/crud-create-read-update-delete-example-in-laravel-52-from-scratchexample.html

Here is an error when I go to edit form Trying to get property of non-object (View: C:\xampp\TODOLISTA\resources\views\tasks\edit.blade.php)

Here is my routing: Route::get('tasks/edit/{id}', '[email protected]')->name('edit'); Route::patch('tasks/edit/{id}', '[email protected]')->name('update');

Methods in TaskController:

public function edit($id) { $task = Task::find($id); return view('tasks.edit', compact('task')); }

public function update(Request $request, $id)
{
    Task::find($id)->update([
    'title' => request('title'),
    'channel_id' => 2,
    'description' => request('description')
]);
}

edit.blade.php

{!! Form::model($task, ['method' => 'PATCH','route' => ['update', $task->id]]) !!} {{ csrf_field() }} Tytuł Opis Zatwierdź {!! Form::close() !!}