StuffedGoat

StuffedGoat

Member Since 3 Years Ago

Experience Points 7,685
Experience Level 2

2,315 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 46
Lessons
Completed
Best Reply Awards 4
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.

30 Nov
3 years ago

StuffedGoat left a reply on Rebuilding Project Flyer With Wordpress

@RachidLaasri Do you think it would also be more costly if a designer has to create something for a CMS like Bolt, October or Grav?

@xsmall Thank you for you insights! My question to you is would you personally take the flat-file CMS for a project where users can upload pictures, create profiles etc. (think of a page where you can sell your house)?

28 Nov
3 years ago

StuffedGoat started a new conversation Rebuilding Project Flyer With Wordpress

Hello!

I really would like to hear your opinion if it is possible to rebuild Project Flyer with Wordpress in coherency with appropriate plugins. This would include all the basic stuff like create a flyer, upload images, set up a basic user authorization/authentication.

The thing is that I have to admit to myself that I'm not a good programmer. In the past I’ve watched lots of videos and was always astonished how easily Jeffrey and other talents manage to go through the code. Also I'm not the youngest anymore and have go ways which lead me faster to my goal. Anyhow, I don’t want to steer the discussion into a “You can do it just hang in” topic.

Right now I have a small business related idea which came close to Project Flyer (Thanks to Jeffrey!) and I want to give it a try as a solopreneur.

Let’s imagine I could gain within a short amount of time a monthly visitor rate of xxx.xxx users. In which dimensions would you say “I would prefer a handcrafted solution via a framework (Laravel) over the way of a Wordpress solution.” or vice versa?

My main concern is security issues. I think if I pick Wordpress over Laravel I have a solid foundation which could not that easily be hacked or destroyed. (I’m just superficial aware of security concerns on/at web technologies.) For me it would be a disaster if I had already gained 500 users per month and one person sees a breach and would destroy the whole database and therefor the whole project.

Laravel:

  • highest level of customization comes with Laravel
  • better performance (my guess)

Wordpress:

  • many freelancers available which offer their help
  • I could start today and would have something done at the end of the day
  • a long-term issue would be the lose of adaptability

Regarding Design: However I decide I would have to buy a complete design which had to be made from scratch. Here my guess is that the creator would have more freedom when I choose Laravel over Wordpress. But I’m not sure.

(Because of more or less not budget I cannot afford a skilled programmer who could build this from scratch with Laravel.)

Thank you all for you replies!

03 Oct
3 years ago

StuffedGoat left a reply on Site Search Engine

So far as I know is Jeffrey using Algolia on laracasts.com and my questions is what is the actual difference between those two services. I know that in Algolia you have to manually choose you database coloumns you want to be indexed/searchable for the user. But in short what does Swiftype different here?

By all means it is good to choose from a various amount of services nowadays but I also feel that it becomes to many you can choose from so that you lose the general survey very quickly.

26 Sep
3 years ago

StuffedGoat started a new conversation Project Flyer Ep. 17 - Parameter Mismatch

Hi there,

I'm following Jeffreys latest episode where he writes a UnitTest but I stuck at it.

I become this error:

PHPUnit 4.7.7 by Sebastian Bergmann and contributors.

E

Time: 967 ms, Memory: 10.25Mb

There was 1 error:

1) App\AddPhotoToFlyerTest::it_processes_a_form_to_add_a_photo_to_a_flyer
ErrorException: preg_replace(): Parameter mismatch, pattern is a string while re
placement is an array

...
C:\xampp\htdocs\projectflyer-master\tests\AddPhotoToFlyerTest.php:14
...

FAILURES!
Tests: 1, Assertions: 0, Errors: 1.

This is how my test class look like:

<?php

namespace App;

use Mockery as m;
use App\AddPhotoToFlyer;
use Symfony\Component\HttpFoundation\File\UploadedFile;

