Andreas94

Andreas94

Member Since 2 Years Ago

Experience Points 2,370
Experience Level 1

2,630 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 1
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.

07 Jul
1 week ago

Andreas94 started a new conversation Tracing Back To The Id Generated By An Insert

Hi guys, I'm catching on IP.Board to my laravel project, I need to insert queries without having to create a model.

I inserted in my post:


      \DB::table('forums_topics')->insert([
        'title'      => $articoli->titolo,
        'state'             => "open",
        'last_post'      => Carbon::now()->timestamp,
      ]);

but I need to get the id generated to insert it in this new query:

      \DB::table('forums_posts')->insert([
        'author_id'      => Auth::user()->id,
        'author_name'             => Auth::user()->username,
        'post_date' => Carbon::now()->timestamp,
        'post' => $request->get('testo'),
        'topic_id' => HERE
      ]);

in a simple new query I would have recalled the save() variable, but how can I do it here?

15 Jun
1 month ago

Andreas94 started a new conversation Delete Query After Checkbox Not Work

Hi guys, I have a list of elements, that if checkboxes are flagged, these elements must be eliminated otherwise you proceed with the change of the other fields:

  public function postOrderDLC(Request $request, $giocoId) {
    $giochi_dlc = GiochiDLC::where('id_gioco_main', $giocoId)->get();

    foreach ($giochi_dlc as $value) {

      if( Input::get('delete'.$value->id, false)) {

        GiochiDLC::where('id', $value->id )->delete();

      } else {

        $value->order = $request->get('order'.$value->id);
        $value->save();
      }

    }
    return \Redirect::back();

  }

        @foreach ($giochi_dlc as $value)

        <tr>
          <th scope="row">
            <div class="custom-control custom-checkbox">
              <input type="checkbox" class="custom-control-input" id="delete{{$value->id}}">
              <label class="custom-control-label" for="delete{{$value->id}}"></label>
            </div>
          </th>
          <td>{{$value->gioco->nome}}</td>
          <td><input type="text" class="form-control col-2" name="order{{$value->id}}" value="{{$value->order}}"></td>
        </tr>
          @endforeach

the fields are updated correctly whereas instead, even if I put the flag in a checkbox, the element is not deleted ... why? where am I wrong? This is a post request.

14 Jun
1 month ago

Andreas94 started a new conversation How To Send A Post Request In Dynamic Input Fields

Hi everyone,

It's been a while since I'd like to integrate dynamic input fields into my project as you can see in this example:

http://jsfiddle.net/lemonkazi/re8e2yov/

The question I have always asked myself is: How can I send a post request?

Up until now I have always taken the name which is unique and I put it in the post controller with a get request, how do you behave in these cases?

10 Jun
1 month ago

Andreas94 left a reply on Error Composer When I Add A Repository

Ok no, i have again this problem.

but now:

Using version ^1.2 for toolkito/larasap
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Conclusion: remove laravel/framework v5.8.0
    - Installation request for laravel/framework (locked at v5.8.0, required as 5.8.*) -> satisfiable by laravel/framework[v5.8.0].
    - Conclusion: don't install illuminate/support v5.8.0
    - Conclusion: don't install laravel/framework v5.8.0
    - toolkito/larasap V1.2.2 requires illuminate/support 5.5.x|5.6.x -> satisfiable by illuminate/support[5.5.x-dev, 5.6.x-dev].
    - toolkito/larasap V1.2.3 requires illuminate/support 5.6.x|5.7.x -> satisfiable by illuminate/support[5.6.x-dev, 5.7.x-dev].
    - don't install illuminate/support 5.5.x-dev|don't install laravel/framework v5.8.0
    - don't install illuminate/support 5.6.x-dev|don't install laravel/framework v5.8.0
    - don't install illuminate/support 5.7.x-dev|don't install laravel/framework v5.8.0
    - Installation request for illuminate/support 5.8 -> satisfiable by illuminate/support[v5.8.0], laravel/framework[v5.8.0].
    - Installation request for toolkito/larasap ^1.2 -> satisfiable by toolkito/larasap[V1.2.2, V1.2.3].


Installation failed, reverting ./composer.json to its original content.

maybe it is not comaptibile with laravel 5.8?

Andreas94 left a reply on Error Composer When I Add A Repository

@VAN1310 - thank you very much solved only with:

"illuminate/support": "5.8",

Andreas94 started a new conversation Error Composer When I Add A Repository

I get this error when I try to add this repo to my composer:

