PaulCatalin97

PaulCatalin97

Member Since 6 Days Ago

Experience Points 640
Experience Level 1

4,360 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 0
Lessons
Completed
Best Reply Awards 0
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.

18 May
1 day ago

PaulCatalin97 started a new conversation Laravel 5.8 Delete/destroy Id From Database

how can be done? i can`t find any solution on documentation.

this is the controller

public function destroy ($id)
    {
        Joburi::destroy($id);
        return redirect()->route('listajoburi.update');
    }

this is the button

<a href="{{route('listajoburi.destroy',$row['id'])}}" class="btn btn-danger">Delete</a>
                            <form method="post" class="delete_form" action="{{route('listajoburi.destroy',$row['id'])}}">
                                @method('DESTROY')
                                <input type="hidden" name="_token" value="@csrf">
                            </form>

and this is the route

Route::post('/listajoburi/{id}/', 'Auth\[email protected]')->name('listajoburi.destroy');

PaulCatalin97 left a reply on How To Update And Edit A Image In Laravel 5.8

routes

Route::get('/imageupload', 'Auth\[email protected]')->name('imageupload');
Route::post('/imageuploadupdate', 'Auth\[email protected]')->name('imageupload.update');

PaulCatalin97 left a reply on How To Update And Edit A Image In Laravel 5.8

this worked for me

class ImageUploadController extends Controller
{
    public function __construct()
    {
        $this->middleware('auth');
    }
    public function index()
    {
        $profileimage = ProfileEmployee::where('uid', Auth::user()->id)->first();
        return view('imageupload', compact('profileimage'));
    }

    public function update(Request $request)
    {
        $request->validate([
            'image' => 'image|mimes:jpeg,png,jpg|max:2048'
        ]);
        $employee = ProfileEmployee::where('uid', Auth::user()->id)->first();

        if ($request->hasfile('image')){
            $file = $request->file('image');
            $extension = $file->getClientOriginalExtension();
            $filename = md5(time()).'.'.$extension;
            $file->move(public_path().'\imagineprofil',$filename);
            $employee->image=$filename;
        } else {
            return $request;
            $employee->image='';
        }

        if($employee->save()){
            return redirect()->route('imageupload')->withSuccess('S-a incarcat cu success!');
        }else{
            return redirect()->route('imageupload')->withDanger('Nu s-a incarcat! A aparut o eroare.');
        }
    }

}

PaulCatalin97 started a new conversation Missing Required Parameters For [Route: Listajoburi.update] [URI: Listajoburiupdate{id}].

i`m new to laravel, why do i get this error ? i have passed the parameters.

this is the blade file

 <form action="{{route('listajoburi.update', $id)}}" method="post" enctype="multipart/form-data">
                @csrf
                <div class="box-body">
                    <div class="form-group">
                        <label for="exampleInputEmail1">Nume Job</label>
                        <input type="text" class="form-control" id="titlu" name="titlu" value="{{$joburi->titlu}}"/>
                    </div>
                    <div class="form-group">
                        <label for="exampleInputPassword1">Descriere:</label>
                        <input type="text" class="form-control" id="descriere" name="descriere" value="{{$joburi->descriere}}"/>
                    </div>
                    <div class="form-group">
                        <label for="exampleInputPassword1">Salariu Estimativ:</label>
                        <input type="text" class="form-control" id="salariu_estimativ" name="salariu_estimativ" value="{{$joburi->salariu_estimativ}}"/>
                    </div>
                    <div class="form-group">
                        <label for="exampleInputPassword1">Oras:</label>
                        <input type="text" class="form-control" id="oras" name="oras" value="{{$joburi->oras}}"/>
                    </div>
                    <div class="form-group">
                        <label for="exampleInputPassword1">Activ(1=activ,0=inactiv)</label>
                        <input type="text" class="form-control" id="activ" name="ativ" value="{{$joburi->activ}}">
                    </div>

this is the controller

