Sergiu17

Sergiu17

Member Since 1 Year Ago

Chisinau

Experience Points 266,710
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 1408
Lessons
Completed
Best Reply Awards 190
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.

19 May
14 hours ago

Sergiu17 left a reply on Organize By Creation

@ZFDEVELOPER - you could add simple orderBy

User::orderBy('created_at', 'desc')->get();

Sergiu17 left a reply on Organize By Creation

@ZFDEVELOPER - How do you grab users from database?

Sergiu17 left a reply on Organize By Creation

What goes to the last in the listing?

Sergiu17 left a reply on How To Add Variable Into Mailable's Build() Function?

You could do this in constructor

class TranslationTask extends Mailable
{
    private $name;

    public function __construct(Task $task)
    {
        $this->name = 'What ever you want';
    }

    public function build()
    {
        return $this->markdown('emails.translation')
                                     ->subject($this->name);
    }

or I'm missing something?

17 May
2 days ago

Sergiu17 left a reply on How To Create Two Columns With @foreach?

@IRANKHOSRAVI - Read documentation, learn the basics....

dd($services);
dd($services->first()); // this is an array...

@foreach($services as $row)
    dd($row)
@endforeach

This is called debug................

16 May
3 days ago

Sergiu17 left a reply on Save File With Original Extension

$ext = $image->getClientOriginalExtension(); // method returns extension.

Instead of .png, use . $ext

14 May
5 days ago

Sergiu17 left a reply on PHPUnit MySQL In Memory Test With Point And Polygon Column

@PONCETHELION - and the packages supports only Laravel 5.5 and lower versions

Sergiu17 left a reply on PHPUnit MySQL In Memory Test With Point And Polygon Column

https://github.com/grimzy/laravel-mysql-spatial

For Laravel versions prior to 5.5, you can use the Blueprint provided by this package (Grimzy\LaravelMysqlSpatial\Schema\Blueprint):

For Laravel < 5.5

13 May
6 days ago

Sergiu17 left a reply on Where I Can Save Array For Blade?

@VIG - if it's really alphabet, then you don't need to store it

@foreach(range('a', 'z') as $let)
    {{ $let }}
@endforeach

Sergiu17 left a reply on How To Pass Id Into Middleware In Laravel

@VAN1310 - read log, storage/logs/curent-date.log

Sergiu17 left a reply on How To Pass Id Into Middleware In Laravel

@VAN1310 - could you add one more if condition?

Sergiu17 left a reply on How To Pass Id Into Middleware In Laravel

@VAN1310 - ok,

if ( user is logged in && signed in user has verified account ) {
    redirect to login page
}

Why redirect authenticated user to login page?

Sergiu17 left a reply on How To Pass Id Into Middleware In Laravel

@VAN1310 - read this

if(\Auth::check() && \Auth::signup()->verify())
{            
                return \Redirect::route('login'); 
}

Sergiu17 left a reply on How To Pass Id Into Middleware In Laravel

@VAN1310 - OK, delete 3rd parameter from your handle function, and it will work,

return \Redirect::route('otp.view', auth()->id); // auth()->id, instead if $id

Sergiu17 left a reply on How To Pass Id Into Middleware In Laravel

@VAN1310 - There already are auth and verify middlewares :)

10 May
1 week ago

Sergiu17 left a reply on Not Working Show Function In Laravel 5.7

@MSOFT - This is other route, the problem is the link to show method

// this is in the for loop somthere
<a href="{{ url('studentcourcedata', ['id' => $id]) }}">Student Course</a>
  1. Update de route as I said
Route::get('studentcourcedata/{id}','[email protected]')->name('studentcourcedata');
  1. Search in your project for {{ url('studentcourcedata') }}

  2. Update it, by passing the ID, {{ url('studentcourcedata', ['id' => $id]) }}

Sergiu17 left a reply on Not Working Show Function In Laravel 5.7