https://github.com/alihesari/laravel-social-auto-posting

  Problem 1
    - Conclusion: remove laravel/framework v5.8.20
    - Conclusion: don't install laravel/framework v5.8.20
    - toolkito/larasap V1.2.2 requires illuminate/support 5.5.x|5.6.x -> satisfiable by illuminate/support[5.5.x-dev, 5.6.x-dev, v5.5.0, v5.5.16, v5.5.17, v5.5.2, v5.5.28, v5.5.33, v5.5.34, v5.5.35, v5.5.36, v5.5.37, v5.5.39, v5.5.40, v5.5.41, v5.5.43, v5.5.44, v5.6.0, v5.6.1, v5.6.10, v5.6.11, v5.6.12, v5.6.13, v5.6.14, v5.6.15, v5.6.16, v5.6.17, v5.6.19, v5.6.2, v5.6.20, v5.6.21, v5.6.22, v5.6.23, v5.6.24, v5.6.25, v5.6.26, v5.6.27, v5.6.28, v5.6.29, v5.6.3, v5.6.30, v5.6.31, v5.6.32, v5.6.33, v5.6.34, v5.6.35, v5.6.36, v5.6.37, v5.6.38, v5.6.39, v5.6.4, v5.6.5, v5.6.6, v5.6.7, v5.6.8, v5.6.9].
    - toolkito/larasap V1.2.3 requires illuminate/support 5.6.x|5.7.x -> satisfiable by illuminate/support[5.6.x-dev, 5.7.17, 5.7.18, 5.7.19, 5.7.x-dev, v5.6.0, v5.6.1, v5.6.10, v5.6.11, v5.6.12, v5.6.13, v5.6.14, v5.6.15, v5.6.16, v5.6.17, v5.6.19, v5.6.2, v5.6.20, v5.6.21, v5.6.22, v5.6.23, v5.6.24, v5.6.25, v5.6.26, v5.6.27, v5.6.28, v5.6.29, v5.6.3, v5.6.30, v5.6.31, v5.6.32, v5.6.33, v5.6.34, v5.6.35, v5.6.36, v5.6.37, v5.6.38, v5.6.39, v5.6.4, v5.6.5, v5.6.6, v5.6.7, v5.6.8, v5.6.9, v5.7.0, v5.7.1, v5.7.10, v5.7.11, v5.7.15, v5.7.2, v5.7.20, v5.7.21, v5.7.22, v5.7.23, v5.7.26, v5.7.27, v5.7.28, v5.7.3, v5.7.4, v5.7.5, v5.7.6, v5.7.7, v5.7.8, v5.7.9].
    - don't install illuminate/support 5.5.x-dev|don't install laravel/framework v5.8.20
    - don't install illuminate/support 5.6.x-dev|don't install laravel/framework v5.8.20
    - don't install illuminate/support 5.7.17|don't install laravel/framework v5.8.20
    - don't install illuminate/support 5.7.18|don't install laravel/framework v5.8.20
    - don't install illuminate/support 5.7.19|don't install laravel/framework v5.8.20
    - don't install illuminate/support 5.7.x-dev|don't install laravel/framework v5.8.20
    - don't install illuminate/support v5.5.0|don't install laravel/framework v5.8.20
    - don't install illuminate/support v5.5.16|don't install laravel/framework v5.8.20
    - don't install illuminate/support v5.5.17|don't install laravel/framework v5.8.20
    - don't install illuminate/support v5.5.2|don't install laravel/framework v5.8.20
    - don't install illuminate/support v5.5.28|don't install laravel/framework v5.8.20
    - don't install illuminate/support v5.5.33|don't install laravel/framework v5.8.20
    - don't install illuminate/support v5.5.34|don't install laravel/framework v5.8.20
    - don't install illuminate/support v5.5.35|don't install laravel/framework v5.8.20
    - don't install illuminate/support v5.5.36|don't install laravel/framework v5.8.20
    - don't install illuminate/support v5.5.37|don't install laravel/framework v5.8.20
    - don't install illuminate/support v5.5.39|don't install laravel/framework v5.8.20
    - don't install illuminate/support v5.5.40|don't install laravel/framework v5.8.20
    - don't install illuminate/support v5.5.41|don't install laravel/framework v5.8.20
    - don't install illuminate/support v5.5.43|don't install laravel/framework v5.8.20
    - don't install illuminate/support v5.5.44|don't install laravel/framework v5.8.20
    - don't install illuminate/support v5.6.0|don't install laravel/framework v5.8.20
    - don't install illuminate/support v5.6.1|don't install laravel/framework v5.8.20
    - don't install illuminate/support v5.6.10|don't install laravel/framework v5.8.20
    - don't install illuminate/support v5.6.11|don't install laravel/framework v5.8.20
    - don't install illuminate/support v5.6.12|don't install laravel/framework v5.8.20
    - don't install illuminate/support v5.6.13|don't install laravel/framework v5.8.20
    - don't install illuminate/support v5.6.14|don't install laravel/framework v5.8.20
    - don't install illuminate/support v5.6.15|don't install laravel/framework v5.8.20
    - don't install illuminate/support v5.6.16|don't install laravel/framework v5.8.20
    - don't install illuminate/support v5.6.17|don't install laravel/framework v5.8.20
    - don't install illuminate/support v5.6.19|don't install laravel/framework v5.8.20
    - don't install illuminate/support v5.6.2|don't install laravel/framework v5.8.20
    - don't install illuminate/support v5.6.20|don't install laravel/framework v5.8.20
    - don't install illuminate/support v5.6.21|don't install laravel/framework v5.8.20
    - don't install illuminate/support v5.6.22|don't install laravel/framework v5.8.20
    - don't install illuminate/support v5.6.23|don't install laravel/framework v5.8.20
    - don't install illuminate/support v5.6.24|don't install laravel/framework v5.8.20
    - don't install illuminate/support v5.6.25|don't install laravel/framework v5.8.20
    - don't install illuminate/support v5.6.26|don't install laravel/framework v5.8.20
    - don't install illuminate/support v5.6.27|don't install laravel/framework v5.8.20
    - don't install illuminate/support v5.6.28|don't install laravel/framework v5.8.20
    - don't install illuminate/support v5.6.29|don't install laravel/framework v5.8.20
    - don't install illuminate/support v5.6.3|don't install laravel/framework v5.8.20
    - don't install illuminate/support v5.6.30|don't install laravel/framework v5.8.20
    - don't install illuminate/support v5.6.31|don't install laravel/framework v5.8.20
    - don't install illuminate/support v5.6.32|don't install laravel/framework v5.8.20
    - don't install illuminate/support v5.6.33|don't install laravel/framework v5.8.20
    - don't install illuminate/support v5.6.34|don't install laravel/framework v5.8.20
    - don't install illuminate/support v5.6.35|don't install laravel/framework v5.8.20
    - don't install illuminate/support v5.6.36|don't install laravel/framework v5.8.20
    - don't install illuminate/support v5.6.37|don't install laravel/framework v5.8.20
    - don't install illuminate/support v5.6.38|don't install laravel/framework v5.8.20
    - don't install illuminate/support v5.6.39|don't install laravel/framework v5.8.20
    - don't install illuminate/support v5.6.4|don't install laravel/framework v5.8.20
    - don't install illuminate/support v5.6.5|don't install laravel/framework v5.8.20
    - don't install illuminate/support v5.6.6|don't install laravel/framework v5.8.20
    - don't install illuminate/support v5.6.7|don't install laravel/framework v5.8.20
    - don't install illuminate/support v5.6.8|don't install laravel/framework v5.8.20
    - don't install illuminate/support v5.6.9|don't install laravel/framework v5.8.20
    - don't install illuminate/support v5.7.0|don't install laravel/framework v5.8.20
    - don't install illuminate/support v5.7.1|don't install laravel/framework v5.8.20
    - don't install illuminate/support v5.7.10|don't install laravel/framework v5.8.20
    - don't install illuminate/support v5.7.11|don't install laravel/framework v5.8.20
    - don't install illuminate/support v5.7.15|don't install laravel/framework v5.8.20
    - don't install illuminate/support v5.7.2|don't install laravel/framework v5.8.20
    - don't install illuminate/support v5.7.20|don't install laravel/framework v5.8.20
    - don't install illuminate/support v5.7.21|don't install laravel/framework v5.8.20
    - don't install illuminate/support v5.7.22|don't install laravel/framework v5.8.20
    - don't install illuminate/support v5.7.23|don't install laravel/framework v5.8.20
    - don't install illuminate/support v5.7.26|don't install laravel/framework v5.8.20
    - don't install illuminate/support v5.7.27|don't install laravel/framework v5.8.20
    - don't install illuminate/support v5.7.28|don't install laravel/framework v5.8.20
    - don't install illuminate/support v5.7.3|don't install laravel/framework v5.8.20
    - don't install illuminate/support v5.7.4|don't install laravel/framework v5.8.20
    - don't install illuminate/support v5.7.5|don't install laravel/framework v5.8.20
    - don't install illuminate/support v5.7.6|don't install laravel/framework v5.8.20
    - don't install illuminate/support v5.7.7|don't install laravel/framework v5.8.20
    - don't install illuminate/support v5.7.8|don't install laravel/framework v5.8.20
    - don't install illuminate/support v5.7.9|don't install laravel/framework v5.8.20
    - Installation request for laravel/framework (locked at v5.8.20, required as 5.8.*) -> satisfiable by laravel/framework[v5.8.20].
    - Installation request for toolkito/larasap ^1.2 -> satisfiable by toolkito/larasap[V1.2.2, V1.2.3].