public function index()
    {
        $joburi = Joburi::all()->toArray();
        return view('listajoburi', compact('joburi'));
    }

    public function edit($id)
    {
        $joburi = Joburi::find($id);
        return view('editarejob', compact('joburi', 'id'));
    }

    public function update(Request $request, $id)
    {
        $this->validator($request->all());

        $update = Joburi::find($id)->update([
            'titlu' => $request->titlu,
            'descriere' => $request->descriere,
            'salariu_estimativ' => $request->salariu_estimativ,
            'oras' => $request->oras,
            'activ' => $request->activ,
            //  'skill' => $request->city,
        ]);

        if ($update) {
            return redirect()->route('listajoburi.update')->withSuccess('S-a modificat cu success!');
        } else {
            return redirect()->back()->withDanger('Nu s-a modificat! A aparut o eroare.');
        }
    }

    protected function validator(array $data)
    {
        return Validator::make($data, [
            'titlu' => ['required', 'string', 'min:3', 'max:255'],
            'descriere' => ['required', 'string', 'max:11'],
            'salariu_estimativ' => ['required', ''],
            'oras' => ['string', 'max:512'],
            'activ' => ['required', 'string', 'max:512'],
            // 'skill' => ['string', 'max:45'],
        ]);

    }
}

and this is the route

Route::get('/listajoburi', 'Auth\[email protected]')->name('listajoburi');
Route::get('/editarejob/{id}/', 'Auth\[email protected]')->name('editarejob');
Route::post('/listajoburiupdate{id}/', 'Auth\[email protected]')->name('listajoburi.update');

15 May
4 days ago

PaulCatalin97 left a reply on Undefined Index

@TISUCHI - solved it, in the validation was the problem, de index was defined 'id_skill' and we tried to fill it the skill field

PaulCatalin97 left a reply on Undefined Index

@TISUCHI - same error...

PaulCatalin97 left a reply on Undefined Index

@TISUCHI - Undefined index: skills for this line->> $skills = $data['skills'];

@kima , both of them are id_skill, thx

PaulCatalin97 left a reply on Undefined Index

@TISUCHI - i updated with the full controller right now

PaulCatalin97 left a reply on Undefined Index

@TISUCHI - still the same error with your code

PaulCatalin97 left a reply on Undefined Index

@TISUCHI - and i have to change it in the create as skills[] ?

PaulCatalin97 started a new conversation Undefined Index

i`m trying to insert some data in model and i get this error

this is my form for this specific column

 <div class="dropdown-field">
                                    <select data-placeholder="Selecteaza Specializare" class="chosen" id="skills" name="skills" multiple="multiple">
                                        @foreach($skills as $skill)
                                            <option value="{{$skill->id}}" >{{strtoupper($skill->name)}}</option>
                                        @endforeach
                                    </select>
                                    <div class="box-footer">

and this is the controller

 public function store(Request $request)
    {
        $data = $request->validate([
            'titlu' => 'required|string|max:255',
            'descriere' => 'required|string|max:255',
            'salariu_estimativ' => 'required|string|max:255',
            'oras'=> 'required',
            'id_skill'=>'',

        ]);

        Joburi::create([
            'titlu' => $data['titlu'],
            'descriere' => $data['descriere'],
            'salariu_estimativ' => $data['salariu_estimativ'],
            'oras' => $data['oras'],
            'is_skill'=>$data['skills'],
        ]);
        if($data){
            return redirect()->route('adaugajob')->withSuccess('S-a incarcat cu success!');
        }else{
            return redirect()->route('adaugajob')->withDanger('Nu s-a incarcat! A aparut o eroare.');
        }
        }
    }

PaulCatalin97 left a reply on No Message Error

@NAKOV - i change it but i get the same message

PaulCatalin97 left a reply on No Message Error

@JHUMANJ - i do not know how to do that

PaulCatalin97 started a new conversation No Message Error

I really dont understand why, my route is post, method for form is post, why im getting this error ?

this is my route

Route::post('/adaugajob', 'Auth\[email protected]')->name('adaugajob');

This is my form

 <form action="{{route('adaugajob')}}" method="POST" enctype="multipart/form-data">
                            @csrf
                            <div class="box-body">
                                <div class="form-group">
                                    <label >Titlu Job:</label>
                                    <input type="text" class="form-control" id="titlu" name="titlu"/>
                                </div>
                                <div class="form-group">
                                    <label >Descriere:</label>
                                    <input type="text" class="form-control" id="descriere" name="descriere"/>
                                </div>
                                <div class="form-group">
                                    <label >Salariu Estimativ:</label>
                                    <input type="text" class="form-control" id="salariu_estimativ" name="salariu_estimativ" />
                                </div>
                                <div class="form-group">
                                    <label >Oras:</label>
                                    <input type="text" class="form-control" id="oras" name="oras" />
                                </div>
                                <div class="form-group">
                                    <label >Activ:</label>
                                    <input type="hidden" class="form-control" id="activ" name="activ" value="0">
                                </div>
                                <div class="dropdown-field">
                                    <select data-placeholder="Selecteaza Specializare" class="chosen" id="multiselect" name="skills[]" multiple="multiple">
                                        @foreach($skills as $skill)
                                            <option value="{{$skill->id}}" >{{strtoupper($skill->name)}}</option>
                                        @endforeach
                                    </select>
                                    <div class="box-footer">
                                        <button type="submit" class="btn btn-primary">Adauga</button>
                                    </div>
                                </div>
                            </div>
                        </form>

And This is my Controller for this form

class AdaugaJobController extends Controller
{

    public function __construct()
    {
        $this->middleware('auth');
    }

    public function index()
    {
        $skills = SkillsEmployee::all();
        return view('adaugajob', compact('skills'));
    }

    protected function validator(array $data)
    {

        if ($data) {
            return Validator::make($data, [
                'titlu' => ['required', 'string', 'max:255'],
                'descriere' => ['required', 'string', 'max:255'],
                'salariu_estimativ' => ['required', 'string', 'max:255'],
                'oras' => ['required', ''],
            ]);
        }
    }

    protected function create( \Illuminate\Http\Request $request)
    {
        $data = $request->all();
        if ($data) {
            Joburi::create([
                'titlu' => $data['titlu'],
                'descriere' => $data['descriere'],
                'salariu_estimativ' => $data['salariu_estimativ'],
                'oras' => $data['oras'],
            ]);
            foreach ($data['skills'] as $skill) {
                Joburi::create([
                    'id_skill' => $skill,
                ]);
            }
        }

    }
}

I want to insert the data from the form in a model. the model has the names of the fields in the form. nothing seems wrong. when it used to work it didn`t insert nothing, but now i get this NO MESSAGE error