class AddPhotoToFlyerTest extends \TestCase
{
    /** @test */
    function it_processes_a_form_to_add_a_photo_to_a_flyer()
    {
        $flyer = factory(Flyer::class)->create();     // <------- This is line 14

        $file = m::mock(UploadedFile::class, [
            'getClientOriginalName'      => 'foo',
            'getClientOriginalExtension' => 'jpg'
        ]);

        $file->shouldReceive('move')
             ->once()
             ->with('images/photos', 'nowfoo.jpg');

        $thumbnail = m::mock(Thumbnail::class);

        $thumbnail->shouldReceive('make')
                  ->once()
                  ->with('images/photos/nowfoo.jpg', 'images/photos/tn-nowfoo.jpg');

        $form = new AddPhotoToFlyer($flyer, $file, $thumbnail);

        $form->save();

        $this->assertCount(1, $flyer->photos);


    }

    function time()
    {
        return 'now';
    }

    function sha1($path)
    {
        return $path;
    }

}

So my guess is that he is unable to create/mock a flyer-object via the faker class?! I also tripple-checked it with Jeffreys and it's the same:

$factory->define(App\Flyer::class, function (Faker\Generator $faker) {
    return [
        'user_id'     => factory('App\User')->create()->id,
        'street'      => $faker->streetAddress,
        'city'        => $faker->city,
        'zip'         => $faker->postcode,
        'state'       => $faker->state,
        'country'     => $faker->country,
        'price'       => $faker->numberBetween(10000, 5000000),
        'description' => $faker->paragraphs(3),
    ];
}); 

Does anyone also experianced this particular error?

25 Sep
3 years ago

StuffedGoat left a reply on Project Flyer Ep. 16 - Two Errors

Thank you very much!

Maybe it's already to late that I didn't not saw this anymore but in my defense,.. this was really sneaking! ;-)

StuffedGoat started a new conversation Project Flyer Ep. 16 - Two Errors

Hi!

I'm following Jeffreys Project Flyer and now in episode 16 I'm stuck because I get this error:

ErrorException in FlyersController.php line 52:
Undefined variable: flyer

&

Call to undefined method Illuminate\Database\Query\Builder::fileName()
at Model->__call('fileName', array()) in AddPhotoToFlyer.php line 46
at Photo->fileName() in AddPhotoToFlyer.php line 46

I rewatched the video several times but I don't find the error which is very frustrating. Maybe someone has it on Github and can point me there? :) I found repositories but unfortunately they are outdated.

Anyway, here are my methods, they look exactly like in Jeffreys video:

// Line 52 is the return statement
public function store(FlyerRequest $request)
{
    $this->user->publish(
        new Flyer($request->all())
    );
    return redirect(flyer_path($flyer));
}

// The helper class:
function flyer_path(App\Flyer $flyer)
{
    return $this->zip .'/'. str_replace(' ', '-', $this->address);
}

And line 46 from my second error looks like this.

public function save()
{
    $photo = $this->flyer->addPhoto($this->makePhoto());

    $this->file->move($photo->baseDir(), $photo->fileName());

    $this->thumbnail->make($photo->path, $photo->thumbnail_path);
}

