Sergiu17

Sergiu17

Member Since 2 Years Ago

Chisinau

Experience Points
296,680
Total
Experience

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
1476
Lessons
Completed
Best Reply Awards
227
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.

Level 50
296,680 XP
22 Sep
16 hours ago

Sergiu17 left a reply on Laravel | How To Display Selected Value In Combobox From Related Table

Probably your find method from PageRepository should be adjusted

class PageRepository 
{
    public function find($id)
    {
        Page::with('navbar')->find($id);
    }
}

This should solve your problem.

Sergiu17 left a reply on Undefined Variable In Mail View

public $user;

public function __construct(User $user)
{
    $this->user = $user;
}

and in your newUser.blade.php

{{ $user->name }}
{{ $user->email }}
21 Sep
1 day ago

Sergiu17 left a reply on Why Image Is Not Showing In Post?

The code you show us, is not related to your problem.

How do you display images in your view?

Sergiu17 left a reply on Less

https://github.com/laravel/laravel/blob/master/webpack.mix.js#L14

Over there,

to compile, you need to run npm run dev or npm run prod, all available scripts are her - https://github.com/laravel/laravel/blob/master/package.json#L3

18 Sep
4 days ago

Sergiu17 left a reply on Image Not Appear All In Slideshow

What is $gallary->image equal to?

Where do you store images?

Sergiu17 left a reply on Cant Get Ajax Request To Trigger Route

Is your JavaScript code inside blade file?

Or, any errors? Network tab?

16 Sep
6 days ago

Sergiu17 left a reply on Laravel | Route To Details Page By Title

@ziben69 , yes

class Article extends Model 
{
    // code ...

    public function getRouteKeyName()
    {
        return 'title';
    }

    // code ...
}

Sergiu17 left a reply on Laravel | Route To Details Page By Title

https://laravel.com/docs/5.8/routing#implicit-binding

/**
 * Get the route key for the model.
 *
 * @return string
 */
public function getRouteKeyName()
{
    return 'title';
}
15 Sep
1 week ago

Sergiu17 left a reply on Pivot Tables And Markdown Mailables - Accessing The Data

/Users/trevorpan/code/bidbird/app/Listeners/SendQuestionAskedNotification.php on line 33

here, you probably have something like:

new QuestionAskedMail($job);

but your constructor expects 2 parameters

public function __construct($job, $question)
14 Sep
1 week ago
13 Sep
1 week ago

Sergiu17 left a reply on Insert In Database Number Of Seats

How do you store data in your database?

06 Sep
2 weeks ago

Sergiu17 left a reply on How To Set A Value Of Hidden Input From Values Of Another Input Fields

Dual binding doesn't work here, you have to do this with JavaScript manually.

<form>
<input name="job_no" id="job_no" class="form-control" required />
<input name="cyc_no" id="cyc_no" class="form-control" required />

<input type="hidden" id='hidden' />

<input type='button' id='submit' value='Submit' />
</form>
</script>
    let form = document.querySelector('form');
    let hiddenInput = document.querySelector('#hidden');
    let submitButton = document.querySelector('#submit');

    let job_no = document.querySelector('#job_no').value;
    let cyc_no = document.querySelector('#cyc_no').value;

    hiddenInput.value = job_no + cyc_no;

    submitButton.addEventListener('click', function() {
        form.submit();
    });
</script>
05 Sep
2 weeks ago

Sergiu17 left a reply on Create A Search With Categories

// route where you'll send the request for search
Route::get('/users/search', '[email protected]');

// localhost:8080/users/search?q=John
public function index(Request $request) {
    $q = $request->input('q');

    $categories = App\Category::whereHas('users', function ($query) {
        $query->where('username', 'like',  $q . '%');
    })->get();

    return $categories;
}

And probably request to search endpoint is done via AJAX,

// here's a little bit of Vue
<select>
    <optgroup v-for="category in categories" :label="category.name">
        <option v-for="user in category.users">{{ user.name }}</option>
    </optgroup>
</select>

this is very basic example, hope it helps

03 Sep
2 weeks ago

Sergiu17 left a reply on How Can I Avoid To Stop Writting Script In Ckeditor ?

@siangboon and if someone inserts some javascript, you display html content in the 'right way' and the web site starts behave differently?

Sergiu17 left a reply on How Can I Avoid To Stop Writting Script In Ckeditor ?

use preg_replace to replace script tag with empty string ( '' )

02 Sep
2 weeks ago

Sergiu17 left a reply on Laravel 5.1 Doc Missing?

There's max-height: 28em, but the list is quite long of sub-menu

.sidebar_layout .sidebar nav .navigation_contain ul li.sub--on ul if you increase the max-height, you will see

30 Aug
3 weeks ago

Sergiu17 left a reply on How To Save Current Date As Unix Timestamps In Postgres?

@alexanderkim well, the DATE type stores only DATE without time, you need to change your column data type in order to store the hours, minutes and seconds.

In MYSQL would be: from DATE type, to DATETIME type

Sergiu17 left a reply on How To Save Current Date As Unix Timestamps In Postgres?

What is the type of the column in your database?

Sergiu17 left a reply on How To Pass Variable From Register Controller

// won't work
Route::get('register', [ 'as' => 'register', 'uses' => '[email protected]']);

// works
Route::get('register', [ 'as' => 'register', 'uses' => 'Auth\[email protected]']);
// or
use App\Http\Controllers\Auth\RegisterController;

Route::get('register', [ 'as' => 'register', 'uses' => RegisterController::class . '@showRegisterForm']);
27 Aug
3 weeks ago