PaulCatalin97 started a new conversation Symfony \ Component \ HttpKernel \ Exception \ MethodNotAllowedHttpException No Message Why?

I really dont understand why, my route is post, method for form is post, why im getting this error ?

this is my route

Route::post('/adaugajob', 'Auth\[email protected]')->name('adaugajob');

This is my form

 <form action="{{route('adaugajob')}}" method="POST" enctype="multipart/form-data">
                            @csrf
                            <div class="box-body">
                                <div class="form-group">
                                    <label >Titlu Job:</label>
                                    <input type="text" class="form-control" id="titlu" name="titlu"/>
                                </div>
                                <div class="form-group">
                                    <label >Descriere:</label>
                                    <input type="text" class="form-control" id="descriere" name="descriere"/>
                                </div>
                                <div class="form-group">
                                    <label >Salariu Estimativ:</label>
                                    <input type="text" class="form-control" id="salariu_estimativ" name="salariu_estimativ" />
                                </div>
                                <div class="form-group">
                                    <label >Oras:</label>
                                    <input type="text" class="form-control" id="oras" name="oras" />
                                </div>
                                <div class="form-group">
                                    <label >Activ:</label>
                                    <input type="hidden" class="form-control" id="activ" name="activ" value="0">
                                </div>
                                <div class="dropdown-field">
                                    <select data-placeholder="Selecteaza Specializare" class="chosen" id="multiselect" name="skills[]" multiple="multiple">
                                        @foreach($skills as $skill)
                                            <option value="{{$skill->id}}" >{{strtoupper($skill->name)}}</option>
                                        @endforeach
                                    </select>
                                    <div class="box-footer">
                                        <button type="submit" class="btn btn-primary">Adauga</button>
                                    </div>
                                </div>
                            </div>
                        </form>

And This is my Controller for this form

class AdaugaJobController extends Controller
{

    public function __construct()
    {
        $this->middleware('auth');
    }

    public function index()
    {
        $skills = SkillsEmployee::all();
        return view('adaugajob', compact('skills'));
    }

    protected function validator(array $data)
    {

        if ($data) {
            return Validator::make($data, [
                'titlu' => ['required', 'string', 'max:255'],
                'descriere' => ['required', 'string', 'max:255'],
                'salariu_estimativ' => ['required', 'string', 'max:255'],
                'oras' => ['required', ''],
            ]);
        }
    }

    protected function create( \Illuminate\Http\Request $request)
    {
        $data = $request->all();
        if ($data) {
            Joburi::create([
                'titlu' => $data['titlu'],
                'descriere' => $data['descriere'],
                'salariu_estimativ' => $data['salariu_estimativ'],
                'oras' => $data['oras'],
            ]);
            foreach ($data['skills'] as $skill) {
                Joburi::create([
                    'id_skill' => $skill,
                ]);
            }
        }

    }
}