you need to pass $id to url

  <form action="{{url('studentcourceform', ['id' => $id])}}" method="post">

something like this

Sergiu17 left a reply on Not Working Show Function In Laravel 5.7

// error
Route::get('studentcourcedata','[email protected]')->name('studentcourcedata');
// fix
Route::get('studentcourcedata/{id}','[email protected]')->name('studentcourcedata');

because
class StudentcourceController extends Controller
{
    public function show($id // <---------- this function waits an parameter 
}

Sergiu17 left a reply on Web Hosting

Take a look at Vimeo

09 May
1 week ago

Sergiu17 left a reply on Search Function MYSQL

@WUSCHELINO22 - What is your model name? Categorie or Category?

Sergiu17 left a reply on Search Function MYSQL

@WUSCHELINO22 - You need to import the class, I just told you to read the documentation :D

<?php

namespace App\Providers;

use Illuminate\Support\Facades\View; // THIS IS WHAT YOU NEED
use App\Category;

class AppServiceProvider extends ServiceProvider
{
    /**
     * Register any application services.
     *
     * @return void
     */
    public function register()
    {
        //
    }

    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {
        View::share('categories', Category::all());
    }
}

Sergiu17 left a reply on Search Function MYSQL

@WUSCHELINO22 - In Accordion section

<!-- Accordion  -->
<div class="accordion" id="accordionExample">
@foreach ($categories as $categorie)

<div class="card">
    <div class="card-header" id="headingSix">
      <h2 class="mb-0">
        <button class="btn btn-link collapsed" type="button" data-toggle="collapse" data-target="#collapse{{$categorie->id}}" aria-expanded="false" aria-controls="collapse{{$categorie->id}}" style="color: black">
        {{ $categorie->name}}
        </button>
      </h2>
    </div>
    <div id="collapse{{$categorie->id}}" class="collapse" aria-labelledby="heading{{$categorie->id}}" data-parent="#accordionExample">
      <div class="card-body">

