Snapey

at Novate / Microlise

Hire Me

Experience

1,038,565

1490 Best Reply Awards

  • Member Since 4 Years Ago
  • 974 Lessons Completed
  • 1 Favorite

18th October, 2018

Snapey left a reply on Help Saving My Form Passing It Through A Upload Trait • 1 hour ago

Well I don't know where your trait originated from and it seems quite complex, processing each of the files and returning some modified request object that contains the filenames of the uploaded videos.

This would seem to suggest that you don't need to put it in a loop, just call it and then process what you get back after it has saved the files.

Snapey left a reply on Help Saving My Form Passing It Through A Upload Trait • 1 hour ago

Your trait is included in the controller.

It looks like this;

public function saveFiles(Request $request)

So you need to use it like this

$output = $this->saveFiles($request)

(passing in a request object)

Snapey left a reply on Installation Problem • 1 hour ago

What version were you expecting?

Snapey left a reply on Is There A Way To Validate Blade Syntax • 1 hour ago

The linter will pick up syntax errors but it won't stop that code being executed when you actually use the data in a view or a form.

Snapey left a reply on Auth::user()->id Not Working In Api.php • 1 hour ago

Routes in api.php are stateless

You need to be passing an identity token with every request in order to be associated with a user account. Are you doing this or are you expecting it to be handled with sessions (as per web.php)

Snapey left a reply on Is There A Way To Validate Blade Syntax • 2 hours ago

Whats 'the linter'

Did you consider my suggestion to not use blade at all..?

Snapey left a reply on Is There A Way To Validate Blade Syntax • 2 hours ago

Basically you are opening it up for a user to do ANYTHING on your server.

Suppose I put


here is some boring text <?php unlink(base_path(.env)) ?> and then your @include('template') 

I just deleted the env file

Snapey left a reply on Is There A Way To Validate Blade Syntax • 2 hours ago

You could invent your own syntax that behaves differently to blade. For instance, you could use [ and ] to wrap the include name

This is a line of text in the database field
[terms_conditions2]
summary of what was proposed

the bracketed statement is easier to check, and won't blow up when processed if they leave off a bracket

In your code you can regex replace the bracketed term with the blade include. I have no idea of your use case, but I imagined something like a quote builder where you needed to include standard passages of text or form.

17th October, 2018

Snapey left a reply on Is There A Way To Validate Blade Syntax • 21 hours ago

you can call View::make() passing in the string and will get back the compiled view.

How you tell that its 'valid', i cannot say

Snapey left a reply on Change File Upload Path • 1 day ago

Laravel does not have a 'file upload path' you have to decide where to put the file. In your case it sounds like you want to put the file on the public disk.

This is the second parameter in the store command or third parameter in storeAs

https://laravel.com/docs/master/requests#storing-uploaded-files

eg

$path = $request->photo->storeAs('images', 'filename.jpg', 'public');

Snapey left a reply on Call To Undefined Method • 1 day ago

and what is in the addressbar when you request password reset

Snapey left a reply on Problem With Modal Window (EDIT) • 1 day ago

console log the data. Its all dependent on this var button = $(event.relatedTarget) picking up on the anchor link and getting access to the data attributes

Snapey left a reply on Image Instead Of Button • 1 day ago

 <form action="{{ route('directory.destroy',$directory->id) }}" method="POST" >
    @csrf
    @method('DELETE')

   <button type="submit" class="btn btn-danger" >
       <img src="../..(../../public/storage/admin/delete.png"/>
    </button>
</form>

Snapey left a reply on Checkbox Doesn't Work In Lc_chat... • 1 day ago

unchecked checkboxes are not sent in the request

Snapey left a reply on How To Stop Eager Loading When Model Already Have $with • 1 day ago

I stopped trying to use with in my models and have not looked back

Snapey left a reply on Call To Undefined Method • 1 day ago

What is in the address bar of the browser when you see this error

Snapey left a reply on Is There Possible To Make A File Import All Class Model, And Then Share It To Multiple Controller? • 1 day ago

If you are really that lazy, you can put it in Controller.php

Snapey left a reply on Edit Passing Id • 1 day ago

@wilk_randall is correct

Route says

