Buy your loved one the ultimate gift. Lifetime gift certificates are $100 off.

tisuchi

Developer at EDV Standard

Hire Me

Experience

267,285

179 Best Reply Awards

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

16th December, 2017

tisuchi left a reply on Convert Json To Array • 22 hours ago

How about do $array = json_decode($json, true); first?

Check this discussion- https://laracasts.com/discuss/channels/general-discussion/convert-json-to-eloquent-collection

tisuchi left a reply on Convert Json To Array • 23 hours ago

tisuchi left a reply on Laravel Query Builder To Eloquent • 23 hours ago

Well, you can make relationships easily. For instance, a worker has many applications. Here is the code for that-

In ** WorkersApplication**-

public function worker(){
    return $this->belongsTo('App\Worker', 'workers_id', 'id');
}

In Worker-

public function applications(){
    return $this->hasMany('App\WorkersApplication', 'workers_id', 'id');
}

Ref: https://laravel.com/docs/5.5/eloquent-relationships#one-to-many

15th December, 2017

tisuchi left a reply on Boolean Value Not Changing From True / False Or False To True? • 2 days ago

Why not you are making it short and try this way?

if($adopt->approved == false){
    $adopt->approved = true;
    $adopt->update(['approved' => true]);
}

14th December, 2017

tisuchi left a reply on Blank Page Is Displaying @yield Is Not Working.Any Help..... • 2 days ago

Than it should be ok. Make sure that you have write everything in proper spelling..

tisuchi left a reply on Blank Page Is Displaying @yield Is Not Working.Any Help..... • 2 days ago

@deepu07

It should be @extends('index') instead of @extend().

Make sure that your master.blade.php and index.blade.php files are in same folder. Otherwise, adjust your extends file path.

tisuchi left a reply on Problem With Old() On Type="date" Field • 2 days ago

I believe you forget to give ) add for first code. It should be like this-

<input type="date" class="form-control" value="{{ old('event_date', date('Y-m-d')) }}" name="event_date">

In last piece of code, you put two ; and forgot to use ) that is wrong. It should be like this-

<input type="date" class="form-control" value="<?php echo e(old('event_date', date('Y-m-d'))); ?>" name="event_date">

tisuchi left a reply on Redirect To Login Page After Session Timeout • 2 days ago

May be you can create a custom exception render in the App\Exceptions\Handler class (in the /app/Exceptions/Handler.php file).

/**
 * Render an exception into an HTTP response.
 *
 * @param  \Illuminate\Http\Request  $request
 * @param  \Exception  $e
 * @return \Illuminate\Http\Response
 */
public function render($request, Exception $e)
{
    if ($e instanceof ModelNotFoundException) {
        $e = new NotFoundHttpException($e->getMessage(), $e);
    }

    if ($e instanceof TokenMismatchException) {

        return redirect(route('login'))->with('message', 'You page session expired. Please try again');
    }

    return parent::render($request, $e);
}

tisuchi left a reply on Adding A GET Variable To A Redirect Route • 3 days ago

What is your question here? @tristanisginger

If you want to know how to pass param after that, I believe this is the easiest way.

redirect('blog.index', ['status' => 'trash']);

tisuchi left a reply on Not Unique Table/alias: • 3 days ago

This is how you need to do it.

use DB;



//inside your method
$feedback = DB::table('feedbacks')
                ->join('questions', 'feedbacks.question_id', '=', 'questions.id')
                ->get();


Note: I assume that, you want to cross check id at questions table with question_id at feedbacks.

tisuchi left a reply on Value = Null • 3 days ago

@kishoresai438

Yes, you are right.

If there is no page, it wont bring any page.

@davy_yg Is $pages2 a group of collections or only single instance?

Can you show your controller code a bit?

tisuchi left a reply on Value = Null • 3 days ago

Have you tried this @davy_yg

<center><b>
    @if(!empty($pages2->pages_title))
        {{ $pages2->pages_title }}
    @endif
</b></center><br> 

@if($pages2->pages_content)    
    {!! $pages2->pages_content !!}
@endif 

9th December, 2017

tisuchi left a reply on How Can I Run Two Functions On Same Url • 1 week ago

@Yamen

I believe same functions for two different routes is ok. The only problem I can see it in default route where you have redeclared.

Change that only.

tisuchi left a reply on Laravel Select Data After Join 3 Tables • 1 week ago

What is the purpose of using ->groupBy('games.id')? ID in games table is a primary key, right?

tisuchi left a reply on Problem With Postgresql 'where' Function SQLSTATE[22P02]: Invalid Text Representation: 7 ERROR: Invalid Input Syntax For Integer: • 1 week ago