    <!-- Einf├╝gen der Daten in die Tabelle nach Kategorie ID -->
      @foreach($shares->where('categorie_id', $categorie->id) as $share)
      <a href='{{ $share->urls }}' style="color: black">{{ $share->name }}</a><br>
      @endforeach
      </div> 
    </div>
</div>       
        @endforeach
</div>

Here is the problem, you try to access $categories variable, but it's not available, because in the controller you return only shares

return view('index', compact('shares'));

If $categories is used in index.php (this means that is used in every view template)

So, you need somehow to share $categories all the time to index.php

Open app/Providers/AppServiceProvider.php in the boot method

    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {
        View::share('categories', Category::all());
    }

Something like this.

Here is the documentation -

https://laravel.com/docs/5.8/views#passing-data-to-views

https://laravel.com/docs/5.8/views#view-composers

Read it!

Sergiu17 left a reply on Search Function MYSQL

Error is quite clear.

In resources\views\index.blade.php you use -$categories variable..and because, you don't pass this variable to the view - it is undefined.

You may consider view composers https://laravel.com/docs/5.8/views#view-composers

Sergiu17 left a reply on Display 4 Or More Different Tables In One View Page

One controller is fine.

public function report()
{
    $set1 = Model::all();
    $set2 = Model2::all();
    // ....

    return view('report', compact('set1', 'set2', '...');
}
08 May
1 week ago

Sergiu17 left a reply on Sending Mail With Attachments In Laravel 5.7

@LARAVELYV - this may help you - https://medium.com/@hfally/how-to-make-multiple-attachments-to-mail-in-laravel-5-6-34b227ba3be1

You can't use implode() to send all files together, you need to loop over each file.

reformat your code.. with ``` (backticks) before and after code

``` // CODE HERE ```

Sergiu17 left a reply on "Call To A Member Function HasFile() On Null"

Input::hasFile('myfile')

try this

07 May
1 week ago

Sergiu17 left a reply on Display Data Which Are Inserted A Today /daily Basis

Expenses::where('created_at', Carbon::today())->get();

Like so?

04 May
2 weeks ago

Sergiu17 left a reply on Using Admin Middleware In Some Only Resource Routing

Easiest way is to add middleware in constructor of the class

class RaccolteController extends Controller {
    
    public function __construct() {
        $this->middleware('admin')->only(['store', 'create']);
    }
}
03 May
2 weeks ago

Sergiu17 left a reply on Referencing All Models At Once In A Controller?

You could use

use App\Http\Models{
    CarModel,
    UserModel,
    PostModel,
    . . .
}

Is this practical ?

Never did this before, and never heard about. Importing everything - means your controller is doing too much

Are there any performance issues ?

use - is like Symbolic Link, like References works. Imagine creating a shortcut of your application to your desktop. So, not big deal importing them

02 May
2 weeks ago

Sergiu17 left a reply on Call To Undefined Relationship [videolikes] On Model [App\Videopost].

likesVideo
videolikes

two different things

01 May
2 weeks ago

Sergiu17 left a reply on The Right Way Formatimg The JS Code

Hi, this article may help you - https://wesbos.com/template-strings-html/

Use Template String

30 Apr
2 weeks ago

Sergiu17 left a reply on Call To A Member Function GetClientOriginalExtension() On Null

@VAN1310 - First, mark resume filed as nullable in your migration.

$registration = new Registration();
$registration->date_registration = $request->get('date_registration');
$registration->status = 'Recently added';

if (request()->has('resume')) {

    $files=Input::file('resume');
    $picName=str_random(30) . '.' . $files->getClientOriginalExtension();
    $files->move(base_path() . '/public/resume/',$picName);

    $registration->resume = base_path() . '/public/resume/'. $picName;
}

$registration->save();

Sergiu17 left a reply on Call To A Member Function GetClientOriginalExtension() On Null

if ( request()->has('resume')) {

    $files=Input::file('resume');
    $picName=str_random(30) . '.' . $files->getClientOriginalExtension();
    $files->move(base_path() . '/public/resume/',$picName);
    $registration=new Registration(array(            
        'resume'=>base_path() . '/public/resume/'. $picName,
        'date_registration'=>$request->get('date_registration'),
        'status'=>'Recently Added',
    ));
    $registration->save();
}

Sergiu17 left a reply on How To Get Current Url In Laravel?

request()->path();
29 Apr
2 weeks ago

Sergiu17 left a reply on Multiple Logins

It's not about logins, it's about permissions.

https://github.com/spatie/laravel-permission - try this cool package

Sergiu17 left a reply on Mail File Attachment In Laravel

@VAN1310 - accidentally I've put a comma after '/public/email/'

there should be a dot

'attach' => base_path() . '/public/email/' . $picName

Sergiu17 left a reply on Mail File Attachment In Laravel

$email=new Email([
    'email'=>$request->get('email'),
    'subject'=>$request->get('subject'),
    'message'=>$request->get('message'),
    'attach'=>base_path() . '/public/email/', $picName,     
]);

Sergiu17 left a reply on Mail File Attachment In Laravel

Give the full path to the file, not just the name.

'attach' => base_path() . '/public/email/', $picName;
28 Apr
3 weeks ago

Sergiu17 left a reply on Same Page

Is your /login route under guest middlewre?

Sergiu17 left a reply on Register Invokable Route With ::class

Route::get('start-analysis', [ 'uses' => StartAnalysis::class]);

Sergiu17 left a reply on Register Invokable Route With ::class

Hi, https://laravel.com/docs/5.8/controllers#basic-controllers

Route::get('user/{id}', 'ShowProfile');

class ShowProfile extends Controller
{
    /**
     * Show the profile for the given user.
     *
     * @param  int  $id
     * @return View
     */
    public function __invoke($id)
    {
        return view('user.profile', ['user' => User::findOrFail($id)]);
    }
}
php artisan make:controller ShowProfile --invokable
`