swimmer

swimmer

Member Since 1 Month Ago

Experience Points 410
Experience Level 1

4,590 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-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.

19 Jul
1 day ago

swimmer started a new conversation How Do I Search For Html In Google Chrome Elements

Hi, I have a particular p tag for example

sample

How do I search for the word sample in my google chrome elements ? I can search for div,tagd but not for the word sample.

Thank you for your help

06 Jul
2 weeks ago

swimmer left a reply on Simulate A Mouse Clicks For An Alt

You mentioned in your reply the following

suggest you create it in a helpers.js and include that into every page

Can you please give more information how to perform this? I am not sure how to force the console to look at my helpers.js in every redirect.

05 Jul
2 weeks ago

swimmer left a reply on Simulate A Mouse Clicks For An Alt

Tray2

Thank you for your reply. I will test what you suggested when I have time in front of the computer.

What about my second question how allow google chrome console to remember the JavaScript when redirecting to a new page?

swimmer started a new conversation Simulate A Mouse Clicks For An Alt

I am trying to simulate a mouse clicks with java script.

I have two questions:

1)I have a page with has many items on it. Each item has on alt for the images of the products I want to perform a loop that cheks if the alt has a predefined string in case it has I want Java script to click on the image.

I can only use native JavaScript for this test not Jquery.

  1. I am inserting the script into my Google Chrome console it seems that when I input JavaScript in the console when the page refreshes the script disappears.

I want chrome to remember the script even on the refresh.

How can this be done?

Thank you so much for your help

18 Jun
1 month ago

swimmer left a reply on Call To A Member Function ToArray() On Null

Thank you for your help jenky

swimmer left a reply on CSS Not Working With My Master Blade Template

The typo seems to be my issue.

What a silly mistake. Thank you for pointing it out.

swimmer left a reply on Call To A Member Function ToArray() On Null

Thank you for your answers, However it is still not clear to me:

  1. what is the point of return []; in the original code that kima sent.
  2. I modified the code and added the line: if(!empty($menu = Menu::where('url', '=', $url)->first()))

In the original code that Kima sent there is no check to check if it is not !empty but the if statement still works well why?

swimmer left a reply on Call To A Member Function ToArray() On Null

I used kima's code and it worked like a charm.

I just had one change I did not use return [];

This is the block of code that I used:


<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class content extends Model
{
    static public function getAll($url){
        if($menu = Menu::where('url', '=', $url)->first()) {
            $content = Content::where('menu_id', '=',$menu->id)->get()->toArray();

            return $content;
        }
        
        

    }
}

Am I missing something that I did not use the return []?

17 Jun
1 month ago

swimmer left a reply on CSS Not Working With My Master Blade Template

I do not understand in the code you sent where in the env file I need to hardcode can you please write exactly what I need to write in the env file.

swimmer left a reply on CSS Not Working With My Master Blade Template

I just checked I do not have any options for a ASSET_URL in my "env" file

I am attaching my files for your reference

Please me know what I am doing wrong.


APP_NAME=Laravel
APP_ENV=local
APP_KEY=YBdJhT7Qm8S8Srf9BkzNeGxaM=
APP_DEBUG=true
APP_URL=http://localhost

LOG_CHANNEL=stack

DB_CONNECTION=mysql
DB_HOST=129.0.0.1
DB_PORT=3111111
DB_DATABASE=med
DB_USERNAME=root
DB_PASSWORD=''

BROADCAST_DRIVER=log
CACHE_DRIVER=file
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120

REDIS_HOST=129.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null

AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=

PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=mt1

MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"



swimmer left a reply on Call To A Member Function ToArray() On Null

I tried to remove the

toArray()

As you suggested however now there's a new error even in sections of the website that there is information in the database for menu.

The error message I am receiving is: syntax error, unexpected '$content' (T_VARIABLE)

Attached is the revised code after your recommendation:


<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class content extends Model
{
    static public function getAll($url){
   if( !empty($menu= Menu::where('url', '=', $url))) {
   
      
    $menu= $menu->>toArray()
    $content = Content::where('menu_id', '=',$menu['id'])->get()->toArray();

    return $content;
   }

   

    }
}


Thank you for your help

swimmer started a new conversation CSS Not Working With My Master Blade Template

It seems like my master template is not getting the css from public.

In the master template I have the following code:


<link herf ="{{asset('css/style.css')}}" rel="stylesheet"> 

My stylesheet is :


.flex-rectangle{
    width: 100%;
    background: #ca0164;
    p
}
.flex-rectangle:before{
    content: "";
    display: block;
    padding-top: 25%;
}
p .flex-rectangle {
    color: green;
   }

   .redtitle {
    color: red;
    background-color: black;
 } 

 h1.title {color: red;}

My Html is :


@extends('master')

@section('content1')
   
   

  @if(!empty($content))
        @foreach($content as $val)


        <div class="row">
            <div class= "flex-rectangle">

        
                <h1 class = "title">{{ $val['ctitle'] }}</h1>
                <p>{{ $val['articale'] }}</p>

                </div>

        </div>
        @endforeach
     @else

        <div class="row">
                    <div class="col-12">
                        <h1>Content not found</h1>
                        <p>Content not found</p>

                    </div>

            </div> 
      @endif          

@endsection

What am I doing wrong?

swimmer left a reply on Call To A Member Function ToArray() On Null

Sorry about that. Here is the code

swimmer started a new conversation Call To A Member Function ToArray() On Null

I built a nav bar and when a link is clicked I bring in from My SQL all the info Relevant to that page in my case the title and description.

However when someone clicks on a link that leads to a page that there is no information in the database I built on else that's states that "no information is available ." However my code gets stuck in the model stage when pulling the information from the database I get the following error: Call to a member function toArray() on null

This is my model code:

28 May
1 month ago

swimmer left a reply on Project Not Being Created

Nakov solution works like a charm. Thank you for your help.

swimmer started a new conversation Project Not Being Created

I am trying to create my first project in Laravel. I already installed Laravel via composer. However when I tried to use the following command line in my CMD "composer create-project laravel/laravel --prefer-dist laravel /laravel Medici"

I am getting an error and it is not working. You can find a screenshot to my issue at the following link: https://drive.google.com/file/d/16uyM811bPNeRyjRnLZQ_IXnAeFSzcbP1/view?usp=sharing

I am using Windows 8.1 Please advise what I am doing wrong.