Its not because of your simple query like this-

Jobfieldofstudy::where("id", $value)->delete();

Its for reference part-

$table->foreign('jobs_id')->references('id')->on('jobs');

5th December, 2017

tisuchi left a reply on No Connection Could Be Made • 1 week ago

Make sure that there is a database in your targeted machine. Check in your .env file that you have all the details-

DB_HOST=127.0.0.1
DB_PORT=33060
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret

tisuchi left a reply on How To Send Mail From A Custom Form ? • 1 week ago

@Yomamen

I don't think that you can call {{ $bookingName }} directly since you are passing as an array.

May be this is the way-

{{ $data['bookingName'] }}

tisuchi left a reply on Making Laravel Code Secure • 1 week ago

You know what @rvsky ?

None of the framework is insecure. You can maximum say that one framework may have advantage on other, nothing else.

Making secure your apps is always depend on programmer that how they write code. Smelly coder will always write the insecure code, doesn't matter what framework they use.

So, my opinion, learn how to write industry standard code, nothing more, nothing less.

tisuchi left a reply on How To Send Mail From A Custom Form ? • 1 week ago

Follow this- https://www.cloudways.com/blog/laravel-contact-form/

Make sure that you have adjusted configuration details.

tisuchi left a reply on How To Send Mail From A Custom Form ? • 1 week ago

Which laravel version you are using?

4th December, 2017

tisuchi left a reply on Filter Products With Checkbox • 1 week ago

There are many ways to implement that @david001

Check this tutorial- https://stackoverflow.com/questions/30414103/laravel-checkbox-filter-ajax

3rd December, 2017

tisuchi left a reply on InvalidArgumentException Route [login] Not Defined • 1 week ago

Make sure that you have generated default auth system if you are using that. Otherwise, make sure that you have route called login.

Can you show where did you use Route [login] in your blade page?

tisuchi left a reply on InvalidArgumentException Route [login] Not Defined • 1 week ago

Show your code instead of error.

30th November, 2017

tisuchi left a reply on Passing Non-related Data To The View • 2 weeks ago

@roniemeque

Since the information (title, description) are somehow related with a particular product and SEO, I believe we can call this info as a *Related Info. In this case, method of a controller is the best way from where you can pass your info.

tisuchi left a reply on Passing Coordinates From View To Controller • 2 weeks ago

@david001

Just echoing @tykus answer-

In your controller, you can simply check like this way-

public function getCoordinates(Request $request)
{

    if( !empty($request->latitude) ){
        $lat=$request->latitude;
    }

    if( !empty($request->longitude) ){
        $lng=$request->longitude;
    }

    return $lat;
}

Make sure that, you have passed your data to controller via ajax.

27th November, 2017

tisuchi left a reply on Where To Find Laravel Freelancers • 2 weeks ago

Of course, you will get almost everywhere. However, for finding more specifically, you can check in following links-

tisuchi left a reply on Help Me • 2 weeks ago

Try this @yatogami

public function postRegister() { 
    
    $roleId = DB::table('roles')->where('namaRole', 'user')->first();
    $user = new User; 
    $user->username = Input::get('username'); 
    $user->name = Input::get('name'); 
    $user->email = Input::get('email'); 
    $user->password = bcrypt(Input::get('password')); 
    $user->role_id = $roleId->id; 
    $user->save(); 
}

tisuchi left a reply on Relationship Between Two Models/Tables • 2 weeks ago

@splendidkeen

That means somewhere you have used route('login') route in view template. That's why you are getting error if you are not define login route.

tisuchi left a reply on Is It Possible To Accessing Excel Feature Using Laravel..? Like Chart Creation Like That • 2 weeks ago

Not exactly.

You have to create all the functions by yourself one by one.

26th November, 2017

tisuchi left a reply on Error Migrations • 2 weeks ago

@yatogami

Show you create_users_table code.

tisuchi left a reply on Error Migrations • 2 weeks ago

@yatogami

Check in your migration files. You have use unnecessary } in somewhere that's why you are facing this issue.

24th November, 2017

tisuchi left a reply on Problems With Search Form • 3 weeks ago

Is that performing well? As long as its working, that should be fine.

tisuchi left a reply on Problems With Search Form • 3 weeks ago

@MATHISHUETTL

Have you tried nested relationships?

Customer::with('Inquiry.Booking', function($q) use ($searchquery){
    $q->where('yourColumn', 'LIKE', "%$searchquery%");
})->get();

Ref: https://laravel.com/docs/5.5/eloquent-relationships#querying-relations

tisuchi left a reply on Route Resource Not Working When Route Group Prefix Is Made • 3 weeks ago

@guru03