Does anyone also encountered this/these errors and could give me some advice? Unfortunately I cannot find this project under Jeffreys Github account :(

Happy Weekend!

02 Sep
3 years ago

StuffedGoat left a reply on Php Artisan Migrate:rollback Error

Try this: composer dump-autoload

I assume that the "framework" does not "know" about your new class.

30 Aug
3 years ago

StuffedGoat left a reply on Phpunit - Command Not Found

The installation via composer global did not do the trick for me here unfornuately.

I also checked the permissions and they are exactly as they should be: -rwxr-xr-x

So I guess I have to open a service request. Thanks anyway!

29 Aug
3 years ago

StuffedGoat left a reply on Issue With Authorization And PDF Generating

Because I don't know the whole business logic of your app I take the liberty to answer:

Would it be an option for you to secure the complete OfferController by putting this into his constructor?

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

StuffedGoat left a reply on Database Time

Maybe you could bypass the Carbon issue by setting the local time in your config file with the timezone from your database server. Would that be an option for you? (I guess you already thougth about that maybe..)

StuffedGoat left a reply on Token Mismatch When Uploading Some Images, And It Doesnt Happen For The Other Photos

Could you replace this

<input name="_token" value="{{ csrf_token() }}" type="hidden" />

with this and give us an update?

{{ csrf_field() }}

StuffedGoat left a reply on Phpunit - Command Not Found

@skliche Thanks for your reply.

I get this message. I guess I have to call my hoster or what do you think? If it comes to unix-systems it's like the left hand doesn't know what the right hand is doing. error1

StuffedGoat left a reply on Example Scenario For A Migration Change In Production System?

Thank you for the good and broad explanation. @rosswilson252

I'm taking away that it comes down (more or less) to the range/scope of the changes that are planned to be made.

StuffedGoat left a reply on Phpunit - Command Not Found

Nope Sir, I used composer create-project laravel/laravel --prefer-dist for the installation.

StuffedGoat started a new conversation Phpunit - Command Not Found

Hello everyone!

I wanted to start and dive into the world of testing on my production system. Because I was not able to successfully run the phpunit command I decided to install a new Laravel instance via composer create-project laravel/laravel --prefer-dist. However with this new installation I'm still not able to run the command.

Here in the forum I read that phpunit is already included and it must me running. Therefore I tried it in XAMPP and there it works strange to say. But not on my server.

Do you guys have any ideas what could be causing this problem?

Here is a screenshot from my terminal on my server. You can see that I tried both paths but unsuccessfully unfortunately. error

StuffedGoat started a new conversation Example Scenario For A Migration Change In Production System?

Hi

I don't fully understand the concept of migrations especially when you want to change something afterwards.

Let's say I have this migration file: 2014_1012000000_create_users_table.php and now I want to add another column or want to change some attributes. The docs state that I need to write another migration file for doing this task. Ok so far so good.

But here is what I would do. Instead of writing another migration file I just would modify the column manually via my database tool and than just change my originally migration file.

// from
$table->string('password', 60);
//to
$table->string('password', 60000);

Is there any error in reasoning I made? I think my way is more convenient and faster. What is you're process when you need to change something afterwards?

24 Aug
3 years ago

StuffedGoat left a reply on How To Change Redirect When Logging In From '/home' To '/'

@bobbybouwmann I checked your concern and could not replicate it. In my app is the default value set and I was logged in so he must have redirect me to /home but he did not. So I don't understand the purpose of this middleware/method when this is apparently enough -> protected $redirectTo = '/'; Can you think of a scenario?

23 Aug
3 years ago

StuffedGoat left a reply on Laravel Boilerplate?

In a couple of weeks Taylor will release a new gem called Laravel Spark. I guess this could be something for you. Check out this video: https://www.youtube.com/watch?v=uOU_N8PNOD8

StuffedGoat left a reply on What GeoIP Service Provider Do You Use?

@Presto MaxMind's demo page works for me. I also use their database in the Piwik analytics platform to determine the users origin.

22 Aug
3 years ago

StuffedGoat left a reply on Cron Or Queue

@seedprod Hey, I came across your questions and just wanted to ask how do you decide to approch this finally? (Your first variant seems good to me.)

Regards

19 Aug
3 years ago

StuffedGoat left a reply on Launching The Site

Hi

I recently switched from localhost to fortrabbit. They manage all the server/unix stuff and I can concentrate on building my site. I just had to copy the whole laravel folder via SFTP and adapt the .env file to the new database connection etc. and it was done. If you want to cope with setting up a virtual private server you can take a look at DigitalOcean or Linode. You came across the first on in this forum very often.

Hope that helps you.

18 Aug
3 years ago

StuffedGoat left a reply on Autocomplete Textfield - What I'm Doing Wrong?

@thomaskim & @Snapey

You are right! I finally got it working. Thomas the ++ means I had pressed the spacebar two times.

There were some problems with two imports I had to replace them. Don't know why the facade aren't working in this case.

// Didn't work
use Illuminate\Support\Facades\Request;
use Request;
// Works
use Illuminate\Http\Request;

So the complete solution is the following. I hope this will help another rookie in the future.

// routes.php
Route::get('autocomplete', 'SearchController@autocomplete');    

// textfield
<input class="..."  name="searchtext" id="auto" type="text">

// JavaScript
<script>
    $( "#auto" ).autocomplete({
        source: 'autocomplete',
        minLength:1,
    });
</script>

// the method
public function autocomplete(Request $request)
{       
    $results          = array();
    $searchstring = $request->term; 
    $queries         = User::where('username', 'LIKE', '%'.$searchstring.'%')->get();
                
    foreach($queries as $query)
    {
        $result[] = ['id' => $query->id, 'value' => $query->username];  
    }
                    
    return $result;     
}

Thanks to everyone for your help!!

StuffedGoat left a reply on Autocomplete Textfield - What I'm Doing Wrong?

Unfortunately than he returns an empty array.

empty array

If I do my code I get the whole table.

[{"value":"John"},{"value":"Max"},{"value":"Walter"}, ...

I'm close to it guys!

StuffedGoat left a reply on Autocomplete Textfield - What I'm Doing Wrong?

@Snapey - Direct hit! Nice visual faculty.

@rest Also my unexpected '$queries' came from a forgotten semicolon. My bad!

Now I still get the whole volume of my users table back. I will try to find out why that is.

StuffedGoat left a reply on Autocomplete Textfield - What I'm Doing Wrong?

@thomaskim Yes you are right $request->searchtext returns nothing. My understanding is that it must return null because if I visit /autocomplete there is no input from the user given.

@ohffs Good hint with the dev tools. I can see that luckily the textfield is responding but it throws an error 500 with this error message. What does he wants me to do? I tried to instantiate $queries via $queries = new User; but that didn't do the trick for me. msg


I also did have to change beforehand:

// Didn't work
$searchstring = $request->input('searchtext');
// Works
$searchstring = Input::get('searchtext')

StuffedGoat started a new conversation Autocomplete Textfield - What I'm Doing Wrong?

Hi there!

My task is to autocomplete a textfield with names of users from the database.

routes.php

Route::get('autocomplete', 'SearchController@autocomplete');    

My textfield

<input class="..."  name="searchtext" id="auto" type="text">

JavaScript

<script>
    $( "#auto" ).autocomplete({
        source: 'autocomplete',
        minLength:1,
    });
</script>

Method

public function autocomplete(Request $request)
{       
    $results      = array();
    $searchstring = $request->input('searchtext');      
    $queries = User::where('username', 'LIKE', '%'.$searchstring.'%')->get();
                
    foreach($queries as $query)
    {
        $results[] = ['id' => $query->id, 'value' => $query->username]; 
    }
                    
    return $queries;        
}

In my users table are a bunch of users so when I type for example "Jo" (for John) I can see at the bottom of my page a message: 19 results are available, use up and down arrow keys to navigate. I don't have 19 John's 19 is the sum of all users. I think this message comes frome JQuery. My textfield doesn't change respectivly shows me any suggestions.

Any ideas what I'm doing wrong here? I think I'm close but at this point nothing more comes to my mind.

17 Aug
3 years ago

StuffedGoat started a new conversation How To Stop Getting Charged?

Hi everyone!

I'm noticed that my credit card was charged again and I didn't want this to be happen or more speciffic I want to control wheater I pay for Laracasts or not. Jeffrey deserves it this is clear but how can I stop this process?

What will happen wenn I cancel the subscription? Can I use the videos another 29 days or is immidiatley over?

StuffedGoat left a reply on Pretty URL Doesn't Work On My CentOS

Hm, thats strange. Sorry but any more does not occur to me right now because I'm not an expert regarding *nix / Apache.

13 Aug
3 years ago

StuffedGoat left a reply on [L5.1] Laravel Log Viewer Error 500

Okay this is strange.

I forgot to take a look into the laravel.log under storage/logs/ and the file stated the following

exception 'Symfony\Component\Debug\Exception\FatalErrorException' with message 'Allowed memory size of 679477248 bytes exhausted (tried to allocate 669253632 bytes)'

I googled around and found that the Debug-Bar could cause this issues (which I use). After I turned the Debug-Bar off the Laravel-Log-Viewer worked.

But then I switched back and turned the Debug-Bar on again and both are working now. So I will see if this exception will occure another times or not.

Source: https://github.com/barryvdh/laravel-debugbar/issues/19

StuffedGoat started a new conversation [L5.1] Laravel Log Viewer Error 500

Hello!

I've installed the Laravel-Log-Viewer and come across a server error 500 when I want to visit /logs . This package can be found here: https://github.com/rap2hpoutre/laravel-log-viewer

I added the Service Provider and set up a route for it:

// under config/app.php - Providers
Rap2hpoutre\LaravelLogViewer\LaravelLogViewerServiceProvider::class,

// my route.php
Route::get('logs', '\Rap2hpoutre\LaravelLogViewer\LogViewerController@index');

php artisan route:list gives me that: route

  • Also the *storage folder has read/write/execute permissions set.
  • app_debug is set to true
  • in my server logs (php & apache) I don't find any indications what could be wrong.

I just get a plain 500 internal server error / blank page.

If I put an echo "test"; into the LogViewerController@index strangely enough he`s visible on the blank page.

Has anybody an idea how I could more isolate or solve this issue?

StuffedGoat left a reply on Save() Inside A Loop Leaks Memory

Allow me to post as a novice.

Would it not be less memory consuming to put the store-method outside of the foreach like so:

foreach($files as $f) {
    // ...
}
$res = Storage::disk('s3')->put('in/' . $new_document->id, $contents);

StuffedGoat left a reply on Weird Behavior Of Blade Using Variables From Eloquent - Depending On PHP-code Doing The Same In Between

Have you found a solution yet? This looks very strange to me too.

Maybe you could try and tidy up a bit via and see if that helps:

php artisan view:clear
php artisan cache:clear
11 Aug
3 years ago

StuffedGoat started a new conversation [L5.1] Redirect With Hidden Parameters

Hello everybody!

I want to pass parameters via redirect()->action. My code looks like this:

return redirect()->action('HomeController@index', [var1]); 

The var1 is visible in my address bar and now I want to pass another variable but hidden. (I don't want to work with Sessions)

Does anyone has an idea how I could do this?

StuffedGoat left a reply on How To Join 3 Tables With Eloquent?

So.. thank you very much gentlemen!

I decided to rep @phildawson because he has a lower count, hope that is okay ;-) This whole stuff is new to me so I wasn't aware of a Collection/Single Row.

StuffedGoat left a reply on How To Join 3 Tables With Eloquent?

I really did exactly what you suggested/mentioned.

This is what I right now copied from my models:

// Category - Model
    public function pages()
    {
        return $this->hasMany('App\Page', 'category_fk');
    }
    
    public function maintable() 
    {
        return $this->belongsTo('App\Maintable', 'maintable_fk');
    }   

// Maintable - Model
    public function categories()
    {
        return $this->hasMany('App\Category', 'maintable_fk');
    }

// Page - Model
    public function category() 
    {
        return $this->belongsTo('App\Category', 'category_fk');
    }
// This is your method where I only added a return statement
        foreach ($maintable->categories as $category)
        {
            foreach ($category->pages as $page)
            {
                return $maintable->id;
            }
        }

And the error message:

Undefined property: Illuminate\Database\Eloquent\Collection::$categories

StuffedGoat left a reply on How To Join 3 Tables With Eloquent?

I really did exactly what you suggested/mentioned.

This is what I right now copied from my models:

// Category - Model
    public function pages()
    {
        return $this->hasMany('App\Page', 'category_fk');
    }
    
    public function maintable() 
    {
        return $this->belongsTo('App\Maintable', 'maintable_fk');
    }   

// Maintable - Model
    public function category()
    {
        return $this->hasMany('App\Category', 'maintable_fk');
    }

// Page - Model
    public function category() 
    {
        return $this->belongsTo('App\Category', 'category_fk');
    }
// This is your method where I only added a return statement
        foreach ($maintable->categories as $category)
        {
            foreach ($category->pages as $page)
            {
                return $maintable->id;
            }
        }

Meanwhile the error message changed to:

BadMethodCallException in Builder.php line 2003: 
Call to undefined method Illuminate\Database\Query\Builder::categories()

StuffedGoat left a reply on How To Join 3 Tables With Eloquent?

@pmall I'm a little further right now. You above solution works but I can't get the foreach working. This is the output:

Undefined property: Illuminate\Database\Eloquent\Builder::$categories
        $maintable = Maintable::with('categories.pages')->get();
        
        foreach ($maintable->categories as $category)
        {
            foreach ($category->pages as $page)
            {
                return $maintable->id;
            }
        }

StuffedGoat left a reply on Project Flyer, Images Don't Load Fomr <img> Src Attribute

Could you try and add a slash like so:

From

src="{{$photo->path}}"

To

src="/{{$photo->path}}"
10 Aug
3 years ago

StuffedGoat left a reply on How To Join 3 Tables With Eloquent?

I tried to implement your proposal but it didn't work but I can feel that you are very close.

!(http://i.imgur.com/1EinLnX.png)

StuffedGoat started a new conversation How To Join 3 Tables With Eloquent?

Hello everybody,

I'm trying to join 3 tables with Eloquent. I have three models pages, maintable and categories.

Categories:

    public function page()
    {
        return $this->hasMany('App\Page', 'category_fk');
    }
    
    public function maintable() 
    {
        return $this->belongsTo('App\Maintable', 'maintable_fk');
    }

Maintable:

    public function category()
    {
        return $this->hasMany('App\Category', 'maintable_fk');
    }

Pages:

   public function category() 
    {
        return $this->belongsTo('App\Category', 'id');
    }

Via SQL query it works with the following statement:

select * from pages p, maintables m, categories c where m.id = c.maintable_fk and c.id = p.category_fk

How can I convert this into Eloquent?

09 Aug
3 years ago

StuffedGoat left a reply on Blade File: Timestamp Format And Leading Space

After a couple of hours I now found the mistake I made. In the routes.php was a leading space at the first line which causes this error.

I also found a solution for the date format -> I just can use date() in a blade file for example {{ date('Y-m-d') }}.

Thanks again all and especially @Snapey for your patience!

08 Aug
3 years ago

StuffedGoat left a reply on Can't Access Site In The Browser.

Delete this folder and start from scratch.

I would recommend that you type composer create-project laravel/laravel and tell us how that worked out.

Good luck!

07 Aug
3 years ago

StuffedGoat left a reply on Blade File: Timestamp Format And Leading Space

@Snapey Nope :( Than he has some problems with version.

FatalErrorException in 79da7e70c5a57c64fe8eac4b4e3cf4bb line 1:
syntax error, unexpected 'version' (T_STRING)

This is driving me nuts...

I also tried to change my php.ini -> short_open_tag = 0 without luck. Wheather with shorttags yes or no neither of them worked.

<?php echo '<?xml version="1.0" encoding="utf-8" ?>'; ?>

StuffedGoat left a reply on Blade File: Timestamp Format And Leading Space

@thepsion5 Yes, when I remove altogehter the leading space is gone, so I thinks it's because of the <? ?> notation. When I just write test at the first line it is also without a leading space.

I don't fully understand your <?=$xmlOpenTag; ?> In Blade file I have to use the {{ }} syntax to readout a variable -> so this doesn't work for me <?={{ $tmp }} ?> nor <?= $tmp; ?>

StuffedGoat left a reply on Blade File: Timestamp Format And Leading Space

Hmm.

I must close this because it is a specification from http://www.sitemaps.org/protocol.html. Or do I misunderstand you? Which codefragment would you change?

StuffedGoat started a new conversation Blade File: Timestamp Format And Leading Space

Hi! I'm building a Sitemap Generator and have some issues with it and kindly ask if you could give me some input.

  1. I want to change the date format of {{ unix() }} to match the standards of sitemap protocol. Is this in some way possible in a Blade file?
  2. You can see that I'm forwading a $tmp variable into the view to render this: . I also tried to put this into the Blade file: '; ?> But how ever I do this he puts a leading space before the line. :-) How can I get rid of this? (This produces an error since it expulses against the Sitemap protocol.

Here is my code:

// Method for creating the view

public function showSitemap()
{   
    $pages = Page::all();       
    $tmp = "<?xml version='1.0' encoding='UTF-8'?>";        
    return response()->view('backend.pages.sitemap', ['pages' => $pages, 'tmp' => $tmp])->header('Content-Type', 'text/xml;charset=UTF-8');
}

// My Blade File

{!! $tmp !!}
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
@foreach($pages as $page)
    <url>
        <loc>http://www.example.org/{{ $page->url }}</loc>
        <lastmod>{{ unix() }}</lastmod>
        <changefreq>daily</changefreq>
        <priority>0.8</priority>
    </url>
@endforeach
</urlset>

And the error message: Alt Text