tomopongrac

tomopongrac

Member Since 4 Years Ago

Croatia

Experience Points 284,670
Experience Level 50

0 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 1006
Lessons
Completed
Best Reply Awards 425
Best Reply
Awards
  • start-engines Created with Sketch.

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • first-thousand Created with Sketch.

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • 1-year Created with Sketch.

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • 2-years Created with Sketch.

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • 3-years Created with Sketch.

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • 4-years Created with Sketch.

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • 5-years Created with Sketch.

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • school-session Created with Sketch.

    School In Session

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

  • welcome-newcomer Created with Sketch.

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • full-time-student Created with Sketch.

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • pay-it-forward Created with Sketch.

    Pay It Forward

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

  • subscriber-token Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer-token Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • lara-evanghelist Created with Sketch.

    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 Created with Sketch.

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • lara-veteran Created with Sketch.

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • 10k-strong Created with Sketch.

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • lara-master Created with Sketch.

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • laracasts-tutor Created with Sketch.

    Laracasts Tutor

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

  • laracasts-sensei Created with Sketch.

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • top-50 Created with Sketch.

    Top 50

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

06 Jun
2 months ago

tomopongrac left a reply on Stop The Loop From Repeating Categories

Try collection method groupBy like this

<?php $grouped = $artist->groupBy('type'); ?> 
@foreach($grouped as $type => $albums)
    
    <div>{{ $type }}</div>


    @foreach($albums as $type => $album)
            {{$album->title}} - {{$album->year}}
    @endforeach

@endforeach

https://laravel.com/docs/5.8/collections#method-groupby

05 Jun
2 months ago

tomopongrac left a reply on Select Inputs Ignored By Validation

Try to remove disabled attribute

<option selected value="">Male or Female? </option>

tomopongrac left a reply on Laracasts Subscription Problem

Are you login in on your phone?

tomopongrac left a reply on Sweet Alert

Try with persistent method

// -> The text will appear in the button
alert('Hello World!')->persistent("Close this");

https://github.com/uxweb/sweet-alert

04 Jun
2 months ago

tomopongrac left a reply on Chaining Fresh() In Model Methods For Test To Pass

That is ok because sometimes you need to get new model from the database in order to pass the test

29 May
2 months ago

tomopongrac left a reply on Map Array Values To Collection Of Items

You can try

$items->mapWithKeys(function ($item) use ($baseMap) {
    return [
            $baseMap['name'] => $item['name'],
            $baseMap['year'] => $item['year'],
        ];
});
28 May
2 months ago

tomopongrac left a reply on Axios

Check the documentation

https://github.com/axios/axios

24 May
2 months ago

tomopongrac left a reply on Function () Does Not Exist

Try

Route::get('/mobileServices', function (){
    Alert::message('Welcome back!');
})->name('mobileServices');

https://laravel.com/docs/5.8/routing#named-routes

22 May
2 months ago

tomopongrac left a reply on How To Change PHP Version In Homestead

Connect to homestead with ssh

vagrant ssh

and write command bellow

php56

if you want php 7.3 again write this command

php73
21 May
2 months ago

tomopongrac left a reply on Change Data From Another Vue Element

Try

<script>
        vm = new Vue({
            el: '#flashMessage',

            data: {
                show: false
            }
        });

    @if($thread->hasReplies())
       vm1 = new Vue({
            el: '#dropdown-vue',

           methods: {
                destroy() {
                    axios.delete('/replies/{{$reply->id}}/delete');
            vm.show = true;
                }
               }

       });
13 May
3 months ago
25 Mar
4 months ago

tomopongrac left a reply on Valid Condition In Blade Form Input

Try

old('common_settings_site_name', $common_settings_site_name)
21 Mar
4 months ago

tomopongrac left a reply on Method Illuminate\Validation\Validator::validateRequired|date|before Does Not Exist.

Try

'start_date'    => 'required|date|before:' . Carbon\Carbon::now(),
'end_date'      => 'date|before:start_date'

or

'start_date'    => ['required', 'date', 'before:' . Carbon\Carbon::now()],
'end_date'      => ['date', 'before:start_date']

tomopongrac left a reply on [5.7.11] Auth And Session Data

if on other machine FOFO user is authenticated you get his data, if you authenicate with TOTO credetials you will get his data

tomopongrac left a reply on [5.7.11] Auth And Session Data

I dont understand the problem because auth()->user() gets the user which is authenticated

tomopongrac left a reply on File Validation Not Working Properly

You only need to define mimes rule because this rule actually validates against the MIME type of the file by reading the file's contents and guessing its MIME type

https://laravel.com/docs/5.8/validation#rule-mimes

20 Mar
5 months ago

tomopongrac left a reply on Uncaught Error: Syntax Error, Unrecognized Expression:

What do you get with

console.log(module_id);
01 Mar
5 months ago
19 Feb
6 months ago

tomopongrac left a reply on How To Get All The Data From My Database

Do you get any results with this query

$levels = Category::all();
dd($levels);

tomopongrac left a reply on How To Get All The Data From My Database

Do you get any results from database

$levels = Category::where(['parent_id'=>0])->get();
dd($levels);

        return view('admin.categories.add_category')->with(compact('levels'));
15 Feb
6 months ago

tomopongrac left a reply on Route Isn't Working

Do you have middlesware admin?

I think that you only need auth middleware

tomopongrac left a reply on Route Isn't Working

Remove /admin from route

Route::get('dashboard','[email protected]')->name('dashboard');
13 Feb
6 months ago

tomopongrac left a reply on Get Number Of Week Day In Carbon

