boyjarv

boyjarv

Member Since 1 Year Ago

Experience Points
3,040
Total
Experience

1,960 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 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-in-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 Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • evangelist 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 1
3,040 XP
Sep
19
22 hours ago
Activity icon

Replied to Form Is Refreshing And Nothing Is Output

<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class EventPostRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'eventName'=>'required',
            'venue_id'=>'required',
            'eventPhoto'=>'required',
            'eventDate'=>'required',
            'eventTimeStart'=>'required',
            'eventTimeEnd'=>'required',
            'eventType'=>'required',
            'eventCost'=>'required'
        ];
    }
}

Activity icon

Started a new Conversation Form Is Refreshing And Nothing Is Output

When I submit my form it just refreshes and noting submitted and nothing output (that works on administration but I recently copied it over for a user)

here is my route:

Route::post('venue/events/create', '[email protected]')->name('event.store');

my form action:

<form action="{{route('event.store')}}" method="post" enctype="multipart/form-data">@csrf

my eventStore method:

public function eventStore(EventPostRequest $request) {
        dd($request);
        $eventphoto = $request->file('eventPhoto')->store('public/events/photos');
        Event::create([
            'venue_id'=>request('venue_id'),
            'eventName'=>request('eventName'),
            'slug'=>str_slug(request('eventName')),
            'eventPhoto'=>$eventphoto,
            'eventDate'=>request('eventDate'),
            'eventTimeStart'=>request('eventTimeStart'),
            'eventTimeEnd'=>request('eventTimeEnd'),
            'eventType'=>request('eventType'),
            'eventCost'=>request('eventCost')
        ]);


        //return redirect()->back()->with('message','Event added successfully!');
    }
Activity icon

Replied to Get Data Out In View

Thank you to all, I know this is basic stuff, I was using findOrFail form the start in my other functions not sure why I changed it?!

Activity icon

Replied to Get Data Out In View

Thanks,

How did you know it was a collection? cos it was in an array? My variable in my controller was made up like this:

$thevenue = Venue::latest()->where("id", "=", "$venueid")->get();
Activity icon

Started a new Conversation Get Data Out In View

When I try the following:

{{ $thevenue ?? '' }}

I get this:

[{"id":1152522,"user_id":19,"email":"[email protected]","venuename":"New Sussex Hotel","slug":"new-sussex-hotel","venuetype":"Public Houses","address":"182 South Street","address2":null,"town":"Lancing","county":"West Sussex","postcode":"BN158AU","postalsearch":"BN15","telephone":"01903 753424","latitude":"50.8220655","longitude":"-0.3245099","website":null,"photo":"public\/venues\/photos\/c1ZHdLFo438pitQNb710eSx1y1Q9ueHxokexECvj.jpeg","is_live":1,"created_at":"2020-03-15 18:37:54","updated_at":"2020-09-15 12:58:49"}]

I just want to show the Venuename but when I do:

{{ $thevenue->venuename }}

I get:

Property [venuename] does not exist on this collection instance.

Activity icon

Replied to Use Of Undefined Constant Venue_id - Assumed 'venue_id'

Ah yes great thanks! that should work Laracoft but yes as Sinnbeck says, It is already on the User

Activity icon

Started a new Conversation Use Of Undefined Constant Venue_id - Assumed 'venue_id'

I am trying to pass my venue_id through to my Event Create page, I get the following error:

Use of undefined constant venue_id - assumed 'venue_id' (this will throw an Error in a future version of PHP)

here is my link

<a class="nav-link" href="{{route('event.create', [Auth::user()->venue_id])}}">Add Event</a>

here is my route:

Route::get('venue/{id}/events/create', '[email protected]')->name('event.create');

here is my function:

public function eventCreate(Request $request) {
        $venue_id = request('venue_id');
        return view('events.create', compact('venue_id'));
    }

What am I doing wrong?! the Venue_id is actually in my URL?!

Sep
16
3 days ago
Activity icon

Replied to Linking To Image In Public Folder?

website root is actually httpdocs/public

I have sorted it thanks

Activity icon