Route::get('edit-recipient/{id}',

therefore parameter in the request is 'id' and NOT $rpt_id

change route;

Route::get('edit-recipient/{recipient}','[email protected]');

change controller;

public function editRecipient(Request $request, RecipientModel $recipient) {

        return view('pages.report.create_recipient')
                ->with('data', $recipient);
    }

and then the framework will perform route model binding and automatically inject the correct model into the controller

Snapey left a reply on Call To Undefined Method • 1 day ago

So when do you get the error, is it when creating the email or when clicking on the link in the email.

What does the error message say about the file and line number

Snapey left a reply on Checkbox Doesn't Work In Lc_chat... • 1 day ago

Still cannot help without more code

16th October, 2018

Snapey left a reply on Call To Undefined Method • 1 day ago

This is not right

$url = url('password/reset/{token}'.$this->token);

it should be

url = url('password/reset/',$this->token);

or

url = url('password/reset/' . $this->token);

Snapey left a reply on Call To Undefined Method • 1 day ago

Answer my question then..

Is http://localhost where you are testing your site?

Snapey left a reply on Problem With Modal Window (EDIT) • 2 days ago

have you assigned all the data- properties in the blade loop?

Any console errors?

Snapey left a reply on After Call Back From Payment Gateway Laravel 5.6 Page Expired Due To Inactivity • 2 days ago

Does everyone use http ?

Your exclusion should be just the local part of the route, eg /payment/status, certainly not including your domain name as that should never be in code.

Snapey left a reply on Checkbox Doesn't Work In Lc_chat... • 2 days ago

I'm not interested in the UI

You are using $setfield->code. This is not working properly perhaps causing Value to be null when inserting into the database.

Or, you are setting the name of the field correctly but then not processing it correctly in the controller.

Snapey left a reply on Understanding Codes • 2 days ago

old() is used when the form validation fails and means you dont have to reenter all the good values

the code is actually not very good since it prioritises data from the model so in the case of edit and a validation failure then the user has the make their changes again.

Better is

value="{{ ($data) ? old('nama', $data->nama): }}">

But I would go with

value="{{  old('nama', $data->nama) }}">

and pass an empty model into the create view from the controller

Snapey left a reply on Why Does This Code Returns An Empty Collection • 2 days ago

well, i guess we really need to see what creates $exists dont you think?

and the code you show for tinker is messed up

$i = App\courseInstructor::where('user_id','2')->where('course_id','6')->get()

Snapey left a reply on After Call Back From Payment Gateway Laravel 5.6 Page Expired Due To Inactivity • 2 days ago

ignore that

The callback url should be excluded from csrf checking

change Route('paytm-callback'); to be route('paytm-callback');

Snapey left a reply on Checkbox Doesn't Work In Lc_chat... • 2 days ago

what package are you using to turn select boxes into a settings model?

There is more going off than you are showing here making it impossible to answer your question

Snapey left a reply on Unexpected Return • 2 days ago

because you miss the semicolon off the second line

Snapey left a reply on Call To A Member Function Where() On Integer • 2 days ago

why do you need to do any query? you are getting the id to assign, just use that?

Why do you want to put the users name in assigned_to? is it not a relation?

15th October, 2018

Snapey left a reply on Eloquent Error • 3 days ago

If you still have a question, please format your code by putting 3 backticks ``` on a line before and after each code block

Snapey left a reply on Hgfhgfh • 3 days ago

Its a clue to the answer

Snapey left a reply on How To Set Up A BelongsTo Relationship Properly? • 3 days ago

Hopefully this is fixed now if you remove the with statements from your models

When defining a belongsTo relationship you only need define it with a foreign key in one table. Eloquent will workout the right key to use for hasMany or hasOne

As your employees table has user_id column then the Employee model belongs to the User

Employee.php

public function user()
{
    return $this->belongsTo(User::class);
}

and the reverse is hasOne (or hasMany)

User.php

public function employee()
{
    return $this->hasOne(Employee::class);
}

or, if many

public function employees()
{
    return $this->hasMany(Employee::class);
}

Snapey left a reply on Hgfhgfh • 3 days ago

mnzxbcm

Snapey left a reply on $with Inside Two Models Causing A Strange Loop • 3 days ago

Its dangerous to use, and will ALWAYS break if you try to load related models

User loads Employee loads User loads Employee loads User etc etc until you run out of memory.

Do it one way only or not at all.

14th October, 2018

Snapey left a reply on 5 Table Relation $?%$& • 3 days ago

Show your Home model?

Snapey left a reply on Getting User Facade Within View Composer • 3 days ago

what you want to do is possible, but with the following tips

  • target the view you want the code only
  • create a composer and put your code in the compose method. This will be called later in the request cycle than a service provider boot method
  • wrap your code in an if(Auth::check())
  • provide a better relationship between the two models

Snapey left a reply on Getting User Facade Within View Composer • 4 days ago

this contains an example of calling the compose method of a view composer class

https://scotch.io/tutorials/sharing-data-between-views-using-laravel-view-composers

Snapey left a reply on Getting User Facade Within View Composer • 4 days ago

just an observation

Snapey left a reply on Getting User Facade Within View Composer • 4 days ago

if its common then you should have a relationship between camper and user so that you don't have to search using the email address

Snapey left a reply on Getting User Facade Within View Composer • 4 days ago

you have to allow for not being logged in else you wond be able to render the login page

Snapey left a reply on Getting User Facade Within View Composer • 4 days ago

be careful with this approach, your queries will be run for every view partial rendered (because of *)

From the docs;

Just before the view is rendered, the composer's compose method is called with the Illuminate\View\View instance. You may use the with method to bind data to the view.

so, you should be able to move your code to a compose() method

I suggest that you install Laravel debugbar so that you can check what queries are being run.

Snapey left a reply on RedirectIfAuthenticated Not Working • 4 days ago

neither of those use the login, unless referenced in your login controller?

Snapey left a reply on RedirectIfAuthenticated Not Working • 4 days ago

ok. Do you have those routes using the middleware?

Snapey left a reply on RedirectIfAuthenticated Not Working • 4 days ago

i mean, how do you expect it to be used. It has nothing to do with the login process?

Snapey left a reply on Allowed Memory Size Of 134217728 Bytes Exhausted • 4 days ago

it should be fairly easy to exclude bits of code to find what is causing the issue?

Snapey left a reply on RedirectIfAuthenticated Not Working • 4 days ago

Do ypu have the right concept for redirectIfAuthenticated? its purpose is to keep logged in users away from login and register routes

Snapey left a reply on Allowed Memory Size Of 134217728 Bytes Exhausted • 4 days ago

do you have any with() statements in your models?

Snapey left a reply on 5 Table Relation $?%$& • 4 days ago

Sorry, you need to specify user

eg,

$items = Auth::user()->homes()->rooms()->boxes()->items();

or if you have user

$items = $user->homes()->rooms()->boxes()->items();
Edit Your Profile
Update

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