Installation failed, reverting ./composer.json to its original content.

My composer is currently:

    "require": {
        "php": "^7.1.3",
        "arrilot/laravel-widgets": "^3.12",
        "artesaos/seotools": "^0.12.1",
        "bkwld/croppa": "^4.7",
        "ecrmnn/laravel-https": "^1.0",
        "fideloper/proxy": "^4.0",
        "greggilbert/recaptcha": "dev-master",
        "intervention/image": "^2.4",
        "jenssegers/date": "^3.4",
        "laravel/framework": "5.8.*",
        "laravel/passport": "^7.2",
        "laravel/scout": "^3.0",
        "laravel/socialite": "^4.0",
        "laravel/tinker": "^1.0",
        "laravelcollective/html": "^5.8",
        "laravelium/feed": "3.1.*",
        "laravelium/sitemap": "3.1.*",
        "silviolleite/laravelpwa": "^1.0"
    },

Where is the error?

09 Jun
1 month ago

Andreas94 left a reply on Include Auth Or Personal Variable In Config.

I also have this problem, no idea?

17 May
2 months ago

Andreas94 started a new conversation Error Unable To Prepare Route [api/user] For Serialization. Uses Closure.

Hi guys, I have been carrying this error for several months, which is not a problem but I want to solve it:

In Route.php line 917:

  Unable to prepare route [api/user] for serialization. Uses Closure.

I read that you have to comment on the code in route / api.php

Route::middleware('auth:api')->get('/user', function (Request $request) {
    return $request->user();
});

after giving the command php artisan route:cache

But now I get the error:

In Route.php line 917:

  Unable to prepare route [{fallbackPlaceholder}] for serialization. Uses Closure.
08 May
2 months ago

Andreas94 left a reply on Edit Delete Permissions In Package Chatter

no idea to add this feature?

07 May
2 months ago

Andreas94 started a new conversation Edit Delete Permissions In Package Chatter

I state by saying that I have also opened a ticket on github hoping for a response from the developer, but this one does not arrive and since this site uses this packages, I hope you can help me.

The packages I'm talking about is: thedevdojo/chatter

I just installed Chatter in my Laravel 5.7 and wanted to include moderation features. In my configuration the permissions are:

$user->role 1 -> user $user->role 2 -> editor $user->role 3 -> moderator $user->role 4 -> admin

I have seen that only the message owner can modify or delete the message and if I have not seen badly, it is the function destroy in ChatterPostController.php

        $post = Models::post()->with('discussion','user')->findOrFail($id);

        if ($request->user()->id !== (int) $post->user_id && $request->user()->role === '1') {
            return redirect('/'.config('chatter.routes.home'))->with([
                'chatter_alert_type' => 'danger',
                'chatter_alert'      => trans('chatter::alert.danger.reason.destroy_post'),
            ]);
        }

        if ($post->discussion->posts()->oldest()->first()->id === $post->id || $post->user->role === '4') {
            if(config('chatter.soft_deletes')) {
                $post->discussion->posts()->delete();
                $post->discussion()->delete();
            } else {
                $post->discussion->posts()->forceDelete();
                $post->discussion()->forceDelete();
            }

            return redirect('/'.config('chatter.routes.home'))->with([
                'chatter_alert_type' => 'success',
                'chatter_alert'      => trans('chatter::alert.success.reason.destroy_post'),
            ]);
        }