You can with this

    $strArray = [];
    for($i = 0; $i<7; $i++){
        $strArray[] = Carbon::now()->addDays($i)->dayOfWeek;
    }
    
    $str = implode(',', $strArray);

tomopongrac left a reply on Get Number Of Week Day In Carbon

Does this work

$dayOfTheWeek = Carbon::now()->dayOfWeek;
11 Feb
6 months ago

tomopongrac left a reply on Laravel 5.7 : Unable To Test Patch/Put/Delete Routes

You need to create row in database with create()

$timesheet = factory(Timesheet::class)->create();

tomopongrac left a reply on About Closures

In line

$keyBy = $this->valueRetriever($keyBy);

you override variable $keyBy and value become closure function

tomopongrac left a reply on About Closures

This is the source code of method keyBy

    public function keyBy($keyBy) {
        $keyBy = $this->valueRetriever($keyBy);

        $results = [];

        foreach ($this->items as $key => $item) {
            $resolvedKey = $keyBy($item, $key); // <--- check this

            if (is_object($resolvedKey)) {
                $resolvedKey = (string) $resolvedKey;
            }

            $results[$resolvedKey] = $item;
        }

        return new static($results);
    }

It is like this code

    class hello {
            function get($value){
                return function ($item) use ($value) {
                    dd($item);
                    return $value;
                };
            }
        }

        $hello = new hello;
        $variable = $hello->get("hello");
        $variable('hello_item');

tomopongrac left a reply on About Closures

Try

class hello {
        function get($value){
            return function ($item) use ($value) {
                    dd($item);
                    return $value;
                };
        }
    }

    $hello = new hello;
    var_dump($hello->get("hello")("hello_item"));

tomopongrac left a reply on Form Submit Not Working

Try to use lower case in route

Route::resource('message','MessageController');
08 Feb
6 months ago

tomopongrac left a reply on Passing The Same Variables To Multiple Views Over And Over Again

What you get with this

public function boot() {

    $menu = MainMenu::OrderBy('Order', 'asc')->get();
    $cat = Category::OrderBy('sortOrder', 'asc')->get();

    $data = array(
        'main_menus' => $menu,
        'categories' => $cat,
    );

dd($data);

    View::share('data', $data);
}
07 Feb
6 months ago

tomopongrac left a reply on Submitting The Form To Show Old Empty Value In Validation Error

Try this

value="{{ old('field_name', ( isset($dbRow) ? $dbRow->field_name : '')) }}"

tomopongrac left a reply on Using Select Blade

Add all() method

$holidayCalenders = Holidaycalander::where(['status'=>'on'])->pluck('name','id')->all();

https://laravel.com/docs/5.7/collections#method-pluck

tomopongrac left a reply on Urgent Help Needed, Even Google Couldn't Answer- Please Help. Laravel Test Fails..

Try to create password grant before login user

//create password grant client
  $this->artisan('passport:client', ['--password' =>true, '--no-interaction' => true, '-- 
  redirect_uri'=>'http://localhost', '--name'=>'test client']);
  // fetch client for id and secret
  $client = \DB::table('oauth_clients')->where('password_client', 1)->first();

$user= factory(User::class)->create(); //create user
$login=$this->actingAs($user,'api'); //user login with api

tomopongrac left a reply on SQLSTATE[42000]: Syntax Error Or Access Violation: 1075 Incorrect Table Definition; There Can Be Only One Auto Column And It Must Be Defined As A Key

You can not set integer length in column working_days instead use

$table->bigInteger()
$table->mediumInteger()
$table->integer()
$table->smallInteger()
$table->tinyInteger()

https://laravel.com/docs/5.5/migrations#columns

Second parametar is for autoIncrement

    /**
     * Create a new integer (4-byte) column on the table.
     *
     * @param  string  $column
     * @param  bool  $autoIncrement
     * @param  bool  $unsigned
     * @return \Illuminate\Database\Schema\ColumnDefinition
     */
    public function integer($column, $autoIncrement = false, $unsigned = false)
    {
        return $this->addColumn('integer', $column, compact('autoIncrement', 'unsigned'));
    }
06 Feb
6 months ago

tomopongrac left a reply on Set A Session In Laravel Blade

In RegisterController create registered method

    /**
     * The user has been registered.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  mixed  $user
     * @return mixed
     */
    protected function registered(Request $request, $user)
    {
        if ($request->session()->has('key')) {
        $sessionData = $request->session()->get('key');
            return redirect()->route('your route');
        }

        return redirect($this->redirectTo);
    }

tomopongrac left a reply on Set A Session In Laravel Blade

In your LoginController try to add this method

    protected function authenticated(Request $request, $user)
    {
        if ($request->session()->has('key')) {
        $sessionData = $request->session()->get('key');
            return redirect()->route('your route');
        }

        return redirect($this->redirectTo);
    }

tomopongrac left a reply on Set A Session In Laravel Blade

In controller which render your blade file put this code ... for example

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;

class UserController extends Controller
{
    /**
     * Show the profile for the given user.
     *
     * @param  Request  $request
     * @param  int  $id
     * @return Response
     */
    public function show(Request $request, $id)
    {
        $value = $request->session()->put('key', 'value');

        //
    }
}

For more explanation check the documentation https://laravel.com/docs/5.7/session#storing-data

tomopongrac left a reply on Set A Session In Laravel Blade

You can like this

<?php
session(['key' => 'value']);
?>

but It is not recommended to do that inside blade templates, blade’s purpose is to render the view.

tomopongrac left a reply on How I Delete Data

You have defined route with get method, you need route with delete method

Route::delete('media_destroy/{media}','[email protected]')->name('media.destroy');'