belykia

belykia

Member Since 1 Year Ago

Experience Points 770
Experience Level 1

4,230 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 Jun
11 months ago

belykia started a new conversation 2 Sliders Depending On Each Others ?

Hello Everybody :

I have a problem with javascript , i would like to know how to manage 2 sliders , i mean 2 input with type="range" , everyone has 100 as a max value , as in the following html code :

 <input type="range" min="0" max="100" id="one">
  <input type="range" min="0" max="100" id="two">

i m going to explain with 3 examples , so i have 2 sliders ,1 and 2 , the first one has a max value 100 , and the second one 100. each slider depends on the other ,according to the html code the value of both sliders is 200 , but the value that the 2 sliders needs to reach is 100 , they have to stop moving in that point , otherwise if i want to come back to the 0 point i can do it .for examples :if the slider one is in the middle , it means that the slider2 has not to surpass the middle.an other example if the i move all the slider1 , the second one doesn't have to move , because the slider 1 reached the 100 value . if i move the slider1 until the value 70 , the second slider , i mean the slider2 needs to move until the value 30 , it's approximately ,one third of the position.

for me i took the value of the 2 sliders , then i used the following code , but , it blocked the sliders at all , and i couldn't move them to the 0 value :

          var      co2 = slider1+slider2;

  if(co2>=100){
         document.getElementById("one").disabled = true;
         document.getElementById("two").disabled = true;

                               co2=100
         }

23 May
1 year ago

belykia left a reply on Background-image Laravel

thank you very much guys

belykia started a new conversation Background-image Laravel

hello everybody : i tried background-image in laravel , it doesn't work , i created a new file(style.css) in the folder css , inside the public , then i created a new folder (image) , inside the public , when i put the image.jpg,inside the style.css i wrote :

body{
      background: url('image/image.jpg');
}

but anything didn t appear in the error.blade.php , where i wrote the following code :

<html lang="fr">
<head>
  <meta charset="utf-8">
  <title>Titre de la page</title>
  <link rel="stylesheet" href="css/style.css">
  <script src="script.js"></script>
</head>
<body>
  <h1>Error</h1></div>
</body>
</html>

So , what s the solution please ??

belykia started a new conversation Designed Button In Laravel 5.6 Language ?

Hello everybody , i tried to design the laravel button ,in 2 different ways , using the normal html code , <button class="btn btn-danger" type="submit"><i class="fas fa-trash-alt"> , it works , but the problem , i would like to use the other method,i can tell it's an emergenzy lol , with this kind of button ,{!! form::submit()!!} .i got the trash button from https://fontawesome.com/icons/trash-alt?style=solid .

22 May
1 year ago

belykia left a reply on From A File Blade To Another In The Same Folder ??

could send me the link @jlrdw please , thank you

belykia started a new conversation From A File Blade To Another In The Same Folder ??

Hello everybody : i created in the view folder a new folder (posts) , inside it i added 2 files "blade.php" .one of the files "create.blade.php"contains a form , the other one "index.blade.php" contains a button <a href="{{ route('post/create') }}" class="btn btn-primary btn-lg">ADD</a> ,in order to access to the other file within the button ADD , i added to the tag the href="{{ route('post/create') }} , but it doesn't work , i got an error , Route [post/create] not defined. (View: /var/www/html/php/projects/resources/views/posts/index.blade.php) ???

belykia left a reply on Allow Only The User To See His Edit And Delete ??

yes , i used the policies , but i have a small problem , i created php artisan make:policy PostPolicy --model=Post , then inside the update , i added :

public function update(User $user, Post $post)
    {
         return $user->id === $post->user_id;
    }

and in the controller file i added ManiController.php :

  public function update(Request $request, $id,Post $post)
    {
        $this->authorize('update', $post);
               $post=Post::findOrFail($id);
               $data=[
    'asnumber' => $request->input('asnumber'),
    'peeringrs' => $request->input('choices'),
    'peeringdb' => $request->input('peeringdb'),
    'asset' => $request->input('assets'),
    'contact' => $request->input('contacts'),
];
$post->update($data);
}

the problem , for all the users when i try to update the data i got the error :

   This action is unauthorized.

