tisuchi

Developer at EDV Standard

Hire Me

Experience

155,055

80 Best Reply Awards

  • Member Since 2 Years Ago
  • 1003 Lessons Completed
  • 12 Favorites

23rd June, 2017

tisuchi left a reply on Laravel - Is It Possible To Learn It In A Few Weeks? • 5 days ago

haha... @teckel

May be you are too advanced on PHP!!!

You know what, we have learned a lot form this community. We are thankful for that..

22nd June, 2017

tisuchi left a reply on MethodNotAllowedHttpException • 5 days ago

What error you are getting now...

tisuchi left a reply on MethodNotAllowedHttpException • 5 days ago

Try changing your <form a bit-

<form action="posts" method="POST">
{{ csrf_field() }}

tisuchi left a reply on MethodNotAllowedHttpException • 5 days ago

Can you show your route?

tisuchi left a reply on Laravel Training • 5 days ago

Correct me, if I am wrong.

Doesn't laracast training enough for you to understand the concept of laravel as well as PHP?

tisuchi left a reply on Cant Download/ Find The File That I've Submit Into The Database • 6 days ago

Just follow this-

 public function store(Request $request)
    {
        
        //create a new post using the request data
        
$user1 = new user1;
        $user1->publish= $request->input('publish');
        $user1->fail= $request->input('fail');
    $user->upload = $request->input('upload');

        //save it into database
        $user1->save();

        //and then return to the homepage.

        return redirect('/home');
    }

Now, this cannot solve your upload file or image part. Follow this- https://laravel.com/docs/5.4/requests#files

In order to upload file via form, you need to add in your <form tag.

enctype="multipart/form-data"

https://www.w3schools.com/php/php_file_upload.asp

tisuchi left a reply on Cant Download/ Find The File That I've Submit Into The Database • 6 days ago

  1. In your store method, you need to create instance first before adding data into database.
