What do you use to get the checksum of a table in Laravel? Is there something already abstracted for this or you have to use raw commands?
Asked
Active
Viewed 974 times
1 Answers
2
You have to use raw commands, but it is pretty easy, just add this method to your model:
public static function checksum()
{
$tableName = with(new static)->getTable();
$query = sprintf('CHECKSUM TABLE %s', $tableName);
return \DB::select(\DB::raw($query))[0]->Checksum;
}
You can now call this method statically to get the checksum.

Jan Wytze
- 3,307
- 5
- 31
- 51