But if I have messages in the topic:

ID 1 ID 1 ID 7

(And I'm ID 7)

when I delete the second ID1 message, my message (ID7) is also deleted.

Is it possible that there is no integrated moderation system in the forum system?

30 Apr
2 months ago

Andreas94 left a reply on Page Not Displayed In Public/forum

I discovered that the error is when I activate the IP.Board Rewrite URLS and I enter the provided htaccess

<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteBase /forum/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule \.(js|css|jpeg|jpg|gif|png|ico|map)(\?|$) /forum/404error.php [L,NC]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /forum/index.php [L]
</IfModule>

what can it be that creates problems?

27 Apr
2 months ago

Andreas94 left a reply on Page Not Displayed In Public/forum

@BOBBYBOUWMANN - Root


<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>

    RewriteEngine On

    RewriteCond %{REQUEST_FILENAME} -d [OR]
    RewriteCond %{REQUEST_FILENAME} -f
    RewriteRule ^ ^ [N]

    RewriteCond %{REQUEST_URI} (\.\w+$) [NC]
    RewriteRule ^(.*)$ public/ 

    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ server.php

</IfModule>

Public


<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>

    RewriteEngine On

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)/$ / [L,R=301]

    RewriteCond %{HTTP_HOST} ^www\.domain\.net [NC]
    RewriteRule ^(.*)$ https://domain.net/ [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]

    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

</IfModule>
26 Apr
2 months ago

Andreas94 left a reply on Page Not Displayed In Public/forum

hi @bobbybouwmann , I added the string 20 but it still doesn't display the page

Andreas94 started a new conversation Page Not Displayed In Public/forum

Hi everyone, I was thinking of creating a forum in InvisionPower by creating a SSO system for my Laravel project but I can't understand why the files in / public / forum are not shown.

If I create an index.html file and visit / forum I will be shown a blank page, while if I visit /forum/index.html the correct file will be shown...

With this problem I can't install the board properly.

what is a problem with the Laravel htaccess?

20 Apr
2 months ago

Andreas94 left a reply on &#039; When Saved In The Db

@BOBBYBOUWMANN - in my blade I already use {{$value->giochi->nome}} but I still see the symbols.

I tried to do in php:


      $trophy->nome = htmlspecialchars($name_clear);
      $trophy->save();
      $trophy->slug = $trophy->id.'-'.Str::slug($trophy->nome, '-');
      $trophy->save();

but it continues to save me symbols both in the name and in the slug

Andreas94 started a new conversation &#039; When Saved In The Db

in the admin of my site I added the simple dom HTML library to extract data, but i have a big problem.

in the site where I extract the data, there is a sentence with the apostrophe, only that I save it in html entities.

site:

Demone dell'odio

my site:

<td>Demone dell&amp;#039;odio</td>

how do I make the symbol appear and not the entity? because it also saves me in the slug..

this is my code:

      $name_clear = preg_replace('/\s+/', ' ', $value->find('div.trophy-title', 0)->plaintext);

      $trophy->nome = $name_clear;
06 Jan
6 months ago

Andreas94 left a reply on Error With Relationship Instance

@ADAMPRICKETT - Yes, the fields is:

{
id: 4277,
id_gioco: 100,
id_pub: 20,
nome: "Westworld",
website: "http://www.wbgames.com/",
logo: "",
data_in: "",
data_out: "",
slug: "110-westworld",
created_at: "2018-06-21 16:05:09",
updated_at: "2018-06-21 16:05:36",
publisher: "20",
copertina: "1706266855-copertina.jpg",
},

If I understood correctly, I was telling myself to do:

        public function getCopertinaAttribute()
      {
            if(!empty($this->attributes['copertina'])) {
                if(file_exists(public_path('upload/copertina/'.$this->attributes['copertina'])))    {
            return 'upload/copertina/'.$this->attributes['copertina'];
            }    else    {
            return 'upload/listagiochi.png';
          }
            }   else    {
                 return 'upload/listagiochi.png';
             }
      }

but to recall it in the blade? $value->copertina() ?

Andreas94 started a new conversation Error With Relationship Instance

Hello everyone, I have updated my Laravel from 5.4 to 5.7, everything works fine, I have adapted the code by removing and replacing the deprecated codes... But...

But I have a problem on one page and I can not get through it:

Models\Publisher

        public function copertina()
      {
            if(!empty($this->copertina)) {
                if(file_exists(public_path('upload/copertina/'.$this->copertina)))  {
            return 'upload/copertina/'.$this->copertina;
            }    else    {
            return 'upload/listagiochi.png';
          }
            }   else    {
                 return 'upload/listagiochi.png';
             }
      }

Controller

            $publisher = Publisher::where('slug', $slug)->first();
            $publisher_pivot = \App\Models\Publisher_pivot::join('publisher', 'publisher_pivot.id_pub', '=','publisher.id')
                                                        ->join('giochi', 'publisher_pivot.id_gioco', '=', 'giochi.id')
                                                        ->join('info_giochi', 'publisher_pivot.id_gioco', '=', 'info_giochi.id_gioco')
                                                        ->where('id_pub', $publisher->id)
                                                        ->groupBy('info_giochi.id_gioco')
                                                        ->orderBy('data')
                                                        ->get();

