[email protected]

Experience

4,220

0 Best Reply Awards

  • Member Since 8 Months Ago
  • 36 Lessons Completed
  • 0 Favorites

21st June, 2017

[email protected] started a new conversation LaravelLocalization Not Translating Routes • 1 month ago

I am using LaravelLocalization in one of my websites but getLocalizedURL doesn't seem to work. I have 3 links like this to shange the language but the url is always in the default language. NL

For example: When I al on the about us page the href should be: - nl/over-ons - en/about-us - fr/de-nous What I get: - nl/over-ons - en/over-ons - fr/over-ons And off course over-ons doesn't exist in frensh or english, only in dutch.

19th June, 2017

[email protected] left a reply on User Logging Out Automaticly • 2 months ago

The AuthenticatesAndRegistersUsers points to AuthenticesUsers. This has a login method.

public function login(Request $request) { $this->validateLogin($request);

    // If the class is using the ThrottlesLogins trait, we can automatically throttle
    // the login attempts for this application. We'll key this by the username and
    // the IP address of the client making these requests into this application.
    $throttles = $this->isUsingThrottlesLoginsTrait();

    if ($throttles && $lockedOut = $this->hasTooManyLoginAttempts($request)) {
        $this->fireLockoutEvent($request);

        return $this->sendLockoutResponse($request);
    }

    $credentials = $this->getCredentials($request);

    if (Auth::guard($this->getGuard())->attempt($credentials, $request->has('remember'))) {
        return $this->handleUserWasAuthenticated($request, $throttles);
    }

    // If the login attempt was unsuccessful we will increment the number of attempts
    // to login and redirect the user back to the login form. Of course, when this
    // user surpasses their maximum number of attempts they will get locked out.
    if ($throttles && ! $lockedOut) {
        $this->incrementLoginAttempts($request);
    }

    return $this->sendFailedLoginResponse($request);
}

[email protected] left a reply on User Logging Out Automaticly • 2 months ago