then when i changed the text inside PostPolicy to :

         return $user->id!== $post->user_id;

that give me the update for all users , again ??

belykia started a new conversation Allow Only The User To See His Edit And Delete ??

Hello everybody :

I m a beginner in Laravel , i made a form with 5 fields , that is related to a table posts , and i have a users table that's related to the login .the posts table is :

Schema::create('posts', function (Blueprint $table) {
            $table->increments('id');
            $table->string('asnumber');
            $table->string('peeringrs')->nullable();
            $table->string('peeringdb')->nullable();
            $table->string('asset')->nullable();
            $table->string('contact');
            $table->integer('user_id');
            $table->timestamps();
        });

the users table is :

Schema::create('users', function (Blueprint $table) {
            $table->increments('id');
            $table->string('name');
            $table->string('email')->unique();
            $table->string('password');
            $table->rememberToken();
            $table->timestamps();
        });

in order to leave only the user to see his edit i , i make the relation one to many , so in the Post.php model i wrote :

class Post extends Model
{
    protected $guarded = [];

        public function User(){
        return  $this->belongsTo('App\User');
        }
}

then in the User.php model i wrote :

{
    use Notifiable;

    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'name', 'email', 'password',
    ];

    /**
     * The attributes that should be hidden for arrays.
     *
     * @var array
     */
    protected $hidden = [
        'password', 'remember_token',
    ];
    public function Post(){
      return $this->hasMany('App\Post','id', 'user_id');
    }
}