Blade

      @foreach ($publisher_pivot as $value)
            <img src="{{url($value->copertina())}}" alt="{{$value->nome}}"> </div>
      @endforeach

I receive the error: App\Models\Publisher::copertina must return a relationship instance. (View: C:\xampp\htdocs\lv\resources\views\front\pages\company\pub.blade.php) How ever updating my laravel, do I have this problem? I've done some research that takes me on stackoverflow, but they do not help me to deal with it

01 Aug
11 months ago

Andreas94 started a new conversation Create Queries For Each Value Selected In The Multiselect

Hello everyone, I have a problem ... For every option I select in the multiselect, I would need to create a query in pivot_quest, both in two different queries, unfortunately I get the error:

Array to string conversion (SQL: insert intopivot_quest(id_quest,id_user,exp,salary,updated_at,created_at) values (0, 1, 0, 0, 2018-08-01 19:19:43, 2018-08-01 19:19:43))

This is my code:

Blade:

                    <select name="id_user[]" class="form-group" multiple>
                      @foreach ($user as $value)
                        <option value="{{$value->id}}"> {{$value->username}}</option>
                      @endforeach
                    </select>

Controller:

    $id_users = (array)$request->get('id_user');

    foreach ($id_users as $value) {
      $pivot_quest = new Pivot_Quest();
      $pivot_quest->id_quest = $request->get('id_quest');
      $pivot_quest->id_user = $request->get('id_user');
      $pivot_quest->exp = '0';
      $pivot_quest->salary = '0';
      $pivot_quest->save();
    }

Where am I doing wrong?

28 Jul
11 months ago

Andreas94 started a new conversation Request Ajax Never Receives Error

Hi everyone, I've created an ajax request with integrated Notquery jquery notifications, only I can never get an error.

    public function postPurchase(Request $request)  {
        #I take the item to buy
          $object = Objects::where('id', $request->input('id_obj'))->first();

          #I check the money that is left to the user after the purchase
          #I look at if the user has the money for the purchase
          $rest = Auth::user()->money - $object->price;

          if($rest >= "0" || Auth::user()->money > $object->price) {
            $logpurchase = new  LogsPurchase();
            $logpurchase->id_user = Auth::id();
            $logpurchase->id_obj = $request->input('id_obj');
            $logpurchase->money = $object->price;
            $logpurchase->save();
            $inventory = new Inventory();
            $inventory->id_user = Auth::id();
            $inventory->id_obj = $request->input('id_obj');
            $inventory->save();
            #I update the user's money in the user table
            User::where('id', Auth::id())->update(['money' => $rest]);

            $response = array(
              'status' => 'success',
              'msg' => $request->message,
            );
            return response()->json($response);
          } else {
            $response = array(
              'status' => 'error',
              'msg' => $request->message,
            );
            return response()->json($response);
          }
    }

Ajax:

<script type="text/javascript">
  $(function() {

    var id_obj = {{$value->id}};
      $("#{{$value->id}}").click(function(e) {
          $.ajax({
              type: "GET",
              url: "{{url('ajax/purchase')}}",
              cache:false,
              data: {
                id_obj: id_obj,
              },
              success: function(response) {
                console.log("success");
                    $("#{{$value->id}}").attr('disabled', true);
                    new Noty({
                      type: 'success',
                      layout: 'topRight',
                      type: 'info',
                      theme: 'mint',
                      layout: 'topRight',
                      timeout: 4000,
                      text: 'You have just bought {{$value->name}}.'
                    }).show();

            },
              error: function(response) {
                console.log("error");
                $("#{{$value->id}}").attr('disabled', true);
                new Noty({
                  type: 'error',
                  layout: 'topRight',
                  type: 'info',
                  theme: 'mint',
                  layout: 'topRight',
                  timeout: 4000,
                  text: 'Error, you could not buy {{$value->name}}.'
                }).show();
              }
          });
      });
  });
</script>

Every time the user clicks the button, even if he does not have the money, in the console of chrome appears success and never error, how can I get the error generated? Where am I doing wrong?

17 Jan
1 year ago
16 Jan
1 year ago

Andreas94 left a reply on Which Session Driver Do You Recommend?

I bring this discussion back to life a few weeks ago. I set 120 as suggested by @Snapey, unfortunately, however, users find themselves having to log in to the site several times a day ... how can I avoid this?

08 Jan
1 year ago

Andreas94 left a reply on Which Session Driver Do You Recommend?

I'm not hiding anything... I simply do not understand why it saves every single session and page visited, these are some contents of the files:

a:3:{s:6:"_token";s:40:"l5bbPnKcUdloPAwKSyO0qMkgpdZK83KIGBFo8t8f";s:9:"_previous";a:1:{s:3:"url";s:63:"/trofei/viva-ferrari";}s:6:"_flash";a:2:{s:3:"old";a:0:{}s:3:"new";a:0:{}}}
a:3:{s:6:"_token";s:40:"Rp4wEKoHQiOh4E1chSWMxmufbVgJRQjRtxnoDbOS";s:9:"_previous";a:1:{s:3:"url";s:147:"nuovo-trailer-di-sid-meiers-civilization-vi-rise-and-fall";}s:6:"_flash";a:2:{s:3:"old";a:0:{}s:3:"new";a:0:{}}}

Honestly, I do not even understand what it means:

s:6:"_flash";a:2:{s:3:"old";a:0:{}s:3:"new";a:0:{}

Andreas94 left a reply on Which Session Driver Do You Recommend?

No, In domain I have:

'domain' => env('SESSION_DOMAIN', null),

and in the env it is not reported, so it is null...

Now i have 9998 file for 2348450 bytes = 2,34 megabytes

07 Jan
1 year ago

Andreas94 left a reply on Which Session Driver Do You Recommend?

In 5 hours, 3912 files... Is this normal?

Andreas94 left a reply on Which Session Driver Do You Recommend?

@Snapey What are the file sessions to contain? only when a user logins in?

Because to me is also saved every page that the user visits, example:

a:3:{s:6:"_token";s:40:"2J2Y6YfFMO8ZuqWV64bnuw36L8Uymq4h78aBMn75";s:9:"_previous";a:1:{s:3:"url";s:28:"/rss.php";}s:6:"_flash";a:2:{s:3:"old";a:0:{}s:3:"new";a:0:{}}}
a:3:{s:6:"_token";s:40:"2mUfgeulnmhGN0eS1jAXxEYEZdV3aiLnnMRAARbl";s:9:"_previous";a:1:{s:3:"url";s:61:"giochi/the-witness-pc/gallery";}s:6:"_flash";a:2:{s:3:"old";a:0:{}s:3:"new";a:0:{}}}

Why this thing? I just reactivated the Sessions with files and I already have 143 files...

@Shez1983 If the user deletes cookies it is because he wants to remove access ... But how come you say that they are few sure?

06 Jan
1 year ago

Andreas94 left a reply on Which Session Driver Do You Recommend?

It is a site with about 4700 unique visits a day @gator, if I set "lifetime" in config/session.php, with an expiration of about 43200 minutes = 30 days, the storage/framework /session directory is emptied every month, but then all users every thirty days have to re-login.

Realize that I have converted my portal in Laravel for about 6 days ... In a week that folder weighed 10MB and inside there were more than 150k files... If I had to put it every 30 days the folder would explode...

But what are these files for? everything that users do on the site or just logins?

@shez1983 And selecting cookies, how do you save the same data I'm saving now with files?

Andreas94 started a new conversation Which Session Driver Do You Recommend?

Hello everyone, at the moment I use the Session Drive "file", but unfortunately the folder / storage/framework/sessions now weighs more than 10MB and has in many files...

What do you recommend? which one do you use? Is it safe to use cookies?

02 Jan
1 year ago

Andreas94 left a reply on Site Reachable With Both /public And Without

nobody knows how to force the use of https without receiving this problem?

Can these package help me?

https://github.com/ecrmnn/laravel-https

01 Jan
1 year ago

Andreas94 left a reply on Site Reachable With Both /public And Without

ok I found out that the culprit of everything was:

RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

So now I miss it only to understand how to force the redirect 301 from http to https:

Reading many guides, they advise to put this in app\Providers\AppServiceProvider.php

    \URL::forceScheme('https');

But by doing so, I receive all the url of the page in HTTPS (css,js,image...), but the user continues to stay on an http page... How can I do?

Andreas94 left a reply on Site Reachable With Both /public And Without

@jlrdw I know very well that this topic can also be dealt with eight hundred times, I also searched on stackoverflow which have recommended different configuration... but the site works great for me, and the problem is only when a user visits the site without https that is brought to https://domain.ext/public/$1 instead of https://domain.ext/$1 but if one visits the site from https:// everything works fine

@GertjanRoke unfortunately if one enters from http it is routed to https with the public folder...

Andreas94 left a reply on Site Reachable With Both /public And Without

I discovered that this problem is created when a user tries to enter the site without http. If a user visits the site with http://hello.com he is referred to http://hello.com/public To force the use of https I used:

# Force SSL
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Andreas94 started a new conversation Site Reachable With Both /public And Without

Hi I have correctly configured laravel on my hosting, however the site is reachable both from:

https://hello.com https://hello.com/public

making it then become the url:

https://hello.com/article/... https://hello.com/public/article/...

How can I overcome this problem?

I tried with:

RewriteRule "^public\/(.+)" "https://hello.com/" [R,L]

but the redirect does not consider it...

28 Dec
1 year ago

Andreas94 left a reply on Recognize The Page Indicated In The Error Log

No one has any idea how I can save the url of the page where there is an error in laravel.log

As the laravel.log is now realized, I can not know what is causing the error...

Andreas94 started a new conversation Recognize The Page Indicated In The Error Log

Hi, I noticed that a mistake is reported in the error strange log,that I visit the pages not reflected.

is it possible to save the address of the page where the error is located in the log?

The error I receive is of a variable, here it is:

[2017-12-28 16:59:08] production.ERROR: ErrorException: Undefined variable: infogioco in /home/game/public_html/storage/framework/views/2aa2153dd4bd8ee731fa4fcff4e8167f6f788ab7.php:72
Stack trace:
#0 /home/game/public_html/storage/framework/views/2aa2153dd4bd8ee731fa4fcff4e8167f6f788ab7.php(72): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(8, 'Undefined varia...', '/home/game/...', 72, Array)
#1 /home/game/public_html/vendor/laravel/framework/src/Illuminate/View/Engines/PhpEngine.php(42): include('/home/game/...')
#2 /home/game/public_html/vendor/laravel/framework/src/Illuminate/View/Engines/CompilerEngine.php(59): Illuminate\View\Engines\PhpEngine->evaluatePath('/home/game/...', Array)
#3 /home/game/public_html/vendor/laravel/framework/src/Illuminate/View/View.php(137): Illuminate\View\Engines\CompilerEngine->get('/home/game/...', Array)
#4 /home/game/public_html/vendor/laravel/framework/src/Illuminate/View/View.php(120): Illuminate\View\View->getContents()
#5 /home/game/public_html/vendor/laravel/framework/src/Illuminate/View/View.php(85): Illuminate\View\View->renderContents()
#6 /home/game/public_html/vendor/laravel/framework/src/Illuminate/Http/Response.php(38): Illuminate\View\View->render()
#7 /home/game/public_html/vendor/symfony/http-foundation/Response.php(200): Illuminate\Http\Response->setContent(Object(Illuminate\View\View))
#8 /home/game/public_html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(615): Symfony\Component\HttpFoundation\Response->__construct(Object(Illuminate\View\View))
#9 /home/game/public_html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(572): Illuminate\Routing\Router->prepareResponse(Object(Illuminate\Http\Request), Object(Illuminate\View\View))
#10 /home/game/public_html/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(30): Illuminate\Routing\Router->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#11 /home/game/public_html/vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php(41): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#12 /home/game/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): Illuminate\Routing\Middleware\SubstituteBindings->handle(Object(Illuminate\Http\Request), Object(Closure))
#13 /home/game/public_html/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#14 /home/game/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php(65): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#15 /home/game/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): Illuminate\Foundation\Http\Middleware\VerifyCsrfToken->handle(Object(Illuminate\Http\Request), Object(Closure))
#16 /home/game/public_html/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#17 /home/game/public_html/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php(49): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#18 /home/game/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): Illuminate\View\Middleware\ShareErrorsFromSession->handle(Object(Illuminate\Http\Request), Object(Closure))
#19 /home/game/public_html/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#20 /home/game/public_html/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(64): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#21 /home/game/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): Illuminate\Session\Middleware\StartSession->handle(Object(Illuminate\Http\Request), Object(Closure))
#22 /home/game/public_html/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#23 /home/game/public_html/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php(37): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#24 /home/game/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse->handle(Object(Illuminate\Http\Request), Object(Closure))
#25 /home/game/public_html/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#26 /home/game/public_html/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php(59): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#27 /home/game/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): Illuminate\Cookie\Middleware\EncryptCookies->handle(Object(Illuminate\Http\Request), Object(Closure))
#28 /home/game/public_html/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#29 /home/game/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(102): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#30 /home/game/public_html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(574): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#31 /home/game/public_html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(533): Illuminate\Routing\Router->runRouteWithinStack(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request))
#32 /home/game/public_html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(511): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))
#33 /home/game/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(176): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))
#34 /home/game/public_html/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(30): Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http\{closure}(Object(Illuminate\Http\Request))
#35 /home/game/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(30): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#36 /home/game/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle(Object(Illuminate\Http\Request), Object(Closure))
#37 /home/game/public_html/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#38 /home/game/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(30): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#39 /home/game/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle(Object(Illuminate\Http\Request), Object(Closure))
#40 /home/game/public_html/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#41 /home/game/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php(27): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#42 /home/game/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): Illuminate\Foundation\Http\Middleware\ValidatePostSize->handle(Object(Illuminate\Http\Request), Object(Closure))
#43 /home/game/public_html/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#44 /home/game/public_html/app/Http/Middleware/CheckForMaintenanceMode.php(26): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#45 /home/game/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): App\Http\Middleware\CheckForMaintenanceMode->handle(Object(Illuminate\Http\Request), Object(Closure))
#46 /home/game/public_html/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#47 /home/game/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(102): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#48 /home/game/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(151): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#49 /home/game/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(116): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request))
#50 /home/game/public_html/public/index.php(53): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))
#51 {main}
27 Dec
1 year ago

Andreas94 started a new conversation Create Slug With ID Via Socialite-Twitter

Hi I need to create a slug ID for each user who registers via Twitter.

This is my code:

RegisterController.php
    public function findOrCreateUser($user, $provider)
    {
        $authUser = User::where('provider_id', $user->id)->first();
        if ($authUser) {
            return $authUser;
        }
        return User::create([
            'username'     => $user->name,
            'email'    => $user->email,
            'provider' => $provider,
            'provider_id' => $user->id,
            'slug'  => $user->id.'-'.$user->name
        ]);
    }

As you can see, I put 'slug' => $user->id.'-'.$user->namebut in this way, he takes the ID of Twitter by creating a slug: 878784187-username and not 170-username.

How can I take my next ID?

21 Dec
1 year ago

Andreas94 left a reply on Exit From Maintenance Via Links

Thanks @Yama,

I created middleware:

namespace App\Http\Middleware;

use Closure;
use Illuminate\Foundation\Application;
use Illuminate\Foundation\Http\Exceptions\MaintenanceModeException;

class CheckForMaintenanceMode
{
    protected $app;

    public function __construct(Application $app)
    {
        $this->app = $app;
    }

    public function handle($request, Closure $next)
    {
        if ($this->app->isDownForMaintenance() && !$this->isBackendRequest($request)) {
            $data = json_decode(file_get_contents($this->app->storagePath() . '/framework/down'), true);

            throw new MaintenanceModeException($data['time'], $data['retry'], $data['message']);
        }

        return $next($request);
    }

    private function isBackendRequest($request)
    {
        return ($request->is('admin/*') or $request->is('login'));
    }
}

Kernel.php

    protected $middleware = [
        \Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode::class,
        \Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
        \App\Http\Middleware\TrimStrings::class,
        \Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
        \App\Http\Middleware\CheckForMaintenanceMode::class,
    ];

web.php

  Route::group(['middleware' => 'auth', 'prefix' => 'admincp'], function () {
    Route::get('/down', function() {\Artisan::call('down');});
    Route::get('/up', function() {\Artisan::call('up');});
  });

Unfortunately, Laravel continues to be properly maintained, but unfortunately I can not get it out of maintenance because the 'Service Unavailable' page appears...

Where am I doing wrong?

Andreas94 left a reply on Exit From Maintenance Via Links

I saw my approach was wrong, so I saw this discussion on stackoverflow:

https://stackoverflow.com/questions/21047573/maintenance-mode-without-using-artisan/29211512

The my.down file is created correctly, but I do not understand how to get the site maintenance by checking if the file exists.

With "Route::filter('applicationIsUp', function()" Laravel 5.4 gives me an error (1/1) InvalidArgumentException Attribute [filter] does not exist.

Andreas94 started a new conversation Exit From Maintenance Via Links

Hello, I need to send the site in maintenance and exit through a link.

To get into maintenance I did:

  Route::get('/down', '[email protected]');
    public function down()
    {
        \Artisan::call('down');
    }

But why if the site is under maintenance and I go to link.ext/admin/up it does not work?

  Route::get('/up', '[email protected]');
    public function up()
    {
        \Artisan::call('up');
    }
08 Nov
1 year ago

Andreas94 left a reply on How Can I Manage Caches?

no advice?

07 Nov
1 year ago

Andreas94 started a new conversation How Can I Manage Caches?

Hi, I would set cache to lighten the load on the homepage, which is the page that takes us longer to load, about 950ms.

The original code is:

        $news_homepage  = "12";
        $articoli = Articoli::where('is_published', '0')->orderBy('created_at', 'desc')->limit($news_homepage)->get();
        $n_othernews    =   $articoli[0]->id - $news_homepage;
    $articoli_other = Articoli::where('is_published', '0')->where('id', '<', $n_othernews)->orderBy('created_at', 'desc')->limit('12')->get();
        $articoli_ajax = Articoli::where('is_published', '0')->where('id', '<', $articoli_other[11]->id)->orderBy('created_at', 'desc')->limit('6')->get();

        if ($request->ajax()) {
            $view = view('front.component.article.articoli_ajax',compact('articoli_ajax'))->render();
                    return response()->json(['html'=>$view]);
            }

I tried to handle the cache in this way:

        $articoli = \Cache::remember('article.first', 5, function()
            {
                return Articoli::where('is_published', '0')->orderBy('created_at', 'desc')->limit($news_homepage)->get();
            });

This works correctly, but how can I handle other queries correctly? is there a better way? unfortunately I'm stuck and I can not get it over...

23 Oct
1 year ago

Andreas94 left a reply on Email Not Sended With Namecheap

I'm trying it all locally with XAMPP, I configured it with mailtrap, I put that when one registers receives a welcome email, and the email is received correctly.

my code:

env

MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=d6d2dee51af1c3
MAIL_PASSWORD=c509ca11b7def1
MAIL_ENCRYPTION=tls

and for send the email, i have using in RegisterController:

Mail::to($user->email)->send(new Welcome);

but the reset password does not work... But this feature is to write to us, or is it already integrated into laravel's auth system?

22 Oct
1 year ago

Andreas94 left a reply on Email Not Sended With Namecheap

Sorry but I really do not understand, But then the password reset email system was not created, and should I create it manually?

Because although the guide is for Laravel 5.2, it works equally.

Andreas94 left a reply on Email Not Sended With Namecheap

Thanks @tisuchi, I followed this guide:

http://www.w3ii.com/it/laravel/laravel_sending_email.html

The email is shipped correctly, even if it goes spam, while the email to retrieve password does not send it, even spam...

Andreas94 left a reply on Email Not Sended With Namecheap

Hi, I'm using Laravel 5.4, i have installed guzzlehttp/guzzle and now with tinker the email is sent, but keep on using mailgun.org and not smtp...

What email code would you like to see? I'm using the laravel authentication system...

Andreas94 left a reply on Email Not Sended With Namecheap

Thanks for the reply. I will follow your advice. But I noticed in the debugbar that when I try to apply for a new password, it signals this error: https://image.ibb.co/bUwMMR/error.png

21 Oct
1 year ago

Andreas94 started a new conversation Email Not Sended With Namecheap

Hi, I installed laravel correctly in a namecheap shared-hosting, I'm trying to see if Laravel's password retrieves correctly, but I do not get the email.

This is my configuration in .env

MAIL_DRIVER=smtp
MAIL_HOST=mail.domain.ext
MAIL_PORT=465
[email protected]
MAIL_PASSWORD=password

my mail.php:

    'driver' => env('MAIL_DRIVER'),
    'host' => env('MAIL_HOST'),
    'port' => env('MAIL_PORT'),
    'from' => [
        'address' => env('MAIL_FROM_ADDRESS', '[email protected]'),
        'name' => env('MAIL_FROM_NAME', 'Example'),
    ],
    'encryption' => env('MAIL_ENCRYPTION', 'tls'),
    'username' => env('MAIL_USERNAME'),
    'password' => env('MAIL_PASSWORD'),
    'sendmail' => '/usr/sbin/sendmail -bs',

where am I wrong? I checked in the storage / log and I have no log...

17 Oct
1 year ago

Andreas94 left a reply on Why Cronjob Not Working?

i tried, he created the test.dat file with inside "hellohello".

Andreas94 started a new conversation Why Cronjob Not Working?

Hi I have problems configuring the cronjob command from my cpanel.

Kernel.php

    protected function schedule(Schedule $schedule)
    {
      $schedule->command('ActiveArticle:activearticles')->everyMinute();
    }

Console/Commands/ActiveArticle.php

  protected $signature = 'ActiveArticle:activearticles';

  protected $description = 'Attivo articolo';
[...]

If I did from the SSH terminal: php artisan schedule:run it's work:

[[email protected] www]$ php artisan schedule:run
Running scheduled command: '/opt/alt/php71/usr/bin/php' 'artisan' ActiveArticle:                                                                activearticles > '/dev/null' 2>&1

While cPanel does not work, I have set them:

          • php /home/calufngd/public_html/artisan schedule:run > /dev/null 2>&1

But nothing happens ... Where am I wrong?