I want to insert the data from the form in a model. the model has the names of the fields in the form. nothing seems wrong. when it used to work it didn`t insert nothing, but now i get this NO MESSAGE error

12 May
1 week ago

PaulCatalin97 left a reply on Uploading A File Error

@TRAY2 - Know that, was jus testing. I edited like that $file->move(public_path().'\cv',$filename);

PaulCatalin97 started a new conversation Uploading A File Error

So, I try to upload a file and shows me this error ! {"_token":"xBDlGKupDvKE3FPI84Eku5Kd6I6l5pKlRHs9LzCk","image":{}} what can i do to solve this ?

class UploadCvController extends Controller
{
    public function __construct()
    {
        $this->middleware('auth');
    }
    public function index()
    {
        $profilecv = ProfileEmployee::where('uid', Auth::user()->id)->first();
        return view('uploadcv', compact('profilecv'));
    }

    public function update(Request $request)
    {
        $request->validate([
            'cv' => 'file', 'max:2048',
        ]);
        dd($request);
        $employeecv = ProfileEmployee::where('uid', Auth::user()->id)->first();

        if ($request->hasfile('cv')){
            $file = $request->file('cv');
            $extension = $file->getClientOriginalName();
            $filename = md5(time()).'.'.$extension;
            $file->move('C:\xampp\htdocs\apcjobs\public\cv',$filename);
            $employeecv->cv=$filename;
        } else {
            return $request;
            $employee->cv='';
        }
        $employeecv->save();

        if($employeecv){
            return redirect()->route('uploadcv')->withSuccess('S-a incarcat cu success!');
        }else{
            return redirect()->back()->withDanger('Nu s-a incarcat! A aparut o eroare.');
        }
    }

}

How can I convert the file or what can i do ? I dd($request) and says that i receive an image, but I upload a word.docx

PaulCatalin97 left a reply on How To Show Image In View When Upload?

@NEVEN - my directory is /imagineprofil. can you please show me the code for it ?

PaulCatalin97 left a reply on How To Show Image In View When Upload?

my directory is /imagineprofil. can you please show me the code for it ?

PaulCatalin97 started a new conversation How To Show Image In View When Upload?

this is my session

 $employer->save();

        if($employer){
            return redirect()->route('imageuploademployer')->withSuccess('S-a incarcat cu success!');
        }else{
            return redirect()->back()->withDanger('Nu s-a incarcat! A aparut o eroare.');

and here i want to display image from directory

 @if(session()->has('success'))
                    <div class="alert alert-success">
                        {{ session('success')}}
                    </div>
                    <div class="img2">
                        <img src="{{$employerimage->image}}">
                    </div>
                @endif

PaulCatalin97 left a reply on How To Show Image In View When Upload?

this is my controller

 $employer->save();

        if($employer){
            return redirect()->route('imageuploademployer')->withSuccess('S-a incarcat cu success!');
        }else{
            return redirect()->back()->withDanger('Nu s-a incarcat! A aparut o eroare.');

PaulCatalin97 started a new conversation How To Show Image In View When Upload?

so, when I upload an image i want to show it after it went up. I use this code and shows me an error pic. How can I display the image in the view with and session message or something else?

    <section class="content">
        <div class="row">
            <div class="col-xs-12">
                <div class="box">
                    <div class="box-header">
                        <h3 class="box-title">Hover Data Table</h3>
                    </div><!-- /.box-header -->
                    <div class="box-body">
                        <div class="panel-heading"><h2>Aici puteti incarca o imagine pentru profilul dumneavoastra!</h2></div>
                        <div class="panel-body">
                        @if(session()->has('success'))
                            <div class="alert alert-success">
                                {{ session('success')}}
                            </div>
                            <img src="/imagineemployer/{{ Session::get('path') }}" width="300"/>
                        @endif
                        @if(session()->has('danger'))
                            <div class="alert alert-danger">
                                {{ session('danger')}}
                            </div>
                        @endif
                <form action="{{route('imageuploademployer.update')}}" method="POST" enctype="multipart/form-data">
                    @csrf
                    <div class="row">
                        <div class="col-md-6">
                            <input type="file" name="image" class="form-control" value="{{$employerimage->image}}">
                        </div>
                        <div class="col-md-6">

                            <button type="submit" class="btn btn-success">Upload</button>