So far fo your restful resource route, you have to provide name. There is no way to leave it empty.

Ref: https://laravel.com/docs/5.2/controllers#restful-resource-controllers

23rd November, 2017

tisuchi left a reply on Laravel - Show Latest 5 Registered Users • 3 weeks ago

@RAINIEREN

You can try this-

$users = User::orderBy('id', 'desc')->take(5)->get();

The full form is-

Your Method-

public function index()
{
    Carbon::setLocale('nl');
    $tijd = Carbon::today();
    $posts = Post::count();
    $users = User::orderBy('id', 'desc')->take(5)->get();
    $replies = Reply::count();

    return view('admin.dashboard', compact('posts', 'users', 'replies', 'tijd'));

}

In view-

    <table class="table table-striped">
     <thead>
      <tr>
       <th>ID</th>
       <th>Name</th>
       <th>Lastname</th>
       <th>Email</th>
     </tr>
     </thead>
    <tbody>
    @if( ! $users->isEmpty() )
        @foreach($users as $user)
            <tr>
                <th scope="row">{{ $user->id }}</th>
                <td>{{ $user->name }}</td>
                <td>{{ $user->lastname }}</td>
                <td>{{ $user->email }}</td>
            </tr>
        @endforeach
    @endif
    </tbody>

21st November, 2017

tisuchi left a reply on Undefined Variable Template2 V5.2 • 3 weeks ago

@muazzamazaz

There are two ways to solve this.

####Way 1

@if( !$template2->isEmpty() )
    @foreach($template2 as $taken)    
        {{ $taken->title }}
    @endforeach
@endif

####Way2 In your method-

$result = User::where("device_token", "!=", "")->where("device_type", "!=", "")->get();
$template2 = DB::table('notification_templates')->get();

return view('admin.push_notifications')
        ->withPage('push_notifications')
        ->with([
                'result' => $result,
                'template2' => $template2,
            ]);

tisuchi left a reply on Include Edit & Delete Button In - Nayjest/grids • 3 weeks ago

@anp24

All the updated work for nayjest/grids is in view-components now. https://github.com/view-components/grids

There is a documentation from where you can get add / delete option. https://github.com/view-components/grids#documentation

tisuchi left a reply on HOW TO GENERATE INVOICE NUMBER • 3 weeks ago

I assume that you have a pattern to generate invoice number that is like so-

2017-0001
2017-0002
2017-0003
.
.

In 2018 it could be like that-

2018-0001
2018-0002
2018-0003
.
.
.

Here is the code-

//get last record
$record = RecordModel::latest()->first();
$expNum = explode('-', $record->invoiceno);

//check first day in a year
if ( date('l',strtotime(date('Y-01-01'))) ){
    $nextInvoiceNumber = date('Y').'-0001';
} else {
    //increase 1 with last invoice number
    $nextInvoiceNumber = $expNum[0].'-'. $expNum[1]+1;
}


//now store $nextInvoiceNumber as a next invoice number. If last invoice number is 2017-0287 than next will be 2017-0288

tisuchi left a reply on Migrating Laravel Project • 3 weeks ago

My opinion is also same-

"The recommended method of upgrading is to create a new Laravel 5.0 install and then to copy your 4.2 site's unique application files into the new application."

Its easier for me. Just install a fresh latest Laravel version, copy all of your route, controllers, model and views.

20th November, 2017

tisuchi left a reply on Best Way To Connect Two Models • 3 weeks ago

I see.

For you than, Many To Many is the best choose via intermediate table.

Applying pivot table, isn't that solve your issue?

tisuchi left a reply on Best Way To Connect Two Models • 3 weeks ago

@jfurnas

Well, you can think of it in different way. For instance-

A employee is belongs to a department and a department is belongs to an organization.

In vise versa, a department has many employee and an organization has many department.

Now your database table should be like this-

employees
- id
- organization_id
- department_id
- some other column
- more column
department
- id
- organization_id
- some other column
- more column
organization
- id
- some other column
- more column

Now you can apply One to Many relationships here.

After doing relationships successfully, you suppose to access data like this way-

//fetch a employee's department and organization 
$employee = Employee::with('department', 'organization')->where('id', 1)->first();

//fetch all employee's and organization of a deparment
$department = Department::with('employee', 'organization')->get();


//fetch all the department and employees of an organization 
$organization = Organization::with('department', 'department.employee')->get();


//here department.employee means that you are accessing department's relationships from organization, that's why . notation for Nested relationship.

Ref: https://laravel.com/docs/5.5/eloquent-relationships#eager-loading

tisuchi left a reply on Has Many Relationships Help. • 3 weeks ago

Have you adjusted foreign key?

Edit Your Profile
Update

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