Started a new Conversation Linking To Image In Public Folder?

Hi,

So I put some QR-codes in my public folder but when I go there I get 404

https://bnhere.co.uk/httpdocs/public/qrcodes/worthing/venues/qrcode-1150760.png

I tried without httpdocs as this is where my laravel project resides:

https://bnhere.co.uk/public/qrcodes/worthing/venues/qrcode-1150760.png

Still I get 404

Activity icon

Replied to Adding A Function To A Route

hmm I see I could just use the function inside my controller... but its not really what I was wanting?!

create a get method?!

PDF is a different part of my application than the PNG

Activity icon

Started a new Conversation Adding A Function To A Route

hi,

I would like to add a function to a route:

this is what I currently have:

Route::get('qr-code-g', function () {
    \QrCode::size(500)
        ->format('png')
        ->generate('ItSolutionStuff.com', public_path('images/qrcode.png'));

    return view('qrCode');

});

I would just like to use the function part:

function () {
    \QrCode::size(500)
        ->format('png')
        ->generate('ItSolutionStuff.com', public_path('images/qrcode.png'));

in this route:

Route::get('/venues/{town}/pdfs', '[email protected]')->name('venues.pdf');

Please help?

Sep
09
1 week ago
Activity icon

Started a new Conversation How Can I Check If My Link Exists?

Hi,

I would like to check if my link actually exists, I have tried the following but if there is no PDF existing then I get a 404?!

@if(Storage::url('letters/'. $venue->town .'/'.$venue->venuename.'.pdf'))
                                    <a href="{{Storage::url('letters/'. $venue->town .'/'.$venue->venuename.'.pdf')}}">View Letter</a>
                                @endif
Activity icon

Replied to Linking To A Symlink

Right, got it now thanks!

Activity icon

Replied to Linking To A Symlink

yes it is on the server, argh.... I really don't get it now?!

Public disc? local disc?

Activity icon

Started a new Conversation Linking To A Symlink

So I have created a symlink using

Php artisan storage:link

And I have generated a PDF but how can I link to it?

My PDF is located at: www.bnhere.co.uk/storage/app/letters/Southwick/TheCricketers.pdf

I have tried

href=“{{Storage::url(‘app/letters/Southwick/TheCricketers.pdf’)}}”

But I get 404

Sep
08
1 week ago
Activity icon

Replied to Why Do I Have To Keep Unlinking And Relinking Storage?

YAY thanks everyone for all your help!

The issue was when I pushed my code about 7 months ago before my gitignore, I had pushed with symlink folder

Activity icon

Replied to Why Do I Have To Keep Unlinking And Relinking Storage?

I think it must be this, how can I find out what my symlink is? in my .ignore I have

storage/* storage/.key storage/app/public/

Activity icon

Replied to Why Do I Have To Keep Unlinking And Relinking Storage?

But why? How to stop it from deleting it?

Activity icon

Replied to Why Do I Have To Keep Unlinking And Relinking Storage?

And whereabouts do I start looking to fix this?

Activity icon

Started a new Conversation Why Do I Have To Keep Unlinking And Relinking Storage?

Hi,

each time I pull my code onto live server, my images always break and I have to login to my server and navigate to public folder and unlink storage then go back a directory and

run php artisan storage:link

Why do I have to keep doing this? is there a work around? Thanks

Sep
07
1 week ago
Activity icon

Started a new Conversation Distinct And Count All Records

Hi,

I have a database of venues, I would like to display a bar chart (or the right chart) to show the towns along the bottom and the number of each venues per town

This is kind of working but not properly?!

$result = Venue::distinct('town')->get();
        return response()->json($result);

here is my javascript for my chart:

$.get(url, function(response){
            response.forEach(function(data){
                town.push(data.town);
                id.push(data.id);
            });
            var ctx = document.getElementById("canvas").getContext('2d');
            var myChart = new Chart(ctx, {
                type: 'bar',
                data: {
                    labels:town,
                    datasets: [{
                        label: 'Venue ID',
                        data: id,
                        borderWidth: 1
                    }]
                },
                options: {
                    scales: {
                        yAxes: [{
                            ticks: {
                                beginAtZero:true
                            }
                        }]
                    }
                }
            });
        });

Please help

Sep
06
1 week ago
Activity icon

Started a new Conversation Setting Up A New Class File

So I have created a new class extending my viewController and added in the code from this page:

http://www.fpdf.org/en/script/script29.php

I am getting the error: Cannot call constructor on Line 49

parent::__construct('P', $unit, $Tformat['paper-size']);
Activity icon

Started a new Conversation Too Few Arguments Help

Please help, I am getting the following error:

Too few arguments to function Illuminate\Filesystem\FilesystemAdapter::put(), 1 passed in /Users/johnbiddulph/Documents/development/laravel/moveme/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemManager.php on line 368 and at least 2 expected

here is my code:

public function pdf(){

//create pdf document
        $pdf = app('Fpdf');
        $pdf->AddPage();
        $pdf->SetFont('Arial','B',16);
        $pdf->Cell(40,10,'Hello World!');

//save file
        Storage::put($pdf->Output('S'));
        return view('venues.pdf', compact(
            'pdf'));
    }```
Jul
14
2 months ago
Activity icon

Started a new Conversation Failed To Open Stream: Operation Not Permitted In /Users/username/.composer/vendor/laravel/valet/server.php On Line 191

Hi, I recently updated my OSX to Big Sur Alpha and I am getting the following when I go to my local Laravel site:

Warning: require(/Users/johnbiddulph/Documents/development/laravel/moveme/public/index.php): failed to open stream: Operation not permitted in /Users/johnbiddulph/.composer/vendor/laravel/valet/server.php on line 191

Fatal error: require(): Failed opening required '/Users/johnbiddulph/Documents/development/laravel/moveme/public/index.php' (include_path='.:/usr/local/Cellar/php/7.4.6_1/share/php/pear') in /Users/johnbiddulph/.composer/vendor/laravel/valet/server.php on line 191

I downgraded PHP to 7.2, resinstalled valet, updated composer and brew updates etc.... HELP?!

Jun
15
3 months ago
Activity icon

Started a new Conversation Getting All Artists/events Or Venue (SKIDDLE API)

I am trying to get all events/artists for a certain venue from the Skiddle API

https://github.com/Skiddle/web-api/wiki

https://www.skiddle.com/api/v1/artists/?api_key=d5f661932662db48fb1509c8dba7d77e/&venueid=3937

this should return all events for venue 3937 (Brighton Concorde 2) but its not?!

Please help

Jun
09
3 months ago
Activity icon

Replied to Question About Scraping

hmmm... ok cool thanks

Activity icon

Replied to Question About Scraping

I'm trying to crawl each of these events:

https://www.allgigs.co.uk/view/venue/140/Concorde-2-Brighton.html

public function handle()
    {
        //
        $client = new Client();
        $crawler = $client->request('GET', 'https://www.allgigs.co.uk/view/venue/140/Concorde-2-Brighton.html');

        $links = $crawler->filter('a.url')->each(function($node) {
            $href  = $node->attr('href');
            return $href;
        });

        foreach($links as $key => $link){

            $client = new Client();
            $crawler = $client->request('GET', $link);

            $crawler->filter('.date, .info > dt > a')->each(function ($node) {
                $output = $node->text()."\n";

                $array = explode("\n", $output);

                $data = array_chunk($array, 2);
//                print_r($data);
                foreach ($data as $row) {
                    [$date, $title] = array_pad($row, 2, null);

                    // here you have your variables
                    print 'Date: '.$date;

                    print 'Title: '.$title;

//                    print 'Type: '.$type;
                }

            });
        }
    }
Activity icon

Replied to Question About Scraping

Please help?!

Activity icon

Replied to Question About Scraping

I'm getting this, when I output $data

Array
(
    [0] => Array
        (
            [0] => Saturday 22nd Aug 2020
            [1] => 
        )

)
Array
(
    [0] => Array
        (
            [0] => Fleetwood Bac
            [1] => 
        )

)
Array
(
    [0] => Array
        (
            [0] => Pop/ Rock
            [1] => 
        )

)
Array
(
    [0] => Array
        (
            [0] => Monday 31st Aug 2020
            [1] => 
        )

)
Array
(
    [0] => Array
        (
            [0] => GZA
            [1] => 
        )

)
Array
(
    [0] => Array
        (
            [0] => Hip Hop
            [1] => 
        )

)
Array
(
    [0] => Array
        (
            [0] => Saturday 5th Sep 2020
            [1] => 
        )

)
Array
(
    [0] => Array
        (
            [0] => Cock Sparrer
            [1] => 
        )

)
Array
(
    [0] => Array
        (
            [0] => Punk
            [1] => 
        )

)
Array
(
    [0] => Array
        (
            [0] => Tuesday 8th Sep 2020
            [1] => 
        )

)
Array
(
    [0] => Array
        (
            [0] => Wendy James
            [1] => 
        )

)
Array
(
    [0] => Array
        (
            [0] => Pop/ Rock
            [1] => 
        )

)
Array
(
    [0] => Array
        (
            [0] => Wednesday 9th Sep 2020
            [1] => 
        )

)
Array
(
    [0] => Array
        (
            [0] => JoJo
            [1] => 
        )

)
Array
(
    [0] => Array
        (
            [0] => Jazz/ RnB
            [1] => 
        )

)
Array
(
    [0] => Array
        (
            [0] => Thursday 10th Sep 2020
            [1] => 
        )

)
Array
(
    [0] => Array
        (
            [0] => The Doors Alive
            [1] => 
        )

)
Array
(
    [0] => Array
        (
            [0] => Rock
            [1] => 
        )

)
Activity icon

Replied to Question About Scraping

print $date 

outputs

29th Jun 2020Cage the ElephantFunk/ RockFriday 31st Jul 2020The CureheadsIndie/ RockThursday 20th Aug 2020CreeperPunkSaturday 22nd Aug 2020Fleetwood BacPop/ RockMonday 31st Aug 2020GZAHip HopSaturday 5th Sep 2020Cock SparrerPunkTuesday 8th Sep 2020Wendy JamesPop/ RockWednesday 9th Sep 2020JoJoJazz/ RnBThursday 10th Sep 2020The Doors AliveRockSaturday 12th Sep 2020The SmythsIndieSaturday 12th Sep 2020Darren StylesDanceSunday 13th Sep 2020T

Not just the date?! $title and $type don't output anything?!

Activity icon

Replied to Question About Scraping

Thanks, here is my code now:

$crawler->filter('li.date, dt > a, li.style')->each(function ($node) {
                $output = $node->text()."\n";

                $array = explode("\n", $output);

                $data = array_chunk($array, 3);

                foreach ($data as $row) {
                    [$date, $title, $type] = $row;
                    // here you have your variables
                    print $date;
                    print $title;
                    print $type;
                }

            });

I am now getting:

  ErrorException  : Undefined offset: 2

and this line is highlighted:

 [$date, $title, $type] = $row;
Activity icon

Started a new Conversation Question About Scraping

My code here:

$crawler->filter('li.date, dt > a, li.style')->each(function ($node) {
                print $node->text()."\n";
            });

Outputs the following:

Saturday 12th Sep 2020
The Smyths
Indie
Saturday 12th Sep 2020
Darren Styles
Dance
Sunday 13th Sep 2020
The Chameleons
Indie/ Rock

My question is, how can I set a variable on each line so it is easy to import into my database?

like the following:

$date = 'Saturday 12th Sep 2020';
$type = 'Dance';
$title = 'Darren Styles';
Activity icon

Replied to Use Goutte To Scrap Multiple Data From Single Div

Great thanks for this HJORTUR17, So I can get events from here: https://www.allgigs.co.uk/view/venue/140/Concorde-2-Brighton.html

But I need to get data from the link of each one, is this possible and how can I go about doing this?

May
01
4 months ago
Activity icon

Awarded Best Reply on Foreach Within A For Each - Controller Or Blade?

ahhh... I can just use the relationship method:

@foreach($section->sectionphotos as $sectionpics)
                        <img src="{{Storage::url($sectionpics->photo)}}" width="100" />
                    @endforeach
Activity icon

Replied to Foreach Within A For Each - Controller Or Blade?

ahhh... I can just use the relationship method:

@foreach($section->sectionphotos as $sectionpics)
                        <img src="{{Storage::url($sectionpics->photo)}}" width="100" />
                    @endforeach
Activity icon

Replied to Foreach Within A For Each - Controller Or Blade?

where did you get: selection_photos from?

Activity icon

Started a new Conversation Foreach Within A For Each - Controller Or Blade?

Hi, I only want to show all the photos for each section. How can I do this?

here is my blade template:

<ul>
            @foreach($sections as $section)
                <li><a href="{{ route('section.edit', [$section->id]) }}">{{$section->sectionName}}</a> |
                    <a href="{{ route('section.addphotos', [$section->id, $section->sectionSlug]) }}" class="btn btn-dark btn-sm">Add Photos</a>
                    @foreach($photos as $sectionpics)
                        <img src="{{Storage::url($sectionpics->photo)}}" width="100" />
                    @endforeach
                </li>
            @endforeach
            </ul>

in my controller method:

$sections = Section::all();
        $photos = SectionPhotos::all();
        return view('home', compact('sections', 'photos'));

My SectionPhotos has the field section_id which I need to base the filter on

Activity icon

Replied to Route Comes Back 404 Not Found?!

I just worked out, I needed to add into my Section model:

public function getRouteKeyName() {
        return 'sectionSlug';
    }
Activity icon

Started a new Conversation Route Comes Back 404 Not Found?!

Can anyone please help, Why am I getting a 404?

Here is my link:

<a href="{{ route('section.addphotos', [$section->id, $section->sectionSlug]) }}" class="btn btn-dark btn-sm">Add Photos</a>

Here is my route:

Route::get('/section/{id}/{section}/addphotos', '[email protected]')->name('section.addphotos');

Here is my controller method:

public function addPhotos($id, Section $section) {
        $sectionPhotos = SectionPhotos::where('section_id', '=', $id)
            ->get();
        dd($sectionPhotos);
        $params = array_merge(['sectionID' => $id, 'photos' => $sectionPhotos], compact('section'));
        return view('section.addphotos', $params);
    }
Apr
29
4 months ago
Activity icon

Replied to Search Not Working?!

thank you!

Apr
28
4 months ago
Activity icon

Replied to Search Not Working?!

Still not working?!

and here is my code so far:

if($propname||$minbeds||$proptype_id||$category_id||$town) {
            $properties = Property::where('proptype_id', $proptype_id)
                ->orWhereNotNull('propname', 'LIKE', "%".$propname."%")
                ->orWhereNotNull('bedroom', $minbeds)
                ->orWhereNotNull('category_id', $category_id)
                ->orWhereNotNull('town', $town)
                ->paginate(20);
}

PLEASE HELP?

Activity icon

Replied to Search Not Working?!

now I'm getting this:

Facade\Ignition\Exceptions\ViewException
Call to undefined method Illuminate\Database\Eloquent\Builder::appends()
Activity icon

Replied to Search Not Working?!

So put an IF condition after each line?

Activity icon

Replied to Search Not Working?!

cool thanks!

Activity icon

Replied to Search Not Working?!

select * from `properties` where `proptype_id` is null or `propname` LIKE ? or `bedroom` is null or `category_id` is null or `town` is null

Error 1064 error in SQL syntax

Activity icon

Replied to Search Not Working?!

I can't get the SQL from that

Activity icon

Replied to Search Not Working?!

ok, I am now using the following:

$properties = Property::where('proptype_id', $proptype_id)
                ->orWhere('propname', 'LIKE', "%".$propname."%")
                ->orWhere('bedroom', $minbeds)
                ->orWhere('category_id', $category_id)
                ->orWhere('town', $town)
                ->paginate(20);

but only the propname search works?!

Activity icon

Replied to Search Not Working?!

so what can I use instead of '=' and multiple if statements?