eventually in the the controller PostController.php in order to give the id in the users table to the user_id in the posts table i added : `` `public function store(Request $request) { $request->validate([ 'ASNumber' => 'required|unique:posts|max:255', 'choice' => 'nullable|max:255', 'peeringDB' => 'nullable|max:255', 'asset' => 'nullable|max:255', 'Contact' => 'required|email', ]); $post_data = [ 'asnumber' => $request->input('ASNumber'), 'peeringrs' => $request->input('choice'), 'peeringdb' => $request->input('peeringDB'), 'asset' => $request->input('asset'), 'contact' => $request->input('Contact'), 'user_id'=> Auth::id(), ]; Post::create($post_data); Session::flash('success', 'Form succesfully saved!'); return redirect('save'); }

so what s should i do to show for each user only his contents, i mean to update only for his own contents .
21 May
1 year ago

belykia left a reply on Assign The Value Of Id In User Table To The User_id In Posts Table Automatically ??

i did the following code , who can help to finish it ??

public function store(Request $request) { $ASNumber = $request->input('ASNumber'); $choice=$request->input('choice'); $peeringDB=$request->input('peeringDB'); $ASSET =$request->input('asset'); $Contact=$request->input('Contact'); $id=Auth::user()->id; $post = new Post; $post_data = [ 'asnumber' => $ASNumber, 'peeringrs' => $choice, 'peeringdb' => $peeringDB, 'asset' => $ASSET, 'contact' => $Contact, 'user_id'=> $id, ]; $post->post()->create($post_data); Session::flash('success', 'Form succesfully saved!');}

belykia started a new conversation Assign The Value Of Id In User Table To The User_id In Posts Table Automatically ??

hello everybody : i want to make the relation between user_id in posts table and id in users table , giving the the user_id the value of id , directly with the logging (one to many) .

in the Post.php model i wrote : public function User(){ return $this->belongsTo('App\User'); } in the User.php model i wrote

public function Post(){ return $this->hasMany('App\Post','user_id', 'user_id'); };

then i have 2 migration tables : the users containt :

Schema::create('users', function (Blueprint $table) { $table->increments('id'); $table->string('name'); $table->string('email')->unique(); $table->string('password'); $table->rememberToken(); $table->timestamps();

then the posts containt :

$table->increments('id'); $table->string('asnumber'); $table->string('peeringrs')->nullable(); $table->string('peeringdb')->nullable(); $table->string('asset')->nullable(); $table->string('contact'); $table->integer('user_id'); $table->timestamps();

??

belykia started a new conversation Allow Only The User To See His CRUD Laravel 5.6??

Hello Everybody :

it's been a long time that i struggle to find the solution of the following question : previously , i created a form with 5 fields . then i showed the database related to the form in an other page , with eventual possibilities to delete or edit the form . but i want to show for every user his own buttons (edit,delete), i mean his own data that he added to the form . somebody , can tell me the different steps to follow , in order to get the solution ??

belykia left a reply on Why Error Message Even With Nullable Laravel 5.6 ?

thank you both of you guys @ rin4ik ,@crnkovic

belykia left a reply on Why Error Message Even With Nullable Laravel 5.6 ?

that s the migration , thank you for your answer :

Schema::create('posts', function (Blueprint $table) { $table->increments('id'); $table->string('asnumber'); $table->string('peeringrs'); $table->string('peeringdb'); $table->string('asset'); $table->string('contact'); $table->timestamps(); };

belykia started a new conversation Why Error Message Even With Nullable Laravel 5.6 ?

hello everybody :

i have 5 fields in a form that i created , but i got this error , even when i wrote 'nullable' in the controller for some fields that their not important to write : public function store(Request $request) { $ASNumber = $request->input('ASNumber'); $request->validate([ 'ASNumber' => 'required|unique:posts|max:255', 'choice' => 'nullable|max:255', 'peeringDB' => 'nullable|max:255', 'asset' => 'nullable|max:255', 'Contact' => 'required|email', ]); $choice=$request->input('choice'); $peeringDB=$request->input('peeringDB'); $ASSET =$request->input('asset'); $Contact=$request->input('Contact'); $post_data = [ 'asnumber' => $ASNumber, 'peeringrs' => $choice, 'peeringdb' => $peeringDB, 'asset' => $ASSET, 'contact' => $Contact ]; $post = new Post($post_data); $post->save();

Session::flash('success', 'Form succesfully saved!');
return redirect('save');

}

when i fill only the important fields , i got this error message :

SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'peeringdb' cannot be null (SQL: insert into posts (asnumber, peeringrs, peeringdb, asset, contact, updated_at, created_at) values (dfsadf, Yes, , , [email protected], 2018-05-21 15:43:00, 2018-05-21 15:43:00))

how is it possible ??

18 May
1 year ago

belykia started a new conversation Allow Edit If Article Belongs To User ?

Hello Everybody : I have done many times trying to get the solution to the following Discussion : i made a form with some fields , then i entered some data in it .in the page where i displayed it post.blade.php , i added an edit button ,it works, so i tried a lot of times to make the edit visible only to the login user that added his own data to the form , using this documentation :(https://laravel.com/docs/5.6/authorization),adding even onetomany between the user table and the form table that i made , somebody can explain me the different steps to make it ?

belykia left a reply on Call To A Member Function Update() On Array?? Laravel 5.6

You are the best @tykus , thank you very much

belykia left a reply on Call To A Member Function Update() On Array?? Laravel 5.6

thank you for your answer @tykus , but i don t know why , it doesn't work , i think because i changed the name variables in the second form , i mean the edit.blade.php one . i want to make it with an array , so i did this solution , and doesn t work either : public function update(Request $request, $id){ $post=Post::find($id);

             $ASNumber = $request->input('asnumber');
              $choice=$request->input('choices');
             $peeringDB=$request->input('peeringdb');
             $ASSET =$request->input('assets');
              $Contact=$request->input('Contacts');
               $post_data = [
    'asnumber' => $ASNumber,
    'peeringrs' => $choice,
    'peeringdb' => $peeringDB,
    'asset' => $ASSET,
    'contact' => $Contact
];
            $post->update($post_data );
            $post->save();
return redirect('save');}

belykia started a new conversation Call To A Member Function Update() On Array?? Laravel 5.6

Hello Everybody: I am getting this error "Call to a member function update() on array" and I have no idea why, is it because I am updating an array? I have check other resources similar to this but not much related to array so I am not sure what to do. Thank you in advance

Controller: $post=Post::find($id); $post=$request->all(); $ASNumber = $request->input('asnumber'); $choice=$request->input('choices'); $peeringDB=$request->input('peeringdb'); $ASSET =$request->input('assets'); $Contact=$request->input('Contacts'); $post_data = [ 'asnumber' => $ASNumber, 'peeringrs' => $choice, 'peeringdb' => $peeringDB, 'asset' => $ASSET, 'contact' => $Contact ]; $post->update($post_data); return redirect('save');

belykia started a new conversation Why An Undefined Variable Post ??

Hello Everybody : I m a begginer in laravel. I'm trying to update my records in my ManiController.php resource controller, however when I try to route to the controller I am getting thrown the following error: ErrorException (E_ERROR) Undefined variable: post (View: /var/www/html/php/blog/resources/views/edit.blade.php)

i created a tag " Edit" inside the save.blade.php . in order to use edit($id) the function in my ManiController.php resource controller: public function edit($id) { $post=Post::find($id); return view('edit',compact('posts')); }

then i created the function an edit.blade.php where i wrote the form , in order to update the id that i clicked with PUT method like that: public function update(Request $request, $id) {

{{ csrf_field() }} {{ method_field('PUT') }} //...the form

then in public function update(Request $request, $id){} , iwrote the update code with the $post function , but i got everytime the same error , waht s the solution please .

16 May
1 year ago

belykia started a new conversation Form Validation Only For Some Parameters ??

hello everybody :

i made a form with 5 inputs , the same one for the last question , i have 5 names parameters for every input,name="ASNumber",name="choice",name="peeringDB",name="asset",name="Contact". i tried to make the form validation only for 2 name parameters: ASNumber,Contact using the following functions in the controller files "postcontroller.php" :

$request->validate([ 'ASNumber' => 'required|unique:posts|max:255', 'contact' => 'required|email', ]);

and tried to print it in the same blade.php file "home.blade.php"using :

@if ($errors->any())

@endif

but the problem , the all fields are concerned ,i need the validation only for the 2 parameters , how can i do ??

belykia left a reply on Save( ) A POST <Form > Using An Array ? Laravel 5.6

i used the all methods that you showed me , in order to know more about "how to fill a database" . in the first method , i used to get an error , but i found the solution , i mean the one of @jcphpdev wrote , that's the good solution ,

$ASNumber = $request->input('ASNumber'); $choice=$request->input('choice'); $peeringDB=$request->input('peeringDB'); $ASSET =$request->input('asset'); $Contact=$request->input('Contact');

$post_data = [
    'asnumber' => $ASNumber,
    'peeringrs' => $choice,
    'peeringdb' => $peeringDB,
    'asset' => $ASSET,
    'contact' => $Contact
]; 
$post = new Post($post_data); 

$post->save(); redirect()->route('home'); echo 'success';

i changed the AS-SET by asset , as @Cronix said . i thank you all guys , especially ,@Cronix ,and @jlrdw

belykia left a reply on Save( ) A POST <Form > Using An Array ? Laravel 5.6

thank you for all your helps , i resolved the problem with the cronix idea . i will even try the other solutions , and i will reply to you guys .

15 May
1 year ago

belykia started a new conversation Save( ) A POST <Form > Using An Array ? Laravel 5.6

Hello Everybody :

i m a beginner in laravel .

trying to solve the problem i used this link , but it doesn't help :(https://laravel.com/docs/5.1/quickstart) , i went back until the title "Creating The Task" .

i created a of 5 inputs ,in home.blade.php each one is a string :

AS Number peeringRS Yes No peeringDB AS-SET Contact

next step in the web.php , i wrote the following ligne : Route::post('/POST', '[email protected]');

then finally , i wrote the following code in PostController.php,in order to save the form in the database table :

public function store(Request $request) { //https://laravel.com/docs/5.1/quickstart impotant link to understant

    //$this->validate($request,[
        //'body'=>'required|unique:todos']);
    $data = new Post ;
    $ASNumber= $request->input('ASNumber');

  $choice=$request->input('choice');
  $peeringDB=$request->input('peeringDB');
     $ASSET =$request->input('AS-SET');
      $Contact=$request->input('Contact');  
  
   $data = array('asnumber'=>$ASNumber,'peeringrs'=>$choice,'peeringdb'=>$peeringDB,'AS

-SET'=>$ASSET,'contact'=>$Contact);

   $data->save();
 return  redirect('/');    
}

the answer in the "http://127.0.0.1:8000/POST" , was "Call to a member function save() on array" .

a last question , why should i redirect ???