public function store(Request $request)
    {
        
        //create a new post using the request data
        
$user1 = new User1;        
  1. You are requesting data in a wrong way. It should be-
$user1->publish= $request->input('publish');

Instead of -

$user1->publish= request('publish');

21st June, 2017

tisuchi left a reply on How To Always Load A Model Function When Retrieving The Model Instance? • 1 week ago

May be you can create an empty object and pass to view to access every methods from the model.

For instance-

$newobj = new ModelName();

return view('view-name')
->with('newobj', $newobj);

Now in your view, you are able to access any method that is belongs to ModelName().

tisuchi left a reply on Error Shows Up At The Start Of The Page(ie. Undefined Variable Users) • 1 week ago

Try with and check whether its working or not?


public function newProduct($y) { $users=addModel::select('Desc')->where('Pname',$y )->first(); return view('design') ->with('users', $users);

}

tisuchi left a reply on 500 Error On Any Use Of Eloquent • 1 week ago

You suppose to put two colons(::) instead of one (:)

It should be like-

$customers = DB::table('customers')->get();

Your code-

$customers = DB:table('customers')->get();

15th June, 2017

tisuchi left a reply on Installation Documentation • 1 week ago

May be you install first, than you remove everything except require packages from composer.json and update your composer.

tisuchi left a reply on HTTP ERROR 500 When Using Model In Routes • 1 week ago

Show your full updated code.

tisuchi left a reply on Is There Any Package For Country, State And City Dependent Drop Down? • 1 week ago

Why not simply using this instead of finding package in Laravel?

tisuchi left a reply on HTTP ERROR 500 When Using Model In Routes • 1 week ago

You need to add App\ than your model name. For example-

$user = App\User::findOrFail(1); 

Now, it should work.

14th June, 2017

tisuchi left a reply on InvalidArgumentException Data Missing • 1 week ago

Can you dd() and show the result here?

public function notifications() { 
    Auth::user()->unreadNotifications->markAsRead(); 

    dd(Auth::user()->notifications);

    return view('nots')->with('nots', Auth::user()->notifications); 
}

tisuchi left a reply on Broken Avatars After Pushing To Production • 1 week ago

can you show your avatars code?

7th June, 2017

tisuchi left a reply on Whoops, Looks Like Something Went Wrong. 1/1 FatalErrorException In ProfileController.php Line 117: Syntax Error, Unexpected 'public' (T_PUBLIC) In ProfileController.php Line 117 • 3 weeks ago

You are right.

Hidden value is ok, if you check in your controller that this record is belongs to you or not.

tisuchi left a reply on Whoops, Looks Like Something Went Wrong. 1/1 FatalErrorException In ProfileController.php Line 117: Syntax Error, Unexpected 'public' (T_PUBLIC) In ProfileController.php Line 117 • 3 weeks ago

I suggest you to finish your series of tutorial before starting your project. https://laracasts.com/series/laravel-from-scratch-2017

It will take few hours. Surely it will solve all of your issues.

tisuchi left a reply on Carbon::createFromFormat Exception : Unexpected Data Found Data Missing • 3 weeks ago

I think you need to change a bit.

'd F, Y' = '7 June, 2017'?

It will return 7 June, 2017

Here, d = 01-31 F= Full Month Name Y = 4 digit year

Ref: http://php.net/manual/en/function.date.php

tisuchi left a reply on Carbon::createFromFormat Exception : Unexpected Data Found Data Missing • 3 weeks ago

Its because of your provided data and expected formate is not matching.

Not enough data

If your date string is "shorter" than the format string like in this case:

Carbon::createFromFormat('Y-m-d H:i:s', '2017-01-04 00:52');

Carbon will throw:

InvalidArgumentException in Carbon.php line 425: Data missing

Too much data

If your date string is "longer" than the format string like in this case:

 Carbon::createFromFormat('Y-m-d H:i', '2017-01-02 00:27:00');

Carbon will throw:

InvalidArgumentException in Carbon.php line 425: Trailing data

Ref: https://stackoverflow.com/questions/34968061/laravel-carbon-data-missing

6th June, 2017

tisuchi left a reply on Broken Link • 3 weeks ago

Yes, I noticed that also.

tisuchi left a reply on Whoops, Looks Like Something Went Wrong. 1/1 FatalErrorException In ProfileController.php Line 117: Syntax Error, Unexpected 'public' (T_PUBLIC) In ProfileController.php Line 117 • 3 weeks ago

You need to change your code bit.

In update method, remove $id from parameter like follows-

public function update(Request $request)
    {

And inside method, change a bit-

$user = User::find($request->input('id'));
            .
            .
            .
            $user->save();

Finally, in your edit profile blade page, add following line after <form starting.

 <input type="hidden" value="{{ Auth::user()->id }}" name="id">

I believe, it will work.

tisuchi left a reply on Collection Prepend Error • 3 weeks ago

I believe, this discussion will figure out your issue-

https://stackoverflow.com/questions/32418811/laravel-lists-function-prepend-value

tisuchi left a reply on Whoops, Looks Like Something Went Wrong. 1/1 FatalErrorException In ProfileController.php Line 117: Syntax Error, Unexpected 'public' (T_PUBLIC) In ProfileController.php Line 117 • 3 weeks ago

Its because of following method-

public function update(Request $request, $id)
    {
        
    {
     

If you look carefully, you put 2 curly brace at the beginning of the method an end of the method also.

It should be like that-

public function update(Request $request, $id)
{
        $rules = [
            'name'                  =>  'required',
            'email'                 =>  'unique:users,email'.$id.'required|email',
            'icNumber'              =>  'required',
            'staffNumber'           =>  'required',
            'faculty'               =>  'required'
        ];

        $validator = Validator::make($request->all(), $rules);

        if($validator->fails())
        {
            return Redirect::to('/profile')
                ->withErrors($validator)
                ->withInput();
        }else{
            $user = User::find($id);
            $user->name = $request->input('name');
            $user->email = $request->input('email');
            $user->icNumber = $request->input('icNumber');
            $user->staffNumber = $request->input('staffNumber');
            $user->faculty= $request->input('faculty');
         
            $user->save();

            Session::flash('success', 'Your profile was updated.');
            return Redirect::to('/home');
        }

}

tisuchi left a reply on Broken Link • 3 weeks ago

I am using chrome, that is absolutely mess...

tisuchi left a reply on Broken Link • 3 weeks ago

@tomi

I thought its my problem only. After hearing you, I checked in some other computer, nothing change.

I believe, your side is something special.... lol

5th June, 2017

tisuchi left a reply on Laravel Linkedin Email Import • 3 weeks ago

You can try with Socialite.

https://github.com/laravel/socialite

tisuchi left a reply on Broken Link • 3 weeks ago

I see... Than its only problem in my computer.

http://imgur.com/a/BaWb8

(If you focus on bottom, than you can see it referring me to google.com/discuss).

tisuchi left a reply on Auth::user()->email Give Wrong Email • 3 weeks ago

Ok, here is the solution.

In your user table, check there is a column called id. You just put any username there, that should not be.

It should be 1, 2, 3, ....

For username, you may create another column.

Change the value in id and it should work.

tisuchi left a reply on Auth::user()->email Give Wrong Email • 3 weeks ago

Try different browser or Incognito window (ctrl + shift + n).

tisuchi left a reply on Auth::user()->email Give Wrong Email • 3 weeks ago

You may be delete your cache or try with different browser. You might get your expected result.

tisuchi left a reply on Auth::user()->email Give Wrong Email • 3 weeks ago

Plz show ur dd() code and post ur database table photo if possible.

tisuchi left a reply on Auth::user()->email Give Wrong Email • 3 weeks ago

Ok, In this case, you just try to logging with other user (who's record is in last position in your db).

Secondly you just

dd(Auth::user());

and post here to see.

tisuchi left a reply on Auth::user()->email Give Wrong Email • 3 weeks ago

Do you have more than 1 account with same email?

tisuchi left a reply on @extends Test • 3 weeks ago

I believe its a issue with your session, that @shakti mentioned.

User laravel session and write your code as follows-

@if($request->session()->has('role'))
    @if($request->session()->get('role') == 'Superviseur')
        @extends('layouts.superviseur') 
    @elseif
        @extends('layouts.master') 
    @endif
@endif

4th June, 2017

tisuchi left a reply on Using Old With Multiple Select Dropdown • 3 weeks ago

How about this?

<select class="form-control" id="stipulations" name="matches[{{ $x }}][stipulations][]" multiple="multiple">
        <option value="0">Choose One</option>
        @foreach(App\Models\Stipulation::all() as $stipulation)
            <option value="{{ $stipulation->id }}" @if(old('matches['.$x.'][stipulations][]') == $stipulation->id) {{ 'selected' }} @endif>{{ $stipulation->name }}</option>
        @endforeach
</select>

tisuchi left a reply on Using Old With Multiple Select Dropdown • 3 weeks ago

You just follow this discussion. I hope you will get your answer-

https://stackoverflow.com/questions/35611945/old-value-in-multiple-select-option-in-laravel-blade

tisuchi left a reply on Can't Use Pagination Before ShortBy • 3 weeks ago

Just use orderBy instead of sortBy-

$topics = Topic::latest()
->withCount('topics')
->orderBy('topics_count', 'desc')
->paginate(12)

2nd June, 2017

tisuchi left a reply on Laravel Eager Loading Returns Empty Array • 3 weeks ago

@st8113

What is the difference between

$users = User::where('id', 40)->with('Conversations', 'childaccounts')->first();

and

$users = User::with('Conversations', 'childaccounts')->find(40);

I think I know how both of these work. For your kind information, nothing will be change if you put with() before or after find() method.

tisuchi left a reply on Laravel Eager Loading Returns Empty Array • 3 weeks ago

@nagavinod424

I think you lost somewhere.

If I load something in blade, thats not eager loading anymore.

Read More: https://laravel.com/docs/5.4/eloquent-relationships#eager-loading

tisuchi left a reply on Laravel Eager Loading Returns Empty Array • 3 weeks ago

@tykus

Relationship-

public function Conversations() {
        return $this->hasMany('App\Conversation', 'user_one')->orWhere('user_two', $this->id);
    }

I use with for loading eager loading.

$users = User::where('id', 40)->with('Conversations', 'childaccounts')->first();

tisuchi left a reply on FatalErrorException In PostController.php Line 49: Class 'App\Post' Not Found In PostController.php Line 49 • 3 weeks ago

Its basically easy.

Just go to command line and navigate to your project and type-

php artisan make:model Post

And hit enter.

Read More: https://laravel.com/docs/5.4/eloquent#defining-models

Edit Your Profile
Update

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