Route::post('webclix-admin/login', [email protected]')->name('login');

[email protected] left a reply on User Logging Out Automaticly • 2 months ago

Webclix

Administrator login.Gewone gebruiker? Klik hier!

{{ csrf_field() }} @if ($errors->has('email')) {{ $errors->first('email') }} @endif @if ($errors->has('password')) {{ $errors->first('password') }} @endif
          <div class="col-xs-12">
            <button type="submit" class="btn btn-primary btn-block btn-flat">Inloggen </button>
          </div>
          <div class="col-xs-12" style="padding-top:15px;">
            {{-- <small><a href="{{ url('password/reset') }}" class="form-link">Wachtwoord vergeten?</a></small> --}}
            <small>Wachtwoord vergeten? Neem contact op met uw beherder - <a href="mailto:[email protected]?subject=Webclix Admin - Ik ben mijn wachtwoord vergeten.">[email protected]</a></small>
          </div>
        </div>
      </form>
    </div>
  </div>
  <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.3/jquery.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.6/js/bootstrap.min.js"></script>

[email protected] left a reply on User Logging Out Automaticly • 2 months ago

Webclix

Administrator login.Gewone gebruiker? Klik hier!

{{ csrf_field() }} @if ($errors->has('email')) {{ $errors->first('email') }} @endif @if ($errors->has('password')) {{ $errors->first('password') }} @endif
          <div class="col-xs-12">
            <button type="submit" class="btn btn-primary btn-block btn-flat">Inloggen </button>
          </div>
          <div class="col-xs-12" style="padding-top:15px;">
            {{-- <small><a href="{{ url('password/reset') }}" class="form-link">Wachtwoord vergeten?</a></small> --}}
            <small>Wachtwoord vergeten? Neem contact op met uw beherder - <a href="mailto:[email protected]?subject=Webclix Admin - Ik ben mijn wachtwoord vergeten.">[email protected]</a></small>
          </div>
        </div>
      </form>
    </div>
  </div>
  <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.3/jquery.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.6/js/bootstrap.min.js"></script>

[email protected] left a reply on User Logging Out Automaticly • 2 months ago

It's not browser specific. Just tested on other browser, same problem. this is my Admin Controller

class AdminAuthController extends Controller {

use AuthenticatesAndRegistersUsers, ThrottlesLogins;

protected $redirectTo = "/webclix-admin";

public function __construct()
{
    $this->middleware('guest', ['except' => 'logout']);

}

public function showLogin(){
  return view('admin.auth.login');
}

protected function validator(array $data)
{
    return Validator::make($data, [
        'name' => 'required|max:255',
        'email' => 'required|email|max:255|unique:users',
        'password' => 'required|confirmed|min:6',
    ]);
}

protected function create(array $data)
{
    $create = User::create([
        'name' => $data['name'],
        'email' => $data['email'],
        'password' => bcrypt($data['password']),
    ]);

    $user = User::find($create->id);

     $role = Role::where('name', '=', 'client')->firstOrFail();

     $user->roles()->attach($role->id);

     return $create;
}

}

[email protected] left a reply on User Logging Out Automaticly • 2 months ago

I'll try that. What I think is strange is that it sometimes happens after seconds of being logged in, sometimes after more than 15 minutes, even when I am constantly using the site. It happens while updating, deleting or even browsing from one page to another. It happend that I log in, change page and I am logged out again.

31st May, 2017

[email protected] started a new conversation Laravel 5.2 Mail Not Sending • 2 months ago

I made a website in Laravel 5.2. The mail function is not sending mails. I don't get any error messages and there is nothing in the log file. Can I get some help please?

The .env settings:

MAIL_DRIVER=smtp MAIL_HOST=smtp.mailprotect.be MAIL_PORT=2525 MAIL_USERNAME=email MAIL_PASSWORD=password MAIL_ENCRYPTION=null

The mail function:

Mail::send('emails.contact', ['request' => $request], function ($m) use ($request) { $m->from([email protected]', 'Company'); $m->to([email protected]', 'Company')->subject('Contact form'); });

16th December, 2016

[email protected] started a new conversation Displaying An Ad Once (per Visit/or) • 8 months ago

Hello,

I'm currently implementing a dynamic ad, edited by the client (webshop) and they asked for it to be displayed once per visit/or. I'm wondering how to, apart from the "check for Session var, if no var - display it and create said var, otherwise nothing", display it.

Should I make a partial and then inside, for instance, the main template do an ajax.get with some animations, etc (based on Session) or could it be handled by yield() where, inside the content(), I'd do a Session check and then dump the ad?

Thanks upfront!

8th December, 2016

[email protected] started a new conversation Laravel Path Breakage On Hosting. Error 500 All Over The Place. • 8 months ago

Day 2 of hosting horrors.

Yesterday, I tried getting the Laravel installation which currently works in a testing subfolder on the hosting, and installing it. The issue I ran into was that after running composer instal, it couldn't find the Page by the slug, it would always return a 500 and a null on Page::findBySlug($slug);

Instead of that, I simply copied the testing installation to the /project and then /project/public to the /www. Changed the paths and it seemed to be ok but for some reason it isn't. Only the main page worked, every single other one would return 500 and this lovely little error

 Uncaught ErrorException: Undefined variable: listing in /data/sites/web/project/storage/framework/views/faf3b9bc67749f60e786fa6832263e13d2214d7b.php:12
Stack trace:
#0 /data/sites/web/project/storage/framework/views/faf3b9bc67749f60e786fa6832263e13d2214d7b.php(12): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(8, 'Undefined varia...', '/data/sites/web...', 12, Array)
#1 /data/sites/web/project/vendor/laravel/framework/src/Illuminate/View/Engines/PhpEngine.php(42): include('/data/sites/web...')
#2 /data/sites/web/project/vendor/laravel/framework/src/Illuminate/View/Engines/CompilerEngine.php(59): Illuminate\View\Engines\PhpEngine->evaluatePath('/data/sites/web...', Array)
#3 /data/sites/web/project/vendor/laravel/framework/src/Illuminate/View/View.php(149): Illuminate\View\Engines\CompilerEngine->get('/data/sites/web...', Array)
#4 /data/sites/web/project/vendor/laravel/framework/src/Illuminate/View/View.php(120): Ill in /data/sites/web/project/storage/framework/views/faf3b9bc67749f60e786fa6832263e13d2214d7b.php:12

I then ran with artisan config:cache and route:cache which broke even the main page.

At that point, I pointed the /www/index.php to the testing platform folder, which makes the home page function again but the rest is still broken and Laravel screams at me that it indeed cannot find that variable.

Now, my knowledge of this project is quite small and 99% of it has been developed by a completely different person but it seems like I'd indeed need to run the config:cache and route:cache but with changes to something. What that thing is I have no clue...

Would appreciate even the slightest bit of help.

7th December, 2016

[email protected] started a new conversation Laravel Slugs On Hosting. • 8 months ago

Hello.

I just pushed a website onto hosting and apparently the slugs broke completely. At first, the page wouldn't even load, showing an error while Page::findBySlug would return null.

    public function index($slug)
    {
        $page = Page::findBySlug($slug);
        $pageTemplate = $page->templates->first();
        return view('frontend.pages.index', compact('page','pageTemplate'));
    }

Now it actually loads the page but shows the custom 500 error instead of just breaking. If I dd($page) it still returns null.

What am I missing here? Thanks.

6th December, 2016

[email protected] started a new conversation Multiple Models Within A Single Form Split Between Two Controllers • 8 months ago

Hello.

I got asked to implement an option to let users choose whether to show their address or not in a project that has sat in production for 4 months now. The main model is the Listing, which saves the address by the id (controller sends the rest of the data to the Address model) and a Country and a Video model. Now, since it's the Address that I'm supposed to add, I had to manually add the show_address field to the db since there's no seeders and there's live data on the testing platform.

I added the show_address to the $fillable and this is where the fun begins. There are different controllers for back and frontend for Listings with different forms. I already solved the frontend issue, where everything inside the form other than the Listing model uses prefixed names, such as listing_show_address and then it goes through them in the controller.

My main issue now is the backend, which doesn't do that at all, it simply resolves to naming fields by their column names with the store method looking like this,

public function store(CreateListingRequest $request)
    {
        $today = Carbon::now();
        $listing = new Listing($request->all());

         if ($request->hasFile('epc-pdf')) {
            $epcPdf = $request->file('epc-pdf');
            $pdfPath = $listing->storeFile($epcPdf);
            $listing->epc_pdf_url = $pdfPath;
        }
        
        $thumbnailPath = $listing->storeImage($request->file('thumbnail'), 1140,640);
        // upload video to vimeo
        $vimeo_url = Vimeo::upload($request->file('video'), true);

        //store paths in the listing table and add expiry date which will never expire
        $listing->video_url             = $vimeo_url;
        $listing->thumbnail_url         = $thumbnailPath;
        $listing->expiry_date           = $today->addYears(10);
         
        $listing->user()->associate($request->user);

        $listing_address = new Address($request->all());
        
        $country = Country::where('iso_code', $request->country)->first();
        $listing_address->country()->associate($country);
        $listing_address->save();

        $listing->address()->associate($listing_address);
        $listing->hometype()->associate($request->hometype);
        $listing->buildingtype()->associate($request->buildingtype);
        $listing->save();

        return redirect('/admin/listings');
    }

and the update one being this,

    public function update(UpdateListingRequest $request, Listing $listing)
    {
         if ($request->hasfile('thumbnail')) {
            File::delete([
                $listing->thumbnail_url,
            ]);
            $thumbnailPath                  = $listing->storeImage($request->file('thumbnail'), 1140,640);
            $listing->thumbnail_url         = $thumbnailPath;
        }

         if ($request->hasFile('epc-pdf')) {
            File::delete([
                $listing->epc_pdf_url
            ]);
            $filePath = $listing->storeFile($request->file('epc-pdf'));
            $listing->epc_pdf_url = $filePath;
        }

        if ($request->hasFile('video')) {
            Vimeo::request($listing->video_url,[], 'DELETE');
            $vimeo_url = Vimeo::upload($request->file('video'),true);
            $listing->video_url = $vimeo_url;
        }

        $listing->update($request->all());

        $listing_address = $listing->address()->first();
        $listing_address->update($request->all());

        $country = Country::where('iso_code', $request->country)->first();
        $listing_address->country()->associate($country);
        $listing_address->save();

        $listing->hometype()->associate($request->hometype);
        $listing->buildingtype()->associate($request->buildingtype);
        $listing->save();

        return redirect('/admin/listings');
    }

Both of them resulting in SQLSTATE[42S22]: Column not found, since it's trying to add the show_address to the Listings model.

Here's a snippet of the create.view where the only thing I changed was adding the show_address button.

<div class="form-group"><label class="col-sm-2 control-label">Price </label>
                  <div class="col-sm-10">
                    <input type="number" class="form-control" value="{{old('price')}}"  min="0.00" step="0.01" name="price">
                  </div>
              </div>

              <div class="form-group"><label class="col-sm-2 control-label">Display price?</label>
                <div class="col-sm-10 checkbox">
                    <input type="hidden" name="show_price" value="0">
                    <label> <input type="checkbox" name="show_price" checked value="1">Show price</label>
                </div>
              </div>
              <div class="form-group"><label class="col-sm-2 control-label">Display address?</label>
                      <div class="col-sm-10 checkbox">
                      <input type="hidden" name="show_address" value="0">
                      <label> <input type="checkbox" name="show_address" checked value="1">Show address</label>
              </div>
               <div class="form-group"><label class="col-sm-2 control-label">Street and house no</label>
                  <div class="col-sm-10">
                    <div class="row">
                      <div class="col-sm-7">
                        <input type="text" value="{{old('street_and_number')}}" name="street_and_number" class="form-control">
                      </div>
                      <div class="col-sm-5">
                        <div class="row">
                          <label class="col-sm-5 control-label">Postbox</label>
                          <div class="col-sm-7"><input type="text" value="{{old('postbox')}}" name="postbox" class="form-control"></div>
                        </div>
                      </div>
                    </div>

Any clues on how to actually send show_address to the correct model? Thanks upfront.

[email protected] started a new conversation Laravel 5.3 Certain Users Bypassing Maintenance Mode. • 8 months ago

Hello.

I'm wondering how can I let certain users through the maintenance mode.

I'm currently using the custom CheckForMaintenanceMode middleware, only checking whether the users are trying to reach the backend. I'd like to indeed check not only for that but also their info. Unfortunately the middleware is not getting any Auth data.

{
    // *
    //  * Handle an incoming request.
    //  *
    //  * @param  \Illuminate\Http\Request  $request
    //  * @param  \Closure  $next
    //  * @return mixed
     
    // public function handle($request, Closure $next)
    // {
    //     return $next($request);
    // }
    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('dashboard'));
    }
}```


I've a single page with partials to log-in/register/send a recovery email and then simply the backend. Routes are looking like this,

```Route::get('/', ['uses' => [email protected]', 'middleware'=>'web']);

Auth::routes();

// partials for the login page
Route::get('/register', [email protected]_register');
Route::get('/login', [email protected]_login');
Route::get('/reset', [email protected]_reset');

Route::group(['middleware'=>'auth'], function(){
    Route::get('/logout' , 'Auth\[email protected]');
    Route::resource('/dashboard', 'FileController');
    Route::patch('/dashboard', [email protected]');
});```

The goal at the end is to let, for instance, admin go in/out of the maintenance mode using a button or something.

Thanks upfront.
Edit Your Profile
Update

Want to change your profile photo? We pull from gravatar.com.