Saturday, March 18, 2017

Can't see changes in blade Laravel 5.4

I recently started learning Laravel 5.4 and so far so good,but I have a problem with displaying the newest data in my .blade files-it's like Laravel has some sort of stupid caching

In routes I'm calling controller like this

Route::get('/home', 'PostController@get');

PostController.php

<?php

namespace App\Http\Controllers;


use Illuminate\Support\Facades\Auth;
use Validator;
use Session;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Hash;
use Illuminate\Routing\Controller;
use Illuminate\Validation\Rule;
use Illuminate\Support\Facades\DB;

class PostController extends Controller
{

/**
 * Home page
 *
 * @return void
 */
public function get(Request $request)
   {



        //$artisan = Artisan::call('view:clear'); -->failed attempt of clearing

       $posts = DB::table('posts')
       ->leftJoin('users','posts.id_user_post','=','users.id_user')
       ->orderBy('id_post','desc')
       ->get();

      if($request->session()->has('id'))
         {
            $options = DB::table('users')
            ->select('avatar_url_user','cookies_user','settings_user')
            ->where('id_user','=',$request->session()->get('id'))
            ->get();

            return view('home',['posts' => $posts,'options' => $options]);
         }



       //$posts = DB::table('posts')->leftJoin('users','posts.id_user_post','=','users.id_user')->orderBy('id_post','desc')->get();
       // $user =  DB::table('users')->where()
       return view('home',['posts' => $posts,'options'=>0]);

   }

}



via Cgdl

Advertisement