Sergiu17 left a reply on Issue With Isset And If Statements In Blade File

Dose @forelse work?

if not,

@if(isset($zipreturns))

@elseif

@endif

Sergiu17 left a reply on PhpStorm "Method 'xyz' Not Found In \Facades\...

@zyxxyzyxz two different things.

// 1
$project = ProjectFactory::create();

// 2
$project = new ProjectFactory();
$project->create();
26 Aug
3 weeks ago

Sergiu17 left a reply on PhpStorm "Method 'xyz' Not Found In \Facades\...

This file is not create because of annotation, is created because of Facade Prefix

Take a look here, every single file has annotations - https://github.com/laravel/framework/tree/5.8/src/Illuminate/Support/Facades

// an alternative
use Tests\Setup\ProjectFactory;

$project = (new ProjectFactory())->ownedBy($user)->create(); 
// you could instantiate the class and use it

Sergiu17 left a reply on PhpStorm "Method 'xyz' Not Found In \Facades\...

@zyxxyzyxz Does my first reply solve your problem?

Sergiu17 left a reply on PhpStorm "Method 'xyz' Not Found In \Facades\...

First of all, you can turn off inspection in PHPStorm.

But, here's a little bit of magic in Laravel, this class - https://github.com/laracasts/birdboard/blob/master/tests/Setup/ProjectFactory.php

ProjectFactory with namespace Tests\Setup

in your code you can prefix the class import with Facade - and use it exactly like a Facade

use Facade\Tests\Setup\ProjectFactory; // now ProjectFactory is a Facade ( Laravel converts it )

ProjectFactory::ownedBy(); // access methods statically

Hope you'll understand what I explained.

Sergiu17 left a reply on Axios Dosent Redirect.

This is not how it works, in your case, you can't say return redirect('/') ( with PHP ) and except to redirect.

axios.post('url', {})
.then(response => {
    // here your redirect should happen, with JavaScript, not PHP
    window.location.replace = 'domain.dev/home';
})
.catch(error => {});

And if you send an AJAX Request, your controller should return a JSON Response, not redirects.

Sergiu17 left a reply on PhpStorm "Method 'xyz' Not Found In \Facades\...

Easiest way would be to add an annotation

...

/**
 * @method static ownedBy()
 */
class ProjectFactory
{

...

Sergiu17 left a reply on Folder/File Permission Issue On Mac

If you are on localhost, just give 777 or 775 permissions

cd root-project
sudo chmod -R 777 .

Sergiu17 left a reply on How To Add Alert Box When Time Rich Zero In This Script

if( seconds > 0 ) {
    setTimeout(tick, 1000);
} else {
    // here ?
    alert();
}

Sergiu17 left a reply on Can Not Run Php Artisan

@trandung https://i.imgur.com/wvsySU4.png

And note that the code is in app.php file from config folder, in your case, could be in any other file, not necessary in app.php ( could be in any php file from config folder )

Sergiu17 left a reply on Can Not Run Php Artisan

@trandung do you have any url() in your config files?

25 Aug
4 weeks ago

Sergiu17 left a reply on Help With Course Structure?

If you visit any of following pages

series are sorted in a proper order, from basic to advanced, so, in your case - https://laracasts.com/series/object-oriented-bootcamp-in-php this is your next step

23 Aug
4 weeks ago

Sergiu17 left a reply on PHP Unit Testing

Would be nice to show us your test

Sergiu17 left a reply on Trying To Get Property Id Of Non Object

if(Auth::getUser() && Auth::getUser()->id == $slug ) {

}

Like so

Sergiu17 left a reply on Migration Solution From Codeigniter To Laravel

Hi, I don't think so. All you can do is to connect with Laravel to the same database and start working, step by step.

20 Aug
1 month ago

Sergiu17 left a reply on How To Sync Attributes In A Specific Order ?

If you really want to do this, you may do something like this:

foreach(attributes as $attribute) {
     $product->attributes()->attach($attribute);
}

Hope it works and helps you)

18 Aug
1 month ago

Sergiu17 left a reply on How To Implement Restaurant Owner Registration

Give more details if you want someone to help you.

Which restaurant? What's your structure of the tables? Models?

If you have everything in place

public function update(Restaurant $restaurant) {
    if ($restaurant->user_id !== auth()->id()) {
        return 'Can not update!';
    }
}

Sergiu17 left a reply on Accessing Property Two Models Deep In View

Do a little bit of debug

// step 1
{{ dd($ticket) }}

// step 2
{{ dd($ticket->asset) }}

// step 3 
{{ dd($ticket->asset->account) }}

Sergiu17 left a reply on Will I Be Charged Monthly?

You can do it right now, the subscription will be active till the end of the paid month

Sergiu17 left a reply on Will I Be Charged Monthly?

It takes automatically. You need to cancel your subscription and activate it whenever you want

Sergiu17 left a reply on How To Redirect User Different Page

Do you use the same method (code / controller) to log in?

12 Aug
1 month ago

Sergiu17 left a reply on Prevent Specific Migration During Test

You could add an if statement in your migrations, until you find better solution

    public function up()
    {
        if(app()->environment('testing')) { return; }

    // code
    }


    public function down()
    {
        if(app()->environment('testing')) { return; }
    
    // code
    }
07 Aug
1 month ago

Sergiu17 left a reply on Passing Variable Inside Function

'featuredProducts' => function($p) use ($sortby) {
    $p->orderBy('prd_id', $sortby);
},

add use ($sortby)